-
Notifications
You must be signed in to change notification settings - Fork 15
/
main.py
72 lines (42 loc) · 1.37 KB
/
main.py
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
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
"""
# Native
import time
import random
# 3rd-Party
# Proprietary
from models.account import Account
from models.tavern import Tavern
import deploy
from db import session
from config import config
account = Account()
session.add(account)
count = 0
refresh = random.randrange(config['settings']['update']['min'], config['settings']['update']['max'])
while True:
if not count or count >= refresh:
account.fetch()
session.commit()
#break
print "Players: %s" % (len(account.players))
print "Buildings: %s" % (len(account.city.buildings))
print "Taverns: %s" % (len(account.taverns))
print "Money: %s" % "{:,}".format(account.resources.money)
print "Supplies: %s" % "{:,}".format(account.resources.supplies)
for tavern in account.taverns:
tavern.sit()
#
for player in account.players:
player.aid()
Tavern.collect()
session.commit()
refresh = count + random.randrange(config['settings']['update']['min'], config['settings']['update']['max'])
print "Checking... (%s)" % (count)
# NOTE: The full update should adjust for any coins/supplies/resources gained from these pickups
account.city.pickup()
account.city.produce()
session.commit()
sleep = random.randrange(10, 30)
time.sleep(sleep)
count += sleep