mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-26 09:26:02 +00:00
libdebuff: add method to iterate own debuffs
This commit is contained in:
@@ -286,5 +286,26 @@ function libdebuff:UnitDebuff(unit, id)
|
||||
return effect, rank, texture, stacks, dtype, duration, timeleft, caster
|
||||
end
|
||||
|
||||
local cache = {}
|
||||
function libdebuff:UnitOwnDebuff(unit, id)
|
||||
-- clean cache
|
||||
for k, v in pairs(cache) do cache[k] = nil end
|
||||
|
||||
-- detect own debuffs
|
||||
local count = 1
|
||||
for i=1,16 do
|
||||
local effect, rank, texture, stacks, dtype, duration, timeleft, caster = libdebuff:UnitDebuff(unit, i)
|
||||
if effect and not cache[effect] and caster and caster == "player" then
|
||||
cache[effect] = true
|
||||
|
||||
if count == id then
|
||||
return effect, rank, texture, stacks, dtype, duration, timeleft, caster
|
||||
else
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- add libdebuff to pfUI API
|
||||
pfUI.api.libdebuff = libdebuff
|
||||
|
||||
Reference in New Issue
Block a user