diff --git a/README.md b/README.md index 6ac49c2b..fa77d343 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Version](https://img.shields.io/badge/version-7.8.0-blue.svg)](https://github.com/me0wg4ming/pfUI) [![Turtle WoW](https://img.shields.io/badge/Turtle%20WoW-1.18.0-brightgreen.svg)](https://turtlecraft.gg/) [![SuperWoW](https://img.shields.io/badge/SuperWoW-Required-purple.svg)](https://github.com/balakethelock/SuperWoW) -[![Nampower](https://img.shields.io/badge/Nampower-Required-purple.svg)](https://gitea.com/avitasia/nampower) +[![Nampower](https://img.shields.io/badge/Nampower-Optional-yellow.svg)](https://gitea.com/avitasia/nampower) [![UnitXP](https://img.shields.io/badge/UnitXP__SP3-Optional-yellow.svg)](https://codeberg.org/konaka/UnitXP_SP3) **A pfUI fork specifically optimized for [Turtle WoW](https://turtlecraft.gg/) which requires SuperWoW and Nampower with optional UnitXP_SP3 DLL integration.** diff --git a/api/config.lua b/api/config.lua index a2454c51..ca4b6767 100644 --- a/api/config.lua +++ b/api/config.lua @@ -925,6 +925,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("thirdparty", "bag_sort", "enable", "1") pfUI:UpdateConfig("thirdparty", "mrplow", "enable", "1") pfUI:UpdateConfig("thirdparty", "bcs", "enable", "1") + pfUI:UpdateConfig("thirdparty", "statcompare", "enable", "1") pfUI:UpdateConfig("thirdparty", "crafty", "enable", "1") pfUI:UpdateConfig("thirdparty", "clevermacro", "enable", "1") pfUI:UpdateConfig("thirdparty", "supercleveroidmacros", "enable", "1") diff --git a/modules/gui.lua b/modules/gui.lua index 8260f125..85a2a407 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2814,6 +2814,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, "Bag_Sort", C.thirdparty.bag_sort, "enable", "checkbox", nil, nil, nil, nil, "tbc") CreateConfig(nil, "MrPlow", C.thirdparty.mrplow, "enable", "checkbox") CreateConfig(nil, "BetterCharacterStats", C.thirdparty.bcs, "enable", "checkbox", nil, nil, nil, nil, "vanilla") + CreateConfig(nil, "StatCompare", C.thirdparty.statcompare, "enable", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "Crafty", C.thirdparty.crafty, "enable", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "CleverMacro", C.thirdparty.clevermacro, "enable", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "SuperCleveRoidMacros", C.thirdparty.supercleveroidmacros, "enable", "checkbox", nil, nil, nil, nil, "vanilla") diff --git a/modules/thirdparty-vanilla.lua b/modules/thirdparty-vanilla.lua index 4cd82fec..ab0fb9db 100644 --- a/modules/thirdparty-vanilla.lua +++ b/modules/thirdparty-vanilla.lua @@ -1014,21 +1014,85 @@ pfUI:RegisterModule("thirdparty-vanilla", "vanilla", function() end) end) - HookAddonOrVariable("BetterCharacterStats", function() +HookAddonOrVariable("BetterCharacterStats", function() if C.thirdparty.bcs.enable == "0" then return end - StripTextures(BetterCharacterAttributesFrame) - if PlayerStatFrameLeftDropDown then - SkinDropDown(PlayerStatFrameLeftDropDown, nil, nil, nil, true) - PlayerStatFrameLeftDropDown.backdrop:SetPoint("TOPLEFT", 19, -2) - PlayerStatFrameLeftDropDown.backdrop:SetPoint("BOTTOMRIGHT", -19, 7) + local bcsframe = _G["BCSFrame"] + if not bcsframe then return end + + local bgframes = { + "PlayerStatLeftTop", "PlayerStatLeftMiddle", "PlayerStatLeftBottom", + "PlayerStatRightTop", "PlayerStatRightMiddle", "PlayerStatRightBottom", + "PlayerStatBackgroundTop", "PlayerStatBackgroundBottom", + } + + local function ApplyBCSSkin() + for _, region in ipairs({bcsframe:GetRegions()}) do + if region and region.Hide then region:Hide() end + end + + --for _, name in ipairs(bgframes) do + -- local f = _G[name] + -- if f then StripTextures(f) f:Hide() end + --end + + if not bcsframe.pfborder then + local rawborder, border = GetBorderSize() + local er, eg, eb, ea = GetStringColor(pfUI_config.appearance.border.color) + + local b = CreateFrame("Frame", nil, bcsframe:GetParent()) + b:SetFrameLevel(bcsframe:GetFrameLevel() - 2) + b:SetPoint("TOPLEFT", bcsframe, "TOPLEFT", -border, border) + b:SetPoint("BOTTOMRIGHT", bcsframe, "BOTTOMRIGHT", border, -border) + b:SetBackdrop(pfUI.backdrop) + b:SetBackdropColor(0, 0, 0, .8) + b:SetBackdropBorderColor(er, eg, eb, ea) + bcsframe.pfborder = b + + local shadow = CreateFrame("Frame", nil, bcsframe:GetParent()) + shadow:SetFrameLevel(bcsframe:GetFrameLevel() - 3) + shadow:SetPoint("TOPLEFT", b, "TOPLEFT", -3, 3) + shadow:SetPoint("BOTTOMRIGHT", b, "BOTTOMRIGHT", 3, -3) + shadow:SetBackdrop({ bgFile = pfUI.media["img:blank"], tile = true, tileSize = 1 }) + shadow:SetBackdropColor(0, 0, 0, .5) + bcsframe.pfborder_shadow = shadow + end end - if PlayerStatFrameRightDropDown then - SkinDropDown(PlayerStatFrameRightDropDown, nil, nil, nil, true) - PlayerStatFrameRightDropDown.backdrop:SetPoint("TOPLEFT", 19, -2) - PlayerStatFrameRightDropDown.backdrop:SetPoint("BOTTOMRIGHT", -19, 7) + local function ApplyDropDownSkin() + if bcsframe.pfdropskinned then return end + + local left = _G["PlayerStatFrameLeftDropDown"] + local right = _G["PlayerStatFrameRightDropDown"] + + if left and left:GetObjectType() == "Frame" then + SkinDropDown(left, nil, nil, nil, true) + if left.backdrop then + left.backdrop:SetPoint("TOPLEFT", 19, -2) + left.backdrop:SetPoint("BOTTOMRIGHT", -19, 7) + end + end + + if right and right:GetObjectType() == "Frame" then + SkinDropDown(right, nil, nil, nil, true) + if right.backdrop then + right.backdrop:SetPoint("TOPLEFT", 19, -2) + right.backdrop:SetPoint("BOTTOMRIGHT", -19, 7) + end + end + + bcsframe.pfdropskinned = true end + + local dropper = CreateFrame("Frame", nil, UIParent) + dropper:RegisterEvent("PLAYER_ENTERING_WORLD") + dropper:SetScript("OnEvent", function() + this:UnregisterAllEvents() + ApplyDropDownSkin() + end) + + HookScript(bcsframe, "OnShow", ApplyBCSSkin) + ApplyBCSSkin() end) HookAddonOrVariable("MyRolePlay", function() @@ -1264,5 +1328,75 @@ pfUI:RegisterModule("thirdparty-vanilla", "vanilla", function() StripTextures(xpsp3_editBox_FPScap, "BACKGROUND") CreateBackdrop(xpsp3_editBox_FPScap) end) + + HookAddonOrVariable("StatCompare", function() + if C.thirdparty.statcompare and C.thirdparty.statcompare.enable == "0" then return end + + local frames = { "StatCompareSelfFrame", "StatCompareTargetFrame" } + + local function SkinStatCompareFrame(frame) + if not frame or frame.pfSkinned then return end + + StripTextures(frame) + + if frame.SetBackdrop then frame:SetBackdrop(nil) end + if frame.SetBackdropColor then frame:SetBackdropColor(0, 0, 0, 0) end + + CreateBackdrop(frame, nil, nil, .8) + CreateBackdropShadow(frame) + + if frame.backdrop then + frame.backdrop:SetBackdropColor(0, 0, 0, .8) + local er, eg, eb, ea = GetStringColor(pfUI_config.appearance.border.color) + frame.backdrop:SetBackdropBorderColor(er, eg, eb, ea) + end + + local closeBtn = _G[frame:GetName() .. "CloseButton"] + if closeBtn then + SkinCloseButton(closeBtn, frame.backdrop) + end + + local otherButtons = { "ArmorButton", "StatsButton", "SpellsButton" } + local textures = { + "Interface\\Icons\\inv_misc_book_08", + "Interface\\Icons\\inv_misc_note_01", + "Interface\\Icons\\inv_helmet_10", + } + + for i, suffix in ipairs(otherButtons) do + local btn = _G[frame:GetName() .. suffix] + if btn and not btn.pfMoved then + SkinButton(btn) + btn:ClearAllPoints() + btn:SetPoint("TOPRIGHT", closeBtn, "TOPLEFT", -(i - 1) * btn:GetWidth(), 0) + btn.pfMoved = true + if not btn.pfIcon then + btn.pfIcon = btn:CreateTexture(nil, "OVERLAY") + btn.pfIcon:SetTexture(textures[i]) + btn.pfIcon:SetTexCoord(.08, .92, .08, .92) + SetAllPointsOffset(btn.pfIcon, btn, 3) + end + end + end + + frame.pfSkinned = true + end + + for _, name in ipairs(frames) do + local f = _G[name] + if f then + SkinStatCompareFrame(f) + HookScript(f, "OnShow", function() + SkinStatCompareFrame(this) + end) + end + end + + local origSCShowFrame = SCShowFrame + _G.SCShowFrame = function(frame, target, tiptitle, tiptext, anchorx, anchory) + origSCShowFrame(frame, target, tiptitle, tiptext, anchorx, anchory) + SkinStatCompareFrame(frame) + end + end) end)