Skip to content

Commit 150d705

Browse files
committed
Fix tests and make logic clearer
1 parent 9aa381c commit 150d705

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

spec/System/TestItemParse_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ describe("TestItemParse", function()
438438
]])
439439

440440
assert.are.equals(3, item.itemSocketCount)
441-
assert.are.same({ "Greater Glacial Rune", "Greater Body Rune" }, item.runes)
441+
assert.are.same({ "Greater Glacial Rune", "Lesser Body Rune" }, item.runes)
442442
assert.are.equals(1, item.runeModLines[1].runeCount)
443443
assert.are.equals(1, item.runeModLines[2].runeCount)
444444
assert.is_nil(item.runeModLines[3].runeCount)

src/Classes/ItemsTab.lua

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,16 +1908,24 @@ function ItemsTabClass:UpdateRuneControls()
19081908
for _, rune in pairs(runeModLines) do
19091909
local subType = item.base.subType and item.base.subType:lower()
19101910
local itemType = item.base.type:lower()
1911-
if rune.slot == "None" or -- Needed "None" for Items Tab
1912-
(subType == "warstaff" and rune.slot == "warstaff") or
1913-
(itemType == "shield" and subType == "evasion" and rune.slot == "buckler") or
1914-
(subType and subType ~= "warstaff" and not (itemType == "shield" and subType == "evasion") and (
1915-
item.base.type:lower() == rune.slot or
1916-
item.base.type == rune.slot
1917-
)) or
1918-
item.base.weapon and rune.slot == "weapon" or
1919-
item.base.armour and rune.slot == "armour" or
1920-
(item.base.tags.wand or item.base.tags.staff or item.base.tags.sceptre) and rune.slot == "caster" then
1911+
local function isRuneValidForSlot(runeSlot)
1912+
if runeSlot == "None" then
1913+
return true
1914+
elseif runeSlot == "warstaff" then
1915+
return subType == "warstaff"
1916+
elseif runeSlot == "buckler" then
1917+
return itemType == "shield" and subType == "evasion"
1918+
elseif runeSlot == "weapon" then
1919+
return item.base.weapon
1920+
elseif runeSlot == "armour" then
1921+
return item.base.armour
1922+
elseif runeSlot == "caster" then
1923+
return item.base.tags.wand or item.base.tags.staff or item.base.tags.sceptre
1924+
else
1925+
return itemType == runeSlot
1926+
end
1927+
end
1928+
if isRuneValidForSlot(rune.slot) then
19211929
if item.title == "Atziri's Splendour" then
19221930
if rune.slot == "None" or rune.type == "SoulCore" then
19231931
table.insert(runes, rune)

0 commit comments

Comments
 (0)