forked from SilverStudioGames/WTS
243 lines
8.2 KiB
Plaintext
243 lines
8.2 KiB
Plaintext
|
define update_message_list = [
|
||
|
"Spinning up disks",
|
||
|
"Lubricating Hermione",
|
||
|
"Filling up Tonks' glass",
|
||
|
"Rendering Cho's marvellous abs",
|
||
|
"Teaching Astoria some manners",
|
||
|
"Gazing into the crystal ball",
|
||
|
"Waxing Cho's broom",
|
||
|
"Sanitizing Dumbledore's desk",
|
||
|
"Confiscating Hermione's panties",
|
||
|
"Adjusting the dress code",
|
||
|
"Deleting Hermiobrine",
|
||
|
"Initializing Snape walk physics",
|
||
|
"Loading Genie's name mispronunciation engine",
|
||
|
"Generating {s}dad{/s} bad jokes",
|
||
|
"Perverting common nouns",
|
||
|
"Inserting obscure pop culture references",
|
||
|
"Loading wardrobe feature fondling",
|
||
|
"Corrupting Teachers",
|
||
|
"Ignoring plot holes",
|
||
|
"Inflating Susan's tits",
|
||
|
"Hiding Room of Requirement",
|
||
|
"Predicting images",
|
||
|
"Initializing sex-drive",
|
||
|
"Loading loading screen",
|
||
|
"Bribing ministry of magic employees",
|
||
|
"Maximizing student gullibility levels",
|
||
|
"Tuning out Luna's rambles",
|
||
|
"Filling cupboard with trash",
|
||
|
"Shredding rule violation reports",
|
||
|
"Adding tissue box of holding to desk",
|
||
|
"Ignoring established lore",
|
||
|
"Neglecting minor characters",
|
||
|
"Hiding the marauders map",
|
||
|
"Injecting British slang",
|
||
|
"Stiffening nipples",
|
||
|
"Nickering at knickers",
|
||
|
"Greasing Snape's hair",
|
||
|
"Increasing Genie's imagination levels",
|
||
|
"Adding illusion of choice dialogue options",
|
||
|
"Redirecting blood flow",
|
||
|
"Slutifying Slytherins",
|
||
|
"Dampening Genie's powers",
|
||
|
"Sleeving wizard cards",
|
||
|
"Breaking old save files",
|
||
|
"Loading pointless bird petting mechanics",
|
||
|
"Applying desk chair cushioning charm",
|
||
|
"Calculating semen trajectory",
|
||
|
"Opening spank-bank account at Gringotts",
|
||
|
"Scratching Genie's leg",
|
||
|
"Polishing Genie's wand",
|
||
|
"Defiling Cho's panties",
|
||
|
"Eliminating common sense",
|
||
|
"Applying lube",
|
||
|
"Restocking chocolate frog supply",
|
||
|
"Charming students",
|
||
|
"Breaking the fourth wall",
|
||
|
"Shortening skirts",
|
||
|
"Undressing house-elves",
|
||
|
"Lewdifying spells",
|
||
|
"Inserting sexual innuendoes",
|
||
|
"Searching for the g-spot",
|
||
|
"Adjusting refractory period levels",
|
||
|
"Indexing breast sizes",
|
||
|
"Prolonging the inevitable heat death of the universe",
|
||
|
"Redefining the big bang",
|
||
|
"Insert disc 2",
|
||
|
]
|
||
|
|
||
|
init python:
|
||
|
import requests
|
||
|
|
||
|
UPDATE_URL = "http://update.silverstudiogames.org/updates.json"
|
||
|
new_version = None
|
||
|
|
||
|
def check_for_updates(interval=3600*6):
|
||
|
global new_version
|
||
|
new_version = updater.UpdateVersion(UPDATE_URL, simulate="not_available", check_interval=interval)
|
||
|
|
||
|
def fetch_update_logo(url):
|
||
|
if not (updater.can_update() or config.developer) or new_version is None:
|
||
|
return Null()
|
||
|
|
||
|
filename = "logo_{}.png".format(new_version)
|
||
|
path = os.path.join(config.basedir, "updates/{}".format(filename))
|
||
|
|
||
|
# Read file if exists
|
||
|
if os.path.isfile(path):
|
||
|
with open(path, "rb") as f:
|
||
|
data = f.read()
|
||
|
return im.Data(data, path)
|
||
|
|
||
|
# Fetch file if doesn't exist
|
||
|
response = requests.get(url, timeout=5)
|
||
|
data = response.content
|
||
|
|
||
|
if not data:
|
||
|
return Null()
|
||
|
|
||
|
with open(path, "wb") as f:
|
||
|
f.write(data)
|
||
|
|
||
|
return im.Data(data, path)
|
||
|
|
||
|
# check_for_updates()
|
||
|
|
||
|
screen updater:
|
||
|
|
||
|
tag menu
|
||
|
|
||
|
default msg = renpy.random.choice(update_message_list)
|
||
|
default logo = fetch_update_logo("https://cdn.discordapp.com/attachments/535709194876354571/957762605735354378/discord.png") # http://update.silverstudiogames.org/logo.webp
|
||
|
|
||
|
use game_menu(_("Updater"), scroll="viewport"):
|
||
|
|
||
|
style_prefix "updater"
|
||
|
|
||
|
vbox:
|
||
|
spacing gui.pref_spacing
|
||
|
xfill True
|
||
|
|
||
|
button:
|
||
|
xalign 0.5
|
||
|
action OpenURL("https://www.silverstudiogames.org/")
|
||
|
add logo xysize(570, 324)
|
||
|
|
||
|
if u.state == u.ERROR:
|
||
|
text _("An error has occured:")
|
||
|
elif u.state == u.CHECKING:
|
||
|
text _("Fetching for updates.")
|
||
|
elif u.state == u.UPDATE_NOT_AVAILABLE:
|
||
|
text _("This program is up to date.")
|
||
|
elif u.state == u.UPDATE_AVAILABLE:
|
||
|
text _("[u.version] is available. Do you want to install it?")
|
||
|
hbox:
|
||
|
xalign 0.5
|
||
|
|
||
|
textbutton "Changelog" action OpenURL("https://www.silverstudiogames.org/p/changelog.html")
|
||
|
textbutton "Patreon" action OpenURL("https://patreon.com/silverstudiogames")
|
||
|
textbutton "Discord" action OpenURL("https://discord.gg/UbQeTCJ5RW")
|
||
|
elif u.state == u.PREPARING:
|
||
|
text _("Preparing to download the updates.")
|
||
|
elif u.state == u.DOWNLOADING:
|
||
|
text _("Downloading the updates.")
|
||
|
elif u.state == u.UNPACKING:
|
||
|
text _("Unpacking the updates.")
|
||
|
elif u.state == u.FINISHING:
|
||
|
text _("Finishing up.")
|
||
|
elif u.state == u.DONE:
|
||
|
text _("The updates have been installed. The program will restart.")
|
||
|
elif u.state == u.DONE_NO_RESTART:
|
||
|
text _("The updates have been installed.")
|
||
|
elif u.state == u.CANCELLED:
|
||
|
text _("The updates were cancelled.")
|
||
|
|
||
|
if u.message is not None:
|
||
|
text "[u.message!q]"
|
||
|
|
||
|
if u.progress is not None:
|
||
|
fixed:
|
||
|
bar value (u.progress or 0.0) range 1.0 style "updater_bar"
|
||
|
text "[msg]" color "#fff" size 10 yoffset 5
|
||
|
|
||
|
hbox:
|
||
|
xalign 0.5
|
||
|
|
||
|
if u.can_proceed:
|
||
|
textbutton _("Proceed") action u.proceed keysym "K_RETURN"
|
||
|
|
||
|
if u.can_cancel:
|
||
|
textbutton _("Cancel") action u.cancel keysym "K_ESCAPE"
|
||
|
|
||
|
timer 2.0 action SetScreenVariable("msg", renpy.random.choice(update_message_list)) repeat True
|
||
|
|
||
|
style updater_text:
|
||
|
xalign 0.5
|
||
|
|
||
|
style updater_button
|
||
|
|
||
|
style updater_button_text is gui_button_text
|
||
|
style updater_label is gui_label:
|
||
|
xsize 209
|
||
|
right_padding 17
|
||
|
|
||
|
style updater_label_text is gui_label_text:
|
||
|
xalign 1.0
|
||
|
text_align 1.0
|
||
|
outlines [(2, "#000", 0, 0)]
|
||
|
|
||
|
style updater_bar is empty:
|
||
|
ysize gui.bar_size
|
||
|
left_bar Frame("gui/bar/left.png", Borders(8, 8, 8, 8), tile=False)
|
||
|
right_bar Frame("gui/bar/right.png", Borders(8, 8, 8, 8), tile=False)
|
||
|
|
||
|
style update_available_button:
|
||
|
xalign 0.5
|
||
|
|
||
|
style update_available_button_text:
|
||
|
color "#F9A001"
|
||
|
hover_color "#fff"
|
||
|
xalign 0.5
|
||
|
|
||
|
|
||
|
init python early:
|
||
|
|
||
|
def version_float():
|
||
|
control, major, minor = config.version.split(" ")[0].split(".")
|
||
|
return float("{}.{}{}".format(control, major, minor))
|
||
|
|
||
|
def version_patch():
|
||
|
if renpy.is_init_phase():
|
||
|
# Don't update save files from when game recovers from a crash.
|
||
|
return
|
||
|
|
||
|
latest = version_float()
|
||
|
|
||
|
if not hasattr(renpy.store, "version"):
|
||
|
if hasattr(renpy.store, "save_internal_version"):
|
||
|
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(getattr(renpy.store, "save_internal_version")), latest)
|
||
|
raise Exception("Loaded save file is incompatible. (Save Version: Unknown, Game Version: {})".format(latest))
|
||
|
|
||
|
current = version
|
||
|
|
||
|
if current > latest:
|
||
|
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest))
|
||
|
|
||
|
if current < latest:
|
||
|
setattr(renpy.store, "version", latest)
|
||
|
message = "Have fun!"
|
||
|
|
||
|
achievements.attempt_repair()
|
||
|
|
||
|
renpy.call_in_new_context("modal_popup", "Update Successful", "\nYour save file has been successfully updated to version {{b}}{}{{/b}}.\n\n{}".format(config.version, message), None, "Hurray!")
|
||
|
renpy.block_rollback()
|
||
|
return
|
||
|
|
||
|
init python:
|
||
|
config.after_load_callbacks.append(version_patch)
|
||
|
|
||
|
label before_main_menu():
|
||
|
# Add screen
|
||
|
return
|