ESOUI

ESOUI (http://www.esoui.com/forums/index.php)
-   Lua/XML Help (http://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Ideas for an identifier-system for EVENT_COMBAT_EVENT (http://www.esoui.com/forums/showthread.php?t=7485)

Letho 11/25/17 10:27 AM

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!

decay2 11/25/17 02:39 PM

Can't you use unitids ?

Letho 11/25/17 03:54 PM

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.

Baertram 11/25/17 04:01 PM

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

Letho 11/25/17 04:04 PM

Quote:

Originally Posted by decay2 (Post 33243)
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:

Baertram 11/25/17 04:14 PM

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.

Letho 11/25/17 04:15 PM

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 :/

decay2 11/26/17 06:15 AM

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.

Letho 11/26/17 07:07 AM

Quote:

Originally Posted by decay2 (Post 33259)
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!


All times are GMT -6. The time now is 12:10 AM.

vBulletin © 2018, Jelsoft Enterprises Ltd
© 2014 - 2017 MMOUI