performance updates

performance updates
This commit is contained in:
Meow
2025-12-31 12:21:44 +01:00
committed by GitHub
parent a4cd49dbfd
commit 6eca163abd
8 changed files with 1938 additions and 18 deletions
+79 -12
View File
@@ -912,24 +912,40 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function ()
end
local cat, stealth
local function IsCatStealth()
local inCatForm = nil -- cached from buff scan
local prowlActive = nil -- tracks if prowl is active
-- Full scan for cat form and prowl (only on login/reload)
local function FullScan()
if class ~= "DRUID" then return nil end
cat, stealth = nil, nil
local foundCat, foundStealth = nil, nil
for i = 0, 31 do
local texture = GetPlayerBuffTexture(i)
if not texture then break end
-- catform icon detected
if strfind(texture, "Ability_Druid_CatForm") then
if stealth then return true end
cat = true
foundCat = true
end
-- stealth icon detected
if strfind(texture, "Ability_Ambush") then
if cat then return true end
stealth = true
foundStealth = true
end
end
inCatForm = foundCat
prowlActive = foundCat and foundStealth
return prowlActive
end
-- Quick scan only for prowl (when we know we're in cat form)
local function HasProwlBuff()
for i = 0, 31 do
local texture = GetPlayerBuffTexture(i)
if not texture then break end
if strfind(texture, "Ability_Ambush") then
return true
end
end
return nil
@@ -956,7 +972,59 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function ()
end
-- setup page switch frame
local prowling = nil
local pageswitch = CreateFrame("Frame", "pfActionBarPageSwitch", UIParent)
pageswitch:RegisterEvent("PLAYER_AURAS_CHANGED")
pageswitch:RegisterEvent("PLAYER_ENTERING_WORLD")
pageswitch:RegisterEvent("UNIT_CASTEVENT")
pageswitch:SetScript("OnEvent", function()
if class ~= "DRUID" then return end
-- UNIT_CASTEVENT: detect Cat Form and Prowl cast instantly
-- Cat Form: 768 | Prowl: 5215 (R1), 6783 (R2), 9913 (R3)
if event == "UNIT_CASTEVENT" then
local guid, target, cEvent, spellId = arg1, arg2, arg3, arg4
local _, playerGuid = UnitExists("player")
if guid == playerGuid and cEvent == "CAST" then
if spellId == 5215 or spellId == 6783 or spellId == 9913 then
inCatForm = true
prowlActive = true
prowling = true
elseif spellId == 768 then
inCatForm = true
end
end
return
end
-- PLAYER_AURAS_CHANGED: smart scanning
if event == "PLAYER_AURAS_CHANGED" then
if prowlActive then
-- We were prowling, check if still prowling
if HasProwlBuff() then
prowling = true
else
-- Prowl ended
prowlActive = nil
prowling = nil
-- Also check if still in cat form
inCatForm = nil
for i = 0, 31 do
local texture = GetPlayerBuffTexture(i)
if not texture then break end
if strfind(texture, "Ability_Druid_CatForm") then
inCatForm = true
break
end
end
end
elseif not inCatForm then
-- Not in cat form, do a full scan (might have just shifted)
prowling = FullScan()
end
-- If inCatForm but not prowlActive, no scan needed (wait for UNIT_CASTEVENT)
end
end)
pageswitch:SetScript("OnUpdate", function()
-- switch actionbar page depending on meta key that is pressed
if C.bars.pagemastershift == "1" and IsShiftKeyDown() then
@@ -974,10 +1042,9 @@ pfUI:RegisterModule("actionbar", "vanilla:tbc", function ()
-- switch actionbar page if druid stealth is detected
if C.bars.druidstealth == "1" then
local stealth = IsCatStealth()
if stealth and _G.CURRENT_ACTIONBAR_PAGE == 1 then
if prowling and _G.CURRENT_ACTIONBAR_PAGE == 1 then
SwitchBar(prowl)
elseif not stealth and _G.CURRENT_ACTIONBAR_PAGE == 8 then
elseif not prowling and _G.CURRENT_ACTIONBAR_PAGE == 8 then
SwitchBar(default)
end
end
File diff suppressed because it is too large Load Diff
+60
View File
@@ -0,0 +1,60 @@
pfUI:RegisterModule("bgscore", "vanilla:tbc", function ()
local bgframe = WorldStateAlwaysUpFrame
if not bgframe then
bgframe = CreateFrame("Frame", "WorldStateAlwaysUpFrame", UIParent)
bgframe:SetWidth(200)
bgframe:SetHeight(25)
bgframe:SetPoint("TOP", UIParent, "TOP", 0, -100)
end
local mover = CreateFrame("Frame", "pfUIBGScoreMover", UIParent)
mover:SetWidth(220)
mover:SetHeight(30)
mover:SetPoint("TOP", UIParent, "TOP", 0, -100)
mover:SetFrameStrata("DIALOG")
mover:SetMovable(true)
mover:EnableMouse(true)
mover:RegisterForDrag("LeftButton")
mover:SetScript("OnDragStart", function() mover:StartMoving() end)
mover:SetScript("OnDragStop", function()
mover:StopMovingOrSizing()
local x = mover:GetLeft()
local y = mover:GetTop()
pfUI_config = pfUI_config or {}
pfUI_config.positions = pfUI_config.positions or {}
pfUI_config.positions["WorldStateAlwaysUpFrame"] = { x = x, y = y }
bgframe:ClearAllPoints()
bgframe:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x, y)
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccBG Score Frame|r position saved.")
end)
mover:Hide()
pfUI.api.CreateBackdrop(mover, nil, nil, .8)
-- Title label
local title = mover:CreateFontString(nil, "OVERLAY")
title:SetFont("Fonts\\FRIZQT__.TTF", 14, "OUTLINE")
title:SetText("Battleground Frames")
title:SetPoint("TOP", mover, "TOP", 0, -2)
-- BG score preview text
local bgscore = mover:CreateFontString(nil, "OVERLAY")
bgscore:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE")
bgscore:SetText("|cff3399ffAlliance: 123|r | |cffff4444Horde: 456|r")
bgscore:SetPoint("BOTTOM", mover, "BOTTOM", 0, 2)
mover.label = "BG Score"
pfUI.unlock.frames = pfUI.unlock.frames or {}
table.insert(pfUI.unlock.frames, mover)
local pos = pfUI_config and pfUI_config.positions and pfUI_config.positions["WorldStateAlwaysUpFrame"]
if pos then
bgframe:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", pos.x, pos.y)
mover:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", pos.x, pos.y)
end
local origShow = pfUI.unlock.Show
local origHide = pfUI.unlock.Hide
pfUI.unlock.Show = function(self) origShow(self); mover:Show() end
pfUI.unlock.Hide = function(self) origHide(self); mover:Hide(); bgframe:Show() end
end)
+2
View File
@@ -455,6 +455,8 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function ()
if C.chat.global.tabmouse == "1" then
pfUI.chat.mouseovertab = CreateFrame("Frame")
pfUI.chat.mouseovertab:SetScript("OnUpdate", function()
-- throttle to 0.1s
if ( this.tick or .1) > GetTime() then return else this.tick = GetTime() + .1 end
if pfUI.chat.hideLock then return end
+16 -6
View File
@@ -7,6 +7,9 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
energytick:RegisterEvent("UNIT_DISPLAYPOWER")
energytick:RegisterEvent("UNIT_ENERGY")
energytick:RegisterEvent("UNIT_MANA")
energytick:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF")
energytick:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS")
energytick:SetScript("OnEvent", function()
if UnitPowerType("player") == 0 and C.unitframes.player.manatick == "1" then
this.mode = "MANA"
@@ -18,6 +21,14 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
this:Hide()
end
-- Filter nur eigene Energy-Gewinne von Talents/Buffs
if event == "CHAT_MSG_SPELL_SELF_BUFF" or event == "CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS" then
if string.find(arg1, "You gain") and string.find(arg1, "Energy from") then
this.ignoreNextGain = true
end
return
end
if event == "PLAYER_ENTERING_WORLD" then
this.lastMana = UnitMana("player")
end
@@ -38,7 +49,10 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
this.badtick = diff
end
elseif this.mode == "ENERGY" and diff > 0 then
this.target = 2
if not this.ignoreNextGain then
this.target = 2
end
this.ignoreNextGain = false
end
this.lastMana = this.currentMana
end
@@ -69,14 +83,10 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
energytick.spark:SetWidth(C.unitframes.player.pheight + 5)
energytick.spark:SetBlendMode('ADD')
-- update spark size on player frame changes
local hookUpdateConfig = pfUI.uf.player.UpdateConfig
function pfUI.uf.player.UpdateConfig()
-- update spark sizes
energytick.spark:SetHeight(C.unitframes.player.pheight + 15)
energytick.spark:SetWidth(C.unitframes.player.pheight + 5)
-- run default unitframe update function
hookUpdateConfig(pfUI.uf.player)
end
end)
end)
+3
View File
@@ -321,6 +321,9 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
end)
nameplates:SetScript("OnUpdate", function()
-- throttle to 10 updates per second instead of every frame
if (this.tick or 0.1) > GetTime() then return else this.tick = GetTime() + 0.1 end
-- propagate events to all nameplates
if this.eventcache then
this.eventcache = nil
+3
View File
@@ -2,6 +2,9 @@ pfUI:RegisterModule("skin", "vanilla:tbc", function ()
-- align UIParent panels
pfUI.panelalign = CreateFrame("Frame", "pfUIParentPanelAlign", UIParent)
pfUI.panelalign:SetScript("OnUpdate", function()
-- throttle to 5 updates per second instead of every frame
if (this.tick or 0.2) > GetTime() then return else this.tick = GetTime() + 0.2 end
local left = UIParent.left
local center = UIParent.center
local rbpos, ropos
+4
View File
@@ -33,6 +33,10 @@ pfUI:RegisterModule("tooltip", "vanilla:tbc", function ()
tooltip.cursor:SetWidth(tonumber(C.tooltip.cursoroffset) * 2)
tooltip.cursor:SetHeight(tonumber(C.tooltip.cursoroffset) * 2)
tooltip.cursor:SetScript("OnUpdate", function()
-- throttle to 0.1s - cursor following doesn't need to be every frame
if (this.tick or 0) > GetTime() then return end
this.tick = GetTime() + 0.1
local scale = UIParent:GetScale()
local x, y = GetCursorPosition()
this:SetPoint("CENTER", UIParent, "BOTTOMLEFT", x/scale, y/scale)