Wait on ContinueOnItemLoad for inbox, panel and loot history items

The inbox package border now waits for the item to load, since another
player's item may not be cached. The panel and loot history drop their
cached branch: ContinueOnItemLoad runs at once for a cached item. The
swing timer reads the off-hand inventory type from the slot instead of
parsing the item link.
This commit is contained in:
Brues
2026-10-30 21:44:37 -05:00
parent bfe1864aa1
commit 1b71ee617f
4 changed files with 29 additions and 40 deletions
+10 -16
View File
@@ -209,23 +209,17 @@ pfUI:RegisterModule("loothistory", function ()
local isExpanded = rollID and expanded[rollID]
SetToggleTexture(f.toggle, isExpanded)
-- Item icon/name/quality via the ClassicAPI Item mixin. When the item
-- isn't cached yet, show a placeholder and re-paint this row from the
-- ContinueOnItemLoad callback (guarded on rollID: rows are pooled, so the
-- Item icon/name/quality via the ClassicAPI Item mixin. The row shows a
-- placeholder until ContinueOnItemLoad paints it, which happens at once
-- when the item is cached (guarded on rollID: rows are pooled, so the
-- callback must no-op if the row has since been reused for another roll).
local item = itemLink and Item:CreateFromItemLink(itemLink)
if item and not item:IsItemEmpty() then
if item:IsItemDataCached() then
RenderItemVisual(f, item)
else
ShowRetrieving(f)
local pending = rollID
item:ContinueOnItemLoad(function()
if f.rollID == pending then RenderItemVisual(f, item) end
end)
end
else
ShowRetrieving(f)
ShowRetrieving(f)
if itemLink then
local item = Item:CreateFromItemLink(itemLink)
local pending = rollID
item:ContinueOnItemLoad(function()
if f.rollID == pending then RenderItemVisual(f, item) end
end)
end
-- winner summary only on a decided, collapsed row
+5 -11
View File
@@ -575,18 +575,12 @@ pfUI:RegisterModule("panel", function()
blindpowder = 5530
}
-- runs at once when the item is cached
local function AddItemToPanel(panelType)
local itemID = itemIDs[panelType]
if C_Item.IsItemDataCachedByID(itemID) then
local itemName, count = C_Item.GetItemNameByID(itemID), C_Item.GetItemCount(itemID)
pfUI.panel:OutputPanel(panelType, itemName .. ": " .. count)
else
local item = Item:CreateFromItemID(itemID)
item:ContinueOnItemLoad(function()
local itemName, count = item:GetItemName(), C_Item.GetItemCount(item:GetItemID())
pfUI.panel:OutputPanel(panelType, itemName .. ": " .. count)
end)
end
local item = Item:CreateFromItemID(itemIDs[panelType])
item:ContinueOnItemLoad(function()
pfUI.panel:OutputPanel(panelType, item:GetItemName() .. ": " .. C_Item.GetItemCount(item:GetItemID()))
end)
end
local class = UnitClassBase('player')
+2 -6
View File
@@ -258,12 +258,8 @@ pfUI:RegisterModule("swingtimer", function ()
-- weapons (22); main-hand-only (21) can never sit there.
local OH_WEAPON_TYPES = { [13]=true, [22]=true }
local function HasOffhandWeapon()
local l = GetInventoryItemLink("player", 17)
if not l then return false end
local _, _, id = string.find(l, "item:(%d+)")
id = tonumber(id)
if not id then return false end
return OH_WEAPON_TYPES[C_Item.GetItemInventoryTypeByID(id)] == true
local invType = C_Item.GetItemInventoryType({ equipmentSlotIndex = INVSLOT_OFFHAND })
return OH_WEAPON_TYPES[invType] == true
end
local function UpdateWeaponSpeeds()
+12 -7
View File
@@ -63,14 +63,19 @@ pfUI:RegisterSkin("Mailbox", function ()
SkinButton(OpenMailPackageButton, nil, nil, nil, OpenMailPackageButtonIconTexture)
hooksecurefunc("InboxFrame_OnClick", function(index)
OpenMailPackageButton:SetBackdropBorderColor(GetStringColor(pfUI_config.appearance.border.color))
-- another player's item may not be cached yet
local _, itemID = GetInboxItemLink(index)
if itemID then
local quality = C_Item.GetItemQualityByID(itemID)
local r,g,b = GetItemQualityColor(quality)
OpenMailPackageButton:SetBackdropBorderColor(r,g,b,1)
else
OpenMailPackageButton:SetBackdropBorderColor(GetStringColor(pfUI_config.appearance.border.color))
end
if not itemID then return end
local item = Item:CreateFromItemID(itemID)
item:ContinueOnItemLoad(function()
local quality = item:GetItemQuality()
if quality and InboxFrame.openMailID == index then
local r,g,b = GetItemQualityColor(quality)
OpenMailPackageButton:SetBackdropBorderColor(r,g,b,1)
end
end)
end)
end