basic cleaning and prototype of game routine
[shakeTheFidget.git] / shakeTheFidget.py
blob733e7db69e4a6adaac46453b8fcad38ae0f06795
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.QuestList.minDuration):
26 quest = session.QuestList.getBestByExperience()
27 if(quest):
28 quest.attend()
30 if(session.cooldownArena <= 0):
31 # find opponent and fight
32 else:
33 session.citywar
35 # destruct session
36 del session