diff options
author | lexicade <jasonnlelong@gmail.com> | 2023-01-27 21:06:30 +0000 |
---|---|---|
committer | lexicade <jasonnlelong@gmail.com> | 2023-01-27 21:06:30 +0000 |
commit | 52801b4de1d63cd01191acf7fcee137977140ec0 (patch) | |
tree | 08271a1f1e3e8060486b6651c67c9934867c648e /cogs/adv_inc/PlayerCreate.py | |
parent | 8df873808c86805624851356f5dea76ec621de23 (diff) |
Diffstat (limited to 'cogs/adv_inc/PlayerCreate.py')
-rw-r--r-- | cogs/adv_inc/PlayerCreate.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/cogs/adv_inc/PlayerCreate.py b/cogs/adv_inc/PlayerCreate.py new file mode 100644 index 0000000..17feae5 --- /dev/null +++ b/cogs/adv_inc/PlayerCreate.py @@ -0,0 +1,65 @@ +# Embedded file name: /home/bouncer/sassbot/modules/advinc/PlayerCreate.py +import pymysql +import importlib +import utils + +from cogs.adv_inc import PlayerStats +from cogs.adv_inc import Items + +importlib.reload(utils) +importlib.reload(PlayerStats) +importlib.reload(Items) + + +async def pick_character_clan(params): + if params['cmd1'] == '': + return 'Name your Clan.' + + elif len(params['cmd1']) < 3: + return 'Your Clan Name must be at least three characters.' + + else: + await utils.sql_postgres('CALL adventurersinc.set_player_character_new(%s,%s)', (params['nick'], params['msg'].strip(),), False) + return f"The adventure for the {params['msg'].strip()} clan begins." + + +async def pick_character_name(params, player_stats): + if params['cmd1'] == '': + return 'Give yourself a name.' + + elif len(params['cmd1']) < 3: + return 'Your name must be at least three characters.' + + else: + await utils.sql_postgres('CALL adventurersinc.set_player_character_name(%s, %s)', (params['cmd1'].strip(), params['nick'],), False) + return f"You are {params['cmd1'].strip()} {player_stats['clan_name']}. Pick a race: (H)uman, (O)rc, (E)lf, (D)warf, (L)izard" + + +async def pick_character_race(params, player_stats): + # Get chosen race + str_race_selected = None + if params['cmd1'].lower() == 'h': + str_race_selected = 'Human' + elif params['cmd1'].lower() == 'o': + str_race_selected = 'Orc' + elif params['cmd1'].lower() == 'e': + str_race_selected = 'Elf' + elif params['cmd1'].lower() == 'd': + str_race_selected = 'Dwarf' + elif params['cmd1'].lower() == 'l': + str_race_selected = 'Lizard' + else: + return 'Pick a race: (H)uman, (O)rc, (E)lf, (D)warf, (L)izard' + + if str_race_selected is not None: + race_stats = await utils.sql_postgres('SELECT adventurersinc.get_race_stats(%s)', (str_race_selected,), True) + await utils.sql_postgres('CALL adventurersinc.set_player_character_race(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)', (race_stats[0][0]['strength'], + race_stats[0][0]['dexterity'], race_stats[0][0]['constitution'], race_stats[0][0]['intelligence'], race_stats[0][0]['dodge'], race_stats[0][0]['crit'], race_stats[0][0]['armour'], + race_stats[0][0]['accuracy'], race_stats[0][0]['resistance'], race_stats[0][0]['luck'], race_stats[0][0]['block'], params['nick'], str_race_selected), False) + + player_stats = await PlayerStats.refresh_stats(params) + await utils.sql_postgres("CALL adventurersinc.set_player_health(%s,%s)", (player_stats['max_hp'], params['nick'],), False) + + return f"{player_stats['character_name']} {player_stats['clan_name']} the {str_race_selected} begins their adventure" + else: + return |