Thread: Z-Perl 2
View Single Post
02-23-16, 01:00 PM   #22
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by ceylina View Post
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:
  1. frame:SetScript("OnAttributeChanged", function(self, name, value)
  2.     --print(self:GetName(), name, value)
  3.     if name == "unit" then
  4.         if value then
  5.             if self.unit ~= value or self.guid ~= UnitGUID(value) then
  6.                 --[[if self.unit ~= value then
  7.                     print("UNIT", self.unit, value)
  8.                 elseif self.guid ~= UnitGUID(value) then
  9.                     print("GUID", value, self.guid, UnitGUID(value), UnitName(value))
  10.                 end]]
  11.  
  12.                 Raid:UpdateDisplay(self)
  13.                 Raid:RegisterUnitEvents(self, value)
  14.             end
  15.         else
  16.             self.events:UnregisterAllEvents()
  17.             --print(self:GetName(), value)
  18.             self.unit = nil
  19.             self.guid = nil
  20.         end
  21.     end
  22. 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
  Reply With Quote