Hey guys, I'm in dire need of your think-tank-abilities. This is the code, that I have:
Code:
function AuraMastery.OnCombatEvent(eventCode,result,isError,abilityName,abilityGraphic,abilityActionSlotType,sourceName,sourceType,targetName,targetType,hitValue,powerType,damageType,combatEventLog,sourceUnitId,targetUnitId,abilityId)
local playerName = GetUnitName("player")
local sourceName = zo_strformat("<<1>>", sourceName)
local targetName = zo_strformat("<<1>>", targetName)
local endTime = GetGameTimeSeconds()+(GetAbilityDuration(abilityId)/1000)
-- ability is being tracked
if (AuraMastery.trackedEvents['EVENT_COMBAT_EVENT'].abilityIds[abilityId]) then
-- effect gained
if (2245 == result) then
if nil == AuraMastery.activeCombatEffects[abilityId] then
AuraMastery.activeCombatEffects[abilityId] = {}; end
table.insert(AuraMastery.activeCombatEffects[abilityId], {['sourceName'] = sourceName, ['targetName'] = targetName, ['endTime'] = endTime});
-- effect faded
elseif (2250 == result) then
local effects = AuraMastery.activeCombatEffects[abilityId]
if nil ~= effects then
for i=#effects, 1, -1 do
-- statement that identifies the relevant entry
end
end
end
end
Let's take this as an example: 3 DKs debuffed a target with their dots. The appropriate table would look like this:
Code:
AuraMastery.activeCombatEffects = {}
AuraMastery.activeCombatEffects[1] = {sourceName, targetName, endTime} -- Data for DK1's dot
AuraMastery.activeCombatEffects[2] = {sourceName, targetName, endTime} -- Data for DK2's dot
AuraMastery.activeCombatEffects[3] = {sourceName, targetName, endTime} -- Data for DK3's dot
As EVENT_COMBAT_EVENT does not give any effectSlot information, there is no way to identify the appropriate effect that has faded :/ using the timestamp does not really work, as a debuff will not only fade if it runs out, but also if it is prematurely refreshed by it's caster. For data processing reasons AuraMastery.activeCombatEffects must remain an array, it will be walked through by a for-loop later.
Some ideas would be really nice!