Skip to content

Commit 5dcad9b

Browse files
committed
update trainNum = 0
dragontable add trainNum
1 parent 0628d60 commit 5dcad9b

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,22 @@
1919
timestr=str(time.strftime('%Y-%m-%d-%H:%M:%S',time.localtime(time.time())))
2020
taskbonus=[]
2121
wartaskbonus=[]
22-
f = file('/root/tg2env/taskbonus.json')
22+
f = file('taskbonus.json')
2323
source = f.read()
2424
target = json.JSONDecoder().decode(source)
25-
f2=file('/root/tg2env/wartask.json')
25+
f2=file('wartask.json')
2626
source2=f2.read()
2727
if source2!=None:
2828
target2 = json.JSONDecoder().decode(source2)
2929
for t in target:
3030
taskbonus.append([t['id'],t['des'],t['lev']])
3131
for tt in target2:
3232
wartaskbonus.append([tt['id'],tt['des'],tt['lev']])
33+
34+
#newtask = file('newtask.json')
35+
#newtask = newtask.read()
36+
#newtask = json.loads(newtask)
37+
3338
logfile=open("logfile"+timestr,'w')
3439
# Base class for all of our model classes: By default, the data model is
3540
# defined with SQLAlchemy's declarative extension, but if you need more
@@ -145,4 +150,6 @@ def init_model(engine):
145150
from stchong.model.papayafriend import Papayafriend
146151
from stchong.model.rank import Rank
147152
from stchong.model.dragon import Dragon
153+
from stchong.model.petAtt import PetAtt
154+
from stchong.model.message import Message
148155
#from stchong.model.useraccount import userAccount

clearPet.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import MySQLdb
22
import json
33

4-
con = MySQLdb.connect(host='localhost', user='root', db='stcHong', passwd='2e4n5k2w2x')
4+
con = MySQLdb.connect(host='localhost', user='root', db='stcHong', passwd='badperson3')
55
cursor = con.cursor()
66

7-
sql = "update dragon set trainNum = 0"
8-
cursor.execute(sql)
9-
con.commit()
10-
117
sql = "select pid, friList, lastFeed, state, health from dragon where state >= 2"
128
cursor.execute(sql)
139
print sql
@@ -31,11 +27,16 @@
3127
elif state == 5:#old
3228
health -= 10
3329
else:
30+
#if state == 5:
31+
# health -= 10
3432
friList = '[]'
3533
lastFeed = 0
3634
if health < 0 :#no dead at all
35+
#if state == 5:
36+
# state = -1 #dead
37+
# else:
3738
health = 0
38-
sql = "update dragon set health = " + str(health) + ', lastFeed = ' + str(lastFeed)+', friList = \''+str(friList) + '\' where pid = ' + str(pid)
39+
sql = "update dragon set health = " + str(health) + ', lastFeed = ' + str(lastFeed)+', friList = \''+str(friList) + '\',trainNum=0 where pid = ' + str(pid)
3940
print sql
4041
cursor.execute(sql)
4142
con.commit()

0 commit comments

Comments
 (0)