View Single Post
08-14-16, 06:29 PM   #2
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
Too exhausted to scold, move hooks outside of hooked events/frames/functions.

Like so, and problem solved(maybe? not tested).
Lua Code:
  1. --removed stuff with no purpose
  2.  
  3. hooksecurefunc("CompactUnitFrame_UpdateName", function (frame)
  4.    --Set the tag based on UnitClassification, can return "worldboss", "rare", "rareelite", "elite", "normal", "minus"
  5.    local tag
  6.    local level = UnitLevel(frame.unit)
  7.    if UnitClassification(frame.unit) == "worldboss" or UnitLevel(frame.unit) == -1 then
  8.       tag = BossTag
  9.       level = "??"
  10.    elseif UnitClassification(frame.unit) == "rare" or UnitClassification(frame.unit) =="rareelite" then
  11.       tag = RareTag
  12.    elseif UnitClassification(frame.unit) == "elite" then
  13.       tag = EliteTag
  14.    else
  15.       tag = ""
  16.    end
  17.    --Set the nameplate name to include tag(if any), name and level
  18.    frame.name:SetText(UnitName(frame.unit).." ("..level..")"..tag)
  19. end)
  20.  
  21. -- deleted whatever was here
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote