This commit is contained in:
Salikh Gurgenidze
2026-01-24 00:38:03 +04:00
parent 21efe4c1cc
commit 75e4d83fc0
2 changed files with 45 additions and 30 deletions
+20 -15
View File
@@ -52,24 +52,29 @@ function BankScanner:GetBankData()
if cacheValid and bankCache then
-- Process any dirty slots incrementally
for bagID, slots in pairs(dirtySlots) do
if bankCache[bagID] then
for slotID in pairs(slots) do
local oldData = bankCache[bagID].slots[slotID]
local newData = addon.Modules.BagScanner:ScanSlot(bagID, slotID)
bankCache[bagID].slots[slotID] = newData
if bagID ~= nil and type(slots) == "table" then
if bankCache[bagID] then
for slotID in pairs(slots) do
-- Validate slotID is a valid number
if type(slotID) == "number" and slotID >= 1 then
local oldData = bankCache[bagID].slots[slotID]
local newData = addon.Modules.BagScanner:ScanSlot(bagID, slotID)
bankCache[bagID].slots[slotID] = newData
-- Update free slot count
local wasEmpty = (oldData == nil)
local isEmpty = (newData == nil)
if wasEmpty and not isEmpty then
bankCache[bagID].freeSlots = bankCache[bagID].freeSlots - 1
elseif not wasEmpty and isEmpty then
bankCache[bagID].freeSlots = bankCache[bagID].freeSlots + 1
-- Update free slot count
local wasEmpty = (oldData == nil)
local isEmpty = (newData == nil)
if wasEmpty and not isEmpty then
bankCache[bagID].freeSlots = bankCache[bagID].freeSlots - 1
elseif not wasEmpty and isEmpty then
bankCache[bagID].freeSlots = bankCache[bagID].freeSlots + 1
end
end
end
else
-- Bag not in cache, scan it
bankCache[bagID] = self:ScanBankBag(bagID)
end
else
-- Bag not in cache, scan it
bankCache[bagID] = self:ScanBankBag(bagID)
end
end
dirtySlots = {}