Thread Tools Display Modes
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
01/28/22, 05:42 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
I think there is no existing vanilla mapping between group unitTags and their names/rawNames. Some events at groups may fire both, not sure.
At best have a look at the ESOUI source code -> group to see what vanilla ZOs code does:
https://github.com/esoui/esoui/tree/...i/ingame/group

First question:
"OnUpdate"? Why not filling and removing entries in your group dict table at the event_group_joined / left callbacks as the group members join and leave your group? They do not need to be re-added or removed each n milliseconds so an OnUpdate is not needed afai understand.
You should be easily able to loop over all grouped players and update your dictionary as these events trigger.

Hints:
I understand that you use the combat event to compare the group's unitTag with the event's name or rawName (or vice versa)?
Should work with your method then, yes. In your OnUpdate, which should only be active within combat or certain cases then to make it performant, you can compare your dictionary of grouped names with the combat event's unitTag.

You should definately add event filters to that combat events then, e.g. the REGISTER_FILTER_COMBAT_RESULT, the group prefix REGISTER_FILTER_UNIT_TAG_PREFIX "group", and if you know the abilityId of that casted buff also use REGISTER_FILTER_ABILITY_ID
https://wiki.esoui.com/AddFilterForEvent


And you should define local pointer variables to your tables to speed up the access to them, e.g.
Else the code will "each time" search _G table for DynamicRO, then it will search the table DynamicRO for GroupDict and so on.
If you use a local pointing to a table, updates on that local will update the table properly (add/remove).

Lua Code:
  1. local groupMemberName = GetRawUnitName("group" .. i)
  2. local groupDict = DynamicRO.GroupDict
  3. groupDict ["group" .. i] = groupMemberName
  4. groupDict [groupMemberName] = "group" .. i

Last edited by Baertram : 01/28/22 at 05:47 PM.
  Reply With Quote
02/02/22, 05:04 AM   #3
zelenin
AddOn Author - Click to view addons
Join Date: Nov 2018
Posts: 7
you can use https://www.esoui.com/downloads/info...itTracker.html
  Reply With Quote

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

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