diff options
Diffstat (limited to 'sassbot/modules/artifact2-0/PlayerDeath.py')
-rw-r--r-- | sassbot/modules/artifact2-0/PlayerDeath.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sassbot/modules/artifact2-0/PlayerDeath.py b/sassbot/modules/artifact2-0/PlayerDeath.py new file mode 100644 index 0000000..9c3df41 --- /dev/null +++ b/sassbot/modules/artifact2-0/PlayerDeath.py @@ -0,0 +1,34 @@ +import time
+import MySQLdb
+
+
+def CharacterDeath(phenny, playerStats, parameters):
+ db = MySQLdb.connect(host="localhost", user=phenny.config.mysql_username, passwd=phenny.config.mysql_password,db=parameters['LiveDB'])
+ c = db.cursor(MySQLdb.cursors.DictCursor)
+ dbIRC = MySQLdb.connect(host="localhost", user=phenny.config.mysql_username, passwd=phenny.config.mysql_password,db='IRC')
+ cIRC = dbIRC.cursor(MySQLdb.cursors.DictCursor)
+
+ # Collect total items lost on death
+ c.execute("SELECT COUNT(`EquipmentName`) AS EquipmentName FROM `Items_PlayerInventory` WHERE `Nick`=%s AND `Permanent`=0;",parameters['Nick'])
+ sqlEquipmentCount = c.fetchone()['EquipmentName']
+
+ # Create death entry
+ cIRC.execute("INSERT INTO `ArtifactsGraveyard` (`Nick`,`CharacterName`,`ClanName`,`ItemsLost`,`ChallengeRating`,`VersionDied`) VALUES (%s,%s,%s,%s,%s,%s);",(parameters['Nick'], playerStats['CharacterName'], playerStats['ClanName'], sqlEquipmentCount,playerStats['ChallengeRating'], '1.3.1'));dbIRC.commit();
+
+ # Delete players Inventory
+ c.execute("DELETE FROM `Items_PlayerInventory` WHERE `Nick`=%s AND `Permanent`=0;", (str(parameters['Nick'])));db.commit();
+
+ # Delete players opponent
+ c.execute("DELETE FROM `CombatEnemy` WHERE `Nick`=%s;", (str(parameters['Nick'])));db.commit();
+
+ # Delete players shop
+ c.execute("DELETE FROM `PlayerShop` WHERE `Nick`=%s;", (str(parameters['Nick'])));db.commit();
+
+ # Update player record for new character
+ c.execute("UPDATE `Players` SET `State`='CreationName', `Alive`=0, `RestedHeal`=0, `HP`=1, `AttributePoints`=0, `Strength`=8, `Dexterity`=8, `Constitution`=8, `Intelligence`=8, `ChallengeRating`=1, `XP`=0, `XPToLevel`=200 WHERE `Nick`=%s;",(parameters['Nick']));db.commit();
+
+ # Lose gold on death
+ c.execute("UPDATE `Players` SET `Currency`=`Currency`/2 WHERE `Nick`=%s;", (parameters['Nick']));db.commit();
+
+ dbIRC.close()
+ db.close()
\ No newline at end of file |