Thread Tools Display Modes
Prev Previous Post   Next Post Next
01/28/22, 04:05 PM   #1
helixanon
 
helixanon's Avatar
AddOn Author - Click to view addons
Join Date: May 2021
Posts: 1
Translating Combat Event to group member's unitTag

Hello.

I'm writing my own Roaring Opportunist tracker that checks the presence of RO Cooldown ability on the group members dynamically.
However, this is not a "buff" so it cannot be pulled from
Code:
GetUnitBuffInfo("group" .. i, j)
Thus, I came up with a workaround:

First, in OnUpdate function I go through every group member and fill my GroupDict dictionary like this:

Code:
local groupMemberName = GetRawUnitName("group" .. i)
DynamicRO.GroupDict["group" .. i] = groupMemberName
DynamicRO.GroupDict[groupMemberName] = "group" .. i
So I can get player's name by their unitTag (e.g. "group7") and their unitTag by their name.

Why I am doing this is because I use EVENT_COMBAT_EVENT's targetName. So when I get the event, I fill my event buff tracker dictionary:

Code:
if DynamicRO.GroupDict[targetName] ~= nil then
    DynamicRO.EventBuffTracker[DynamicRO.GroupDict[targetName]] = {}
    DynamicRO.EventBuffTracker[DynamicRO.GroupDict[targetName]][abilityId] = {}
    DynamicRO.EventBuffTracker[DynamicRO.GroupDict[targetName]][abilityId].EndsAt = GetGameTimeMilliseconds() + 22000
end
I'm using a whole new {} for each ability because I may want to expand it to support other abilities not tracked by GetUnitBuffInfo and other logical components in the future.

Finally, back in the group loop, if I see that the unitTag's corresponding EventBuffTracker RO buff is nil or less than the current time, I can conclude that RO needs to be recast.

...

Now, is there a better way for this? I kinda don't like this workaround with using 2 external dictionaries. I also found it to be unstable at times and thus I had to add
Code:
DynamicRO.GroupDict[targetName] ~= nil
although I've no idea when it can be nil.

I hope I was clear enough with my explanation and would appreciate some help.

Cheers!

Last edited by helixanon : 01/28/22 at 04:26 PM.
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » Translating Combat Event to group member's unitTag


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