forked from Anaphory/apocalypse
-
Notifications
You must be signed in to change notification settings - Fork 1
/
aw_save3.py
41 lines (36 loc) · 837 Bytes
/
aw_save3.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
#!/usr/bin/python
# aw_save.py
# ===================================================================
import shelve, json
from aw_character import player, listingm, fn_menu
from aw_tools import menu
def loadAW():
#print('Loading ...')
db = shelve.open('saves/aw_saves3')
p = db['AW3']
return p
def saveAW(p):
#print('Saving ...')
db = shelve.open('saves/aw_saves3')
db['AW3'] = p
db.close()
return
def main():
try:
with open('AW-db/aw_classes.json') as f:
awcl=json.load(f)
except IOError:
print(IOError)
m=[]
p = player()
p.starterPack(awcl)
listingm(p.characters)
for i in p.characters:
m.append(i.name)
r=menu(m)
i=p.characters[r[0]]
fn_menu[i.skill](i)
saveAW(p)
return
if __name__ == "__main__":
main()