From 8dde1c29cc85cf895084564a3307b4fe4a776cd1 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 20 Apr 2025 15:54:15 +0200 Subject: [PATCH] gryphons: add new module to display gryphon textures Thanks @mrrosh for supporting this feature for so long as standalone module and making so many people happy with it. This now is an entire rewrite of it, but still would not have been possible without his work. --- api/config.lua | 8 ++++++++ init/modules.xml | 1 + modules/gryphons.lua | 48 ++++++++++++++++++++++++++++++++++++++++++++ modules/gui.lua | 15 ++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 modules/gryphons.lua diff --git a/api/config.lua b/api/config.lua index 711da2f2..012fcbfe 100644 --- a/api/config.lua +++ b/api/config.lua @@ -569,6 +569,14 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("bars", nil, "bind_color", "1,1,0,1") pfUI:UpdateConfig("bars", nil, "cd_size", "12") + pfUI:UpdateConfig("bars", "gryphons", "texture", "None") + pfUI:UpdateConfig("bars", "gryphons", "color", ".6,.6,.6,1") + pfUI:UpdateConfig("bars", "gryphons", "size", "64") + pfUI:UpdateConfig("bars", "gryphons", "anchor_left", "pfActionBarLeft") + pfUI:UpdateConfig("bars", "gryphons", "anchor_right", "pfActionBarRight") + pfUI:UpdateConfig("bars", "gryphons", "offset_h", "-48") + pfUI:UpdateConfig("bars", "gryphons", "offset_v", "-4") + pfUI:UpdateConfig("totems", nil, "direction", "HORIZONTAL") pfUI:UpdateConfig("totems", nil, "iconsize", "26") pfUI:UpdateConfig("totems", nil, "spacing", "3") diff --git a/init/modules.xml b/init/modules.xml index 20a6f053..9c17cf52 100644 --- a/init/modules.xml +++ b/init/modules.xml @@ -4,6 +4,7 @@ + diff --git a/modules/gryphons.lua b/modules/gryphons.lua new file mode 100644 index 00000000..69f4e7c6 --- /dev/null +++ b/modules/gryphons.lua @@ -0,0 +1,48 @@ +pfUI:RegisterModule("gryphons", "vanilla:tbc", function () + pfUI.gryphons = { + frames = { + left = CreateFrame("Frame"), + right = CreateFrame("Frame"), + } + } + + pfUI.gryphons.textures = { + ["None"] = nil, + ["Gryphon"] = "Interface\\MainMenuBar\\UI-MainMenuBar-EndCap-Dwarf", + ["Lion"] = "Interface\\MainMenuBar\\UI-MainMenuBar-EndCap-Human", + } + + pfUI.gryphons.UpdateConfig = function() + for position, frame in pairs(pfUI.gryphons.frames) do + local anchor = _G[C.bars.gryphons["anchor_"..position]] + local texture = pfUI.gryphons.textures[C.bars.gryphons.texture] + local r, g, b, a = GetStringColor(C.bars.gryphons.color) + local size = tonumber(C.bars.gryphons.size) or 50 + local offset_h = tonumber(C.bars.gryphons.offset_h) or 0 + local offset_v = tonumber(C.bars.gryphons.offset_v) or 0 + local relative = "BOTTOM"..string.upper(position) + + frame:SetParent(anchor) + frame:SetWidth(size) + frame:SetHeight(size) + frame:SetPoint(relative, anchor, relative, (position == "right" and -1 or 1) * offset_h, offset_v) + + frame.texture = frame.texture or frame:CreateTexture(nil, "OVERLAY") + frame.texture:SetTexture(texture) + frame.texture:SetVertexColor(r, g, b, a) + frame.texture:SetAllPoints() + + if position == "right" then + frame.texture:SetTexCoord(1, 0, 0, 1) + end + + if texture then + frame:Show() + else + frame:Hide() + end + end + end + + pfUI.gryphons.UpdateConfig() +end) diff --git a/modules/gui.lua b/modules/gui.lua index 2f738e19..b1391ed4 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1196,6 +1196,11 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () "CENTER:" .. T["Center"], "RIGHT:" .. T["Right"], }, + ["gryphons"] = { + "None:"..T["None"], + "Gryphon:"..T["Gryphon"], + "Lion:"..T["Lion"], + } } -- add locale dependent client fonts to the list @@ -2012,6 +2017,16 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, T["Range Based Hunter Paging"], C.bars, "hunterbar", "checkbox", nil, nil, nil, nil, "vanilla") end) + CreateGUIEntry(T["Actionbar"], T["Gryphons"], function() + CreateConfig(U["gryphons"], T["Texture"], C.bars.gryphons, "texture", "dropdown", pfUI.gui.dropdowns.gryphons) + CreateConfig(U["gryphons"], T["Color"], C.bars.gryphons, "color", "color") + CreateConfig(U["gryphons"], T["Left Anchor"], C.bars.gryphons, "anchor_left", "dropdown", pfUI.gui.dropdowns.xpanchors) + CreateConfig(U["gryphons"], T["Right Anchor"], C.bars.gryphons, "anchor_right", "dropdown", pfUI.gui.dropdowns.xpanchors) + CreateConfig(U["gryphons"], T["Size"], C.bars.gryphons, "size") + CreateConfig(U["gryphons"], T["Horizontal Offset"], C.bars.gryphons, "offset_h") + CreateConfig(U["gryphons"], T["Vertical Offset"], C.bars.gryphons, "offset_v") + end) + -- Shared Actionbar Settings local barnames = { -- default