@@ -46,47 +46,17 @@ def get_item_names(self) -> list:
4646 "Doctor"
4747]
4848
49- with open (f"{ wdir } /database/currency.json" , 'r' ) as f : currency = json .load (f )
49+ # with open(f"{wdir}/database/currency.json", 'r') as f: currency = json.load(f)
5050with open (f"{ wdir } /database/items.json" , 'r' ) as f : items = json .load (f )
5151with open (f"{ wdir } /config/shop.json" , 'r' ) as f : shopitem = json .load (f )
5252with open (f"{ wdir } /database/user_data.json" , 'r' ) as f : userdat = json .load (f )
5353
5454def save ():
55- with open (f"{ wdir } /database/currency.json" , 'w+' ) as f : json .dump (currency , f , indent = 4 )
55+ # with open(f"{wdir}/database/currency.json", 'w+') as f: json.dump(currency, f, indent=4)
5656 with open (f"{ wdir } /database/items.json" , 'w+' ) as f : json .dump (items , f , indent = 4 )
5757 with open (f"{ wdir } /database/user_data.json" , 'w+' ) as f : json .dump (userdat , f , indent = 4 )
5858
5959# Functions
60- def get_user_networth (user_id :int ):
61- nw = currency ["wallet" ][str (user_id )] + currency ["bank" ][str (user_id )]
62- #for e in items[str(user_id)]:
63- # if e != 0: nw += shopitem[e]["sell price"]
64- return nw
65-
66- def get_wallet (id : int ) -> int :
67- return currency ['wallet' ][str (id )]
68-
69- def get_bank (id : int ) -> int :
70- return currency ['bank' ][str (id )]
71-
72- def new_wallet (id : int ):
73- if str (id ) not in currency ['wallet' ]:
74- currency ['wallet' ][str (id )] = 5000
75- return 0
76- else : return 1
77-
78- def new_bank (id : int ):
79- if str (id ) not in currency ['bank' ]:
80- currency ['bank' ][str (id )] = 0
81- return 0
82- else : return 1
83-
84- def get_user_count ():
85- users = 0
86- for x in currency ["wallet" ].keys ():
87- users += 1
88- return users
89-
9060def new_userdat (id : int ):
9161 if str (id ) not in userdat .keys ():
9262 userdat [str (id )] = {"work_job" : None }
0 commit comments