From de980b129e048d8ead30a7bd3ee9087b53126486 Mon Sep 17 00:00:00 2001 From: Stephen Faure Date: Sun, 22 Feb 2026 15:50:06 +0100 Subject: [PATCH 1/3] Add energy tick reduction calculation for Blade Rush Rogue --- modules/energytick.lua | 51 ++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/modules/energytick.lua b/modules/energytick.lua index 825a4257..a1273629 100644 --- a/modules/energytick.lua +++ b/modules/energytick.lua @@ -1,5 +1,7 @@ -pfUI:RegisterModule("energytick", "vanilla:tbc", function () - if not pfUI.uf or not pfUI.uf.player then return end +pfUI:RegisterModule("energytick", "vanilla:tbc", function() + if not pfUI.uf or not pfUI.uf.player then + return + end local energytick = CreateFrame("Frame", nil, pfUI.uf.player.power.bar) energytick:SetAllPoints(pfUI.uf.player.power.bar) @@ -9,7 +11,7 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function () 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" @@ -40,17 +42,31 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function () diff = this.currentMana - this.lastMana end + -- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent) + local adjustedEnergyTick = 2 + if UnitClass("player") == "Rogue" then + local _, _, _, _, currRank = GetTalentInfo(2, 16) + local bladeRushRank = currRank or 0 + + if bladeRushRank > 0 then + local agility = UnitStat("player", 2) -- 2 is agility stat index + local reductionPerAgi = 0.0006 * bladeRushRank -- 0.0006 for rank 1, 0.0012 for rank 2 + local totalReduction = agility * reductionPerAgi + adjustedEnergyTick = adjustedEnergyTick - totalReduction + end + end + if this.mode == "MANA" and diff < 0 then this.target = 5 elseif this.mode == "MANA" and diff > 0 then - if this.max ~= 5 and diff > (this.badtick and this.badtick*1.2 or 5) then + if this.max ~= 5 and diff > (this.badtick and this.badtick * 1.2 or 5) then this.target = 2 else this.badtick = diff end elseif this.mode == "ENERGY" and diff > 0 then if not this.ignoreNextGain then - this.target = 2 + this.target = adjustedEnergyTick end this.ignoreNextGain = false end @@ -60,15 +76,19 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function () energytick:SetScript("OnUpdate", function() -- Throttle for performance - if (this.tick or 0) > GetTime() then return end + if (this.tick or 0) > GetTime() then + return + end this.tick = GetTime() + 0.020 - + if this.target then this.start, this.max = GetTime(), this.target this.target = nil end - if not this.start then return end + if not this.start then + return + end this.current = GetTime() - this.start @@ -76,16 +96,19 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function () this.start, this.max, this.current = GetTime(), 2, 0 end - local pos = (C.unitframes.player.pwidth ~= "-1" and C.unitframes.player.pwidth or C.unitframes.player.width) * (this.current / this.max) - if not C.unitframes.player.pheight then return end - this.spark:SetPoint("LEFT", pos-((C.unitframes.player.pheight+5)/2), 0) + local pos = (C.unitframes.player.pwidth ~= "-1" and C.unitframes.player.pwidth or C.unitframes.player.width) + * (this.current / this.max) + if not C.unitframes.player.pheight then + return + end + this.spark:SetPoint("LEFT", pos - ((C.unitframes.player.pheight + 5) / 2), 0) end) - energytick.spark = energytick:CreateTexture(nil, 'OVERLAY') + energytick.spark = energytick:CreateTexture(nil, "OVERLAY") energytick.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark") energytick.spark:SetHeight(C.unitframes.player.pheight + 15) energytick.spark:SetWidth(C.unitframes.player.pheight + 5) - energytick.spark:SetBlendMode('ADD') + energytick.spark:SetBlendMode("ADD") local hookUpdateConfig = pfUI.uf.player.UpdateConfig function pfUI.uf.player.UpdateConfig() @@ -93,4 +116,4 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function () energytick.spark:SetWidth(C.unitframes.player.pheight + 5) hookUpdateConfig(pfUI.uf.player) end -end) \ No newline at end of file +end) From b36bf04e621fd5731ee35e16685b1a1044c996f5 Mon Sep 17 00:00:00 2001 From: Stephen Faure Date: Sun, 22 Feb 2026 16:35:03 +0100 Subject: [PATCH 2/3] Apply energy timer reduction on energy event and on update --- modules/energytick.lua | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/modules/energytick.lua b/modules/energytick.lua index a1273629..c86ec9e8 100644 --- a/modules/energytick.lua +++ b/modules/energytick.lua @@ -1,3 +1,20 @@ +local function getAdjustedTickTimer() + local adjustedEnergyTick = 2 + if UnitClass("player") == "Rogue" then + local _, _, _, _, currRank = GetTalentInfo(2, 16) + local bladeRushRank = currRank or 0 + + if bladeRushRank > 0 then + local agility = UnitStat("player", 2) -- 2 is agility stat index + local reductionPerAgi = 0.0006 * bladeRushRank -- 0.0006 for rank 1, 0.0012 for rank 2 + local totalReduction = agility * reductionPerAgi + adjustedEnergyTick = adjustedEnergyTick - totalReduction + end + end + + return adjustedEnergyTick +end + pfUI:RegisterModule("energytick", "vanilla:tbc", function() if not pfUI.uf or not pfUI.uf.player then return @@ -43,18 +60,6 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function() end -- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent) - local adjustedEnergyTick = 2 - if UnitClass("player") == "Rogue" then - local _, _, _, _, currRank = GetTalentInfo(2, 16) - local bladeRushRank = currRank or 0 - - if bladeRushRank > 0 then - local agility = UnitStat("player", 2) -- 2 is agility stat index - local reductionPerAgi = 0.0006 * bladeRushRank -- 0.0006 for rank 1, 0.0012 for rank 2 - local totalReduction = agility * reductionPerAgi - adjustedEnergyTick = adjustedEnergyTick - totalReduction - end - end if this.mode == "MANA" and diff < 0 then this.target = 5 @@ -64,9 +69,9 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function() else this.badtick = diff end - elseif this.mode == "ENERGY" and diff > 0 then + elseif this.mode == "ENERGY" and diff >= 0 then if not this.ignoreNextGain then - this.target = adjustedEnergyTick + this.target = getAdjustedTickTimer() end this.ignoreNextGain = false end @@ -93,7 +98,7 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function() this.current = GetTime() - this.start if this.current > this.max then - this.start, this.max, this.current = GetTime(), 2, 0 + this.start, this.max, this.current = GetTime(), getAdjustedTickTimer(), 0 end local pos = (C.unitframes.player.pwidth ~= "-1" and C.unitframes.player.pwidth or C.unitframes.player.width) From 785a8bd3c3ca373a3727609b81d3181f1c89b821 Mon Sep 17 00:00:00 2001 From: Stephen Faure Date: Sun, 22 Feb 2026 16:43:16 +0100 Subject: [PATCH 3/3] Clean up the file before PR --- modules/energytick.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/energytick.lua b/modules/energytick.lua index c86ec9e8..72c19703 100644 --- a/modules/energytick.lua +++ b/modules/energytick.lua @@ -1,5 +1,7 @@ local function getAdjustedTickTimer() local adjustedEnergyTick = 2 + + -- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent) if UnitClass("player") == "Rogue" then local _, _, _, _, currRank = GetTalentInfo(2, 16) local bladeRushRank = currRank or 0 @@ -59,8 +61,6 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function() diff = this.currentMana - this.lastMana end - -- Check rogue talents and compute energy tick timing reduction for Combat spec (1.18.0 Blade Rush Talent) - if this.mode == "MANA" and diff < 0 then this.target = 5 elseif this.mode == "MANA" and diff > 0 then