Thread Tools Display Modes
07-16-12, 12:31 AM   #1
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
HEX_CLASS_COLORS removed?

Idk if it was JUST this last patch (15851) but HEX_CLASS_COLORS is now returning nils and instead is replaced by RAID_CLASS_COLORS[class].colorStr which now contains the hex + 'ff' in the front.

Was this just a recent change? Or has this been like this since MoP beta was available?

Lua Code:
  1. RAID_CLASS_COLORS = {
  2.     ["HUNTER"] = { r = 0.67, g = 0.83, b = 0.45, colorStr = "ffabd473" },
  3.     ["WARLOCK"] = { r = 0.58, g = 0.51, b = 0.79, colorStr = "ff9482c9" },
  4.     ["PRIEST"] = { r = 1.0, g = 1.0, b = 1.0, colorStr = "ffffffff" },
  5.     ["PALADIN"] = { r = 0.96, g = 0.55, b = 0.73, colorStr = "fff58cba" },
  6.     ["MAGE"] = { r = 0.41, g = 0.8, b = 0.94, colorStr = "ff69ccf0" },
  7.     ["ROGUE"] = { r = 1.0, g = 0.96, b = 0.41, colorStr = "fffff569" },
  8.     ["DRUID"] = { r = 1.0, g = 0.49, b = 0.04, colorStr = "ffff7d0a" },
  9.     ["SHAMAN"] = { r = 0.0, g = 0.44, b = 0.87, colorStr = "ff0070de" },
  10.     ["WARRIOR"] = { r = 0.78, g = 0.61, b = 0.43, colorStr = "ffc79c6e" },
  11.     ["DEATHKNIGHT"] = { r = 0.77, g = 0.12 , b = 0.23, colorStr = "ffc41f3b" },
  12.     ["MONK"] = { r = 0.0, g = 1.00 , b = 0.59, colorStr = "ff00ff96" },
  13. };

Edit: I am a baboon and I completely forgot I made that a global table for my own addon >.> just forgot to include monk.

Last edited by suicidalkatt : 07-16-12 at 12:49 AM.
 
07-16-12, 12:51 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
The colorStr keys have been part of RAID_CLASS_COLORS at least since they enabled addons in the MoP beta, in case anyone was wondering.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
07-16-12, 01:06 AM   #3
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Phanx View Post
The colorStr keys have been part of RAID_CLASS_COLORS at least since they enabled addons in the MoP beta, in case anyone was wondering.
What would be the best way to easily create a table for just the hex values of those strings, i.e. just clip the 'ff' off at the start?

Lua Code:
  1. HEX_CLASS_COLORS = {};
  2. for i=1,#CLASS_SORT_ORDER do
  3.     local str = RAID_CLASS_COLORS[CLASS_SORT_ORDER[i]].colorStr;
  4.     local str = -- Do action here that changes str to correct str;
  5.     HEX_CLASS_COLORS[CLASS_SORT_ORDER[i]] = str;
  6. end

edit: local str = gsub(str,"(ff)","",1)

seems to do the trick.

Last edited by suicidalkatt : 07-16-12 at 01:14 AM.
 
07-16-12, 04:34 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That works, although I'm not sure why you would want to use an indexed table based on Blizzard's arbitrary and unintuitive CLASS_SORT_ORDER values, instead of a hash table with class/color pairs.

On a marginally related note, the MoP betas for !ClassColors support the colorStr key, so if your addon supports that you can read the values from there... and if your addon doesn't support it, it should.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
07-16-12, 06:29 AM   #5
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
I don't think you need to use CLASS_SORT_ORDER, the order isn't even based on the real class ID's or anything, hehe. I'd just use something like:

Code:
HEX_CLASS_COLORS = {}
do
  for k, v in pairs(RAID_CLASS_COLORS) do
    HEX_CLASS_COLORS[k] = v.colorStr:sub(3)
  end
end
Not sure if I contributed much, hehe. :P
 
07-17-12, 04:48 PM   #6
Farmbuyer
A Cyclonian
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 43
Originally Posted by Phanx View Post
That works, although I'm not sure why you would want to use an indexed table based on Blizzard's arbitrary and unintuitive CLASS_SORT_ORDER values, instead of a hash table with class/color pairs.
My Hobby: re-sorting CLASS_SORT_ORDER to be alphabetical, with makes 70% of addons list their class-related things in a nice alphabetical intuitive way, and the remaining 30% puke horribly because of poor assumptions.

As for RAID_CLASS_COLORS, it looks like they adopted their (smart) current idea of "ITEM_QUALITY_COLORS[n].hex", but called the field "colorStr" instead of "hex". But colorStr includes the leading "ff" value, where "hex" includes the entire "|cff" escape-sequence-plus-ff value.

(Curious: Is "colorStr" ever used in Blizzard's code without unconditionally prefixing the |c escape? Brief investigation says not. Maybe they plan to do other things with it.)
 
07-17-12, 05:20 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Farmbuyer View Post
(Curious: Is "colorStr" ever used in Blizzard's code without unconditionally prefixing the |c escape? Brief investigation says not. Maybe they plan to do other things with it.)
Well, as far as I know the only use for color hex strings in WoW is with the "|c" escape... and the leading "ff" is only relevant in that case. My guess would be that whoever was adding the values to the table just didn't think very thoroughly about what the values would be used for. Otherwise, they'd have either included the "|c" escape in the values, or left off the leading "ff". Preferrably the latter.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
 

WoWInterface » Site Forums » Archived Beta Forums » MoP Beta archived threads » HEX_CLASS_COLORS removed?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off