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):
c = conn.cursor()
if member.name.lower() != db_membername:
log("Member Name changed! {} to {}".format(db_membername, member.name.lower()))
log("Member Name changed! {} to {}".format(byteify(db_membername), byteify(member.name.lower())))
c.execute("UPDATE members SET member_name = ? WHERE discord_id = ?;", (member.name.lower(), member.id,))
conn.commit()
aliases = c.execute("SELECT * FROM aliases WHERE alias_name = ? AND member_id = ?;", (db_membername, db_member_id)).fetchone()
log("Alias list for user: {}".format(aliases))
if aliases == None:
log("creating new alias: {}, {}".format(db_membername, db_member_id))
log("creating new alias: {}, {}".format(byteify(db_membername), db_member_id))
c.execute("INSERT INTO aliases (alias_name, member_id) VALUES (?, ?);", (db_membername, db_member_id))
conn.commit()
......@@ -698,6 +698,33 @@ Stuff:
client.send_message(message.channel, out_string)
return
if message.content.startswith('!startraffle'):
if message.author.id != '78767557628133376':
client.send_message(message.channel, "You are not Hellsbreath. Go die in an especially hot fire.")
return
members = db_get_all_members()
if len(members) < 0:
client.send_message(message.channel, "There was a problem looking up your information.")
else:
ticket_count = 0
for member in members:
if member['discord_id'] != '78767557628133376':
log(member)
ticket_count += member['tickets']
log("Ticket Count: {}".format(ticket_count))
out_string = "The final standings are as follows: \n\n"
ticket_reel = []
for member in members:
if member['tickets'] > 0 and member['discord_id'] != '78767557628133376':
ticket_reel += [member['member_name']] * member['tickets']
percent = (float(member['tickets']) / float(ticket_count)) * 100.0
out_string += "{} - {}%\n".format(member['member_name'], int(percent))
winner = random.choice(ticket_reel)
out_string += "\n\n\nThe winner is....\n\n{}!".format(winner,)
client.send_message(message.channel, out_string)
return
if message.content.startswith('!raffle'):
client.send_message(message.channel, """Current Raffle Item:
......
......@@ -130,17 +130,17 @@ class Pankration:
return ""
class Monster:
def __init__(self, monster_data):
self.Family
self.level
self.main_job
self.support_job
self.FP_capacity
self.innate_feral_skills = []
self.equipped_feral_skills
self.discipline_level
self.temperament
pass
def __init__(self, family, level, main_job, support_job, fp_capacity, innate_feral_skills,
eqipped_feral_skills, dicipline_level, temperament):
self.family = family
self.level = level
self.main_job = main_job
self.support_job = support_job
self.fp_capacity = fp_capacity
self.innate_feral_skills = innate_feral_skills
self.equipped_feral_skills = eqipped_feral_skills
self.discipline_level = dicipline_level
self.temperament = temperament
def calculate_fp_gain(self):
pass
......@@ -168,7 +168,9 @@ print("hunt_response")
print(str(hunt_response.result))
time.sleep(0.5)
if hunt_response.result == HuntResponse.SUCCESS:
print('Success! {} - {}'.format(hunt_response.message, hunt_response.monster))
print(hunt_response.message)
monster = Monsters[hunt_response.monster]
print("The Soul Plate Shows: \n\n{}\n{}{}".format(hunt_response.monster))
else:
print(hunt_response.message)
......