6060local ItemClass = newClass (" Item" , function (self , raw , rarity , highQuality )
6161 if raw then
6262 self :ParseRaw (sanitiseText (raw ), rarity , highQuality )
63- end
63+ end
6464end )
6565
6666local lineFlags = {
@@ -395,7 +395,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
395395 local linePrefix = " "
396396 local linePostfix = " "
397397
398- while self .rawLines [l ] do
398+ while self .rawLines [l ] do
399399 local line = self .rawLines [l ]
400400 if flaskBuffLines and flaskBuffLines [line ] then
401401 flaskBuffLines [line ] = nil
@@ -687,8 +687,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
687687 self .requirements [specName :sub (1 ,3 ):lower ()] = specToNumber (specVal )
688688 elseif specName == " Critical Hit Range" or specName == " Attacks per Second" or specName == " Weapon Range" or
689689 specName == " Critical Hit Chance" or specName == " Physical Damage" or specName == " Elemental Damage" or
690- specName == " Chaos Damage" or specName == " Fire Damage" or specName == " Cold Damage" or specName == " Lightning Damage" or
691- specName == " Reload Time" or specName == " Chance to Block" or specName == " Block chance" or
690+ specName == " Chaos Damage" or specName == " Fire Damage" or specName == " Cold Damage" or specName == " Lightning Damage" or
691+ specName == " Reload Time" or specName == " Chance to Block" or specName == " Block chance" or
692692 specName == " Armour" or specName == " Energy Shield" or specName == " Evasion" or specName == " Requires" then
693693 self .hidden_specs = true
694694 -- Anything else is an explicit with a colon in it (Fortress Covenant, Pure Talent, etc) unless it's part of the custom name
@@ -869,7 +869,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
869869 self .pendingAffixList = { pendingAffix }
870870 break
871871 end
872- end
872+ end
873873 end
874874 end
875875 -- Use rolling Delta/Range in case one range is 1-3 and another is 1-100 so we get the finest precision possible
@@ -894,7 +894,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
894894 -- Use rolling Delta/Range in case one range is 1-3 and another is 1-100 so we get the finest precision possible
895895 local bestPrecisionDelta = - 1
896896 local bestPrecisionRange = - 1
897-
897+
898898 -- Replace non-number ranges as unsupported
899899 line = line :gsub (" (%a+)%([%a%s]+%-[%a%s]+%)" , " %1" )
900900
@@ -1128,7 +1128,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11281128
11291129 if result then -- we have found a valid combo for that rune category
11301130 remainingRunes = remainingRunes - numRunes
1131- -- this code should probably be refactored to based off stored self.runes rather than the recomputed amounts off the runeModLines this
1131+ -- this code should probably be refactored to based off stored self.runes rather than the recomputed amounts off the runeModLines this
11321132 -- is too avoid having to run the relatively expensive recomputation every time the item is parsed even if we know the runes on the item already.
11331133 modLine .soulCore = groupedRunes [1 ].name :match (" Soul Core" ) ~= nil
11341134 modLine .runeCount = numRunes
@@ -1149,7 +1149,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11491149 self .runes = { }
11501150 end
11511151 end
1152-
1152+
11531153 if self .base and not self .requirements .level then
11541154 if importedLevelReq and # self .sockets == 0 then
11551155 -- Requirements on imported items can only be trusted for items with no sockets
@@ -1173,7 +1173,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11731173 end
11741174 self .affixLimit = 0
11751175 if self .crafted then
1176- if not self .affixes then
1176+ if not self .affixes then
11771177 self .crafted = false
11781178 elseif self .rarity == " MAGIC" then
11791179 if self .prefixes .limit or self .suffixes .limit then
@@ -1255,7 +1255,7 @@ function ItemClass:NormaliseQuality()
12551255 elseif not self .uniqueID and not self .corrupted and not self .mirrored and not (self .base .type == " Charm" ) and self .quality < self .base .quality then -- charms cannot be modified by quality currency.
12561256 self .quality = main .defaultItemQuality
12571257 end
1258- end
1258+ end
12591259end
12601260
12611261function ItemClass :GetModSpawnWeight (mod , includeTags , excludeTags )
@@ -1389,7 +1389,7 @@ function ItemClass:BuildRaw()
13891389 if baseLine .variantList then
13901390 writeModLine (baseLine )
13911391 end
1392- end
1392+ end
13931393 if self .hasAltVariant then
13941394 t_insert (rawLines , " Has Alt Variant: true" )
13951395 t_insert (rawLines , " Selected Alt Variant: " .. self .variantAlt )
@@ -1483,7 +1483,7 @@ end
14831483-- Rebuild rune modifiers using the item's runes
14841484function ItemClass :UpdateRunes ()
14851485 wipeTable (self .runeModLines )
1486- local getModRunesForTypes = function (runeName , baseType , specificType )
1486+ local getModRunesForTypes = function (runeName , baseType , specificType )
14871487 local rune = data .itemMods .Runes [runeName ]
14881488 local gatheredRuneMods = { }
14891489 if rune then
@@ -1492,21 +1492,26 @@ function ItemClass:UpdateRunes()
14921492 t_insert (gatheredRuneMods , rune [baseType ])
14931493 -- end
14941494 end
1495- if rune [specificType ] then
1495+ if rune [specificType ] then
14961496 -- for _, mod in pairs(rune[specificType]) do
14971497 t_insert (gatheredRuneMods , rune [specificType ])
14981498 -- end
14991499 end
15001500 end
15011501 return gatheredRuneMods
15021502 end
1503-
1503+
15041504 local statOrder = {}
15051505 for i = 1 , self .itemSocketCount do
15061506 local name = self .runes [i ]
15071507 if name and name ~= " None" then
1508- local baseType = self .base .weapon and " weapon" or self .base .armour and " armour" or (self .base .tags .wand or self .base .tags .staff ) and " caster"
1509- local specificType = self .base .type :lower ()
1508+ local subType = self .base .subType and self .base .subType :lower ()
1509+ local itemType = self .base .type :lower ()
1510+ local baseType = self .base .weapon and " weapon" or self .base .armour and " armour" or (self .base .tags .wand or self .base .tags .staff or self .base .tags .sceptre ) and " caster"
1511+ local specificType =
1512+ (subType == " warstaff" and " warstaff" ) or
1513+ (itemType == " shield" and subType == " evasion" and " buckler" ) or
1514+ itemType
15101515 local gatheredMods = getModRunesForTypes (name , baseType , specificType )
15111516 for _ , mod in ipairs (gatheredMods ) do
15121517 for i , modLine in ipairs (mod ) do
@@ -1528,12 +1533,11 @@ function ItemClass:UpdateRunes()
15281533 end
15291534 end
15301535 statOrder [order ] = modLine
1531- end
1536+ end
15321537 end
15331538 end
15341539 end
15351540 end
1536-
15371541end
15381542
15391543-- Rebuild explicit modifiers using the item's affixes
@@ -1586,7 +1590,7 @@ function ItemClass:Craft()
15861590 end
15871591 end
15881592 statOrder [order ] = modLine
1589- end
1593+ end
15901594 end
15911595 end
15921596 end
@@ -1601,7 +1605,7 @@ function ItemClass:Craft()
16011605end
16021606
16031607function ItemClass :CheckModLineVariant (modLine )
1604- return not modLine .variantList
1608+ return not modLine .variantList
16051609 or modLine .variantList [self .variant ]
16061610 or (self .hasAltVariant and modLine .variantList [self .variantAlt ])
16071611 or (self .hasAltVariant2 and modLine .variantList [self .variantAlt2 ])
@@ -1718,7 +1722,7 @@ function ItemClass:BuildModListForSlotNum(baseList, slotNum)
17181722 weaponData .AttackRate = round (self .base .weapon .AttackRateBase * (1 + weaponData .AttackSpeedInc / 100 ), 2 )
17191723 weaponData .rangeBonus = calcLocal (modList , " WeaponRange" , " BASE" , 0 ) + 10 * calcLocal (modList , " WeaponRangeMetre" , " BASE" , 0 ) + m_floor (self .quality / 10 * calcLocal (modList , " AlternateQualityLocalWeaponRangePer10Quality" , " BASE" , 0 ))
17201724 weaponData .range = self .base .weapon .Range + weaponData .rangeBonus
1721- if self .base .weapon .ReloadTimeBase then
1725+ if self .base .weapon .ReloadTimeBase then
17221726 weaponData .ReloadSpeedInc = calcLocal (modList , " ReloadSpeed" , " INC" , ModFlag .Attack ) + weaponData .AttackSpeedInc
17231727 weaponData .ReloadTime = round (self .base .weapon .ReloadTimeBase / (1 + weaponData .ReloadSpeedInc / 100 ), 2 )
17241728 end
@@ -1898,11 +1902,11 @@ function ItemClass:BuildModListForSlotNum(baseList, slotNum)
18981902 if jewelData .clusterJewelSkill and not self .clusterJewel .skills [jewelData .clusterJewelSkill ] then
18991903 jewelData .clusterJewelSkill = nil
19001904 end
1901- jewelData .clusterJewelValid = jewelData .clusterJewelKeystone
1902- or ((jewelData .clusterJewelSkill or jewelData .clusterJewelSmallsAreNothingness ) and jewelData .clusterJewelNodeCount )
1905+ jewelData .clusterJewelValid = jewelData .clusterJewelKeystone
1906+ or ((jewelData .clusterJewelSkill or jewelData .clusterJewelSmallsAreNothingness ) and jewelData .clusterJewelNodeCount )
19031907 or (jewelData .clusterJewelSocketCountOverride and jewelData .clusterJewelNothingnessCount )
19041908 end
1905- end
1909+ end
19061910 return { unpack (modList ) }
19071911end
19081912
@@ -1947,7 +1951,7 @@ function ItemClass:BuildModList()
19471951 if modLine .range then
19481952 -- Check if line actually has a range
19491953 if modLine .line :find (" %((%-?%d+%.?%d*)%-(%-?%d+%.?%d*)%)" ) then
1950- local strippedModeLine = modLine .line :gsub (" \n " ," " )
1954+ local strippedModeLine = modLine .line :gsub (" \n " ," " )
19511955 local catalystScalar = getCatalystScalar (self .catalyst , modLine , self .catalystQuality )
19521956 -- Put the modified value into the string
19531957 local line = itemLib .applyRange (strippedModeLine , modLine .range , catalystScalar , modLine .corruptedRange )
@@ -2058,9 +2062,9 @@ function ItemClass:BuildModList()
20582062 self .requirements .dexMod = 0
20592063 self .requirements .intMod = 0
20602064 elseif calcLocal (baseList , " AttributeRequirementsConverted" , " FLAG" , 0 ) then
2061- local strConversion = calcLocal (baseList , " AttributeRequirementsConvertedToStrength" , " BASE" , 0 ) / 100
2062- local dexConversion = calcLocal (baseList , " AttributeRequirementsConvertedToDexterity" , " BASE" , 0 ) / 100
2063- local intConversion = calcLocal (baseList , " AttributeRequirementsConvertedToIntelligence" , " BASE" , 0 ) / 100
2065+ local strConversion = calcLocal (baseList , " AttributeRequirementsConvertedToStrength" , " BASE" , 0 ) / 100
2066+ local dexConversion = calcLocal (baseList , " AttributeRequirementsConvertedToDexterity" , " BASE" , 0 ) / 100
2067+ local intConversion = calcLocal (baseList , " AttributeRequirementsConvertedToIntelligence" , " BASE" , 0 ) / 100
20642068 self .requirements .intBase = intConversion * (self .requirements .str + self .requirements .dex ) + (self .requirements .int + calcLocal (baseList , " IntRequirement" , " BASE" , 0 )) - self .requirements .int * (strConversion + dexConversion )
20652069 self .requirements .intMod = m_floor (self .requirements .intBase * (1 + calcLocal (baseList , " IntRequirement" , " INC" , 0 ) / 100 ))
20662070 self .requirements .dexBase = dexConversion * (self .requirements .str + self .requirements .int ) + (self .requirements .dex + calcLocal (baseList , " DexRequirement" , " BASE" , 0 )) - self .requirements .dex * (strConversion + intConversion )
0 commit comments