Add web version savegame
This commit is contained in:
20
data/save.py
20
data/save.py
@@ -5,6 +5,8 @@ import sys
|
||||
import hashlib
|
||||
import systems.ui
|
||||
import shutil
|
||||
import base64
|
||||
import systems.ui
|
||||
|
||||
|
||||
def punish(cat):
|
||||
@@ -55,10 +57,20 @@ class SaveData:
|
||||
self.money = money
|
||||
|
||||
|
||||
def save(cat, hide_web_message=False):
|
||||
if os.path.exists("WEB_VERSION"):
|
||||
if not hide_web_message:
|
||||
print("Saving is disabled.")
|
||||
def save(cat, dont_save=False):
|
||||
if os.path.exists("WEB_VERSION") and not dont_save:
|
||||
print(
|
||||
"Under this message, in quotes, will be a long string of text, this is your savefile, please copy this somewhere safe (WITHOUT THE QUOTES) and make sure to copy the whole thing, you will paste it back to load your game. DO NOT use control+c to copy, instead, select it, and use the right click menu to copy, ctrl+c will crash this."
|
||||
)
|
||||
print('"' + base64.b64encode(json.dumps(cat.to_dict()).encode()).decode() + '"')
|
||||
print(
|
||||
"Your savefile has been printed above this, please save it somewhere safe."
|
||||
)
|
||||
print(
|
||||
"Any progress done after this will not be saved in this string, please generate a new one to update your progress."
|
||||
)
|
||||
print("To get back to the main menu and quit, reload the page.")
|
||||
systems.ui.press_any_key_to_continue("Press any key to continue.")
|
||||
return
|
||||
currentjson = {}
|
||||
data_dir = get_data_dir()
|
||||
|
||||
Reference in New Issue
Block a user