diff options
author | Jason Le Long <jasonnlelong@gmail.com> | 2018-03-08 13:57:31 +0000 |
---|---|---|
committer | Jason Le Long <jasonnlelong@gmail.com> | 2018-03-08 13:57:31 +0000 |
commit | a2b21dff76b66b0f73d49b9f1b8bee94f2e7fe17 (patch) | |
tree | 26fe2ad15835335b7ea122d233a167cc4b038d07 /sassbot/modules/artifact2-0/EquipmentCreate.py | |
parent | 5b3e69b1b42fd7608822b4b96672202d8402c712 (diff) |
Equipment rolls working as desired
Diffstat (limited to 'sassbot/modules/artifact2-0/EquipmentCreate.py')
-rw-r--r-- | sassbot/modules/artifact2-0/EquipmentCreate.py | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/sassbot/modules/artifact2-0/EquipmentCreate.py b/sassbot/modules/artifact2-0/EquipmentCreate.py index e1520d7..c7f1c8c 100644 --- a/sassbot/modules/artifact2-0/EquipmentCreate.py +++ b/sassbot/modules/artifact2-0/EquipmentCreate.py @@ -14,19 +14,28 @@ def GenerateItem(phenny, parameters, itemCode): itemGenEquipment = CreateItemName(phenny, parameters, itemCode[1])
#Generate Enchantment
- itemGenEnchantment = CreateItemEnchantment(phenny, parameters, itemCode[2])
+ itemGenEnchantment = CreateItemEnchantment(phenny, parameters, itemCode[2], int(itemGenRarity["ID"]))
#Generate Element
- itemGenElement = CreateItemElement(phenny, parameters, itemCode[3])
+ 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 + itemGenElement['EffectName'] + " " + itemGenEquipment['EquipmentName'] + " " + itemGenEnchantment['Name']+"\x0399"
- #itemGen['EquipmentName']
+ 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']
@@ -68,16 +77,19 @@ def CreateItemName(phenny, parameters, itemCode): itemGenEquipment['Permanent'] = 0
return itemGenEquipment
-def CreateItemElement(phenny, parameters, itemCode):
+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)
- itemGenElement = {}
- 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()
+
+ 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):
@@ -111,16 +123,19 @@ def CreateItemRarity(phenny, parameters, itemCode): return itemGenRarity
db.close()
-def CreateItemEnchantment(phenny, parameters, itemCode):
+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)
- itemGenElement = {}
- 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()
+
+ 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):
|