now even stable with asyc events like chat or mail, etc
[shakeTheFidget.git] / shakeTheFidget.py
blob2cf3f3998c2ac9bb0d1ba00b43563736eb62e1bf
1 #!/usr/bin/python
2 from session import Session
3 from time import time, sleep
4 from sys import argv
7 # parse parameters
8 if(len(argv) < 3):
9 print """%s [options, ..] <user> <password>""" % (argv[0])
10 exit()
11 user = argv[-2]
12 passwd = argv[-1]
14 # setup session with connection and db
15 session = Session(user, passwd)
16 session.connect()
17 session.dbInit()
19 # login to the server
20 session.sfLogin()
22 # game routine
23 while(True):
24 session.sfQueryTavern()
25 if(session.questTime >= session.quests.minDuration):
26 quest = session.quests.getBestByExperience()
27 if(quest.attend()): break
29 #if(session.cooldownArena <= 0):
30 # find opponent and fight
31 # print 'arena dummy'
32 else:
33 #TODO CityWard cycle
34 break
36 # destruct session
37 session.close()