-
Posted by mandok on Thu, 21 Aug 2008 15:14:13
Should be:
function TargetText:UpdateClass ()
local class, key = UnitClass ("target")
local color = RAID_CLASS_COLORS [key]
TargetTextFrameClass:SetText (key)
TargetTextFrameClass:SetTextColor (color.r, color.g, color.b)
endCan't get UpdatepowerType to set color correctly.
-
Posted by mandok on Thu, 21 Aug 2008 15:14:13
Should be:
function TargetText:UpdateClass ()
local class, key = UnitClass ("target")
local color = RAID_CLASS_COLORS [key]
TargetTextFrameClass:SetText (key)
TargetTextFrameClass:SetTextColor (color.r, color.g, color.b)
endCan't get UpdatepowerType to set color correctly.
-
Posted by jnwhiteh on Thu, 21 Aug 2008 17:39:48
XSSFilter could not parse (X)HTML: <blockquote> <p>Should be:</p> <blockquote> <p>function TargetText:UpdateClass ()<br /> local class, key = UnitClass ("target")<br /> local color = RAID_CLASS_COLORS [key]<br /> TargetTextFrameClass:SetText (key)<br /> TargetTextFrameClass:SetTextColor (color.r, color.g, color.b) <br />end</p> </blockquote> <p>Can't get UpdatepowerType to set color correctly.</p> <p></blockquote></p> <p>No, this is not correct. The code listed on page 198 is absolutely correct. What you've done here is change it to use the upper-case english name of the class rather than the actual localized class name. Also, I don't understand what you mean regarding <code>UpdatePowerType()</code>. You can download the code for the addon from the website (<a href="/chapters/first-edition/15.html">http://wowprogramming.com/chapters/first-edition/15</a>) to check it against yours but the addon code listed in that chapter is correct to the best of our knowledge.</p>
-
Posted by mandok on Thu, 21 Aug 2008 19:08:38
OK - got confused by the fact that sometimes it returns the name of a character rather than a class - but the WOW interface does the same.
-
Posted by morlando on Fri, 22 Aug 2008 10:52:58
In a recent patch (2.4, I believe) Blizzard changed the functionality of
UnitClass
andUnitRace
(possibly others?) to return the names of NPCs instead of their actual class or race. To get the intended functionality, you should useUnitClassBase
andUnitRaceBase
.I'll add this to the Errata for the chapter.