Skip to content

Commit

Permalink
Worked around a bug in Blizzard's free slot API for banks in classic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cidan committed Mar 19, 2024
1 parent f39f7cb commit 03e565e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions data/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ function items:BackpackLoadFunction()
else
local invid = C_Container.ContainerIDToInventoryID(bagid)
local baglink = GetInventoryItemLink("player", invid)
if baglink ~= nil and invid~= nil then
if baglink ~= nil and invid ~= nil then
local class, subclass = select(6, GetItemInfoInstant(baglink)) --[[@as number]]
name = GetItemSubClassInfo(class, subclass)
extraSlotInfo.emptySlots[name] = extraSlotInfo.emptySlots[name] or 0
Expand Down Expand Up @@ -500,10 +500,17 @@ function items:BankLoadFunction()
for bagid, bag in pairs(items.bankItemsByBagAndSlot) do
local name = ""
local freeSlots = C_Container.GetContainerNumFreeSlots(bagid)
if bagid == 0 then
if bagid == Enum.BagIndex.Bank then
-- BugFix(https://github.com/Stanzilla/WoWUIBugs/issues/538):
-- There are 4 extra slots in the bank bag in Classic that should not
-- exist. This is a Blizzard bug.
if addon.isClassic then
freeSlots = freeSlots - 4
end
name = GetItemSubClassInfo(Enum.ItemClass.Container, 0)
extraSlotInfo.emptySlots[name] = extraSlotInfo.emptySlots[name] or 0
extraSlotInfo.emptySlots[name] = extraSlotInfo.emptySlots[name] + freeSlots
print(bagid, freeSlots)
else
local invid = C_Container.ContainerIDToInventoryID(bagid)
local baglink = GetInventoryItemLink("player", invid)
Expand Down

0 comments on commit 03e565e

Please sign in to comment.