View Single Post
03-24-22, 08:34 AM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Here's a simple example of what I've come up with. It'll pop up with big text in the center of your screen whenever your healer's mana goes below 25%.

Copy/Paste this into addon.bool.no and it'll make it into an addon for you.

Lua Code:
  1. local WarningText=UIParent:CreateFontString(nil,"OVERLAY","BossEmoteNormalHuge");
  2. WarningText:SetPoint("CENTER",0,128);
  3. WarningText:SetTextColor(ColorMixin.GetRGB(PowerBarColor.MANA));
  4.  
  5. local EventFrame=CreateFrame("Frame");
  6. EventFrame:RegisterEvent("UNIT_POWER_UPDATE");
  7. EventFrame:RegisterEvent("UNIT_POWER_FREQUENT");
  8.  
  9. local Enum_PowerType_Mana=Enum.PowerType.Mana;
  10. EventFrame:SetScript("OnEvent",function(self,event,unit,powertype)
  11.     if powertype=="MANA" and UnitInParty(unit) and UnitGroupRolesAssigned(unit)=="HEALER" then
  12.         local percent=UnitPower(unit,Enum_PowerType_Mana)*100/UnitPowerMax(unit,Enum_PowerType_Mana);
  13.         if percent<=25 then
  14.             WarningText:SetFormattedText("%s %s %.0f%%",UnitName(unit),MANA,percent);
  15.         else WarningText:SetText(nil); end
  16.     end
  17. end);
__________________
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