Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Apr 7, 2019. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathupdate.py
More file actions
Latest commit
59 lines (51 loc) · 2.79 KB
/
Copy pathupdate.py
File metadata and controls
59 lines (51 loc) · 2.79 KB
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
fromutilsimportUtils
fromplayerimportPlayer
importos, time, random
classUpdate():
def__init__(self, ut):
self.ut=ut
self.Configuration=self.ut.readConfiguration()
self.startFunctionUpdate()
defstartFunctionUpdate(self):
p=Player(self.ut)
# get money info
if"money"inp.getStoreand"apps"inp.getStore:
money=int(p.getStore["money"])
apps=p.getStore["apps"]
else:
apps= []
money=0
getTask=self.ut.requestString("tasks.php", accesstoken=self.Configuration["accessToken"])
if'updateCount'ingetTask.keys():
update=int(getTask['updateCount'])
else:
update=0
# get applications and update this
forcount_update, applicationsinenumerate(apps):
# update application
if (count_update+update) <9:
Appid=int(applications["appid"])
random.shuffle(self.Configuration["update"])
forlist_updateinself.Configuration["update"]:
application_update=int(p.getHelperApplication()[list_update]["appid"])
ifmoney>=int(applications["price"]):
result=self.ut.requestString("store.php",
accesstoken=self.Configuration["accessToken"],
appcode=application_update,
action="100")
money=money-int(applications["price"])
ifresult['result'] =='0':
update=update+1
self.ut.viewsPrint("showMsgUpdate", "[{}] - Updated {} +1".format(os.path.basename(__file__), list_update))
else:
self.ut.viewsPrint("showMsgUpdate", "[{}] - you have not money to upgrade {}".format(os.path.basename(__file__), list_update))
else:
self.ut.viewsPrint("showMsgUpdatefull", "[{}] - full task list, please wait.".format(os.path.basename(__file__)))
# install application if level required < level
ifint(applications["require"]) <=int(p.getStore["level"]) andint(applications["level"]) ==0:
result=self.ut.requestString("store.php",
accesstoken=self.Configuration["accessToken"],
appcode=applications["appid"],
action="200")
self.ut.viewsPrint("showMsgInstalleApp", "[{}] - Installed new application.".format(os.path.basename(__file__)))
break