Skip to content

Commit d0149d9

Browse files
author
LocalIdentity
committed
Fix jewel slots not working on weapon swap slots
Also fixes trade for not working with weapon swap slots
1 parent fec3356 commit d0149d9

2 files changed

Lines changed: 26 additions & 17 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,29 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
193193
self.slotOrder[slot.slotName] = #self.orderedSlots
194194
t_insert(self.controls, slot)
195195
end
196+
local function addJewelSockets(parentSlot, shownFunc)
197+
for i = 1, 6 do
198+
local jewel = new("ItemSlotControl", {"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, parentSlot.slotName.." Jewel Socket "..i, "Jewel #"..i)
199+
addSlot(jewel)
200+
jewel.parentSlot = parentSlot
201+
jewel.weaponSet = parentSlot.weaponSet
202+
jewel.shown = function()
203+
return not jewel.inactive and shownFunc()
204+
end
205+
parentSlot.jewelSocketList[i] = jewel
206+
end
207+
end
196208
for index, slotName in ipairs(baseSlots) do
197209
local slot = new("ItemSlotControl", {"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, slotName)
198210
addSlot(slot)
211+
local swapSlot
199212
if slotName:match("Weapon") then
200213
-- Add alternate weapon slot
201214
slot.weaponSet = 1
202215
slot.shown = function()
203216
return not self.activeItemSet.useSecondWeaponSet
204217
end
205-
local swapSlot = new("ItemSlotControl", {"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, slotName.." Swap", slotName)
218+
swapSlot = new("ItemSlotControl", {"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, slotName.." Swap", slotName)
206219
addSlot(swapSlot)
207220
swapSlot.weaponSet = 2
208221
swapSlot.shown = function()
@@ -215,21 +228,17 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
215228
end
216229
if slotName == "Weapon 1" or slotName == "Weapon 2" or slotName == "Helmet" or slotName == "Gloves" or slotName == "Body Armour" or slotName == "Boots" or slotName == "Belt" or slotName == "Ring 1" or slotName == "Ring 2" or slotName == "Ring 3" then
217230
-- Add Jewel Socket slots
218-
for i = 1, 6 do
219-
local jewel = new("ItemSlotControl", {"TOPLEFT",prevSlot,"BOTTOMLEFT"}, 0, 2, self, slotName.." Jewel Socket "..i, "Jewel #"..i)
220-
addSlot(jewel)
221-
jewel.parentSlot = slot
222-
if slotName:match("Weapon") then
223-
jewel.weaponSet = 1
224-
jewel.shown = function()
225-
return not jewel.inactive and not self.activeItemSet.useSecondWeaponSet
226-
end
227-
else
228-
jewel.shown = function()
229-
return not jewel.inactive and slot.shown()
230-
end
231-
end
232-
slot.jewelSocketList[i] = jewel
231+
if slotName:match("Weapon") then
232+
addJewelSockets(slot, function()
233+
return not self.activeItemSet.useSecondWeaponSet
234+
end)
235+
addJewelSockets(swapSlot, function()
236+
return self.activeItemSet.useSecondWeaponSet
237+
end)
238+
else
239+
addJewelSockets(slot, function()
240+
return slot.shown()
241+
end)
233242
end
234243
end
235244
end

src/Classes/TradeQuery.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ Highest Weight - Displays the order retrieved from trade]]
458458
end
459459

460460
local activeJewelSockets = {
461-
["Weapon 1"] = { }, ["Weapon 2"] = { }, ["Helmet"] = { },
461+
["Weapon 1"] = { }, ["Weapon 2"] = { }, ["Weapon 1 Swap"] = { }, ["Weapon 2 Swap"] = { }, ["Helmet"] = { },
462462
["Body Armour"] = { }, ["Gloves"] = { }, ["Boots"] = { },
463463
["Belt"] = { }, ["Ring 1"] = { }, ["Ring 2"] = { }, ["Ring 3"] = { },
464464
}

0 commit comments

Comments
 (0)