Skip to content

Commit c8a6f18

Browse files
committed
Fix quarterstaff and buckler stuff
1 parent 72778bb commit c8a6f18

4 files changed

Lines changed: 105 additions & 95 deletions

File tree

src/Classes/Item.lua

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ end
6060
local ItemClass = newClass("Item", function(self, raw, rarity, highQuality)
6161
if raw then
6262
self:ParseRaw(sanitiseText(raw), rarity, highQuality)
63-
end
63+
end
6464
end)
6565

6666
local 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
@@ -686,8 +686,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
686686
self.requirements[specName:sub(1,3):lower()] = specToNumber(specVal)
687687
elseif specName == "Critical Hit Range" or specName == "Attacks per Second" or specName == "Weapon Range" or
688688
specName == "Critical Hit Chance" or specName == "Physical Damage" or specName == "Elemental Damage" or
689-
specName == "Chaos Damage" or specName == "Fire Damage" or specName == "Cold Damage" or specName == "Lightning Damage" or
690-
specName == "Reload Time" or specName == "Chance to Block" or specName == "Block chance" or
689+
specName == "Chaos Damage" or specName == "Fire Damage" or specName == "Cold Damage" or specName == "Lightning Damage" or
690+
specName == "Reload Time" or specName == "Chance to Block" or specName == "Block chance" or
691691
specName == "Armour" or specName == "Energy Shield" or specName == "Evasion" or specName == "Requires" then
692692
self.hidden_specs = true
693693
-- Anything else is an explicit with a colon in it (Fortress Covenant, Pure Talent, etc) unless it's part of the custom name
@@ -863,7 +863,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
863863
self.pendingAffixList = { pendingAffix }
864864
break
865865
end
866-
end
866+
end
867867
end
868868
end
869869
-- Use rolling Delta/Range in case one range is 1-3 and another is 1-100 so we get the finest precision possible
@@ -888,7 +888,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
888888
-- Use rolling Delta/Range in case one range is 1-3 and another is 1-100 so we get the finest precision possible
889889
local bestPrecisionDelta = -1
890890
local bestPrecisionRange = -1
891-
891+
892892
-- Replace non-number ranges as unsupported
893893
line = line:gsub("(%a+)%([%a%s]+%-[%a%s]+%)", "%1")
894894

@@ -1122,7 +1122,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11221122

11231123
if result then -- we have found a valid combo for that rune category
11241124
remainingRunes = remainingRunes - numRunes
1125-
-- this code should probably be refactored to based off stored self.runes rather than the recomputed amounts off the runeModLines this
1125+
-- this code should probably be refactored to based off stored self.runes rather than the recomputed amounts off the runeModLines this
11261126
-- 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.
11271127
modLine.soulCore = groupedRunes[1].name:match("Soul Core") ~= nil
11281128
modLine.runeCount = numRunes
@@ -1143,7 +1143,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11431143
self.runes = { }
11441144
end
11451145
end
1146-
1146+
11471147
if self.base and not self.requirements.level then
11481148
if importedLevelReq and #self.sockets == 0 then
11491149
-- Requirements on imported items can only be trusted for items with no sockets
@@ -1167,7 +1167,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11671167
end
11681168
self.affixLimit = 0
11691169
if self.crafted then
1170-
if not self.affixes then
1170+
if not self.affixes then
11711171
self.crafted = false
11721172
elseif self.rarity == "MAGIC" then
11731173
if self.prefixes.limit or self.suffixes.limit then
@@ -1249,7 +1249,7 @@ function ItemClass:NormaliseQuality()
12491249
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.
12501250
self.quality = main.defaultItemQuality
12511251
end
1252-
end
1252+
end
12531253
end
12541254

12551255
function ItemClass:GetModSpawnWeight(mod, includeTags, excludeTags)
@@ -1383,7 +1383,7 @@ function ItemClass:BuildRaw()
13831383
if baseLine.variantList then
13841384
writeModLine(baseLine)
13851385
end
1386-
end
1386+
end
13871387
if self.hasAltVariant then
13881388
t_insert(rawLines, "Has Alt Variant: true")
13891389
t_insert(rawLines, "Selected Alt Variant: " .. self.variantAlt)
@@ -1477,7 +1477,7 @@ end
14771477
-- Rebuild rune modifiers using the item's runes
14781478
function ItemClass:UpdateRunes()
14791479
wipeTable(self.runeModLines)
1480-
local getModRunesForTypes = function(runeName, baseType, specificType)
1480+
local getModRunesForTypes = function(runeName, baseType, specificType)
14811481
local rune = data.itemMods.Runes[runeName]
14821482
local gatheredRuneMods = { }
14831483
if rune then
@@ -1486,21 +1486,26 @@ function ItemClass:UpdateRunes()
14861486
t_insert(gatheredRuneMods, rune[baseType])
14871487
-- end
14881488
end
1489-
if rune[specificType] then
1489+
if rune[specificType] then
14901490
-- for _, mod in pairs(rune[specificType]) do
14911491
t_insert(gatheredRuneMods, rune[specificType])
14921492
-- end
14931493
end
14941494
end
14951495
return gatheredRuneMods
14961496
end
1497-
1497+
14981498
local statOrder = {}
14991499
for i = 1, self.itemSocketCount do
15001500
local name = self.runes[i]
15011501
if name and name ~= "None" then
1502-
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"
1503-
local specificType = self.base.type:lower()
1502+
local subType = self.base.subType and self.base.subType:lower()
1503+
local itemType = self.base.type:lower()
1504+
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"
1505+
local specificType =
1506+
(subType == "warstaff" and "warstaff") or
1507+
(itemType == "shield" and subType == "evasion" and "buckler") or
1508+
itemType
15041509
local gatheredMods = getModRunesForTypes(name, baseType, specificType)
15051510
for _, mod in ipairs(gatheredMods) do
15061511
for i, modLine in ipairs(mod) do
@@ -1522,12 +1527,11 @@ function ItemClass:UpdateRunes()
15221527
end
15231528
end
15241529
statOrder[order] = modLine
1525-
end
1530+
end
15261531
end
15271532
end
15281533
end
15291534
end
1530-
15311535
end
15321536

15331537
-- Rebuild explicit modifiers using the item's affixes
@@ -1580,7 +1584,7 @@ function ItemClass:Craft()
15801584
end
15811585
end
15821586
statOrder[order] = modLine
1583-
end
1587+
end
15841588
end
15851589
end
15861590
end
@@ -1595,7 +1599,7 @@ function ItemClass:Craft()
15951599
end
15961600

15971601
function ItemClass:CheckModLineVariant(modLine)
1598-
return not modLine.variantList
1602+
return not modLine.variantList
15991603
or modLine.variantList[self.variant]
16001604
or (self.hasAltVariant and modLine.variantList[self.variantAlt])
16011605
or (self.hasAltVariant2 and modLine.variantList[self.variantAlt2])
@@ -1712,7 +1716,7 @@ function ItemClass:BuildModListForSlotNum(baseList, slotNum)
17121716
weaponData.AttackRate = round(self.base.weapon.AttackRateBase * (1 + weaponData.AttackSpeedInc / 100), 2)
17131717
weaponData.rangeBonus = calcLocal(modList, "WeaponRange", "BASE", 0) + 10 * calcLocal(modList, "WeaponRangeMetre", "BASE", 0) + m_floor(self.quality / 10 * calcLocal(modList, "AlternateQualityLocalWeaponRangePer10Quality", "BASE", 0))
17141718
weaponData.range = self.base.weapon.Range + weaponData.rangeBonus
1715-
if self.base.weapon.ReloadTimeBase then
1719+
if self.base.weapon.ReloadTimeBase then
17161720
weaponData.ReloadSpeedInc = calcLocal(modList, "ReloadSpeed", "INC", ModFlag.Attack) + weaponData.AttackSpeedInc
17171721
weaponData.ReloadTime = round(self.base.weapon.ReloadTimeBase / (1 + weaponData.ReloadSpeedInc / 100), 2)
17181722
end
@@ -1892,11 +1896,11 @@ function ItemClass:BuildModListForSlotNum(baseList, slotNum)
18921896
if jewelData.clusterJewelSkill and not self.clusterJewel.skills[jewelData.clusterJewelSkill] then
18931897
jewelData.clusterJewelSkill = nil
18941898
end
1895-
jewelData.clusterJewelValid = jewelData.clusterJewelKeystone
1896-
or ((jewelData.clusterJewelSkill or jewelData.clusterJewelSmallsAreNothingness) and jewelData.clusterJewelNodeCount)
1899+
jewelData.clusterJewelValid = jewelData.clusterJewelKeystone
1900+
or ((jewelData.clusterJewelSkill or jewelData.clusterJewelSmallsAreNothingness) and jewelData.clusterJewelNodeCount)
18971901
or (jewelData.clusterJewelSocketCountOverride and jewelData.clusterJewelNothingnessCount)
18981902
end
1899-
end
1903+
end
19001904
return { unpack(modList) }
19011905
end
19021906

@@ -1941,7 +1945,7 @@ function ItemClass:BuildModList()
19411945
if modLine.range then
19421946
-- Check if line actually has a range
19431947
if modLine.line:find("%((%-?%d+%.?%d*)%-(%-?%d+%.?%d*)%)") then
1944-
local strippedModeLine = modLine.line:gsub("\n"," ")
1948+
local strippedModeLine = modLine.line:gsub("\n"," ")
19451949
local catalystScalar = getCatalystScalar(self.catalyst, modLine, self.catalystQuality)
19461950
-- Put the modified value into the string
19471951
local line = itemLib.applyRange(strippedModeLine, modLine.range, catalystScalar, modLine.corruptedRange)
@@ -2052,9 +2056,9 @@ function ItemClass:BuildModList()
20522056
self.requirements.dexMod = 0
20532057
self.requirements.intMod = 0
20542058
elseif calcLocal(baseList, "AttributeRequirementsConverted", "FLAG", 0) then
2055-
local strConversion = calcLocal(baseList, "AttributeRequirementsConvertedToStrength", "BASE", 0) / 100
2056-
local dexConversion = calcLocal(baseList, "AttributeRequirementsConvertedToDexterity", "BASE", 0) / 100
2057-
local intConversion = calcLocal(baseList, "AttributeRequirementsConvertedToIntelligence", "BASE", 0) / 100
2059+
local strConversion = calcLocal(baseList, "AttributeRequirementsConvertedToStrength", "BASE", 0) / 100
2060+
local dexConversion = calcLocal(baseList, "AttributeRequirementsConvertedToDexterity", "BASE", 0) / 100
2061+
local intConversion = calcLocal(baseList, "AttributeRequirementsConvertedToIntelligence", "BASE", 0) / 100
20582062
self.requirements.intBase = intConversion * (self.requirements.str + self.requirements.dex) + (self.requirements.int + calcLocal(baseList, "IntRequirement", "BASE", 0)) - self.requirements.int * (strConversion + dexConversion)
20592063
self.requirements.intMod = m_floor(self.requirements.intBase * (1 + calcLocal(baseList, "IntRequirement", "INC", 0) / 100))
20602064
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

Comments
 (0)