View Single Post
03-24-18, 01:04 AM   #5
Ethly
A Fallenroot Satyr
Join Date: Mar 2018
Posts: 23
Thanks. Currently I'm making specifically raid frames (or party frames if I'm in party) based on SecureGroupHeaderTemplate and they seem to work with OnAttributeChanged way. If someone joins, each unit frame updates with new unit, if someone leaves, last frame updates with null unit, etc. At least from my limited testing with some people joining and leaving. Here's my snippet:
Lua Code:
  1. function MyFrames_UnitTemplate_OnAttributeChanged(self, attributeName)
  2.   if attributeName == "unit" then
  3.     local unit = self:GetAttribute("unit");
  4.     if unit == nil then
  5.       self:UnregisterAllEvents();
  6.     else
  7.       self.name:SetText(UnitName(unit));
  8.       updateBarTextures(self, unit);
  9.       self:RegisterUnitEvent("UNIT_ABSORB_AMOUNT_CHANGED", unit);
  10.       self:RegisterUnitEvent("UNIT_HEAL_ABSORB_AMOUNT_CHANGED", unit);
  11.       self:RegisterUnitEvent("UNIT_HEAL_PREDICTION", unit);
  12.       self:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", unit);
  13.       self:RegisterUnitEvent("UNIT_MAXHEALTH", unit);
  14.     end
  15.   end
  16. end

PS UNIT_HEALTH_FREQUENT is so weird. Combat log events arriving 200-300 ms earlier than UNIT_HEALTH_FREQUENT so parsing combat log would make unit frames a bit more responsive, but it's quite a headache, why WoW implemented this way I just don't understand, it's not even about throttling, a single npc swinging me every few seconds still shows the same lag between combat log event and UNIT_HEALTH_FREQUENT event. And with heals this problem is not present, I'm receiving UNIT_HEALTH_FREQUENT exactly at the same time as heal combat log event.

Last edited by Ethly : 03-24-18 at 01:08 AM.
  Reply With Quote