From 8c35b8b6ad3181470c2f96e6e36a11da59d8c358 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon, 22 Jun 2026 19:09:19 -0500 Subject: [PATCH] Fix equipped-item match in FindItemIcon and drop the link loop The equipped-slot check compared itemName to its own lowercase (always matching the first named slot) instead of the searched item; now it compares against item. The separate GetInventoryItemLink/ItemLinkToName loop for slots past INVSLOT_LAST_EQUIPPED is folded into the ItemLocation loop by extending its range by 4. --- MikScrollingBattleText/MikScrollingBattleText.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/MikScrollingBattleText/MikScrollingBattleText.lua b/MikScrollingBattleText/MikScrollingBattleText.lua index 46e5ea3..801ff63 100644 --- a/MikScrollingBattleText/MikScrollingBattleText.lua +++ b/MikScrollingBattleText/MikScrollingBattleText.lua @@ -1950,22 +1950,13 @@ end function MikSBT.FindItemIcon(item) if ( not item ) then return end item = string.lower(item); - for slot = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do + for slot = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED + 4 do local itemLocation = ItemLocation:CreateFromEquipmentSlot(slot) local itemName = C_Item.GetItemName(itemLocation) - if itemName and itemName == string.lower(itemName) then + if itemName and item == string.lower(itemName) then return slot, nil, C_Item.GetItemIcon(itemLocation), GetInventoryItemCount('player', slot) end end - local link; - for i = INVSLOT_LAST_EQUIPPED + 1, 23 do - link = GetInventoryItemLink("player",i); - if ( link ) then - if ( item == string.lower(ItemLinkToName(link)) )then - return i, nil, GetInventoryItemTexture('player', i), GetInventoryItemCount('player', i); - end - end - end local count, texture; for i = 0, NUM_BAG_FRAMES do for j = 1, GetContainerNumSlots(i) do