From aa2c21887a6169868711bd35511d183245eec4f6 Mon Sep 17 00:00:00 2001 From: Jason Le Long Date: Sat, 24 Mar 2018 22:26:36 +0000 Subject: First working build for V2 --- sassbot/modules/artifact2-0/PlayerCreate.py | 68 +++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sassbot/modules/artifact2-0/PlayerCreate.py (limited to 'sassbot/modules/artifact2-0/PlayerCreate.py') diff --git a/sassbot/modules/artifact2-0/PlayerCreate.py b/sassbot/modules/artifact2-0/PlayerCreate.py new file mode 100644 index 0000000..6a30d6c --- /dev/null +++ b/sassbot/modules/artifact2-0/PlayerCreate.py @@ -0,0 +1,68 @@ +# Embedded file name: /home/bouncer/sassbot/modules/artifact2-0/PlayerCreate.py +import PlayerStats +import MySQLdb + +def PickCharacterClan(phenny, parameters, strCmd1): + db = MySQLdb.connect(host='localhost', user=phenny.config.mysql_username, passwd=phenny.config.mysql_password, db=parameters['LiveDB']) + c = db.cursor(MySQLdb.cursors.DictCursor) + if strCmd1 is '': + return '\x0399Name your Clan.' + elif len(strCmd1) < 3: + return 'Your Clan name must be at least three characters.' + else: + c.execute('INSERT INTO `Players` (`Nick`,`ClanName`,`State`) VALUES (%s,%s,%s);', (parameters['Nick'], strCmd1, 'CreationName')) + db.commit() + return '\x0399The adventure for the ' + strCmd1 + ' clan begins.' + + +def PickCharacterName(phenny, parameters, playerStats, strCmd1): + db = MySQLdb.connect(host='localhost', user=phenny.config.mysql_username, passwd=phenny.config.mysql_password, db=parameters['LiveDB']) + c = db.cursor(MySQLdb.cursors.DictCursor) + if strCmd1 is '': + return 'Give yourself a name.' + elif len(strCmd1) < 3: + return 'Your name must be at least three characters.' + else: + c.execute('UPDATE `Players` SET `CharacterName`=%s, `Alive`=1, `State`=%s WHERE `Nick`=%s;', (strCmd1, 'CreationRace', parameters['Nick'])) + db.commit() + c.execute('SELECT COUNT(`Requirement`) AS `Requirement` FROM `Items_PlayerPool` INNER JOIN `Items_Master` ON `Items_PlayerPool`.`EquipmentName` = `Items_Master`.`EquipmentName` WHERE `Nick`=%s and `Requirement`=%s', (parameters['Nick'], 'Default')) + sqlUnlockCheck = c.fetchone() + if str(sqlUnlockCheck['Requirement']) == '0': + UnlockItems(phenny, parameters, 'Default') + return 'You are ' + strCmd1 + ' ' + playerStats['ClanName'] + '. Pick a race: (H)uman, (O)rc, (E)lf, (D)warf, (L)izardman' + + +def PickCharacterRace(phenny, parameters, playerStats, strCmd1): + db = MySQLdb.connect(host='localhost', user=phenny.config.mysql_username, passwd=phenny.config.mysql_password, db=parameters['LiveDB']) + c = db.cursor(MySQLdb.cursors.DictCursor) + strRaceSelected = None + if strCmd1.lower() == 'h': + strRaceSelected = 'Human' + elif strCmd1.lower() == 'o': + strRaceSelected = 'Orc' + elif strCmd1.lower() == 'e': + strRaceSelected = 'Elf' + elif strCmd1.lower() == 'd': + strRaceSelected = 'Dwarf' + elif strCmd1.lower() == 'l': + strRaceSelected = 'Lizardman' + else: + return 'Pick a race: (H)uman, (O)rc, (E)lf, (D)warf, (L)izardman' + if strRaceSelected is not None: + c.execute('SELECT `Strength`, `Dexterity`, `Constitution`, `Intelligence`, `Dodge`, `Crit`, `Armor` FROM `LK_Races` WHERE `Race` = %s;', strRaceSelected) + sqlRaceStats = c.fetchone() + c.execute("UPDATE `Players` SET `Strength`=%s, `Dexterity`=%s, `Constitution`=%s, `Intelligence`=%s, `Dodge`=%s, `Crit`=%s, `Armor`=%s, `State`='Rest' WHERE `Nick`=%s;", (sqlRaceStats['Strength'], + sqlRaceStats['Dexterity'], + sqlRaceStats['Constitution'], + sqlRaceStats['Intelligence'], + sqlRaceStats['Dodge'], + sqlRaceStats['Crit'], + sqlRaceStats['Armor'], + parameters['Nick'])) + db.commit() + playerStats = PlayerStats.RefreshStats(phenny, parameters) + c.execute('UPDATE `Players` SET `HP`=%s WHERE `Nick`=%s;', (playerStats['MaxHP'], parameters['Nick'])) + db.commit() + return playerStats['CharacterName'] + ' ' + playerStats['ClanName'] + ' the ' + strRaceSelected + ' begins their adventure' + else: + return \ No newline at end of file -- cgit v1.2.3