-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathversion.py
66 lines (57 loc) · 2.32 KB
/
version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import random
from engine import timestamp_now
version_name = "alpha 0.04 (pre-release)"
version_code = "0.04a-pre-release"
def migrate_loaded_save(save: dict) -> bool:
# discard current version saves
if save["version"] == version_code:
return False
# fix 0.01a saves
if "version" not in save or save["version"] is None:
save["version"] = "0.01a"
# 0.01a -> 0.02a
if save["version"] == "0.01a":
save["maps"][0]["timestamp"] = timestamp_now()
save["privateState"]["dartsRandomSeed"] = abs(int((2**16 - 1) * random.random()))
save["version"] = "0.02a"
print(" > migrated to 0.02a")
# 0.02a -> 0.03a
if save["version"] == "0.02a":
if "arrayAnimals" not in save["privateState"]:
save["privateState"]["arrayAnimals"] = {} # fix no animal spawning
if "strategy" not in save["privateState"]:
save["privateState"]["strategy"] = 8 # fix crash when attacking a player
if "universAttackWin" not in save["maps"][0]:
save["maps"][0]["universAttackWin"] = [] # pvp current island progress
if "questTimes" not in save["maps"][0]:
save["maps"][0]["questTimes"] = [] # quests
if "lastQuestTimes" not in save["maps"][0]:
save["maps"][0]["lastQuestTimes"] = [] # 1.1.5 quests
save["version"] = "0.03a"
print(" > migrated to 0.03a")
# 0.03a -> 0.04a
if save["version"] == "0.03a":
if "pic" not in save["playerInfo"].keys():
save["playerInfo"]["pic"] = ""
if("survivalVidaTimeStamp" not in save["privateState"]):
save["privateState"]["survivalVidaTimeStamp"] = []
if("survivalVidasExtra" not in save["privateState"]):
save["privateState"]["survivalVidasExtra"] = 0
if("survivalMaps" not in save["privateState"]):
save["privateState"]["survivalMaps"] = {
"100000035": {
"ts": 0,
"tp": 0
},
"100000036": {
"ts": 0,
"tp": 0
},
"100000037": {
"ts": 0,
"tp": 0
}
}
# save["version"] = "0.04a"
print(" > migrated to 0.04a")
return True