Skip to content

Commit

Permalink
Worked around a Blizzard bug where items may not update when questing…
Browse files Browse the repository at this point in the history
…, looting, or other tasks.
  • Loading branch information
Cidan committed Sep 3, 2024
1 parent 6434e33 commit 62d9e1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions data/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,17 @@ function items:LoadItems(ctx, kind, dataCache, equipmentCache, callback)
search:Add(currentItem)
elseif items:ItemChanged(currentItem, previousItem) then
debug:Log("ItemChanged", currentItem.itemInfo.itemLink)
slotInfo:AddToUpdatedItems(previousItem, currentItem)
search:Remove(currentItem)
search:Add(currentItem)
--- HACKFIX: If the item is empty and the previous item is empty, then the item is bugged
--- This happens due to a race condition in Blizzard's server side code
--- where BAG_UPDATE and BAG_UPDATE_DELAYED events are fired prematurely.
--- See: https://github.com/Stanzilla/WoWUIBugs/issues/650
if currentItem.isItemEmpty and previousItem and previousItem.isItemEmpty then
debug:Log("ItemChanged", "Bugged item detected during loading, skipping.")
else
slotInfo:AddToUpdatedItems(previousItem, currentItem)
search:Remove(currentItem)
search:Add(currentItem)
end
end

slotInfo:StoreIfEmptySlot(name, currentItem)
Expand Down
2 changes: 1 addition & 1 deletion data/loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function ItemLoader:ProcessMixin(itemMixin)
local itemLocation = itemMixin:GetItemLocation()
if itemLocation == nil then return end

if itemMixin:IsItemEmpty() then
if not itemMixin:GetItemLocation():IsValid() then
local data = {}
---@cast data +ItemData
data.bagid, data.slotid = itemMixin:GetItemLocation():GetBagAndSlot()
Expand Down

0 comments on commit 62d9e1a

Please sign in to comment.