From 9d0f945c59900eb2997189654692a0c3dad18f50 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon, 22 Jun 2026 19:13:18 -0500 Subject: [PATCH] Make FindItemIcon return the icon consistently from both paths The equipped-slot path returned (slot, nil, icon, count) while the bag path returned just the icon. The sole caller (AddAnimation) uses only the first return value as the texture, so equipped items produced a slot number instead of an icon path. Both paths now return the icon as the first value. Also call FindItemIcon once in the caller instead of three times, folding the no-icon case into the same branch. --- .../MikScrollingBattleText.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MikScrollingBattleText/MikScrollingBattleText.lua b/MikScrollingBattleText/MikScrollingBattleText.lua index 801ff63..f9e1dfc 100644 --- a/MikScrollingBattleText/MikScrollingBattleText.lua +++ b/MikScrollingBattleText/MikScrollingBattleText.lua @@ -1884,12 +1884,14 @@ function MikSBT.AddAnimation(animationEvent) end elseif not texture and BS and BS.GetSpellIcon and BS:GetSpellIcon(name) then texture = BS:GetSpellIcon(name) - elseif not texture and MikSBT.FindItemIcon(lowerName) then - texture = MikSBT.FindItemIcon(lowerName) - ICON_CACHE[lowerName] = MikSBT.FindItemIcon(lowerName) elseif not texture then - texture = nil - NO_ICON_CACHE[lowerName] = 1 + local itemIcon = MikSBT.FindItemIcon(lowerName) + if itemIcon then + texture = itemIcon + ICON_CACHE[lowerName] = itemIcon + else + NO_ICON_CACHE[lowerName] = 1 + end end end @@ -1954,19 +1956,17 @@ function MikSBT.FindItemIcon(item) local itemLocation = ItemLocation:CreateFromEquipmentSlot(slot) local itemName = C_Item.GetItemName(itemLocation) if itemName and item == string.lower(itemName) then - return slot, nil, C_Item.GetItemIcon(itemLocation), GetInventoryItemCount('player', slot) + return C_Item.GetItemIcon(itemLocation) end end - local count, texture; for i = 0, NUM_BAG_FRAMES do for j = 1, GetContainerNumSlots(i) do local itemName = C_Item.GetItemName(ItemLocation:CreateFromBagAndSlot(i,j)) if itemName and item == string.lower(itemName) then - texture, count = GetContainerItemInfo(i,j); + return (GetContainerItemInfo(i,j)) end end end - return texture; end -- **********************************************************************************