7825fa6d by Barry

Added the feral skills code into the bot.

1 parent b1760e6e
......@@ -413,6 +413,23 @@ def db_convert_soul_plate_to_reflector(member_id, soul_plate, idx):
return True
def db_convert_soul_plate_to_skill(member_id, soul_plate, idx, skill):
pankration_data = db_get_pankration_record(member_id)
skill_data = pankration_data['feral_skills']
if not skill_data:
feral_skills = []
else:
feral_skills = pickle.loads(str(skill_data))
feral_skills.append(skill)
db_update_pankration_record(member_id, 'feral_skills', pickle.dumps(feral_skills))
#if not db_remove_soul_plate(member_id, idx):
# return False
return True
def db_register_battle(member_id, reflector, idx, target_member_id=None):
pan_record = db_get_pankration_record(member_id)
conn = sqlite3.connect('db.sqlite3')
......
No preview for this file type
......@@ -87,14 +87,14 @@ registered_commands = {'!help': 'do_help', '!commands': 'do_help',
'!stars': 'do_stars',
'!rigged': 'do_rigged',
'!listzones': 'do_list_zones',
'!huntmonster': 'do_hunt_monster',
'!listferalskills': 'do_list_feral_skills', '!listferalskill': 'do_list_feral_skills',
'!huntmonster': 'do_hunt_monster', '!hunt': 'do_hunt_monster',
'!listskills': 'do_list_feral_skills', '!listferalskills': 'do_list_feral_skills', '!listferalskill': 'do_list_feral_skills',
'!listreflectors': 'do_list_reflectors', '!listreflector': 'do_list_reflectors',
'!listsoulplates': 'do_list_soul_plates', '!listsoulplate': 'do_list_soul_plates',
'!convertplate': 'do_convert_plate', '!convertsoulplate': 'do_convert_plate',
'!assignskill': 'do_assign_skill',
'!convert': 'do_convert_plate', '!convertplate': 'do_convert_plate', '!convertsoulplate': 'do_convert_plate',
'!registerbattle': 'do_register_battle',
'!setreflectorname': 'do_set_reflector_name',
'!equip': 'do_equip_feral_skills', '!equipskill': 'do_equip_feral_skills', '!equipferalskill': 'do_equip_feral_skills',
'!pankration': 'do_pankration',
}
......@@ -1044,7 +1044,7 @@ def do_pankration(client, message_parts, message):
*Hunting for Soul Plates:*
**!listzones** - Returns a list of zones available for hunting and how many credits it costs to search in that zone. Depending on the weather and other factors some zones may not always be available.
**!huntmonster <zone>** - An attempt will be made to search for a soul plate (monster) in the zone specified. Each search costs a certain amount of credits. Each zone has a different cost.
**!hunt <zone>** - An attempt will be made to search for a soul plate (monster) in the zone specified. Each search costs a certain amount of credits. Each zone has a different cost.
*Viewing Your Inventory:*
**!listsoulplates** - Returns a list of all soul plates you have in your posession.
......@@ -1052,10 +1052,10 @@ def do_pankration(client, message_parts, message):
**!listferalskills** - Returns a list of all feral skills you have in your inventory
*Editing Your Collections:*
**!convertplate <plate number> <convert_to>** - From the list of soul plates you can choose to either convert the plate into a \"reflector\" or \"skill\".
**!convert <plate number> <convert_to>** - From the list of soul plates you can choose to either convert the plate into a \"reflector\" or \"skill\".
Ex: **!convertplate 1 reflector**
**!convertplate 4 skill**
**!assignskill <reflector number> <skill num>** - Assigns a skill to a reflector. Each skill is worth a certain amount of feral points, each monster has a maximum of feral points available.
**!equip <skill num> <reflector number>** - Assigns a skill to a reflector. Each skill is worth a certain amount of feral points, each monster has a maximum of feral points available.
**!setreflectorname <reflector number> <name>** - This will rename a monster in your collection to a custom name.
*Arena Battle:*
......@@ -1150,8 +1150,14 @@ def do_convert_plate(client, message_parts, message):
else:
send_message(client, message.channel, 'There was an issue converting your soul plate...Conversion failed.')
elif convert_to == "skill":
send_message(client, message.channel, '**Feral Skills are not yet supported**')
# do skill stuff
soul_plates[plate_num].convert_to_feral_skill()
skill = soul_plates[plate_num].convert_to_feral_skill()
if not skill:
send_message(client, message.channel, 'The conversion **failed** the soul plate has been destroyed in the process.')
else:
send_message(client, message.channel, 'Congratulations! The soul plate was converted to feral skill: **{}**'.format(byteify(skill)))
data.db_convert_soul_plate_to_skill(member['member_id'], soul_plates[plate_num], plate_num, skill)
do_list_feral_skills(client, message_parts, message)
pass
else:
send_message(client, message.channel, 'A plate can only be converted into a reflector or skill. Please see !pankration for an example.')
......@@ -1190,6 +1196,44 @@ def do_list_reflectors(client, message_parts, message):
send_message(client, message.channel, 'You have no reflectors.')
def do_equip_feral_skills(client, message_parts, message):
member = data.db_get_member(message.author.id)
skill_num = message_parts[0]
reflector_num = message_parts[1]
pankration_data = data.db_get_pankration_record(member['member_id'])
if pankration_data and pankration_data['reflectors']:
reflectors = pickle.loads(str(pankration_data['reflectors']))
if pankration_data and pankration_data['feral_skills']:
feral_skills = pickle.loads(str(pankration_data['feral_skills']))
if not skill_num.isdigit() or int(skill_num) < 1 or int(skill_num) > len(feral_skills):
send_message(client, message.channel, 'The requested feral skill is invalid. Please provide the number from !listferalskills')
return
skill_num = int(skill_num) - 1
if not reflector_num.isdigit() or int(reflector_num) < 1 or int(reflector_num) > len(reflectors):
send_message(client, message.channel, 'The requested reflector is invalid. Please provide the number from !listreflectors')
return
reflector_num = int(reflector_num) - 1
skill_name = feral_skills[skill_num]
print(reflector_num)
print(reflectors[reflector_num])
success, err_message = reflectors[reflector_num].equip_feral_skill(skill_name)
if not success:
send_message(client, message.channel, byteify(err_message))
else:
data.db_update_pankration_record(member['member_id'], 'reflectors', pickle.dumps(reflectors))
send_message(client, message.channel, "{} has been equipped.\n{}".format(skill_name, reflectors[reflector_num]))
else:
send_message(client, message.channel, 'You have no feral skills. You can get more feral skills by hunting for soul plates and converting them into skills.')
else:
send_message(client, message.channel, 'You have no reflectors. You can get more reflectors by hunting monsters and converting soul plates into reflectors.')
def do_list_feral_skills(client, message_parts, message):
member = data.db_get_member(message.author.id)
......