View Single Post
04-21-22, 01:38 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
You need to either remove the function enclosures or call them. I suggest removing them since the functions hooked already exist on load.
Lua Code:
  1. -- Включение цвета классов на полосах здоровья
  2. hooksecurefunc("HealthBar_OnValueChanged",function(self)
  3.     local unit=self.unit;
  4.     if UnitIsPlayer(unit) and UnitIsConnected(unit) then
  5.         local _,class=UnitClass(unit);
  6.         if class then
  7.             self:SetStatusBarColor(ColorMixin.GetRGB(CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]));
  8.         end
  9.     end
  10. end);
  11.  
  12. -- Изменяет бэкграунд на фреймах таргета и фокуса
  13. hooksecurefunc("TargetFrame_CheckFaction",function(self)
  14.     self.nameBackground:SetVertexColor(0.0, 0.0, 0.0, 0.01);
  15. end);

PS: I cleaned up the code some. Hooking UnitFrameHealthBar_Update() was unnecessary as it ended up triggering HealthBar_OnValueChanged() anyway. Also while RAID_CLASS_COLORS inherits ColorMixin, CUSTOM_CLASS_COLORS isn't so clearly defined as it's not a Blizzard variable. This is why :GetRGB() is called from ColorMixin instead of the color tables. Note '.' was used instead of ':' so the color table could be given to the function as a reference instead of it trying to take ColorMixin as self.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote