Added: Details:FindBuffCastedBy(unitId, buffSpellId, casterName), return up to 19 parameters

This commit is contained in:
Tercio Jose
2023-07-26 20:48:46 -03:00
parent 98250a2cf9
commit f6931c2d8b
2 changed files with 99 additions and 2 deletions
+22 -2
View File
@@ -36,15 +36,15 @@
local predicateFunc = function(spellIdToFind, casterName, _, name, icon, applications, dispelName, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, applications)
--print(name, texture, count, debuffType, duration, expirationTime, spellID)
--print("sourceUnit", sourceUnit)
if (spellIdToFind == spellId and UnitExists(sourceUnit)) then
local spellname = GetSpellInfo(spellId)
if (casterName == GetUnitName(sourceUnit, true)) then
return true
end
end
end
---find the duration of a buff by passing the spellId and the caster name
---find the duration of a debuff by passing the spellId and the caster name
---@param unitId unit
---@param spellId spellid
---@param casterName actorname
@@ -57,6 +57,26 @@
end
end
---find the duration of a buff by passing the spellId and the caster name
---@param unitId unit
---@param spellId spellid
---@param casterName actorname
---@return auraduration|nil auraDuration
---@return number|nil expirationTime
function Details:FindBuffDuration(unitId, spellId, casterName)
local name, texture, count, debuffType, duration, expirationTime = AuraUtil.FindAura(predicateFunc, unitId, "HELPFUL", spellId, casterName)
if (name) then
return duration, expirationTime
end
end
function Details:FindBuffCastedBy(unitId, buffSpellId, casterName)
local auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5 = AuraUtil.FindAura(predicateFunc, unitId, "HELPFUL", buffSpellId, casterName)
if (auraName) then
return auraName, texture, count, auraType, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, v1, v2, v3, v4, v5
end
end
---return the unitId by passing a unit serial (guid)
---@param unitSerial serial
---@return unit|nil unitId