mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 21:40:49 +00:00
Merge pull request #65 from freohr/combat-rogue-energy-fix
Combat rogue energy fix
This commit is contained in:
+44
-16
@@ -1,5 +1,26 @@
|
|||||||
pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
|
local function getAdjustedTickTimer()
|
||||||
if not pfUI.uf or not pfUI.uf.player then return end
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
local energytick = CreateFrame("Frame", nil, pfUI.uf.player.power.bar)
|
local energytick = CreateFrame("Frame", nil, pfUI.uf.player.power.bar)
|
||||||
energytick:SetAllPoints(pfUI.uf.player.power.bar)
|
energytick:SetAllPoints(pfUI.uf.player.power.bar)
|
||||||
@@ -9,7 +30,7 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
|
|||||||
energytick:RegisterEvent("UNIT_MANA")
|
energytick:RegisterEvent("UNIT_MANA")
|
||||||
energytick:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF")
|
energytick:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF")
|
||||||
energytick:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS")
|
energytick:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS")
|
||||||
|
|
||||||
energytick:SetScript("OnEvent", function()
|
energytick:SetScript("OnEvent", function()
|
||||||
if UnitPowerType("player") == 0 and C.unitframes.player.manatick == "1" then
|
if UnitPowerType("player") == 0 and C.unitframes.player.manatick == "1" then
|
||||||
this.mode = "MANA"
|
this.mode = "MANA"
|
||||||
@@ -43,14 +64,14 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
|
|||||||
if this.mode == "MANA" and diff < 0 then
|
if this.mode == "MANA" and diff < 0 then
|
||||||
this.target = 5
|
this.target = 5
|
||||||
elseif this.mode == "MANA" and diff > 0 then
|
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
|
this.target = 2
|
||||||
else
|
else
|
||||||
this.badtick = diff
|
this.badtick = diff
|
||||||
end
|
end
|
||||||
elseif this.mode == "ENERGY" and diff > 0 then
|
elseif this.mode == "ENERGY" and diff >= 0 then
|
||||||
if not this.ignoreNextGain then
|
if not this.ignoreNextGain then
|
||||||
this.target = 2
|
this.target = getAdjustedTickTimer()
|
||||||
end
|
end
|
||||||
this.ignoreNextGain = false
|
this.ignoreNextGain = false
|
||||||
end
|
end
|
||||||
@@ -60,32 +81,39 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
|
|||||||
|
|
||||||
energytick:SetScript("OnUpdate", function()
|
energytick:SetScript("OnUpdate", function()
|
||||||
-- Throttle for performance
|
-- 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
|
this.tick = GetTime() + 0.020
|
||||||
|
|
||||||
if this.target then
|
if this.target then
|
||||||
this.start, this.max = GetTime(), this.target
|
this.start, this.max = GetTime(), this.target
|
||||||
this.target = nil
|
this.target = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if not this.start then return end
|
if not this.start then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
this.current = GetTime() - this.start
|
this.current = GetTime() - this.start
|
||||||
|
|
||||||
if this.current > this.max then
|
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
|
end
|
||||||
|
|
||||||
local pos = (C.unitframes.player.pwidth ~= "-1" and C.unitframes.player.pwidth or C.unitframes.player.width) * (this.current / this.max)
|
local pos = (C.unitframes.player.pwidth ~= "-1" and C.unitframes.player.pwidth or C.unitframes.player.width)
|
||||||
if not C.unitframes.player.pheight then return end
|
* (this.current / this.max)
|
||||||
this.spark:SetPoint("LEFT", pos-((C.unitframes.player.pheight+5)/2), 0)
|
if not C.unitframes.player.pheight then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
this.spark:SetPoint("LEFT", pos - ((C.unitframes.player.pheight + 5) / 2), 0)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
energytick.spark = energytick:CreateTexture(nil, 'OVERLAY')
|
energytick.spark = energytick:CreateTexture(nil, "OVERLAY")
|
||||||
energytick.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
|
energytick.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
|
||||||
energytick.spark:SetHeight(C.unitframes.player.pheight + 15)
|
energytick.spark:SetHeight(C.unitframes.player.pheight + 15)
|
||||||
energytick.spark:SetWidth(C.unitframes.player.pheight + 5)
|
energytick.spark:SetWidth(C.unitframes.player.pheight + 5)
|
||||||
energytick.spark:SetBlendMode('ADD')
|
energytick.spark:SetBlendMode("ADD")
|
||||||
|
|
||||||
local hookUpdateConfig = pfUI.uf.player.UpdateConfig
|
local hookUpdateConfig = pfUI.uf.player.UpdateConfig
|
||||||
function pfUI.uf.player.UpdateConfig()
|
function pfUI.uf.player.UpdateConfig()
|
||||||
@@ -93,4 +121,4 @@ pfUI:RegisterModule("energytick", "vanilla:tbc", function ()
|
|||||||
energytick.spark:SetWidth(C.unitframes.player.pheight + 5)
|
energytick.spark:SetWidth(C.unitframes.player.pheight + 5)
|
||||||
hookUpdateConfig(pfUI.uf.player)
|
hookUpdateConfig(pfUI.uf.player)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user