summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sassbot/modules/artifact2-0/Calculate.pycbin0 -> 545 bytes
-rw-r--r--sassbot/modules/artifact2-0/Combat.pycbin0 -> 6402 bytes
-rw-r--r--sassbot/modules/artifact2-0/Enemy.pycbin0 -> 3713 bytes
-rw-r--r--sassbot/modules/artifact2-0/EquipmentCreate.py154
-rw-r--r--sassbot/modules/artifact2-0/Items.pycbin0 -> 9282 bytes
-rw-r--r--sassbot/modules/artifact2-0/LevelUp.pycbin0 -> 2249 bytes
-rw-r--r--sassbot/modules/artifact2-0/PlayerAdventuring.pycbin0 -> 149 bytes
-rw-r--r--sassbot/modules/artifact2-0/PlayerCreate.pycbin0 -> 3673 bytes
-rw-r--r--sassbot/modules/artifact2-0/PlayerDeath.pycbin0 -> 1953 bytes
-rw-r--r--sassbot/modules/artifact2-0/PlayerStats.pycbin0 -> 3886 bytes
-rw-r--r--sassbot/modules/artifact2-0/Resting.pycbin0 -> 8382 bytes
-rw-r--r--sassbot/modules/artifact2.py115
12 files changed, 75 insertions, 194 deletions
diff --git a/sassbot/modules/artifact2-0/Calculate.pyc b/sassbot/modules/artifact2-0/Calculate.pyc
new file mode 100644
index 0000000..149285d
--- /dev/null
+++ b/sassbot/modules/artifact2-0/Calculate.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/Combat.pyc b/sassbot/modules/artifact2-0/Combat.pyc
new file mode 100644
index 0000000..669f5f7
--- /dev/null
+++ b/sassbot/modules/artifact2-0/Combat.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/Enemy.pyc b/sassbot/modules/artifact2-0/Enemy.pyc
new file mode 100644
index 0000000..028851c
--- /dev/null
+++ b/sassbot/modules/artifact2-0/Enemy.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/EquipmentCreate.py b/sassbot/modules/artifact2-0/EquipmentCreate.py
deleted file mode 100644
index c7f1c8c..0000000
--- a/sassbot/modules/artifact2-0/EquipmentCreate.py
+++ /dev/null
@@ -1,154 +0,0 @@
-import MySQLdb
-import random
-
-def GenerateItem(phenny, parameters, itemCode):
- db = MySQLdb.connect(host="localhost", user=phenny.config.mysql_username, passwd=phenny.config.mysql_password,db=parameters['LiveDB'])
- c = db.cursor(MySQLdb.cursors.DictCursor)
- intIteration=0
- itemName=strRaritySpacing='';
-
- #Generate Rarity
- itemGenRarity = CreateItemRarity(phenny, parameters, itemCode[0])
-
- #Generate Item
- itemGenEquipment = CreateItemName(phenny, parameters, itemCode[1])
-
- #Generate Enchantment
- itemGenEnchantment = CreateItemEnchantment(phenny, parameters, itemCode[2], int(itemGenRarity["ID"]))
-
- #Generate Element
- itemGenElement = CreateItemElement(phenny, parameters, itemCode[3], int(itemGenRarity["ID"]))
-
- #Attempt creating an Artifact
- itemGenEquipment = CreateItemArtifact(phenny, parameters, itemGenEquipment, itemCode[4])
-
- strRaritySpacing = "" if len(itemGenRarity['RarityName']) == 0 else " "
-
-
-
-
- itemGen={}
- itemGen['EquipmentName'] = ("\x03"+itemGenRarity['RarityColor'] +
- itemGenEquipment['FabledPrefix'] +
- itemGenRarity['RarityName'] +
- strRaritySpacing +
- ("" if itemGenElement == {} else itemGenElement['EffectName'] + " ") +
- itemGenEquipment['EquipmentName'] + " " +
- ("" if itemGenEnchantment == {} else itemGenEnchantment['Name'] + " ") +
- "\x0399")
- #itemGen['EquipmentSlot']
- #itemGen['EquipmentType']
- #itemGen['HandsReq']
- #itemGen['Strength']
- #itemGen['Dexterity']
- #itemGen['Constitution']
- #itemGen['Intelligence']
- #itemGen['Dodge']
- #itemGen['Crit']
- #itemGen['Armor']
- #itemGen['Precision']
- #itemGen['Resistance']
- #itemGen['Luck']
- #itemGen['BlockitemGen']
-
- return itemGen
-
-def CreateItemName(phenny, parameters, itemCode):
- db = MySQLdb.connect(host="localhost", user=phenny.config.mysql_username, passwd=phenny.config.mysql_password,db=parameters['LiveDB'])
- c = db.cursor(MySQLdb.cursors.DictCursor)
- itemGenEquipment = {}
-
- #Item by ID
- if int(itemCode) is not 0:
- c.execute("SELECT `EquipmentName`, `EquipmentSlot`, `EquipmentType`, `HandsReq`, `Strength`, `Dexterity`, `Constitution`, `Intelligence`, `Dodge`, `Crit`, `Armor`, `Precision`, `Resistance`, `Luck`, `Block` FROM `Items_Master` WHERE `ID` = " + str(itemCode))
- itemGenEquipment = c.fetchone()
- return itemGenEquipment
-
- #Item by Random
- elif int(itemCode) is 0:
- #UPDATE: Should be able to generate an available weapon with just one query
- # Pick random item that is available to the player
- c.execute("SELECT `Items_PlayerPool`.`Nick`, `Items_PlayerPool`.`EquipmentName`, `Items_Master`.`Locked` FROM `Items_PlayerPool` INNER JOIN `Items_Master` ON `Items_PlayerPool`.`EquipmentName` = `Items_Master`.`EquipmentName` WHERE `Nick`=%s AND `Locked`=0 ORDER BY RAND() LIMIT 1",parameters['Nick'])
- sqlItemPlayer = c.fetchone()
-
- # Get information from randomly picked weapon
- c.execute("SELECT `EquipmentName`, `EquipmentSlot`, `EquipmentType`, `HandsReq`, `Strength`, `Dexterity`, `Constitution`, `Intelligence`, `Dodge`, `Crit`, `Armor`, `Precision`, `Resistance`, `Luck`, `Block` FROM `Items_Master` WHERE `EquipmentName`=%s",sqlItemPlayer['EquipmentName'])
- itemGenEquipment = c.fetchone()
- itemGenEquipment['Permanent'] = 0
- return itemGenEquipment
-
-def CreateItemElement(phenny, parameters, itemCode, RarityID):
- 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 random.randint(1, 3) is 1 or RarityID <= 3:
- itemGenElement = {}
- else:
- if int(itemCode) is not 0:
- c.execute("SELECT `EffectName`, `Strength`, `Dexterity`, `Constitution`, `Intelligence`, `Dodge`, `Crit`, `Armor` FROM `GenElement` WHERE `ID` = %s",itemCode)
- itemGenElement = c.fetchone()
- elif int(itemCode) is 0:
- c.execute("SELECT `EffectName`, `Strength`, `Dexterity`, `Constitution`, `Intelligence`, `Dodge`, `Crit`, `Armor` FROM `GenElement` ORDER BY RAND() LIMIT 1")
- itemGenElement = c.fetchone()
- return itemGenElement
-
-def CreateItemRarity(phenny, parameters, itemCode):
- db = MySQLdb.connect(host="localhost", user=phenny.config.mysql_username, passwd=phenny.config.mysql_password,db=parameters['LiveDB'])
- c = db.cursor(MySQLdb.cursors.DictCursor)
- itemGenRarity = {}
- if int(itemCode) is not 0:
- c.execute("SELECT `ID`,`RarityName`,`RarityColor`,`RarityModifier`,`RarityChance`,`RarityCost` FROM `GenRarity` WHERE `ID` = " + str(itemCode))
- itemGenRarity = c.fetchone()
- elif int(itemCode) is 0:
- # Obtain sum of all rarities
- c.execute("SELECT SUM(`RarityChance`) AS RarityTotal FROM `GenRarity`")
- intRarityTotal = c.fetchone()['RarityTotal']
-
- # Variable declaration
- intIteration = 0
- intRandom = random.randint(1, intRarityTotal)
-
- while True:
- intIteration = intIteration + 1
-
- # Obtain Rarity in order of lowest to highest with each iteration
- c.execute("SELECT `ID`,`RarityName`,`RarityColor`,`RarityModifier`,`RarityChance` FROM `GenRarity` WHERE `ID` = " + str(intIteration))
- itemGenRarity = c.fetchone()
-
- # Subtract the current iterations rarity from the random roll
- # If intRandom becomes negative, our item rarity has been found. End the loop.
- intRandom = intRandom - itemGenRarity['RarityChance']
- if intRandom <= 0:
- break
- return itemGenRarity
- db.close()
-
-def CreateItemEnchantment(phenny, parameters, itemCode, RarityID):
- 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 random.randint(1, 3) is 1 or RarityID <= 2:
- itemGenEnchantment = {}
- else:
- if int(itemCode) is not 0:
- c.execute("SELECT `Name`,`Strength`,`Dexterity`,`Constitution`,`Intelligence`,`Dodge`, `Crit`, `Armor` FROM `GenEnchantment` WHERE `ID` = %s", str(itemCode))
- itemGenEnchantment = c.fetchone()
- elif int(itemCode) is 0:
- c.execute("SELECT `Name`,`Strength`,`Dexterity`,`Constitution`,`Intelligence`,`Dodge`, `Crit`, `Armor` FROM `GenEnchantment` ORDER BY RAND() LIMIT 1")
- itemGenEnchantment = c.fetchone()
- return itemGenEnchantment
-
-def CreateItemArtifact(phenny, parameters, itemGenEquipment, itemCode):
- db = MySQLdb.connect(host="localhost", user=phenny.config.mysql_username, passwd=phenny.config.mysql_password,db=parameters['LiveDB'])
- c = db.cursor(MySQLdb.cursors.DictCursor)
- # Gen for Artifact item:
- if random.randint(1, 150) == 1 or int(itemCode) == 1:
- if itemGenEquipment['EquipmentType'] == 'Armor' or itemGenEquipment['EquipmentType'] == 'Weapon':
- c.execute("SELECT COUNT(`Permanent`) AS `Artifacts` FROM `Items_PlayerInventory` WHERE `Nick`=%s AND `Permanent`=1;",parameters['Nick'])
- sqlCountArtifacts = c.fetchone()
- if sqlCountArtifacts['Artifacts'] < 2:
- itemGenEquipment['FabledPrefix'] = 'Fabled '
- itemGenEquipment['Permanent'] = 1
- else:
- itemGenEquipment['FabledPrefix'] = ''
- return itemGenEquipment \ No newline at end of file
diff --git a/sassbot/modules/artifact2-0/Items.pyc b/sassbot/modules/artifact2-0/Items.pyc
new file mode 100644
index 0000000..29fa4cc
--- /dev/null
+++ b/sassbot/modules/artifact2-0/Items.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/LevelUp.pyc b/sassbot/modules/artifact2-0/LevelUp.pyc
new file mode 100644
index 0000000..e24911f
--- /dev/null
+++ b/sassbot/modules/artifact2-0/LevelUp.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/PlayerAdventuring.pyc b/sassbot/modules/artifact2-0/PlayerAdventuring.pyc
new file mode 100644
index 0000000..fb9d0fa
--- /dev/null
+++ b/sassbot/modules/artifact2-0/PlayerAdventuring.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/PlayerCreate.pyc b/sassbot/modules/artifact2-0/PlayerCreate.pyc
new file mode 100644
index 0000000..8a1301c
--- /dev/null
+++ b/sassbot/modules/artifact2-0/PlayerCreate.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/PlayerDeath.pyc b/sassbot/modules/artifact2-0/PlayerDeath.pyc
new file mode 100644
index 0000000..76a599d
--- /dev/null
+++ b/sassbot/modules/artifact2-0/PlayerDeath.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/PlayerStats.pyc b/sassbot/modules/artifact2-0/PlayerStats.pyc
new file mode 100644
index 0000000..68b2299
--- /dev/null
+++ b/sassbot/modules/artifact2-0/PlayerStats.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2-0/Resting.pyc b/sassbot/modules/artifact2-0/Resting.pyc
new file mode 100644
index 0000000..8a51966
--- /dev/null
+++ b/sassbot/modules/artifact2-0/Resting.pyc
Binary files differ
diff --git a/sassbot/modules/artifact2.py b/sassbot/modules/artifact2.py
index b0d2643..3736eae 100644
--- a/sassbot/modules/artifact2.py
+++ b/sassbot/modules/artifact2.py
@@ -4,56 +4,91 @@ import random
import math
import re
+sys.path.insert(0, '/home/bouncer/sassbot/modules/')
+import BotUtils
+
sys.path.insert(0, '/home/bouncer/sassbot/modules/artifact2-0/')
-import EquipmentCreate
+import Items
+import PlayerStats
+import PlayerCreate
+import Resting
+import Combat
+import LevelUp
+import PlayerDeath
+import Enemy
+import LevelUp
def adventurersinc(phenny, input):
- #Variables
if input.sender.lower() == "#fromsteamland" or input.sender.lower() == "#artifact":
+ #Variables
strInputGroup = input.group().split(" ")
- try:
- strCmd1 = strInputGroup[1]
- except:
- strCmd1 = ""
- try:
- strCmd2 = strInputGroup[2]
- except:
- strCmd2 = ""
-
- strPlayerState="debug"
- parameters = {}
- parameters['LiveDB'] = 'Artifact2.0'
- parameters['LiveVersion'] = '2.0'
- parameters['Nick'] = input.nick
+ try:
+ strCmd1 = strInputGroup[1]
+ except:
+ strCmd1 = ""
+ try:
+ strCmd2 = strInputGroup[2]
+ except:
+ strCmd2 = ""
+
+ strPlayerState="debug"
+ parameters = {}
+ parameters['LiveDB'] = 'Artifact2.0'
+ parameters['LiveVersion'] = '2.0'
+ parameters['Nick'] = input.nick
+
+ playerStats = PlayerStats.RefreshStats(phenny, parameters)
- #Global Commands
- if strCmd1 == "git":
- phenny.say("Artifact v2 git: http://www.blatech.co.uk/JasonFS/Artifact-v2")
- elif strCmd1 == "version":
- phenny.say("Artifact v2 - alpha 0.0")
- else:
- #Actions based on player state
- if strPlayerState == "newchar":
- phenny.say("New Character")
-
- elif strPlayerState == "rest":
- phenny.say("Resting")
-
- elif strPlayerState == "adventuring":
- phenny.say("Exploring")
-
- elif strPlayerState == "combat":
- phenny.say("Combat")
-
- elif strPlayerState == "debug":
- itemCode = input.group(2).split(':')
- #phenny.say(str(input.group(2)))
- NewItem = EquipmentCreate.GenerateItem(phenny, parameters, itemCode)
- phenny.say(NewItem["EquipmentName"])
+ #Global Commands
+ if strCmd1 == "git":
+ phenny.say("Artifact v2 git: http://www.blatech.co.uk/JasonFS/Artifact-v2")
+ elif strCmd1 == "version":
+ phenny.say("Artifact v2 - alpha 0.1")
+ else:
+ #Actions based on player state
+ if playerStats == {}:
+ #Do not use strCmd1 here, input.group(2) allows for spaces in a Clan name
+ strOutput = PlayerCreate.PickCharacterClan(phenny, parameters, input.group(2))
+
+ elif playerStats["State"] == "CreationName":
+ strOutput = PlayerCreate.PickCharacterName(phenny, parameters, playerStats, strCmd1)
+
+ elif playerStats["State"] == "CreationRace":
+ strOutput = PlayerCreate.PickCharacterRace(phenny, parameters, playerStats, strCmd1)
+
+ elif playerStats["State"] == "Rest" and playerStats['AttributePoints'] > 0:
+ strOutput = LevelUp.LevelUpAttributes(phenny, parameters, strCmd1, strCmd2)
+
+ elif playerStats["State"] == "Rest" and playerStats['AttributePoints'] == 0:
+ strOutput = Resting.PlayerResting(phenny, parameters, playerStats, strCmd1, strCmd2)
+
+ elif playerStats["State"] == "Combat":
+ strOutput = Combat.PlayerInCombat(phenny, parameters, playerStats, strCmd1, strCmd2)
+
+ #elif strPlayerState == "debug":
+ #phenny.say(str(input.group(2)))
+ #NewItem = Items.GenerateEquipment(phenny, parameters, input.group(2))
+ #phenny.say(strOutputNick + ": " + str(NewItem))
+ #phenny.say(strOutputNick + ": " + NewItem["RarityColor"] + NewItem["EquipmentName"] + "\x0399 = " + str(NewItem['Cost']) )
+
+ #Items.AddToShop(phenny, parameters, NewItem)
+
+ if strOutput is not None:
+
+ strOutputNick = BotUtils.BotifyFilter(phenny, input.nick, input.nick)
+ phenny.say(strOutputNick + ": " + str(strOutput))
adventurersinc.commands = ['a']
adventurersinc.priority = 'high'
+def ArtifactAuto(phenny, input):
+ bitChatOutput = True
+
+ if input.sender.lower() == '#artifact' and not input.group().startswith("!") and bitChatOutput == True:
+ phenny.write(('NOTICE', input.nick), "Message output to #artifact-chat")
+ phenny.msg('#artifact-chat', BotUtils.BotifyFilter(phenny, input.nick, input.nick + ": " + input.group()))
+ArtifactAuto.rule = r'(.*)'
+ArtifactAuto.priority = 'medium'
#https://stackoverflow.com/questions/4340793/how-to-find-gaps-in-sequential-numbering-in-mysql \ No newline at end of file