Thread Tools Display Modes
11/25/17, 10:27 AM   #1
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Ideas for an identifier-system for EVENT_COMBAT_EVENT

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!

Last edited by Letho : 11/25/17 at 10:34 AM.
  Reply With Quote
11/25/17, 02:39 PM   #2
Solinur
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 78
Can't you use unitids ?
  Reply With Quote
11/25/17, 03:54 PM   #3
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Well, I had an aproach using unitIds as keys when I started writing the addon and I found them to be extremely unreliable. Although I cannot tell anymore, why I came to that conclusion :/

I'll check it out again, I think.
  Reply With Quote
11/25/17, 04:01 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Never used the event so far so sorry if I understand something wrong.

Are you able to detemrine the name of the caster from the event?
What is "sourceName" giving you as the information?

Maybe a table key like this would help:
Lua Code:
  1. AuraMastery.activeCombatEffects[sourceName .. "|" .. targetName] = {sourceName, targetName, endTime}

Or you'll just iterate over the entries with

Lua Code:
  1. for index, buffData in iparis(AuraMastery.activeCombatEffects) do
  2. if buffData.sourceName == currentFadedOrRefreshedBuff.sourcename and buffData.targetName == currentFadedOrRefreshedBuff.targetName then
  3. --Faded or refreshed buff of DK n (sourceName)
  4. end
  5. end
  Reply With Quote
11/25/17, 04:04 PM   #5
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Originally Posted by decay2 View Post
Can't you use unitids ?
Ah well, I remember: It's the same like using unitName: For FADE-results (2250), origin unitId/unitName is not communicated.

@Baertram: Same problem with your idea Fade-events don't give any source info, it only contains info on the unit the effect faded from. If a target is debuffed by 3 DKs and only one debuff fades, using the target's unitId or unitName would match all 3 entries and not only the relevant one.


To clarify more:

Last edited by Letho : 11/25/17 at 04:09 PM.
  Reply With Quote
11/25/17, 04:14 PM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Seems as if there is no way then and the refresh part needs to be fixed so it shows the unitTag of the "refresher" too.
  Reply With Quote
11/25/17, 04:15 PM   #7
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Well, I am just thinking of ways to write a function that does sth. with timestamps or endtime or a combination of some fields, but I don't have a specific idea :/
  Reply With Quote
11/26/17, 06:15 AM   #8
Solinur
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 78
Endtime is your only chance here, I'd say.

Or listen to combat events that often fire for effects as well. that way you might get the unitId too. But crossreferencing those two events is going to be pretty messy.
  Reply With Quote
11/26/17, 07:07 AM   #9
Letho
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 238
Originally Posted by decay2 View Post
Endtime is your only chance here, I'd say.

Or listen to combat events that often fire for effects as well. that way you might get the unitId too. But crossreferencing those two events is going to be pretty messy.
Well, I have thought over all ideas and it looks like there is really no proper way to do what I want to do, unless ZOS provides a possibility to read sourceInfo out of fade-combatevents. I opened a request for it,. Thx for all your ideas!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Ideas for an identifier-system for EVENT_COMBAT_EVENT

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off