WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   MoP Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=162)
-   -   HEX_CLASS_COLORS removed? (https://www.wowinterface.com/forums/showthread.php?t=43730)

suicidalkatt 07-16-12 12:31 AM

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.

Phanx 07-16-12 12:51 AM

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.

suicidalkatt 07-16-12 01:06 AM

Quote:

Originally Posted by Phanx (Post 258286)
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.

Phanx 07-16-12 04:34 AM

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. :p

Vlad 07-16-12 06:29 AM

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

Farmbuyer 07-17-12 04:48 PM

Quote:

Originally Posted by Phanx (Post 258289)
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.)

Phanx 07-17-12 05:20 PM

Quote:

Originally Posted by Farmbuyer (Post 258353)
(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.

Vlad 07-18-12 05:31 AM

Isn't the leading ff supposed to be alpha channel? If anything, hehe. :)

eiszeit 07-18-12 05:58 AM

It is, I guess.

Phanx 07-18-12 02:52 PM

It is, but it's not specific to the individual color, and it is specific to the |c escape sequence, so it shouldn't really be included in the table values.

zork 07-19-12 02:16 AM

The leading FF or 00 are non-functional. I guess they added it to go from 24bit to 32bit (24bit RGB color with 8bit alpha channel) but currently it has no effect. Where do you need hex colors? Strings only right. For those you need all the 8 characters.

Maybe they plan on adding text alpha channels? If that's true everyone with 00 leading a color string will get invisibile text strings. ;)
*Mark for myself*...check the text strings and swap leading 00 with FF.

Seerah 07-19-12 01:47 PM

I feel like I've changed those before myself... iirc, it changed the saturation, not the alpha. But I could be misremembering...


All times are GMT -6. The time now is 12:52 AM.

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