Thread Tools Display Modes
08-24-24, 07:28 AM   #1
Primo_nxs
A Kobold Labourer
Join Date: Aug 2024
Posts: 1
Question In TWW, how to highlight specific bag slot with custom texture? My DF addon broke

In Dragonflight I make a personal addon that place a custom texture over one or multiple bag slots that contains a specific equippable item. In The War Within no icon is visualized anymore inside my bags because the way how the bag slot are identified is changed... I think...

This was the piece of the code that worked in Dragonflight:

Code:
-- Function to highlight a specific bag slot
local function HighlightBagSlot(bag, slot, iconPath)
    local bagFrame = _G["ContainerFrame"..(bag + 1)]
    if bagFrame then
        local slotsPerBag = C_Container.GetContainerNumSlots(bag)
        local index = (slotsPerBag + 1) - slot
        local button = _G[bagFrame:GetName().."Item"..index]
        if button and C_Container.GetContainerItemLink(bag, slot) then
            button:SetHighlightTexture(iconPath or "Interface\\AddOns\\MyAddons\\MyImage\\Image.tga")
            local highlightTexture = button:GetHighlightTexture()
            if highlightTexture then
		highlightTexture:SetBlendMode("BLEND") -- Set the blend mode to "BLEND"
		highlightTexture:SetPoint("TOPLEFT", button, "TOPLEFT", -3, 3)
                highlightTexture:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 3, -3)
                highlightTexture:SetVertexColor(1, 1, 1, 1)  -- Ensure the texture is fully opaque
                button:LockHighlight()
            end
        end
    end
end
Maybe there is a simple way to do that? I know is possible, the Zygor Guide is able to do that but is a quite complex addon.

I tried everything, even AI. ...so.... help???
  Reply With Quote
08-24-24, 11:04 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,358
You can't rely on the container name matching the bagID being opened as ContainerFrames are a pooled resource. There does appear to be a UI function that'll get you the ItemButton associated for a specific bag and slot.

See: ContainerFrameUtil_GetItemButtonAndContainer()
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » In TWW, how to highlight specific bag slot with custom texture? My DF addon broke


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off