summaryrefslogtreecommitdiff
path: root/sassbot/modules/artifact2-0/PlayerCreate.py
diff options
context:
space:
mode:
authorJason Le Long <jasonnlelong@gmail.com>2018-03-24 22:35:35 +0000
committerJason Le Long <jasonnlelong@gmail.com>2018-03-24 22:35:35 +0000
commit1d19309cd59dbac7e6c0505b3c1944d2b081788f (patch)
tree6c330e52fd46727183559c7773c7af8721bb3a67 /sassbot/modules/artifact2-0/PlayerCreate.py
parent002c61f74a3f24afbca34ca38e85eea854150677 (diff)
First build V2
Diffstat (limited to 'sassbot/modules/artifact2-0/PlayerCreate.py')
-rw-r--r--sassbot/modules/artifact2-0/PlayerCreate.py68
1 files changed, 68 insertions, 0 deletions
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