From d522b59b3d06e2e4aaac349085372676629c79c6 Mon Sep 17 00:00:00 2001 From: Gethe Date: Sat, 18 Mar 2023 22:07:17 -0400 Subject: [PATCH] [wrath] Skin pets/mounts pane Fixes #81 --- .../FrameXML/PetPaperDollFrame.lua | 96 ++++++++++++++++--- 1 file changed, 84 insertions(+), 12 deletions(-) diff --git a/Skin/Classic/Interface_Wrath/FrameXML/PetPaperDollFrame.lua b/Skin/Classic/Interface_Wrath/FrameXML/PetPaperDollFrame.lua index 61421f9c..2d277b19 100644 --- a/Skin/Classic/Interface_Wrath/FrameXML/PetPaperDollFrame.lua +++ b/Skin/Classic/Interface_Wrath/FrameXML/PetPaperDollFrame.lua @@ -2,39 +2,74 @@ local _, private = ... if private.shouldSkip() then return end --[[ Lua Globals ]] --- luacheck: globals floor +-- luacheck: globals floor wipe tinsert --[[ Core ]] local Aurora = private.Aurora +local Base = Aurora.Base local Hook, Skin = Aurora.Hook, Aurora.Skin -local Util = Aurora.Util +local Color, Util = Aurora.Color, Aurora.Util do --[[ FrameXML\PetPaperDollFrame.lua ]] - function Hook.PetTab_Update(self) - _G.CharacterFrameTab3:ClearAllPoints() + local tabs = {} + function Hook.PetPaperDollFrame_UpdateTabs(self) + _G.PetPaperDollFrameTab1:ClearAllPoints() + _G.PetPaperDollFrameTab2:ClearAllPoints() + _G.PetPaperDollFrameTab3:ClearAllPoints() + wipe(tabs) + if _G.HasPetUI() then - _G.CharacterFrameTab3:SetPoint("TOPLEFT", "CharacterFrameTab2", "TOPRIGHT", 1, 0); - else - _G.CharacterFrameTab3:SetPoint("TOPLEFT", "CharacterFrameTab1", "TOPRIGHT", 1, 0); + tinsert(tabs, _G.PetPaperDollFrameTab1) + end + if _G.GetNumCompanions("CRITTER") > 0 then + tinsert(tabs, _G.PetPaperDollFrameTab2) end + if _G.GetNumCompanions("MOUNT") > 0 then + tinsert(tabs, _G.PetPaperDollFrameTab3) + end + + Util.PositionRelative("BOTTOMLEFT", _G.CompanionModelFrame._bg, "TOPLEFT", 20, 1, 1, "Right", tabs) end end ---do --[[ FrameXML\PetPaperDollFrame.xml ]] ---end +do --[[ FrameXML\PetPaperDollFrame.xml ]] + function Skin.CompanionButtonTemplate(CheckButton) + Base.SetBackdrop(CheckButton, Color.black, Color.frame.a) + CheckButton._auroraIconBorder = CheckButton + + Base.CropIcon(_G[CheckButton:GetName().."ActiveTexture"]) + + local bg = CheckButton:GetBackdropTexture("bg") + local disabled = CheckButton:GetDisabledTexture() + disabled:SetTexCoord(0.234375, 0.75, 0.234375, 0.75) + disabled:SetPoint("TOPLEFT", bg, 1, -1) + disabled:SetPoint("BOTTOMRIGHT", bg, -1, 1) + + Base.CropIcon(CheckButton:GetHighlightTexture()) + CheckButton:SetNormalTexture(private.textures.plain) + local normal = CheckButton:GetNormalTexture() + Base.CropIcon(normal) + normal:SetPoint("TOPLEFT", bg, 1, -1) + normal:SetPoint("BOTTOMRIGHT", bg, -1, 1) + end +end function private.FrameXML.PetPaperDollFrame() - --_G.hooksecurefunc("PetTab_Update", Hook.PetTab_Update) + _G.hooksecurefunc("PetPaperDollFrame_UpdateTabs", Hook.PetPaperDollFrame_UpdateTabs) local PetPaperDollFrame = _G.PetPaperDollFrame - local TopLeft, TopRight, BotLeft, BotRight = PetPaperDollFrame:GetRegions() + + _G.PetNameText:SetAllPoints(_G.CharacterNameText) + local _, TopLeft, TopRight, BotLeft, BotRight = PetPaperDollFrame:GetRegions() TopLeft:Hide() TopRight:Hide() BotLeft:Hide() BotRight:Hide() - _G.PetNameText:SetAllPoints(_G.CharacterNameText) + -------------- + -- PetFrame -- + -------------- Skin.FrameTypeStatusBar(_G.PetPaperDollFrameExpBar) local left, right = _G.PetPaperDollFrameExpBar:GetRegions() left:Hide() @@ -70,4 +105,41 @@ function private.FrameXML.PetPaperDollFrame() frame:SetPoint("TOPRIGHT", _G["PetMagicResFrame"..i - 1], "BOTTOMRIGHT", 0, -6) end end + + + -------------------- + -- CompanionFrame -- + -------------------- + local slotsBG, modelBG = _G.PetPaperDollFrameCompanionFrame:GetRegions() + slotsBG:Hide() + modelBG:Hide() + + Base.SetBackdrop(_G.CompanionModelFrame, Color.frame) + _G.CompanionModelFrame:SetBackdropOption("offsets", { + left = -9, + right = -9, + top = -9, + bottom = -53, + }) + _G.CompanionModelFrame._bg = _G.CompanionModelFrame:GetBackdropTexture("bg") + + Skin.NavButtonPrevious(_G.CompanionModelFrameRotateLeftButton) + Skin.NavButtonNext(_G.CompanionModelFrameRotateRightButton) + Skin.GameMenuButtonTemplate(_G.CompanionSummonButton) + + for i = 1, 12 do + Skin.CompanionButtonTemplate(_G["CompanionButton"..i]) + end + + Skin.NavButtonPrevious(_G.CompanionPrevPageButton) + Skin.NavButtonNext(_G.CompanionNextPageButton) + + Skin.TabButtonTemplate(_G.PetPaperDollFrameTab1) + Skin.TabButtonTemplate(_G.PetPaperDollFrameTab2) + Skin.TabButtonTemplate(_G.PetPaperDollFrameTab3) + + + -------------- + -- PetFrame -- + -------------- end