WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   AggroDisplay (https://www.wowinterface.com/forums/showthread.php?t=36061)

Korby 10-21-10 02:30 AM

AggroDisplay
 
Long ago when I started playing WoW, one of the first addons I downloaded from this site was named AggroDisplay. That addon has worked flawlessly up until 4.01 hit.

I am not a programmer, though I do understand enough to see how things work, and what this addon does is very simple. If PLAYER_REGEN_ENABLED is true (essentially meaning that the player is not in combat and is regening health and mana at a normal rate), then the addon just displays an * on the screen. However, if you happen to tick something off and PLAYER_REGEN_DISABLED is true, then the message "Aggro!" is shown on screen. Nothing more, nothing less, short and simple.

Could somebody please take a look at it, the lua is only 25 lines long, and see if you can get it working for 4.01? I would really appreciate it.

moggan 10-21-10 02:56 AM

It's a rar archive which means I can't even open it :/

You might consider bar4threat or Simple Threat Meter (both on this site).

Korby 10-21-10 06:21 AM

Except I don't want a threat meter, I have Omen for that, and even Omen doesn't do what this does unless I have the mob targeted.

Also, I should have just put this here in the first post, since it's so short.

Code:

function aggroFrame_OnEvent()
local aggro_TRUE = "Aggro !";
local aggro_FALSE = "*";

    if(event == "PLAYER_REGEN_DISABLED") then
        aggro_TRUE = "Aggro !";
   
        aggro:SetText(aggro_TRUE);
    end

    if(event == "PLAYER_REGEN_ENABLED") then
        aggro_FALSE = "*";
   
        aggro:SetText(aggro_FALSE);
    end

end

function aggroFrame_OnLoad()
    this:RegisterEvent("PLAYER_REGEN_DISABLED");
    this:RegisterEvent("PLAYER_REGEN_ENABLED")
    DEFAULT_CHAT_FRAME:AddMessage("Aggro Display loaded -OK-");
end

That's the whole thing. I doubt the XML needs any editing though.

Ailae 10-21-10 06:40 AM

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

Korby 10-21-10 08:44 PM

Beautiful! Works perfectly. Thank you so much.


All times are GMT -6. The time now is 04:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI