Originally Posted by ceylina
One other thing and well first off get better but make sure you don't pull a pitbull unit frame and use GROUP_ROSTER_UPDATE for things like afk timers.
If you call that event it's perfect for dynamically updating raid member group numbers when members change groups and is the most efficient call I've found. They used it in their lua text module which made calling it anywhere else or using it break timers, when leaving a raid group or converting back to party, that they made for afk, dead, etc.
Just wanted to point that out but I can't remember if you have it in raid frames or not. Having the ability to sort raids by role and having a group number next to each raid member is extremely valuable anymore.
Would also love a decent built in pattern matching or text shortening routine. So many people want to be able to have the name of a super long npc shortened in a smart way. So Gargantuan Oversized Guardian would be shortened to fit the confines of the frame without some non dynamic gsub shenanigans.
Breaking a name into a table then using some logic to trim it based on how many words in a name or the length of a frame is much better than a super long logic statement with static gsub pattern matching.
Would also love to test this out and give feedback (I can be pretty thorough) as I have a soft spot for perl like frames even if I no longer use them.
|
I don't use roster update for anything but to create a sub event called GROUP_TYPE_CHANGED to update the group leader. Also currently testing if the party/raid needs an update or not when the group type changes from party to partyinstance or from raid to raidinstance (Like zoning into a battleground/arena/scenario/LFGinstance).
For everything else i use attribute based changes, and only update the changed frames like this: (Could add the group number changes to this funciton and it would be still very light.)
Lua Code:
frame:SetScript("OnAttributeChanged", function(self, name, value)
--print(self:GetName(), name, value)
if name == "unit" then
if value then
if self.unit ~= value or self.guid ~= UnitGUID(value) then
--[[if self.unit ~= value then
print("UNIT", self.unit, value)
elseif self.guid ~= UnitGUID(value) then
print("GUID", value, self.guid, UnitGUID(value), UnitName(value))
end]]
Raid:UpdateDisplay(self)
Raid:RegisterUnitEvents(self, value)
end
else
self.events:UnregisterAllEvents()
--print(self:GetName(), value)
self.unit = nil
self.guid = nil
end
end
end)
Currently i use individual event handlers for every frame, and i update/kill the events on the fly. I found this method to be pretty solid even in very big fights. However it's eats more resources when the group changes a lot.
I havn't decided about the name shortening yet, but it's a valid issue. I guess you want something like this? Training Dummy -> T. Dummy