From dd5fe60b985f9d475d1c357762323142fc6c0190 Mon Sep 17 00:00:00 2001 From: PeluxGit <63825662+PeluxGit@users.noreply.github.com> Date: Wed, 19 Nov 2025 19:46:04 -0500 Subject: [PATCH 1/3] Fix Baggins skin errors (GetContainerItemInfo nil, unpack nil). Closes #271 --- AddOnSkins/Skins/AddOns/Baggins.lua | 63 ++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/AddOnSkins/Skins/AddOns/Baggins.lua b/AddOnSkins/Skins/AddOns/Baggins.lua index 27fdd799..e3447747 100644 --- a/AddOnSkins/Skins/AddOns/Baggins.lua +++ b/AddOnSkins/Skins/AddOns/Baggins.lua @@ -1,5 +1,44 @@ local AS, L, S, R = unpack(AddOnSkins) +--Compatibility helpers for bag APIs +local function AS_GetContainerItemInfo(bag, slot) + -- Retail C_Container API (Dragonflight / The War Within) + if C_Container and C_Container.GetContainerItemInfo then + local info = C_Container.GetContainerItemInfo(bag, slot) + if not info then + return + end + + local icon = info.iconFileID + local count = info.stackCount + local locked = info.isLocked + local quality = info.quality + local readable = info.isReadable + local itemLink = C_Container.GetContainerItemLink(bag, slot) + local itemID = info.itemID + + -- Return values in the same order as the old API where it matters + -- texture, itemCount, locked, quality, readable, lootable, + -- itemLink, isFiltered, hasNoValue, itemID + return icon, count, locked, quality, readable, nil, itemLink, nil, nil, itemID + end + + -- Older / Classic clients + if GetContainerItemInfo then + return GetContainerItemInfo(bag, slot) + end +end + +local function AS_GetContainerItemLink(bag, slot) + if C_Container and C_Container.GetContainerItemLink then + return C_Container.GetContainerItemLink(bag, slot) + end + + if GetContainerItemLink then + return GetContainerItemLink(bag, slot) + end +end + function R:Baggins() local AddOnSkins_BagginsSkin = { BagLeftPadding = 10, @@ -55,8 +94,21 @@ function R:Baggins() local BankColor = { 0, .5, 1 } function AddOnSkins_BagginsSkin:SetBankVisual(frame, isBank) - frame.backdrop:SetBackdropBorderColor(unpack(isBank and BankColor or AS.BorderColor)) - end + if not frame or not frame.backdrop then + return + end + + local borderColor + + if isBank then + borderColor = BankColor + else + -- Fall back hierarchy: BorderColor -> Color -> plain white + borderColor = AS.BorderColor or AS.Color or { 1, 1, 1 } + end + + frame.backdrop:SetBackdropBorderColor(unpack(borderColor)) + end function AddOnSkins_BagginsSkin:SkinSection(frame) frame.title:SetVertexColor(1, 1, 1, 1) @@ -82,8 +134,8 @@ function R:Baggins() hooksecurefunc(Baggins, "UpdateItemButton", function(self, _, button, bag, slot) local p = self.db.profile if p.skin and p.skin == 'AddOnSkins' then - local texture, _, _, quality = GetContainerItemInfo(bag, slot) - local link = GetContainerItemLink(bag, slot) + local texture, _, _, quality = AS_GetContainerItemInfo(bag, slot) + local link = AS_GetContainerItemLink(bag, slot) if link then local qual = select(3, GetItemInfo(link)) quality = qual or quality @@ -96,7 +148,8 @@ function R:Baggins() end button:SetBackdropBorderColor(r, g, b, 1) else - button:SetBackdropBorderColor(unpack(AS.BorderColor)) + local borderColor = AS.BorderColor or AS.Color or { 1, 1, 1 } + button:SetBackdropBorderColor(unpack(borderColor)) end button.Count:ClearAllPoints() From d6fe260eeaa868f866b32a68159fe1a75bab423f Mon Sep 17 00:00:00 2001 From: PeluxGit <63825662+PeluxGit@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:12:47 -0500 Subject: [PATCH 2/3] Integrated ElvUI theme support for border and backdrop colors --- AddOnSkins/Skins/AddOns/Baggins.lua | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/AddOnSkins/Skins/AddOns/Baggins.lua b/AddOnSkins/Skins/AddOns/Baggins.lua index e3447747..36f7f81a 100644 --- a/AddOnSkins/Skins/AddOns/Baggins.lua +++ b/AddOnSkins/Skins/AddOns/Baggins.lua @@ -93,19 +93,32 @@ function R:Baggins() local BankColor = { 0, .5, 1 } + local function GetASThemeColors() + -- Prefer ElvUI theme if present, fall back to AddOnSkins defaults + if AS:CheckAddOn('ElvUI') and _G.ElvUI and _G.ElvUI[1] then + local media = _G.ElvUI[1].media or {} + local border = media.bordercolor or media.borderColor + local backdrop = media.backdropfadecolor or media.backdropFadeColor or media.backdropcolor or media.backdropColor + if border or backdrop then + return border or { 1, 1, 1, 1 }, backdrop or { 0, 0, 0, 0.5 } + end + end + + return AS.BorderColor or AS.Color or { 1, 1, 1, 1 }, AS.BackdropColor or { 0, 0, 0, 0.5 } + end + function AddOnSkins_BagginsSkin:SetBankVisual(frame, isBank) if not frame or not frame.backdrop then return end - local borderColor + local borderColor, backdropColor = GetASThemeColors() - if isBank then - borderColor = BankColor - else - -- Fall back hierarchy: BorderColor -> Color -> plain white - borderColor = AS.BorderColor or AS.Color or { 1, 1, 1 } - end + frame.backdrop:SetBackdropColor(unpack(backdropColor)) + + if isBank then + borderColor = BankColor + end frame.backdrop:SetBackdropBorderColor(unpack(borderColor)) end @@ -148,7 +161,7 @@ function R:Baggins() end button:SetBackdropBorderColor(r, g, b, 1) else - local borderColor = AS.BorderColor or AS.Color or { 1, 1, 1 } + local borderColor = GetASThemeColors() button:SetBackdropBorderColor(unpack(borderColor)) end From 7b688c38e5b9e423338a002a38742a9dd0096635 Mon Sep 17 00:00:00 2001 From: PeluxGit <63825662+PeluxGit@users.noreply.github.com> Date: Thu, 20 Nov 2025 13:00:30 -0500 Subject: [PATCH 3/3] Skin Baggins with ElvUI theme colors and fix quest/search/bank UI - add C_Container/quest helpers and ElvUI-first theme/id coords for item buttons - apply border/backdrop + icon handling (flat empty slots, quest overlays) - skin bank control buttons and search edit box to match ElvUI styling --- AddOnSkins/Skins/AddOns/Baggins.lua | 178 ++++++++++++++++++++++++---- 1 file changed, 155 insertions(+), 23 deletions(-) diff --git a/AddOnSkins/Skins/AddOns/Baggins.lua b/AddOnSkins/Skins/AddOns/Baggins.lua index 36f7f81a..4e5686fb 100644 --- a/AddOnSkins/Skins/AddOns/Baggins.lua +++ b/AddOnSkins/Skins/AddOns/Baggins.lua @@ -30,15 +30,27 @@ local function AS_GetContainerItemInfo(bag, slot) end local function AS_GetContainerItemLink(bag, slot) - if C_Container and C_Container.GetContainerItemLink then - return C_Container.GetContainerItemLink(bag, slot) - end + if C_Container and C_Container.GetContainerItemLink then + return C_Container.GetContainerItemLink(bag, slot) + end if GetContainerItemLink then return GetContainerItemLink(bag, slot) end end +local function AS_GetContainerItemQuestInfo(bag, slot) + if C_Container and C_Container.GetContainerItemQuestInfo then + return C_Container.GetContainerItemQuestInfo(bag, slot) + end + + if GetContainerItemQuestInfo then + local isQuestItem, questID, isActive = GetContainerItemQuestInfo(bag, slot) + -- Normalize to a table so we can treat retail/classic the same + return { isQuestItem = isQuestItem, questID = questID, isActive = isActive } + end +end + function R:Baggins() local AddOnSkins_BagginsSkin = { BagLeftPadding = 10, @@ -47,7 +59,8 @@ function R:Baggins() BagBottomPadding = 10, TitlePadding = 32 + 48, SectionTitleHeight = 13, - EmptySlotTexture = 'Interface\\AddOns\\Baggins\\Textures\\EmptySlot', + -- Use flat color fallback for empty slots + EmptySlotTexture = nil, } function AddOnSkins_BagginsSkin:SkinBag(frame) @@ -72,27 +85,47 @@ function R:Baggins() end function AddOnSkins_BagginsSkin:SkinItem(button) - if button.IsSkinned then return end - button:SetNormalTexture("") - button:SetPushedTexture("") + if button.isSkinned then return end - S:SetTemplate(button) - S:StyleButton(button) + S:HandleItemButton(button, true) - S:HandleIcon(button.icon) - S:SetInside(button.icon) - - button.IconBorder:SetAlpha(0) + if button.IconBorder then + button.IconBorder:SetAlpha(0) + end if AS:CheckAddOn('ElvUI') then - _G.ElvUI[1]:RegisterCooldown(_G[button:GetName().."Cooldown"]) + local cooldown = _G[button:GetName().."Cooldown"] + if cooldown then + _G.ElvUI[1]:RegisterCooldown(cooldown) + end end - - button.IsSkinned = true end local BankColor = { 0, .5, 1 } + local function SetFrameBorderColor(frame, color) + if not frame then return end + local target = frame + if not target.SetBackdropBorderColor then + target = frame.backdrop or frame.Backdrop + end + if target and target.SetBackdropBorderColor then + target:SetBackdropBorderColor(unpack(color)) + end + end + + local function SetFrameBackdropColor(frame, color) + if not frame then return end + local target = frame.backdrop or frame.Backdrop or frame + if target and target.SetBackdropColor then + target:SetBackdropColor(unpack(color)) + end + end + + local function GetButtonIcon(btn) + return btn and (btn.icon or btn.Icon or btn.IconTexture or btn.iconTexture or (btn.GetName and _G[btn:GetName() .. "IconTexture"])) + end + local function GetASThemeColors() -- Prefer ElvUI theme if present, fall back to AddOnSkins defaults if AS:CheckAddOn('ElvUI') and _G.ElvUI and _G.ElvUI[1] then @@ -107,6 +140,19 @@ function R:Baggins() return AS.BorderColor or AS.Color or { 1, 1, 1, 1 }, AS.BackdropColor or { 0, 0, 0, 0.5 } end + local function GetIconTexCoords() + -- Prefer AddOnSkins coord, then ElvUI TexCoords, then default crop + if S.IconCoord then + return S.IconCoord + end + + if AS:CheckAddOn('ElvUI') and _G.ElvUI and _G.ElvUI[1] and _G.ElvUI[1].TexCoords then + return _G.ElvUI[1].TexCoords + end + + return { 0.08, 0.92, 0.08, 0.92 } + end + function AddOnSkins_BagginsSkin:SetBankVisual(frame, isBank) if not frame or not frame.backdrop then return @@ -114,13 +160,12 @@ function R:Baggins() local borderColor, backdropColor = GetASThemeColors() - frame.backdrop:SetBackdropColor(unpack(backdropColor)) - if isBank then borderColor = BankColor end - frame.backdrop:SetBackdropBorderColor(unpack(borderColor)) + SetFrameBackdropColor(frame.backdrop, backdropColor) + SetFrameBorderColor(frame.backdrop, borderColor) end function AddOnSkins_BagginsSkin:SkinSection(frame) @@ -130,6 +175,49 @@ function R:Baggins() frame.title:SetHeight(13) end + local function SkinBankControls() + local frame = _G.BagginsBankControlFrame + if not frame then return end + + local function skin(btn) + if btn and not btn.isSkinned then + S:HandleButton(btn) + btn.isSkinned = true + end + end + + skin(frame.radeposit) + skin(frame.rabuy) + skin(frame.slotbuy) + end + + local function SkinSearchBox() + local edit = _G.BagginsSearch_EditBox + if not edit or edit.isSkinned then return end + + -- Strip default backdrop/background so only our skin shows + if edit.SetBackdrop then + edit:SetBackdrop(nil) + end + if edit.Background then + edit.Background:SetTexture(nil) + edit.Background:Hide() + end + S:StripTextures(edit, true) + + S:HandleEditBox(edit) + local _, backdropColor = GetASThemeColors() + if edit.SetBackdropColor and backdropColor then + edit:SetBackdropColor(unpack(backdropColor)) + end + + if edit.SetTextColor then + edit:SetTextColor(1, 1, 1) + end + + edit.isSkinned = true + end + Baggins:RegisterSkin('AddOnSkins', AddOnSkins_BagginsSkin) hooksecurefunc(Baggins, "CreateMoneyFrame", function(self) @@ -144,11 +232,21 @@ function R:Baggins() end end) + hooksecurefunc(Baggins, "UpdateBankControlFrame", function() + SkinBankControls() + end) + + hooksecurefunc(Baggins, "Baggins_RefreshBags", function() + SkinSearchBox() + end) + hooksecurefunc(Baggins, "UpdateItemButton", function(self, _, button, bag, slot) local p = self.db.profile if p.skin and p.skin == 'AddOnSkins' then - local texture, _, _, quality = AS_GetContainerItemInfo(bag, slot) + local texture, _, _, quality, _, _, _, _, _, itemID = AS_GetContainerItemInfo(bag, slot) local link = AS_GetContainerItemLink(bag, slot) + local borderColor, backdropColor = GetASThemeColors() + local questInfo = AS_GetContainerItemQuestInfo(bag, slot) if link then local qual = select(3, GetItemInfo(link)) quality = qual or quality @@ -159,10 +257,44 @@ function R:Baggins() if glowTexture ~= TEXTURE_ITEM_QUEST_BANG and glowTexture ~= TEXTURE_ITEM_QUEST_BORDER then button.glow:Hide() end - button:SetBackdropBorderColor(r, g, b, 1) + SetFrameBorderColor(button, { r, g, b, 1 }) else - local borderColor = GetASThemeColors() - button:SetBackdropBorderColor(unpack(borderColor)) + SetFrameBorderColor(button, borderColor) + end + + local icon = GetButtonIcon(button) + if button.IconBorder then + button.IconBorder:SetAlpha(0) + end + if button.Border then + button.Border:SetAlpha(0) + end + if icon then + local texCoord = GetIconTexCoords() + if texture then + icon:SetTexture(texture) + icon:SetTexCoord(unpack(texCoord)) + icon:SetAlpha(1) + else + icon:SetTexture(nil) + icon:SetColorTexture(backdropColor[1], backdropColor[2], backdropColor[3], backdropColor[4] or 0.5) + icon:SetTexCoord(unpack(texCoord)) + icon:SetAlpha(1) + end + end + + -- Restore quest overlays (bang/border) if present + if button.IconQuestTexture and questInfo then + local tex = button.IconQuestTexture + if questInfo.questID and not questInfo.isActive then + tex:SetTexture(TEXTURE_ITEM_QUEST_BANG) + tex:Show() + elseif questInfo.questID or questInfo.isQuestItem then + tex:SetTexture(TEXTURE_ITEM_QUEST_BORDER) + tex:Show() + else + tex:Hide() + end end button.Count:ClearAllPoints()