mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-07 06:00:00 +00:00
dedup shot-haste loops behind libcast.ApplyShotHaste
The three customcast handlers (Aimed Shot, Multi-Shot, Steady Shot) each iterated 1..32 UnitBuff slots checking the same four icon paths for haste-providing buffs. Lifted into libcast.ApplyShotHaste which iterates the populated auras once via C_UnitAuras.GetUnitAuras and reads from a single SHOT_HASTE lookup table. Three loop copies collapse to one helper. Kept texture-keyed matching (rather than spellID) because the Naxx trinket and Quick Shots procs have spell-ID variants across server flavors but stable icons.
This commit is contained in:
+1
-18
@@ -331,24 +331,7 @@ pfUI:RegisterModule("turtle-wow", "vanilla", function ()
|
||||
libcast.customcast[strlower(trueshot)] = function(begin, duration)
|
||||
if begin then
|
||||
-- cast time is 1sec, however it takes 1.4sec to fire in average
|
||||
local duration = duration or 1400
|
||||
|
||||
for i=1,32 do
|
||||
if UnitBuff("player", i) == "Interface\\Icons\\Racial_Troll_Berserk" then
|
||||
local berserk = 0.3
|
||||
if((UnitHealth("player")/UnitHealthMax("player")) >= 0.40) then
|
||||
berserk = (1.30 - (UnitHealth("player") / UnitHealthMax("player"))) / 3
|
||||
end
|
||||
|
||||
duration = duration / (1 + berserk)
|
||||
elseif UnitBuff("player", i) == "Interface\\Icons\\Ability_Hunter_RunningShot" then
|
||||
duration = duration / 1.4
|
||||
elseif UnitBuff("player", i) == "Interface\\Icons\\Ability_Warrior_InnerRage" then
|
||||
duration = duration / 1.3
|
||||
elseif UnitBuff("player", i) == "Interface\\Icons\\Inv_Trinket_Naxxramas04" then
|
||||
duration = duration / 1.2
|
||||
end
|
||||
end
|
||||
local duration = libcast.ApplyShotHaste(duration or 1400)
|
||||
|
||||
local _,_, lag = GetNetStats()
|
||||
local start = GetTime() + lag/1000
|
||||
|
||||
Reference in New Issue
Block a user