From ba566cdd534e87f3bd296b4a8bfa935fbaad4f4c Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon, 25 May 2026 18:40:11 -0500 Subject: [PATCH] phase 2 removing tbc Strip dead pfUI.client > 11200 and pfUI.expansion == "tbc" branches now that vanilla is the only supported client. - pfUI.lua: hardcode expansion = "vanilla"; collapse force_region matrix - compat/vanilla.lua, libs/{libcast,libdebuff,libtotem,libunitscan, focus}: drop always-false early-returns - api/unitframes.lua: delete TargetBuffOnUpdate poller + tbc visibility and secure-template branches; click-cast keeps only vanilla path - api/ui-widgets.lua: unconditional EffectiveScale divide - env/tables.lua: drop unused focus/focustarget pfValidUnits entries - modules/actionbar.lua: simplify EnablePaging, drop ButtonSwitch/ petvisibility, unwrap prowl block, single keybind-remap path - modules/{castbar,chat,cooldown,loot,questitem,totems}: unwrap always-true conditionals - modules/nameplates.lua: cfg-only fake-cooldown gate, unwrap overlap/ clickthrough + mouselook blocks - modules/friends.lua + skins/blizzard/friends.lua: maxtab = 4 - skins/blizzard/{help,game_menu,questlog}: drop tbc-only branches --- api/ui-widgets.lua | 4 +- api/unitframes.lua | 69 +----------- compat/vanilla.lua | 1 - env/tables.lua | 3 - libs/libcast.lua | 3 - libs/libdebuff.lua | 3 - libs/libtotem.lua | 3 - libs/libunitscan.lua | 42 ++++---- modules/actionbar.lua | 197 ++++++++--------------------------- modules/castbar.lua | 8 +- modules/chat.lua | 18 ++-- modules/cooldown.lua | 13 +-- modules/focus.lua | 3 - modules/friends.lua | 2 +- modules/loot.lua | 8 +- modules/nameplates.lua | 195 ++++++++++++++++------------------ modules/questitem.lua | 6 +- modules/totems.lua | 9 +- pfUI.lua | 63 ++++------- skins/blizzard/friends.lua | 2 +- skins/blizzard/game_menu.lua | 6 +- skins/blizzard/help.lua | 12 --- skins/blizzard/questlog.lua | 6 +- 23 files changed, 205 insertions(+), 471 deletions(-) diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index a37a32ab..1aea1b77 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -34,7 +34,7 @@ do -- statusbars if self.mode == "vertical" then height = self:GetHeight() - if pfUI.expansion == "vanilla" then height = height / self:GetEffectiveScale() end + height = height / self:GetEffectiveScale() point = height / (self.max - self.min) * (val - self.min) -- keep values in limits @@ -53,7 +53,7 @@ do -- statusbars self.bg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, point) else width = self:GetWidth() - if pfUI.expansion == "vanilla" then width = width / self:GetEffectiveScale() end + width = width / self:GetEffectiveScale() point = width / (self.max - self.min) * (val - self.min) -- keep values in limits diff --git a/api/unitframes.lua b/api/unitframes.lua index 44a746ef..2057cacb 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -47,15 +47,6 @@ local function DoNothing() return end -local function TargetBuffOnUpdate() - local name, rank, icon, count, duration, timeleft = _G.UnitBuff("target", this.id) - if duration and timeleft then - CooldownFrame_SetTimer(this.cd, GetTime() + timeleft - duration, duration, 1) - else - CooldownFrame_SetTimer(this.cd, 0, 0, 0) - end -end - local function BuffOnEnter() local parent = this:GetParent() if not parent.label then return end @@ -364,20 +355,6 @@ function pfUI.uf:UpdateVisibility() self.visible = nil end - -- tbc visibility - if pfUI.client > 11200 then - self:SetAttribute("unit", unitstr) - - -- update visibility condition on change - if self.visibilitycondition ~= visibility then - RegisterStateDriver(self, 'visibility', visibility) - self.visibilitycondition = visibility - self.visible = true - end - - return - end - -- vanilla visibility if self.unitname and self.unitname ~= "focus" and self.unitname ~= "focustarget" then self:Show() @@ -839,10 +816,6 @@ function pfUI.uf:UpdateConfig() CreateBackdrop(f.buffs[i], default_border) - if f:GetName() == "pfTarget" and pfUI.expansion == "tbc" then - f.buffs[i]:SetScript("OnUpdate", TargetBuffOnUpdate) - end - f.buffs[i]:SetScript("OnEnter", BuffOnEnter) f.buffs[i]:SetScript("OnLeave", BuffOnLeave) f.buffs[i]:SetScript("OnClick", BuffOnClick) @@ -1638,14 +1611,7 @@ end function pfUI.uf:EnableScripts() local f = self - -- handle secure unit button templates (> vanilla) - if pfUI.client > 11200 then - f.showmenu = pfUI.uf.RightClickAction - f:SetAttribute("*type1", "target") - f:SetAttribute("*type2", "showmenu") - else - f:SetScript("OnClick", pfUI.uf.OnClick) - end + f:SetScript("OnClick", pfUI.uf.OnClick) f:SetScript("OnShow", pfUI.uf.OnShow) f:SetScript("OnEvent", pfUI.uf.OnEvent) @@ -2508,36 +2474,9 @@ function pfUI.uf:EnableClickCast() for modifier, mconf in pairs(modifiers) do local bconf = bid == 1 and "" or bid if pfUI_config.unitframes["clickcast"..bconf..mconf] ~= "" then - -- prepare click casting - if pfUI.client > 11200 then - -- set attributes for tbc+ - local prefix = modifier == "" and "" or modifier .. "-" - - -- check for "/" in the beginning of the string, to detect macros - local ccval = pfUI_config.unitframes["clickcast"..bconf..mconf] - local ccval_lower = string.lower(ccval) - if string.find(ccval, "^%/(.+)") then - self:SetAttribute(prefix.."type"..bid, "macro") - self:SetAttribute(prefix.."macrotext"..bid, ccval) - self:SetAttribute(prefix.."spell"..bid, nil) - elseif string.find(ccval_lower, "^target") then - self:SetAttribute(prefix.."type"..bid, "target") - self:SetAttribute(prefix.."macrotext"..bid, nil) - self:SetAttribute(prefix.."spell"..bid, nil) - elseif string.find(ccval_lower, "^menu") then - self:SetAttribute(prefix.."type"..bid, "showmenu") - self:SetAttribute(prefix.."macrotext"..bid, nil) - self:SetAttribute(prefix.."spell"..bid, nil) - else - self:SetAttribute(prefix.."type"..bid, "spell") - self:SetAttribute(prefix.."spell"..bid, pfUI_config.unitframes["clickcast"..bconf..mconf]) - self:SetAttribute(prefix.."macro"..bid, nil) - end - else - -- fill clickaction table for vanillla - self.clickactions = self.clickactions or {} - self.clickactions[modifier..button] = pfUI_config.unitframes["clickcast"..bconf..mconf] - end + -- fill clickaction table + self.clickactions = self.clickactions or {} + self.clickactions[modifier..button] = pfUI_config.unitframes["clickcast"..bconf..mconf] end end end diff --git a/compat/vanilla.lua b/compat/vanilla.lua index 5135bdda..8bb1836e 100644 --- a/compat/vanilla.lua +++ b/compat/vanilla.lua @@ -1,6 +1,5 @@ -- load pfUI environment setfenv(1, pfUI:GetEnvironment()) -if pfUI.expansion ~= "vanilla" then return end -- [[ Constants ]]-- CASTBAR_EVENT_CAST_DELAY = "SPELLCAST_DELAYED" diff --git a/env/tables.lua b/env/tables.lua index 4e7c3a0c..a4b84615 100644 --- a/env/tables.lua +++ b/env/tables.lua @@ -57,9 +57,6 @@ pfValidUnits["playertarget"] = true pfValidUnits["targettarget"] = true pfValidUnits["mouseovertarget"] = true pfValidUnits["targettargettarget"] = true -pfValidUnits["focus"] = pfUI.client > 11200 or nil -pfValidUnits["focustarget"] = pfUI.client > 11200 or nil - for i=1,4 do pfValidUnits["party" .. i] = true end for i=1,4 do pfValidUnits["partypet" .. i] = true end for i=1,40 do pfValidUnits["raid" .. i] = true end diff --git a/libs/libcast.lua b/libs/libcast.lua index 72e06f3c..1600bd62 100644 --- a/libs/libcast.lua +++ b/libs/libcast.lua @@ -41,9 +41,6 @@ setfenv(1, pfUI:GetEnvironment()) -- spell can be set to "INTERRUPT" to force remove an action. -- --- return instantly if we're not on a vanilla client -if pfUI.client > 11200 then return end - -- return instantly when another libcast is already active if pfUI.api.libcast then return end diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index af9cb694..ac6b564a 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -15,9 +15,6 @@ setfenv(1, pfUI:GetEnvironment()) -- Returns debuff informations on the given effect of the specified unit. -- name, rank, texture, stacks, dtype, duration, timeleft, caster --- return instantly if we're not on a vanilla client -if pfUI.client > 11200 then return end - -- return instantly when another libdebuff is already active if pfUI.api.libdebuff then return end diff --git a/libs/libtotem.lua b/libs/libtotem.lua index 97560dfa..4652e40e 100644 --- a/libs/libtotem.lua +++ b/libs/libtotem.lua @@ -11,9 +11,6 @@ setfenv(1, pfUI:GetEnvironment()) -- Returns totem informations on the givent totem slot -- active, name, start, duration, icon --- return instantly if we're not on a vanilla client -if pfUI.client > 11200 then return end - -- return instantly when another libtotem is already active if pfUI.api.libtotem then return end diff --git a/libs/libunitscan.lua b/libs/libunitscan.lua index 793b3355..326c111c 100644 --- a/libs/libunitscan.lua +++ b/libs/libunitscan.lua @@ -165,34 +165,30 @@ libunitscan:SetScript("OnEvent", function() end end) --- since TargetByName can only be triggered within vanilla, --- we can't auto-scan targets on further expansions. -if pfUI.client <= 11200 then - -- setup sound function switches - local SoundOn = PlaySound - local SoundOff = function() return end +-- setup sound function switches +local SoundOn = PlaySound +local SoundOff = function() return end - libunitscan:SetScript("OnUpdate", function() - -- don't scan when another unit is in target - if UnitExists("target") or UnitName("target") then return end +libunitscan:SetScript("OnUpdate", function() + -- don't scan when another unit is in target + if UnitExists("target") or UnitName("target") then return end - local name = next(queue) - if name then - -- disable sound - _G.PlaySound = SoundOff + local name = next(queue) + if name then + -- disable sound + _G.PlaySound = SoundOff - -- try to target the unknown unit - TargetByName(name, true) - ClearTarget() + -- try to target the unknown unit + TargetByName(name, true) + ClearTarget() - -- enable sound again - _G.PlaySound = SoundOn + -- enable sound again + _G.PlaySound = SoundOn - queue[name] = nil - end + queue[name] = nil + end - this:Hide() - end) -end + this:Hide() +end) pfUI.api.libunitscan = libunitscan diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 6a9e5418..479abd64 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -13,8 +13,6 @@ pfUI:RegisterModule("actionbar", "vanilla", function () local updatecache = { } -- contains a list of buttons slots that shall be refreshed later -> [slot] = true local buttoncache = { } -- contains a list of all buttons ever created -> [slot] = frame - local petvisibility = "[pet] show; hide" - -- try to assume based on the current mouse positions if a button drag -- should happen even if action-on-key-down is used. By that replace the -- cast events by reverting the active buttons to the old mouse-up state. @@ -471,7 +469,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function () castable, autocast, token = nil, nil, nil -- set the own ID for compatibility to some vanilla addons - if pfUI.client <= 11200 then self:SetID(self.id) end + self:SetID(self.id) grid = self.bar == 12 and showgrid_pet or showgrid @@ -817,78 +815,25 @@ pfUI:RegisterModule("actionbar", "vanilla", function () bars:SetScript("OnUpdate", BarsUpdate) -- enable bar paging via secure functions - local function ButtonSwitch(self, att, value) - if att == "state-parent" then - local action = SecureButton_GetModifiedAttribute(self, "action", SecureStateChild_GetEffectiveButton(self)) or self.id - if self.id == action then return end - updatecache[self.slot] = true - self.id = action - end - end - local function EnablePaging(bar) - if pfUI.client <= 11200 then - if not bar.pager then - bar.pager = CreateFrame("Frame") - bar.pager:RegisterEvent("PLAYER_ENTERING_WORLD") - bar.pager:RegisterEvent("UPDATE_BONUS_ACTIONBAR") - bar.pager:RegisterEvent("ACTIONBAR_PAGE_CHANGED") - bar.pager:SetScript("OnEvent", function() - for i=1, 10 do -- reload pageable bars - local pageable = C.bars["bar"..i] and C.bars["bar"..i].pageable == "1" and true or nil - _G.VIEWABLE_ACTION_BAR_PAGES[i] = pageable - end - - local active = GetActiveBar() - for i=1,12 do - local id = i + (active-1)*12 - bar[i].id = id - updatecache[i] = true - end - end) - end - else - -- append paging enabled bars to the filter list - for i=1,12 do bar[i]:SetScript("OnAttributeChanged", ButtonSwitch) end - - -- fill all possible page states - local page, pages = nil, {} - while not pages[6] do - for i=1, 6 do - page = i == 1 and 1 or C.bars["bar"..i] and C.bars["bar"..i].pageable == "1" and i - if page then table.insert(pages, page) end + if not bar.pager then + bar.pager = CreateFrame("Frame") + bar.pager:RegisterEvent("PLAYER_ENTERING_WORLD") + bar.pager:RegisterEvent("UPDATE_BONUS_ACTIONBAR") + bar.pager:RegisterEvent("ACTIONBAR_PAGE_CHANGED") + bar.pager:SetScript("OnEvent", function() + for i=1, 10 do -- reload pageable bars + local pageable = C.bars["bar"..i] and C.bars["bar"..i].pageable == "1" and true or nil + _G.VIEWABLE_ACTION_BAR_PAGES[i] = pageable end - end - bar:SetAttribute("statemap-page", "$input") - bar:SetAttribute("state", (bar:GetAttribute("state-page") or 1)) - - -- prio posses bar - bar.filter = "[bonusbar: 5] 11;" - - -- set bar 8 for druid stealth if enabled - local prowl = class == "DRUID" and C.bars["druidstealth"] == "1" and "8" or "7" - - -- write default pages - for state, page in pairs(pages) do - if page ~= 1 then -- skip page 1 as it is supposed to stay dynamic for stances - bar.filter = string.format("%s[actionbar: %s] %s; ", bar.filter, state, page) + local active = GetActiveBar() + for i=1,12 do + local id = i + (active-1)*12 + bar[i].id = id + updatecache[i] = true end - end - - -- write page driver conditions - bar.filter = string.format("%s[bonusbar:1,nostealth] 7; [bonusbar:1,stealth] %s; [bonusbar:2] 10; [bonusbar:3] 9; [bonusbar:4] 10; 1", bar.filter, prowl) - - -- prepend pagemaster states if enabled - if C.bars.pagemaster == "1" then - for mod, page in pairs({ ["shift"] = "6", ["ctrl"] = "5", ["alt"] = "3" }) do - bar.filter = string.format("[modifier:%s] %s;", mod, page) .. bar.filter - end - end - - -- enable page driver conditions - RegisterStateDriver(bar, "page", bar.filter) - SecureStateHeader_Refresh(bar) + end) end end @@ -917,7 +862,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function () end -- pagemaster / meta page switch - if pfUI.expansion == "vanilla" then + do local prowl, shift, ctrl, alt, default = 8, 6, 5, 3, 1 -- set temporary pagemaster bindings keybinds @@ -1287,40 +1232,26 @@ pfUI:RegisterModule("actionbar", "vanilla", function () if enable == "1" then -- handle pet bar if i == 12 then - if pfUI.client > 11200 then - if InCombatLockdown and InCombatLockdown() then - -- don't process those events during combat - else - -- set state driver for pet bars - bars[i]:SetAttribute("unit", "pet") - local visibility = pfUI.unlock and pfUI.unlock:IsShown() and "show" or petvisibility - if bars[i].visibility ~= visibility then - RegisterStateDriver(bars[i], 'visibility', visibility) - bars[i].visibility = visibility - end - end + -- only show when pet actions exists + if PetHasActionBar() or pfUI.unlock and pfUI.unlock:IsShown() then + bars[i]:Show() else - -- only show when pet actions exists - if PetHasActionBar() or pfUI.unlock and pfUI.unlock:IsShown() then - bars[i]:Show() - else - bars[i]:Hide() - end + bars[i]:Hide() + end - -- show/hide petbar on petbar updates - if init then - bars[i]:RegisterEvent("PET_BAR_UPDATE") - bars[i]:SetScript("OnEvent", function() - -- hide obsolete buttons - for i=1, NUM_PET_ACTION_SLOTS do - if not PetHasActionBar() and bars[12][i] then - bars[12][i]:Hide() - end - end - -- refresh layout - CreateActionBar(12) - end) - end + -- show/hide petbar on petbar updates + if init then + bars[i]:RegisterEvent("PET_BAR_UPDATE") + bars[i]:SetScript("OnEvent", function() + -- hide obsolete buttons + for i=1, NUM_PET_ACTION_SLOTS do + if not PetHasActionBar() and bars[12][i] then + bars[12][i]:Hide() + end + end + -- refresh layout + CreateActionBar(12) + end) end -- handle shapeshift bar @@ -1390,12 +1321,6 @@ pfUI:RegisterModule("actionbar", "vanilla", function () end end - -- add up to 0-11 button parent states to each bar - if i <= 10 and pfUI.client > 11200 then - bars[i]:SetAttribute("statebutton", "0:S0;1:S1;2:S2;3:S3;4:S4;5:S5;6:S6;7:S7;8:S8;9:S9;10:S10;11:S11;") - bars[i]:SetAttribute("statebutton2", "0:S0Right;1:S1Right;2:S2Right;3:S3Right;4:S4Right;5:S5Right;6:S6Right;7:S7Right;8:S8Right;9:S9Right;10:S10Right;11:S11Right;") - end - -- enable paging for the first actionbar if i == 1 then EnablePaging(bars[i]) @@ -1565,48 +1490,16 @@ pfUI:RegisterModule("actionbar", "vanilla", function () end -- Set keybinds to all actionbuttons - if pfUI.client <= 11200 then - -- In order to be able to reuse already defined keybinds, we need to remap - -- existing button functions to pfUI. We need to get rid of the blizzard calls - -- to avoid having them call texture changes and errors due to missing buttons - _G.ActionButtonDown = pfActionButton - _G.ActionButtonUp = pfActionButton - _G.BonusActionButtonDown = function(slot) pfActionButton(slot, nil, "BonusActionBar") end - _G.BonusActionButtonUp = function(slot) pfActionButton(slot, nil, "BonusActionBar") end - _G.MultiActionButtonDown = function(bar, slot, slf) pfActionButton(slot, slf, bar) end - _G.MultiActionButtonUp = function(bar, slot, slf) pfActionButton(slot, slf, bar) end - _G.ShapeshiftBar_ChangeForm = function(slot) pfActionButton(slot, nil, "ShapeShiftBar") end - else - local bindwraps = { - ["ACTIONBUTTON%d"] = 1, - ["SHAPESHIFTBUTTON%d"] = 11, -- ShapeShiftBar - ["BONUSACTIONBUTTON%d"] = 12, -- BonusActionBar - ["MULTIACTIONBAR1BUTTON%d"] = 6, -- MultiBarBottomLeft - ["MULTIACTIONBAR2BUTTON%d"] = 5, -- MultiBarBottomRight - ["MULTIACTIONBAR3BUTTON%d"] = 3, -- MultiBarRight - ["MULTIACTIONBAR4BUTTON%d"] = 4, -- MultiBarLeft - ["PFPAGING%d"] = 2, - ["PFSTANCEONE%d"] = 7, - ["PFSTANCETWO%d"] = 8, - ["PFSTANCETHREE%d"] = 9, - ["PFSTANCEFOUR%d"] = 10, - } - - -- rebind all existing bindings to our own buttons - local keybinder = CreateFrame("Frame") - keybinder:RegisterEvent("UPDATE_BINDINGS") - keybinder:SetScript("OnEvent", function() - for name, bar in pairs(bindwraps) do - for i=1,12 do - local key = GetBindingKey(format(name, i)) - local button = bars[bar][i] - if key and button then - SetOverrideBindingClick(button, false, key, button:GetName(), 'LeftButton') - end - end - end - end) - end + -- In order to be able to reuse already defined keybinds, we need to remap + -- existing button functions to pfUI. We need to get rid of the blizzard calls + -- to avoid having them call texture changes and errors due to missing buttons + _G.ActionButtonDown = pfActionButton + _G.ActionButtonUp = pfActionButton + _G.BonusActionButtonDown = function(slot) pfActionButton(slot, nil, "BonusActionBar") end + _G.BonusActionButtonUp = function(slot) pfActionButton(slot, nil, "BonusActionBar") end + _G.MultiActionButtonDown = function(bar, slot, slf) pfActionButton(slot, slf, bar) end + _G.MultiActionButtonUp = function(bar, slot, slf) pfActionButton(slot, slf, bar) end + _G.ShapeshiftBar_ChangeForm = function(slot) pfActionButton(slot, nil, "ShapeShiftBar") end -- handle drag-drop grid local grid = CreateFrame("Frame") diff --git a/modules/castbar.lua b/modules/castbar.lua index 1f9f68b4..bc8f0efc 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -306,8 +306,8 @@ pfUI:RegisterModule("castbar", "vanilla", function () end elseif event == CASTBAR_EVENT_CAST_START or event == CASTBAR_EVENT_CHANNEL_START then - playerarg = pfUI.client <= 11200 or arg1 == "player" and true or nil - if playerarg then this.delay = 0 end + playerarg = true + this.delay = 0 end end) @@ -391,9 +391,7 @@ pfUI:RegisterModule("castbar", "vanilla", function () pfUI.castbar.focus.spacing = default_border * 2 + tonumber(C.unitframes.focus.pspace) * GetPerfectPixel() -- reset unitstr for vanilla focus frame emulation - if pfUI.client <= 11200 then - pfUI.castbar.focus.unitstr = nil - end + pfUI.castbar.focus.unitstr = nil local anchor = pfUI.uf.focus.portrait:GetHeight() > pfUI.uf.focus:GetHeight() and pfUI.uf.focus.power or pfUI.uf.focus local width = C.castbar.focus.width ~= "-1" and C.castbar.focus.width or anchor:GetWidth() diff --git a/modules/chat.lua b/modules/chat.lua index accf0a27..ce5e5c97 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -3,17 +3,15 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function () local panelfont_size = C.panel.use_unitfonts == "1" and C.global.font_unit_size or C.global.font_size local rawborder, default_border = GetBorderSize("chat") - if pfUI.client <= 11200 then - -- The 'GetChatWindowInfo' function returns shown as 'false' while the UIParent is hidden (Alt+Z). - -- Based on that return value, the 'FloatingChatFrame_Update' would remove every chat frame, - -- that isn't tabbed while the interface is hidden. With this hook we prevent the original - -- 'FloatingChatFrame_Update' function from being called during that time. + -- The 'GetChatWindowInfo' function returns shown as 'false' while the UIParent is hidden (Alt+Z). + -- Based on that return value, the 'FloatingChatFrame_Update' would remove every chat frame, + -- that isn't tabbed while the interface is hidden. With this hook we prevent the original + -- 'FloatingChatFrame_Update' function from being called during that time. - local HookFloatingChatFrame_Update = _G.FloatingChatFrame_Update - _G.FloatingChatFrame_Update = function(id, onUpdateEvent) - if not UIParent:IsShown() then return end - HookFloatingChatFrame_Update(id, onUpdateEvent) - end + local HookFloatingChatFrame_Update = _G.FloatingChatFrame_Update + _G.FloatingChatFrame_Update = function(id, onUpdateEvent) + if not UIParent:IsShown() then return end + HookFloatingChatFrame_Update(id, onUpdateEvent) end _G.CHAT_FONT_HEIGHTS = { 8, 10, 12, 14, 16, 18, 20 } diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 30ee0869..9f9f9b42 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -134,14 +134,7 @@ pfUI:RegisterModule("cooldown", "vanilla:tbc", function () end end - if pfUI.expansion == "vanilla" then - -- vanilla does not have a cooldown frame type, so we hook the - -- regular SetTimer function that each one is calling. - hooksecurefunc("CooldownFrame_SetTimer", SetCooldown) - else - -- tbc and later expansion have a cooldown frametype, so we can - -- hook directly into the frame creation and add our function there. - local methods = getmetatable(CreateFrame('Cooldown', nil, nil, 'CooldownFrameTemplate')).__index - hooksecurefunc(methods, 'SetCooldown', SetCooldown) - end + -- vanilla does not have a cooldown frame type, so we hook the + -- regular SetTimer function that each one is calling. + hooksecurefunc("CooldownFrame_SetTimer", SetCooldown) end) \ No newline at end of file diff --git a/modules/focus.lua b/modules/focus.lua index 6fa83066..95905d24 100644 --- a/modules/focus.lua +++ b/modules/focus.lua @@ -15,9 +15,6 @@ pfUI:RegisterModule("focus", "vanilla:tbc", function () pfUI.uf.focustarget:Hide() end) --- register focus emulation commands for vanilla -if pfUI.client > 11200 then return end - -- Helper: set focus frame to a GUID local function SetFocusByGUID(guid) pfUI.uf.focus.unitname = nil diff --git a/modules/friends.lua b/modules/friends.lua index 9c090819..9f54291b 100644 --- a/modules/friends.lua +++ b/modules/friends.lua @@ -1,7 +1,7 @@ pfUI:RegisterSkin("Friends", "vanilla:tbc", function () local rawborder, border = GetBorderSize() local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel() - local maxtab = pfUI.expansion == "vanilla" and 4 or 5 + local maxtab = 4 StripTextures(FriendsFrame, true) CreateBackdrop(FriendsFrame, nil, nil, .75) diff --git a/modules/loot.lua b/modules/loot.lua index a2284398..c0c0b242 100644 --- a/modules/loot.lua +++ b/modules/loot.lua @@ -714,14 +714,10 @@ pfUI:RegisterModule("loot", "vanilla:tbc", function () if event == "LOOT_BIND_CONFIRM" then local slot = arg1 QueueFunction(function() - if pfUI.client <= 12000 then - LootSlot(slot) - elseif pfUI.client <= 20400 then - ConfirmLootSlot(slot) - end + LootSlot(slot) StaticPopup_Hide("LOOT_BIND") end) - elseif event == "LOOT_OPENED" and pfUI.client <= 11200 then + elseif event == "LOOT_OPENED" then for i=1,GetNumLootItems() do LootSlot(i) end diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 0da625f2..68ed1101 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -480,7 +480,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function () -- PERF: Use lightweight fake cooldown frame when animation disabled -- The Model-based CooldownFrameTemplate causes major lag with many nameplates - if pfUI.client <= 11200 and cfg.debuffanim ~= 1 then + if cfg.debuffanim ~= 1 then plate.debuffs[index].cd = CreateFrame("Frame", plate.platename.."Debuff"..index.."Cooldown", plate.debuffs[index]) plate.debuffs[index].cd:SetAllPoints(plate.debuffs[index]) plate.debuffs[index].cd:SetFrameLevel(6) @@ -489,7 +489,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function () plate.debuffs[index].cd.SetSequence = DoNothing plate.debuffs[index].cd.SetSequenceTime = DoNothing else - -- Use CooldownFrameTemplate for animation or TBC+ + -- 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:SetAllPoints(plate.debuffs[index]) plate.debuffs[index].cd:SetFrameLevel(6) @@ -540,12 +540,6 @@ pfUI:RegisterModule("nameplates", "vanilla", function () nameplate.debuffs[i].cd.pfCooldownStyleText = cooldown_text nameplate.debuffs[i].cd.pfCooldownStyleAnimation = cooldown_anim - -- Update scale for TBC+ - if pfUI.client > 11200 then - local debuffsize = tonumber(C.nameplates.debuffsize) - local cdScale = debuffsize / 32 - nameplate.debuffs[i].cd:SetScale(cdScale) - end end end @@ -1519,40 +1513,38 @@ end end -- ========================================================================= - -- VANILLA OVERLAP/CLICKTHROUGH HANDLING + -- OVERLAP/CLICKTHROUGH HANDLING -- ========================================================================= - if pfUI.client <= 11200 then - local useOverlap = C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0" - local clickable = C.nameplates["clickthrough"] ~= "1" + local useOverlap = C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0" + local clickable = C.nameplates["clickthrough"] ~= "1" - if not clickable then - frame:EnableMouse(false) - nameplate:EnableMouse(false) - else - local plate = useOverlap and nameplate or frame - plate:EnableMouse(clickable) + if not clickable then + frame:EnableMouse(false) + nameplate:EnableMouse(false) + else + local plate = useOverlap and nameplate or frame + plate:EnableMouse(clickable) + end + + if C.nameplates["overlap"] == "1" then + if frame:GetWidth() > 1 then + frame:SetWidth(1) + frame:SetHeight(1) + end + else + if not nameplate.dwidth then + nameplate.dwidth = floor(nameplate:GetWidth() * UIParent:GetScale()) end - if C.nameplates["overlap"] == "1" then - if frame:GetWidth() > 1 then - frame:SetWidth(1) - frame:SetHeight(1) - end - else - if not nameplate.dwidth then - nameplate.dwidth = floor(nameplate:GetWidth() * UIParent:GetScale()) - end - - if floor(frame:GetWidth()) ~= nameplate.dwidth then - frame:SetWidth(nameplate:GetWidth() * UIParent:GetScale()) - frame:SetHeight(nameplate:GetHeight() * UIParent:GetScale()) - end + if floor(frame:GetWidth()) ~= nameplate.dwidth then + frame:SetWidth(nameplate:GetWidth() * UIParent:GetScale()) + frame:SetHeight(nameplate:GetHeight() * UIParent:GetScale()) end + end - local mouseEnabled = nameplate:IsMouseEnabled() - if C.nameplates["clickthrough"] == "0" and C.nameplates["overlap"] == "1" and SpellIsTargeting() == mouseEnabled then - nameplate:EnableMouse(not mouseEnabled) - end + local mouseEnabled = nameplate:IsMouseEnabled() + if C.nameplates["clickthrough"] == "0" and C.nameplates["overlap"] == "1" and SpellIsTargeting() == mouseEnabled then + nameplate:EnableMouse(not mouseEnabled) end -- Cache strata changes @@ -1951,85 +1943,82 @@ end end end - if pfUI.client <= 11200 then - -- handle vanilla only settings - local hookOnConfigChange = nameplates.OnConfigChange - nameplates.OnConfigChange = function(self) - hookOnConfigChange(self) + local hookOnConfigChange = nameplates.OnConfigChange + nameplates.OnConfigChange = function(self) + hookOnConfigChange(self) - local parent = self - local nameplate = self.nameplate - local plate = (C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0") and nameplate or parent + local parent = self + local nameplate = self.nameplate + local plate = (C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0") and nameplate or parent - -- disable all clicks for now - parent:EnableMouse(false) - nameplate:EnableMouse(false) + -- disable all clicks for now + parent:EnableMouse(false) + nameplate:EnableMouse(false) - -- adjust vertical offset - if C.nameplates["vertical_offset"] ~= "0" then - nameplate:SetPoint("TOP", parent, "TOP", 0, tonumber(C.nameplates["vertical_offset"])) - end - - -- replace clickhandler - if C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0" then - plate:SetScript("OnClick", function() parent:Click() end) - end - - -- enable mouselook on rightbutton down - if C.nameplates["rightclick"] == "1" then - plate:SetScript("OnMouseDown", nameplates.mouselook.OnMouseDown) - else - plate:SetScript("OnMouseDown", nil) - end + -- adjust vertical offset + if C.nameplates["vertical_offset"] ~= "0" then + nameplate:SetPoint("TOP", parent, "TOP", 0, tonumber(C.nameplates["vertical_offset"])) end - local hookOnDataChanged = nameplates.OnDataChanged - nameplates.OnDataChanged = function(self, nameplate) - hookOnDataChanged(self, nameplate) - - -- make sure to keep mouse events disabled on parent nameplate - if (C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0") then - nameplate.parent:EnableMouse(false) - end + -- replace clickhandler + if C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0" then + plate:SetScript("OnClick", function() parent:Click() end) end -- enable mouselook on rightbutton down - nameplates.mouselook = CreateFrame("Frame", nil, UIParent) - nameplates.mouselook.time = nil - nameplates.mouselook.frame = nil - nameplates.mouselook.OnMouseDown = function() - if arg1 and arg1 == "RightButton" then - MouselookStart() + if C.nameplates["rightclick"] == "1" then + plate:SetScript("OnMouseDown", nameplates.mouselook.OnMouseDown) + else + plate:SetScript("OnMouseDown", nil) + end + end - -- start detection of the rightclick emulation - nameplates.mouselook.time = GetTime() - nameplates.mouselook.frame = this - nameplates.mouselook:Show() - end + local hookOnDataChanged = nameplates.OnDataChanged + nameplates.OnDataChanged = function(self, nameplate) + hookOnDataChanged(self, nameplate) + + -- make sure to keep mouse events disabled on parent nameplate + if (C.nameplates["overlap"] == "1" or C.nameplates["vertical_offset"] ~= "0") then + nameplate.parent:EnableMouse(false) + end + end + + -- enable mouselook on rightbutton down + nameplates.mouselook = CreateFrame("Frame", nil, UIParent) + nameplates.mouselook.time = nil + nameplates.mouselook.frame = nil + nameplates.mouselook.OnMouseDown = function() + if arg1 and arg1 == "RightButton" then + MouselookStart() + + -- start detection of the rightclick emulation + nameplates.mouselook.time = GetTime() + nameplates.mouselook.frame = this + nameplates.mouselook:Show() + end + end + + nameplates.mouselook:SetScript("OnUpdate", function() + -- break here if nothing to do + if not this.time or not this.frame then + this:Hide() + return end - nameplates.mouselook:SetScript("OnUpdate", function() - -- break here if nothing to do - if not this.time or not this.frame then - this:Hide() - return - end + -- if threshold is reached (0.5 second) no click action will follow + if not IsMouselooking() and this.time + tonumber(C.nameplates["clickthreshold"]) < GetTime() then + this:Hide() + return + end - -- if threshold is reached (0.5 second) no click action will follow - if not IsMouselooking() and this.time + tonumber(C.nameplates["clickthreshold"]) < GetTime() then - this:Hide() - return - end - - -- run a usual nameplate rightclick action - if not IsMouselooking() then - this.frame:Click("LeftButton") - if UnitCanAttack("player", "target") and not nameplates.combat.inCombat then AttackTarget() end - this:Hide() - return - end - end) - end + -- run a usual nameplate rightclick action + if not IsMouselooking() then + this.frame:Click("LeftButton") + if UnitCanAttack("player", "target") and not nameplates.combat.inCombat then AttackTarget() end + this:Hide() + return + end + end) pfUI.nameplates = nameplates end) \ No newline at end of file diff --git a/modules/questitem.lua b/modules/questitem.lua index 7c2b19f9..cf4f691c 100644 --- a/modules/questitem.lua +++ b/modules/questitem.lua @@ -97,11 +97,7 @@ pfUI:RegisterModule("questitem", function () SelectQuestLogEntry(quest) -- detect and ignore quest headers - if pfUI.client <= 11200 then -- vanilla - _, _, _, header = GetQuestLogTitle(quest) - elseif pfUI.client > 11200 then -- tbc - _, _, _, _, header = GetQuestLogTitle(quest) - end + _, _, _, header = GetQuestLogTitle(quest) if not header then text, objective = GetQuestLogQuestText() diff --git a/modules/totems.lua b/modules/totems.lua index 90c20aea..b0857ac8 100644 --- a/modules/totems.lua +++ b/modules/totems.lua @@ -15,7 +15,7 @@ pfUI:RegisterModule("totems", "vanilla:tbc", function () totems:RefreshList() end) - if pfUI.client <= 11200 and class == "SHAMAN" then + if class == "SHAMAN" then -- there's no totem event in vanilla using ticks instead local eventemu = CreateFrame("Frame") eventemu:SetScript("OnUpdate", function() @@ -39,13 +39,10 @@ end end totems.OnClick = function(self) - if pfUI.client <= 11200 and this.id and arg1 and arg1 == "LeftButton" then - -- Try to recast totem on left click in vanilla + if this.id and arg1 and arg1 == "LeftButton" then + -- Try to recast totem on left click local active, name, start, duration, icon = GetTotemInfo(this.id) if name then CastSpellByName(name) end - elseif pfUI.client > 11200 and this.id and arg1 and arg1 == "RightButton" then - -- Try to cancel totem on right click in tbc+ - DestroyTotem(this.id) end end diff --git a/pfUI.lua b/pfUI.lua index 6ecad2e1..686bd880 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -83,40 +83,29 @@ end}) local _, _, _, client = GetBuildInfo() client = client or 11200 --- detect client expansion -if client >= 20000 and client <= 20400 then - pfUI.expansion = "tbc" - pfUI.client = client -elseif client >= 30000 and client <= 30300 then - pfUI.expansion = "wotlk" - pfUI.client = client -else - pfUI.expansion = "vanilla" - pfUI.client = client -end +pfUI.expansion = "vanilla" +pfUI.client = client -- setup pfUI namespace setmetatable(pfUI.env, {__index = getfenv(0)}) function pfUI:UpdateColors() - if pfUI.expansion == "vanilla" then - -- update table to get unknown colors and blue shamans for vanilla - RAID_CLASS_COLORS = { - ["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43, colorStr = "ffc79c6e" }, - ["MAGE"] = { r = 0.41, g = 0.8, b = 0.94, colorStr = "ff69ccf0" }, - ["ROGUE"] = { r = 1, g = 0.96, b = 0.41, colorStr = "fffff569" }, - ["DRUID"] = { r = 1, g = 0.49, b = 0.04, colorStr = "ffff7d0a" }, - ["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45, colorStr = "ffabd473" }, - ["SHAMAN"] = { r = 0.14, g = 0.35, b = 1.0, colorStr = "ff0070de" }, - ["PRIEST"] = { r = 1, g = 1, b = 1, colorStr = "ffffffff" }, - ["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79, colorStr = "ff9482c9" }, - ["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73, colorStr = "fff58cba" }, - } + -- update table to get unknown colors and blue shamans for vanilla + RAID_CLASS_COLORS = { + ["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43, colorStr = "ffc79c6e" }, + ["MAGE"] = { r = 0.41, g = 0.8, b = 0.94, colorStr = "ff69ccf0" }, + ["ROGUE"] = { r = 1, g = 0.96, b = 0.41, colorStr = "fffff569" }, + ["DRUID"] = { r = 1, g = 0.49, b = 0.04, colorStr = "ffff7d0a" }, + ["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45, colorStr = "ffabd473" }, + ["SHAMAN"] = { r = 0.14, g = 0.35, b = 1.0, colorStr = "ff0070de" }, + ["PRIEST"] = { r = 1, g = 1, b = 1, colorStr = "ffffffff" }, + ["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79, colorStr = "ff9482c9" }, + ["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73, colorStr = "fff58cba" }, + } - RAID_CLASS_COLORS = setmetatable(RAID_CLASS_COLORS, { __index = function(tab,key) - return { r = 0.6, g = 0.6, b = 0.6, colorStr = "ff999999" } - end}) - end + RAID_CLASS_COLORS = setmetatable(RAID_CLASS_COLORS, { __index = function(tab,key) + return { r = 0.6, g = 0.6, b = 0.6, colorStr = "ff999999" } + end}) end function pfUI:UpdateFonts() @@ -125,34 +114,20 @@ function pfUI:UpdateFonts() -- load font configuration local default, tooltip, unit, unit_name, combat - if pfUI_config.global.force_region == "1" and GetLocale() == "zhCN" and pfUI.expansion == "vanilla" then + if pfUI_config.global.force_region == "1" and GetLocale() == "zhCN" then -- force locale compatible fonts (zhCN 1.12) default = "Fonts\\FZXHLJW.TTF" tooltip = "Fonts\\FZXHLJW.TTF" combat = "Fonts\\FZXHLJW.TTF" unit = "Fonts\\FZXHLJW.TTF" unit_name = "Fonts\\FZXHLJW.TTF" - elseif pfUI_config.global.force_region == "1" and GetLocale() == "zhCN" and pfUI.expansion == "tbc" then - -- force locale compatible fonts (zhCN 2.4.3) - default = "Fonts\\ZYHei.ttf" - tooltip = "Fonts\\ZYHei.ttf" - combat = "Fonts\\ZYKai_C.ttf" - unit = "Fonts\\ZYKai_T.ttf" - unit_name = "Fonts\\ZYHei.ttf" - elseif pfUI_config.global.force_region == "1" and GetLocale() == "zhTW" and pfUI.expansion == "vanilla" then + elseif pfUI_config.global.force_region == "1" and GetLocale() == "zhTW" then -- force locale compatible fonts (zhTW 1.12) default = "Fonts\\FZXHLJW.ttf" tooltip = "Fonts\\FZXHLJW.ttf" combat = "Fonts\\FZXHLJW.ttf" unit = "Fonts\\FZXHLJW.ttf" unit_name = "Fonts\\FZXHLJW.ttf" - elseif pfUI_config.global.force_region == "1" and GetLocale() == "zhTW" and pfUI.expansion == "tbc" then - -- force locale compatible fonts (zhTW 2.4.3) - default = "Fonts\\bHEI01B.ttf" - tooltip = "Fonts\\bHEI01B.ttf" - combat = "Fonts\\bHEI01B.ttf" - unit = "Fonts\\bHEI01B.ttf" - unit_name = "Fonts\\bHEI01B.ttf" elseif pfUI_config.global.force_region == "1" and GetLocale() == "koKR" then -- force locale compatible fonts (koKR) default = "Fonts\\2002.TTF" diff --git a/skins/blizzard/friends.lua b/skins/blizzard/friends.lua index fe6080e6..e8e92685 100644 --- a/skins/blizzard/friends.lua +++ b/skins/blizzard/friends.lua @@ -1,7 +1,7 @@ pfUI:RegisterSkin("Friends", "vanilla:tbc", function () local rawborder, border = GetBorderSize() local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel() - local maxtab = pfUI.expansion == "vanilla" and 4 or 5 + local maxtab = 4 StripTextures(FriendsFrame, true) CreateBackdrop(FriendsFrame, nil, nil, .75) diff --git a/skins/blizzard/game_menu.lua b/skins/blizzard/game_menu.lua index 9b6d440b..c6beb760 100644 --- a/skins/blizzard/game_menu.lua +++ b/skins/blizzard/game_menu.lua @@ -4,11 +4,7 @@ pfUI:RegisterSkin("Game Menu", "vanilla:tbc", function () CreateBackdropShadow(GameMenuFrame) GameMenuFrame:SetWidth(GameMenuFrame:GetWidth() - 30) - if pfUI.expansion == 'tbc' then - GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 10) - elseif pfUI.expansion == 'vanilla' then - GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 6) - end + GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + 6) local title = GetNoNameObject(GameMenuFrame, "FontString", "ARTWORK", MAIN_MENU) title:SetTextColor(1,1,1,1) diff --git a/skins/blizzard/help.lua b/skins/blizzard/help.lua index 54413aa1..87814c8d 100644 --- a/skins/blizzard/help.lua +++ b/skins/blizzard/help.lua @@ -2,18 +2,6 @@ pfUI:RegisterSkin("Help", "vanilla:tbc", function () local rawborder, border = GetBorderSize() local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel() - -- not much here for tbc yet - if pfUI.client > 11200 then - local ticket, background = TicketStatusFrame:GetChildren() - CreateBackdrop(background, nil, true, .75) - TicketStatusFrame:SetHeight(40) - TicketStatusFrame:ClearAllPoints() - TicketStatusFrame:SetPoint("TOP", 0, -5) - - UpdateMovable(TicketStatusFrame) - return - end - StripTextures(HelpFrame) CreateBackdrop(HelpFrame, nil, nil, .75) CreateBackdropShadow(HelpFrame) diff --git a/skins/blizzard/questlog.lua b/skins/blizzard/questlog.lua index 23b4d0e8..e3933c6c 100644 --- a/skins/blizzard/questlog.lua +++ b/skins/blizzard/questlog.lua @@ -180,11 +180,7 @@ pfUI:RegisterSkin("Quest Log", "vanilla:tbc", function () if C.questlog.showQuestLevels == "1" then questIndex = i + FauxScrollFrame_GetOffset(QuestLogListScrollFrame) if questIndex <= numEntries then - if pfUI.expansion == 'vanilla' then - text, level, questTag, isHeader = GetQuestLogTitle(questIndex) - else - text, level, questTag, _, isHeader = GetQuestLogTitle(questIndex) - end + text, level, questTag, isHeader = GetQuestLogTitle(questIndex) if not isHeader then _G["QuestLogTitle"..i]:SetText(" ".."["..(questTag and level.."+" or level).."] "..text) end