Thread: AggroDisplay
View Single Post
10-21-10, 06:40 AM   #4
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
I'll give a drycode try (meaning I didn't try it ingame). :P

aggrodisplay.xml
xml Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
  2. <Script file="aggrodisplay.lua" />
  3.  
  4.     <Frame name="aggroFrame" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
  5.         <Size x="76" y="30" />
  6.         <Anchors>
  7.             <Anchor point="TOPLEFT">
  8.             </Anchor>
  9.         </Anchors>
  10.         <Scripts>
  11.             <OnMouseDown>self:StartMoving();</OnMouseDown>
  12.             <OnMouseUp>self:StopMovingOrSizing();</OnMouseUp>
  13.             <OnLoad>aggroFrame_OnLoad(self);</OnLoad>
  14.             <OnEvent>aggroFrame_OnEvent(self, event, ...);</OnEvent>
  15.         </Scripts>
  16.  
  17.         <Layers>
  18.             <Layer>
  19.                 <FontString name="aggro" inherits="GameFontNormalSmall" font="Fonts\ARIALN.TTF" text="*" justifyH="RIGHT">
  20.                     <FontHeight>
  21.                         <AbsValue val="26"/> -- text size
  22.                     </FontHeight>
  23.                     <Size x="76" y="30" />
  24.                 </FontString>
  25.                                    
  26.             </Layer>
  27.         </Layers>
  28.     </Frame>
  29.  
  30. </Ui>

aggrodisplay.lua
lua Code:
  1. function aggroFrame_OnEvent(self, event, ...)
  2.     local aggro_TRUE = "Aggro !";
  3.     local aggro_FALSE = "*";
  4.  
  5.     if (event == "PLAYER_REGEN_DISABLED") then
  6.         aggro_TRUE = "Aggro !";
  7.  
  8.         aggro:SetText(aggro_TRUE);
  9.     end
  10.  
  11.     if (event == "PLAYER_REGEN_ENABLED") then
  12.         aggro_FALSE = "*";
  13.    
  14.         aggro:SetText(aggro_FALSE);
  15.     end
  16.  
  17. end
  18.  
  19. function aggroFrame_OnLoad(self)
  20.     self:RegisterEvent("PLAYER_REGEN_DISABLED");
  21.     self:RegisterEvent("PLAYER_REGEN_ENABLED")
  22.     DEFAULT_CHAT_FRAME:AddMessage("Aggro Display loaded -OK-");
  23. end
__________________
Oh, the simulated horror!
  Reply With Quote