From 611994a5116b275ea996610fa464079e911f254c Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Thu, 3 Sep 2026 14:50:08 -0500 Subject: [PATCH] Drop the vanilla compat layer compat\vanilla.lua named the handful of things that differed between clients back when pfUI targeted several. Only one client remains, so every constant had exactly one value. Inline each at its use site and delete the file, init\compat.xml, and both TOC entries. COOLDOWN_FRAME_TYPE -> "Model" LOOT_BUTTON_FRAME_TYPE -> "LootButton" MINIMAP_TRACKING_FRAME -> _G.MiniMapTrackingFrame FRIENDS_NAME_LOCATION -> "ButtonTextNameLocation" EVENTS_MINIMAP_ZONE_UPDATE -> the event list, in panel.lua MICRO_BUTTONS -> a local in panel.lua NAMEPLATE_OBJECTORDER -> a local in nameplates.lua ACTIONBAR_SECURE_TEMPLATE_BAR/_BUTTON -> nil, so the argument goes away NAMEPLATE_FRAMETYPE and PLAYER_BUFF_START_ID had no readers left. RunMacroText moves to pfUI.lua. compat\vanilla.lua was setfenv'd into the pfUI environment, so the function only ever existed on pfUI.env; at file scope it lands on _G as a real export instead. Nothing in pfUI calls it, and ClassicAPI neither defines nor looks for a RunMacroText global -- it does the same throwaway edit box natively in src/macro/Execute.cpp and only defers to a global RunMacro. --- api/unitframes.lua | 6 +++--- compat/vanilla.lua | 43 ------------------------------------------ init/compat.xml | 3 --- modules/actionbar.lua | 6 +++--- modules/bags.lua | 2 +- modules/loot.lua | 2 +- modules/nameplates.lua | 4 +++- modules/panel.lua | 14 ++++++++++---- modules/socialmod.lua | 2 +- modules/totems.lua | 2 +- modules/tracking.lua | 4 ++-- pfUI.lua | 15 +++++++++++++++ pfUI_ClassicAPI.toc | 1 - pfUI_Turtle.toc | 1 - 14 files changed, 40 insertions(+), 65 deletions(-) delete mode 100644 compat/vanilla.lua delete mode 100644 init/compat.xml diff --git a/api/unitframes.lua b/api/unitframes.lua index b07c5edf..417dcd3c 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -767,7 +767,7 @@ function pfUI.uf:UpdateConfig() if not f.buffs[i].cd then if cooldown_anim == 1 then -- Animation enabled: Use Model frame with CooldownFrameTemplate - f.buffs[i].cd = CreateFrame(COOLDOWN_FRAME_TYPE, f.buffs[i]:GetName() .. "Cooldown", f.buffs[i], "CooldownFrameTemplate") + f.buffs[i].cd = CreateFrame("Model", f.buffs[i]:GetName() .. "Cooldown", f.buffs[i], "CooldownFrameTemplate") else -- Animation disabled: Use regular Frame with dummy functions f.buffs[i].cd = CreateFrame("Frame", f.buffs[i]:GetName() .. "Cooldown", f.buffs[i]) @@ -840,7 +840,7 @@ function pfUI.uf:UpdateConfig() if not f.debuffs[i].cd then if cooldown_anim == 1 then -- Animation enabled: Use Model frame with CooldownFrameTemplate - f.debuffs[i].cd = CreateFrame(COOLDOWN_FRAME_TYPE, f.debuffs[i]:GetName() .. "Cooldown", f.debuffs[i], "CooldownFrameTemplate") + f.debuffs[i].cd = CreateFrame("Model", f.debuffs[i]:GetName() .. "Cooldown", f.debuffs[i], "CooldownFrameTemplate") else -- Animation disabled: Use regular Frame with dummy functions f.debuffs[i].cd = CreateFrame("Frame", f.debuffs[i]:GetName() .. "Cooldown", f.debuffs[i]) @@ -2244,7 +2244,7 @@ function pfUI.uf:AddIcon(frame, pos, icon, timeleft, stacks, start, duration) -- Check if parent frame has cooldown animation enabled local parent_cooldown_anim = frame.config and tonumber(frame.config.cooldown_anim) or 1 if parent_cooldown_anim == 1 then - frame.icon[pos].cd = CreateFrame(COOLDOWN_FRAME_TYPE, nil, frame.icon[pos]) + frame.icon[pos].cd = CreateFrame("Model", nil, frame.icon[pos]) else frame.icon[pos].cd = CreateFrame("Frame", nil, frame.icon[pos]) frame.icon[pos].cd.AdvanceTime = DoNothing diff --git a/compat/vanilla.lua b/compat/vanilla.lua deleted file mode 100644 index 4af29bbb..00000000 --- a/compat/vanilla.lua +++ /dev/null @@ -1,43 +0,0 @@ --- load pfUI environment -setfenv(1, pfUI:GetEnvironment()) - --- [[ Constants ]]-- -EVENTS_MINIMAP_ZONE_UPDATE = {"PLAYER_ENTERING_WORLD", "MINIMAP_ZONE_CHANGED"} - -MICRO_BUTTONS = { - 'CharacterMicroButton', 'SpellbookMicroButton', 'TalentMicroButton', - 'QuestLogMicroButton', 'SocialsMicroButton', 'WorldMapMicroButton', - 'MainMenuMicroButton', 'HelpMicroButton', -} - -NAMEPLATE_OBJECTORDER = { "border", "glow", "name", "level", "levelicon", "raidicon" } - -NAMEPLATE_FRAMETYPE = "Button" - -MINIMAP_TRACKING_FRAME = _G.MiniMapTrackingFrame - -FRIENDS_NAME_LOCATION = "ButtonTextNameLocation" - -COOLDOWN_FRAME_TYPE = "Model" -LOOT_BUTTON_FRAME_TYPE = "LootButton" - -PLAYER_BUFF_START_ID = -1 - -ACTIONBAR_SECURE_TEMPLATE_BAR = nil -ACTIONBAR_SECURE_TEMPLATE_BUTTON = nil - ---[[ Vanilla API Extensions ]]-- - -do -- RunMacroText - local obj = { ["GetText"] = function(self) return self.text end } - obj = setmetatable(obj, {__index = function(tab,key) - local value = function() return end - rawset(tab,key,value) - return value - end}) - - function RunMacroText(text) - obj.text = text - ChatEdit_ParseText(obj, 1) - end -end \ No newline at end of file diff --git a/init/compat.xml b/init/compat.xml deleted file mode 100644 index 173883ce..00000000 --- a/init/compat.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 6c0a6b68..896ee80f 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -1016,7 +1016,7 @@ pfUI:RegisterModule("actionbar", function () local id = (bar-1)*12+button local exists = _G[button_name] and true or nil - local f = _G[button_name] or CreateFrame("Button", button_name, parent, ACTIONBAR_SECURE_TEMPLATE_BUTTON) + local f = _G[button_name] or CreateFrame("Button", button_name, parent) -- no button available, create a new one if not exists then @@ -1042,7 +1042,7 @@ pfUI:RegisterModule("actionbar", function () f.slot = id -- cooldown - f.cd = CreateFrame(COOLDOWN_FRAME_TYPE, f:GetName() .. "Cooldown", f, "CooldownFrameTemplate") + f.cd = CreateFrame("Model", f:GetName() .. "Cooldown", f, "CooldownFrameTemplate") f.cd.pfCooldownStyleAnimation = 1 f.cd.pfCooldownType = "NOGCD" f.cd.pfCooldownSize = cd_size @@ -1233,7 +1233,7 @@ pfUI:RegisterModule("actionbar", function () -- create frame local init = not bars[i] - bars[i] = bars[i] or CreateFrame("Frame", "pfActionBar" .. barnames[i], UIParent, ACTIONBAR_SECURE_TEMPLATE_BAR) + bars[i] = bars[i] or CreateFrame("Frame", "pfActionBar" .. barnames[i], UIParent) bars[i]:SetID(i) -- autohide diff --git a/modules/bags.lua b/modules/bags.lua index ae950c33..c468920c 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -396,7 +396,7 @@ pfUI:RegisterModule("bags", function () if tpl == "BankItemButtonGenericTemplate" then local bankslot = pfUI.bags[bag].slots[slot].frame local name = "pfBag" .. bag .. "item" .. slot .. "Cooldown" - bankslot.cd = CreateFrame(COOLDOWN_FRAME_TYPE, name, bankslot, "CooldownFrameTemplate") + bankslot.cd = CreateFrame("Model", name, bankslot, "CooldownFrameTemplate") bankslot.cd:SetAllPoints(bankslot) bankslot.cd.pfCooldownStyleAnimation = 1 bankslot.cd.pfCooldownType = "ALL" diff --git a/modules/loot.lua b/modules/loot.lua index 98cd1305..b3461cc3 100644 --- a/modules/loot.lua +++ b/modules/loot.lua @@ -511,7 +511,7 @@ pfUI:RegisterModule("loot", function () end function pfUI.loot:CreateSlot(id) - local frame = CreateFrame(LOOT_BUTTON_FRAME_TYPE, 'pfLootButton'..id, pfUI.loot) + local frame = CreateFrame("LootButton", 'pfLootButton'..id, pfUI.loot) frame:RegisterForClicks('LeftButtonUp', 'RightButtonUp') frame:SetPoint("LEFT", border*2, 0) frame:SetPoint("RIGHT", -border*2, 0) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index e27b892f..63394b0a 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -433,7 +433,7 @@ pfUI:RegisterModule("nameplates", function () plate.debuffs[index].cd.SetSequenceTime = DoNothing else -- Use CooldownFrameTemplate for animation - plate.debuffs[index].cd = CreateFrame(COOLDOWN_FRAME_TYPE, plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index], "CooldownFrameTemplate") + plate.debuffs[index].cd = CreateFrame("Model", plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index], "CooldownFrameTemplate") plate.debuffs[index].cd:SetAllPoints(plate.debuffs[index]) plate.debuffs[index].cd:SetFrameLevel(6) end @@ -771,6 +771,8 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE") DisableObject(nameplate.original.healthbar) DisableObject(nameplate.original.castbar) + local NAMEPLATE_OBJECTORDER = { "border", "glow", "name", "level", "levelicon", "raidicon" } + for i, object in pairs({parent:GetRegions()}) do if NAMEPLATE_OBJECTORDER[i] and NAMEPLATE_OBJECTORDER[i] == "raidicon" then nameplate[NAMEPLATE_OBJECTORDER[i]] = object diff --git a/modules/panel.lua b/modules/panel.lua index c76b5187..6cb38aa8 100644 --- a/modules/panel.lua +++ b/modules/panel.lua @@ -457,7 +457,7 @@ pfUI:RegisterModule("panel", function() do -- Zone local widget = CreateFrame("Frame", "pfPanelWidgetZone", UIParent) - for _,event in pairs(EVENTS_MINIMAP_ZONE_UPDATE) do + for _,event in pairs({"PLAYER_ENTERING_WORLD", "MINIMAP_ZONE_CHANGED"}) do widget:RegisterEvent(event) end widget.Tooltip = function() @@ -777,9 +777,15 @@ pfUI:RegisterModule("panel", function() pfUI.panel.microbutton:SetSize(145, 23) pfUI.panel.microbutton:SetFrameStrata("MEDIUM") - for i=1,table.getn(MICRO_BUTTONS) do - local anchor = _G[MICRO_BUTTONS[i-1]] or pfUI.panel.microbutton - local button = _G[MICRO_BUTTONS[i]] + local microButtons = { + 'CharacterMicroButton', 'SpellbookMicroButton', 'TalentMicroButton', + 'QuestLogMicroButton', 'SocialsMicroButton', 'WorldMapMicroButton', + 'MainMenuMicroButton', 'HelpMicroButton', + } + + for i=1,table.getn(microButtons) do + local anchor = _G[microButtons[i-1]] or pfUI.panel.microbutton + local button = _G[microButtons[i]] button:ClearAllPoints() button:SetParent(pfUI.panel.microbutton) if i == 1 then diff --git a/modules/socialmod.lua b/modules/socialmod.lua index c9a7c9bb..f06b99af 100644 --- a/modules/socialmod.lua +++ b/modules/socialmod.lua @@ -81,7 +81,7 @@ pfUI:RegisterModule("socialmod", function () if not info or not info.name or info.name == _G.UNKNOWN then break end local name = info.name local friendName = _G["FriendsFrameFriendButton"..i.."ButtonTextName"] - local friendLoc = _G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION] + local friendLoc = _G["FriendsFrameFriendButton"..i.."ButtonTextNameLocation"] local friendInfo = _G["FriendsFrameFriendButton"..i.."ButtonTextInfo"] local caption = friendName or friendLoc diff --git a/modules/totems.lua b/modules/totems.lua index 1f8f421d..533d2b18 100644 --- a/modules/totems.lua +++ b/modules/totems.lua @@ -113,7 +113,7 @@ pfUI:RegisterModule("totems", function () self.bar[i].cdbg = self.bar[i].cdbg or CreateFrame("Frame", nil, self.bar[i]) self.bar[i].cdbg:SetSize(self.iconsize - 3, self.iconsize - 3) self.bar[i].cdbg:SetPoint("CENTER", self.bar[i], "CENTER", 0, 0) - self.bar[i].cd = self.bar[i].cd or CreateFrame(COOLDOWN_FRAME_TYPE, "pfTotemsBar"..i.."Cooldown", self.bar[i].cdbg, "CooldownFrameTemplate") + self.bar[i].cd = self.bar[i].cd or CreateFrame("Model", "pfTotemsBar"..i.."Cooldown", self.bar[i].cdbg, "CooldownFrameTemplate") self.bar[i].cd.pfCooldownStyleAnimation = 1 self.bar[i].cd.pfCooldownType = "ALL" diff --git a/modules/tracking.lua b/modules/tracking.lua index ec203893..b339c10b 100644 --- a/modules/tracking.lua +++ b/modules/tracking.lua @@ -1,7 +1,7 @@ pfUI:RegisterModule("tracking", function () - MINIMAP_TRACKING_FRAME:UnregisterAllEvents() - MINIMAP_TRACKING_FRAME:Hide() + _G.MiniMapTrackingFrame:UnregisterAllEvents() + _G.MiniMapTrackingFrame:Hide() local rawborder, border = GetBorderSize() local size = tonumber(C.appearance.minimap.tracking_size) diff --git a/pfUI.lua b/pfUI.lua index 435ca848..3a58b25c 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -496,3 +496,18 @@ function pfUI.SetupCVars() end UIParentLoadAddOn("Blizzard_CombatText") end + +do -- RunMacroText + local obj = setmetatable({ ["GetText"] = function(self) return self.text end }, { + __index = function(tab,key) + local value = function() return end + rawset(tab,key,value) + return value + end + }) + + function RunMacroText(text) + obj.text = text + ChatEdit_ParseText(obj, 1) + end +end diff --git a/pfUI_ClassicAPI.toc b/pfUI_ClassicAPI.toc index 1458535e..5443ff8b 100644 --- a/pfUI_ClassicAPI.toc +++ b/pfUI_ClassicAPI.toc @@ -17,7 +17,6 @@ pfUI.lua init\env.xml init\stock.xml -init\compat.xml init\api.xml init\libs.xml init\skins.xml diff --git a/pfUI_Turtle.toc b/pfUI_Turtle.toc index e1064ef4..8e121236 100644 --- a/pfUI_Turtle.toc +++ b/pfUI_Turtle.toc @@ -17,7 +17,6 @@ API_Check.lua pfUI.lua init\env.xml -init\compat.xml init\api.xml init\libs.xml init\skins.xml