mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-26 14:00:48 +00:00
libdebuff: align and optimize spell post-hooks
This commit is contained in:
+15
-18
@@ -75,15 +75,13 @@ function libdebuff:UpdateUnits()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function libdebuff:AddPending(unit, unitlevel, effect, duration)
|
function libdebuff:AddPending(unit, unitlevel, effect, duration)
|
||||||
if not unit then return end
|
if not unit or duration <= 0 then return end
|
||||||
if not L["debuffs"][effect] then return end
|
if not L["debuffs"][effect] or libdebuff.pending[3] == effect then return end
|
||||||
|
|
||||||
if duration > 0 and libdebuff.pending[3] ~= effect then
|
libdebuff.pending[1] = unit
|
||||||
libdebuff.pending[1] = unit
|
libdebuff.pending[2] = unitlevel or 0
|
||||||
libdebuff.pending[2] = unitlevel or 0
|
libdebuff.pending[3] = effect
|
||||||
libdebuff.pending[3] = effect
|
libdebuff.pending[4] = duration -- or libdebuff:GetDuration(effect)
|
||||||
libdebuff.pending[4] = duration or libdebuff:GetDuration(effect)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function libdebuff:RemovePending()
|
function libdebuff:RemovePending()
|
||||||
@@ -218,24 +216,23 @@ end)
|
|||||||
|
|
||||||
-- Gather Data by User Actions
|
-- Gather Data by User Actions
|
||||||
hooksecurefunc("CastSpell", function(id, bookType)
|
hooksecurefunc("CastSpell", function(id, bookType)
|
||||||
local effect = GetSpellName(id, bookType)
|
local rawEffect, rank = libspell.GetSpellInfo(id, bookType)
|
||||||
local _, rank = libspell.GetSpellInfo(id, bookType)
|
local duration = libdebuff:GetDuration(rawEffect, rank)
|
||||||
local duration = libdebuff:GetDuration(effect, rank)
|
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration)
|
||||||
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration)
|
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
hooksecurefunc("CastSpellByName", function(effect, target)
|
hooksecurefunc("CastSpellByName", function(effect, target)
|
||||||
local _, rank = libspell.GetSpellInfo(effect)
|
local rawEffect, rank = libspell.GetSpellInfo(effect)
|
||||||
local duration = libdebuff:GetDuration(effect, rank)
|
local duration = libdebuff:GetDuration(rawEffect, rank)
|
||||||
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration)
|
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration)
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
hooksecurefunc("UseAction", function(slot, target, button)
|
hooksecurefunc("UseAction", function(slot, target, button)
|
||||||
if GetActionText(slot) or not IsCurrentAction(slot) then return end
|
if GetActionText(slot) or not IsCurrentAction(slot) then return end
|
||||||
scanner:SetAction(slot)
|
scanner:SetAction(slot)
|
||||||
local effect, rank = scanner:Line(1)
|
local rawEffect, rank = scanner:Line(1)
|
||||||
local duration = libdebuff:GetDuration(effect, rank)
|
local duration = libdebuff:GetDuration(rawEffect, rank)
|
||||||
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration)
|
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration)
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
function libdebuff:UnitDebuff(unit, id)
|
function libdebuff:UnitDebuff(unit, id)
|
||||||
|
|||||||
Reference in New Issue
Block a user