feat: Enhance debuff tracking in Personal Auras module with AuraUtil support
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.git
|
.git
|
||||||
.gitea
|
.gitea
|
||||||
.vscode
|
.vscode
|
||||||
|
*.txt
|
||||||
*.zip
|
*.zip
|
||||||
@@ -151,6 +151,27 @@ local function GetPlayerTrackedDebuff(spellId)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if AuraUtil and type(AuraUtil.ForEachAura) == "function" then
|
||||||
|
local foundAura = nil
|
||||||
|
AuraUtil.ForEachAura("player", "HARMFUL", nil, function(auraData)
|
||||||
|
if type(auraData) == "table" and tonumber(auraData.spellId) == sid then
|
||||||
|
foundAura = auraData
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end, true)
|
||||||
|
if foundAura and IsAuraDataHarmful(foundAura) then
|
||||||
|
return {
|
||||||
|
spellId = sid,
|
||||||
|
name = tostring(foundAura.name or GetSpellName(sid) or ("Spell " .. tostring(sid))),
|
||||||
|
icon = foundAura.icon or foundAura.iconFileID or GetSpellIcon(sid),
|
||||||
|
applications = NormalizeAuraApplications(foundAura),
|
||||||
|
duration = tonumber(foundAura.duration) or 0,
|
||||||
|
expirationTime = tonumber(foundAura.expirationTime) or 0,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if C_UnitAuras and type(C_UnitAuras.GetPlayerAuraBySpellID) == "function" then
|
if C_UnitAuras and type(C_UnitAuras.GetPlayerAuraBySpellID) == "function" then
|
||||||
local auraData = C_UnitAuras.GetPlayerAuraBySpellID(sid)
|
local auraData = C_UnitAuras.GetPlayerAuraBySpellID(sid)
|
||||||
if auraData and IsAuraDataHarmful(auraData) then
|
if auraData and IsAuraDataHarmful(auraData) then
|
||||||
@@ -230,10 +251,7 @@ function PA:AddTrackedDebuff(spellId)
|
|||||||
if not sid or sid <= 0 then
|
if not sid or sid <= 0 then
|
||||||
return false, "invalid"
|
return false, "invalid"
|
||||||
end
|
end
|
||||||
local name = GetSpellName(sid)
|
local name = GetSpellName(sid) or ("Spell " .. tostring(sid))
|
||||||
if not name then
|
|
||||||
return false, "invalid"
|
|
||||||
end
|
|
||||||
local settings = self:GetSettings()
|
local settings = self:GetSettings()
|
||||||
settings.trackedDebuffs[sid] = true
|
settings.trackedDebuffs[sid] = true
|
||||||
self:Refresh()
|
self:Refresh()
|
||||||
|
|||||||
Reference in New Issue
Block a user