e64ece4e by Barry

Bug fix for missing users. It now checks users constantly and updates them if needed.

Added several things to pankration.
1 parent 989c737e
No preview for this file type
...@@ -385,6 +385,7 @@ def on_socket_raw_send(payload, binary=False): ...@@ -385,6 +385,7 @@ def on_socket_raw_send(payload, binary=False):
385 385
386 @client.event 386 @client.event
387 def on_status(member): 387 def on_status(member):
388 for member in client.get_all_members():
388 try: 389 try:
389 db_member = db_get_member(member.id) 390 db_member = db_get_member(member.id)
390 #log(db_member) 391 #log(db_member)
...@@ -1143,6 +1144,7 @@ def on_ready(): ...@@ -1143,6 +1144,7 @@ def on_ready():
1143 print(client.user.name) 1144 print(client.user.name)
1144 print(client.user.id) 1145 print(client.user.id)
1145 print('------') 1146 print('------')
1147
1146 check_msg_queue() 1148 check_msg_queue()
1147 1149
1148 retries = 0 1150 retries = 0
......
1 import random
2 import time
3
4 FIND_PERCENTAGE = 80
5
6
7 class HuntResponse:
8 ERROR = -1
9 FAILURE = 0
10 SUCCESS = 1
11
12 def __init__(self, result, message, monster):
13 self.result = result
14 self.message = message
15 self.monster = monster
16
17
1 class Jobs: 18 class Jobs:
2 WAR = 1 19 WAR = 1
3 MNK = 2 20 MNK = 2
...@@ -79,16 +96,35 @@ Monsters = { ...@@ -79,16 +96,35 @@ Monsters = {
79 } 96 }
80 } 97 }
81 98
82 print Families 99
83 class Pankration: 100 class Pankration:
84 def __init__(self, arena_name): 101 def __init__(self):
85 pass 102 pass
86 103
87 def start_battle(self, monster1, monster2, battle_type): 104 def start_battle(self, monster1, monster2, battle_type):
88 pass 105 pass
89 106
90 def get_seeking_monsters(self): 107 def list_zones(self):
91 pass 108 zone_list = []
109 for monster in Monsters.itervalues():
110 if monster['zone'] not in zone_list:
111 zone_list.append(monster['zone'])
112 return zone_list
113
114 def get_monsters(self, zone):
115 monster_list = []
116 for monster_name, monster in Monsters.iteritems():
117 if monster['zone'] == zone:
118 monster_list.append(monster_name)
119 return monster_list
120
121 def hunt_monster(self, zone):
122 if random.randint(1, 100) > FIND_PERCENTAGE:
123 return HuntResponse(HuntResponse.SUCCESS, "You captured the monster!",
124 random.choice(self.get_monsters(zone)))
125 else:
126 return HuntResponse(HuntResponse.FAILURE, "You were unable to capture a monster's soul.",
127 None)
92 128
93 def get_action(): 129 def get_action():
94 return "" 130 return ""
...@@ -121,3 +157,31 @@ class Battle: ...@@ -121,3 +157,31 @@ class Battle:
121 class Arena: 157 class Arena:
122 pass 158 pass
123 159
160 #print Families
161
162 p = Pankration()
163 print("Zones: \n\n{}".format('\n'.join(p.list_zones())))
164 hunt_zone = p.list_zones()[0]
165 print("Hunting for monster in zone: {}\n".format(hunt_zone))
166 hunt_response = p.hunt_monster(hunt_zone)
167 print("hunt_response")
168 print(str(hunt_response.result))
169 time.sleep(0.5)
170 if hunt_response.result == HuntResponse.SUCCESS:
171 print('Success! {} - {}'.format(hunt_response.message, hunt_response.monster))
172 else:
173 print(hunt_response.message)
174
175
176
177
178
179
180
181
182
183
184
185
186
187
......