775d749e by Barry

Updates for pankration and added a raffle winner command.

1 parent e64ece4e
No preview for this file type
...@@ -333,14 +333,14 @@ def db_update_member(member, db_member): ...@@ -333,14 +333,14 @@ def db_update_member(member, db_member):
333 333
334 c = conn.cursor() 334 c = conn.cursor()
335 if member.name.lower() != db_membername: 335 if member.name.lower() != db_membername:
336 log("Member Name changed! {} to {}".format(db_membername, member.name.lower())) 336 log("Member Name changed! {} to {}".format(byteify(db_membername), byteify(member.name.lower())))
337 c.execute("UPDATE members SET member_name = ? WHERE discord_id = ?;", (member.name.lower(), member.id,)) 337 c.execute("UPDATE members SET member_name = ? WHERE discord_id = ?;", (member.name.lower(), member.id,))
338 conn.commit() 338 conn.commit()
339 339
340 aliases = c.execute("SELECT * FROM aliases WHERE alias_name = ? AND member_id = ?;", (db_membername, db_member_id)).fetchone() 340 aliases = c.execute("SELECT * FROM aliases WHERE alias_name = ? AND member_id = ?;", (db_membername, db_member_id)).fetchone()
341 log("Alias list for user: {}".format(aliases)) 341 log("Alias list for user: {}".format(aliases))
342 if aliases == None: 342 if aliases == None:
343 log("creating new alias: {}, {}".format(db_membername, db_member_id)) 343 log("creating new alias: {}, {}".format(byteify(db_membername), db_member_id))
344 c.execute("INSERT INTO aliases (alias_name, member_id) VALUES (?, ?);", (db_membername, db_member_id)) 344 c.execute("INSERT INTO aliases (alias_name, member_id) VALUES (?, ?);", (db_membername, db_member_id))
345 conn.commit() 345 conn.commit()
346 346
...@@ -698,6 +698,33 @@ Stuff: ...@@ -698,6 +698,33 @@ Stuff:
698 client.send_message(message.channel, out_string) 698 client.send_message(message.channel, out_string)
699 return 699 return
700 700
701 if message.content.startswith('!startraffle'):
702 if message.author.id != '78767557628133376':
703 client.send_message(message.channel, "You are not Hellsbreath. Go die in an especially hot fire.")
704 return
705 members = db_get_all_members()
706 if len(members) < 0:
707 client.send_message(message.channel, "There was a problem looking up your information.")
708 else:
709 ticket_count = 0
710 for member in members:
711 if member['discord_id'] != '78767557628133376':
712 log(member)
713 ticket_count += member['tickets']
714 log("Ticket Count: {}".format(ticket_count))
715 out_string = "The final standings are as follows: \n\n"
716 ticket_reel = []
717 for member in members:
718 if member['tickets'] > 0 and member['discord_id'] != '78767557628133376':
719 ticket_reel += [member['member_name']] * member['tickets']
720 percent = (float(member['tickets']) / float(ticket_count)) * 100.0
721 out_string += "{} - {}%\n".format(member['member_name'], int(percent))
722
723 winner = random.choice(ticket_reel)
724 out_string += "\n\n\nThe winner is....\n\n{}!".format(winner,)
725 client.send_message(message.channel, out_string)
726 return
727
701 if message.content.startswith('!raffle'): 728 if message.content.startswith('!raffle'):
702 client.send_message(message.channel, """Current Raffle Item: 729 client.send_message(message.channel, """Current Raffle Item:
703 730
......
...@@ -130,17 +130,17 @@ class Pankration: ...@@ -130,17 +130,17 @@ class Pankration:
130 return "" 130 return ""
131 131
132 class Monster: 132 class Monster:
133 def __init__(self, monster_data): 133 def __init__(self, family, level, main_job, support_job, fp_capacity, innate_feral_skills,
134 self.Family 134 eqipped_feral_skills, dicipline_level, temperament):
135 self.level 135 self.family = family
136 self.main_job 136 self.level = level
137 self.support_job 137 self.main_job = main_job
138 self.FP_capacity 138 self.support_job = support_job
139 self.innate_feral_skills = [] 139 self.fp_capacity = fp_capacity
140 self.equipped_feral_skills 140 self.innate_feral_skills = innate_feral_skills
141 self.discipline_level 141 self.equipped_feral_skills = eqipped_feral_skills
142 self.temperament 142 self.discipline_level = dicipline_level
143 pass 143 self.temperament = temperament
144 144
145 def calculate_fp_gain(self): 145 def calculate_fp_gain(self):
146 pass 146 pass
...@@ -168,7 +168,9 @@ print("hunt_response") ...@@ -168,7 +168,9 @@ print("hunt_response")
168 print(str(hunt_response.result)) 168 print(str(hunt_response.result))
169 time.sleep(0.5) 169 time.sleep(0.5)
170 if hunt_response.result == HuntResponse.SUCCESS: 170 if hunt_response.result == HuntResponse.SUCCESS:
171 print('Success! {} - {}'.format(hunt_response.message, hunt_response.monster)) 171 print(hunt_response.message)
172 monster = Monsters[hunt_response.monster]
173 print("The Soul Plate Shows: \n\n{}\n{}{}".format(hunt_response.monster))
172 else: 174 else:
173 print(hunt_response.message) 175 print(hunt_response.message)
174 176
......