Download
(9 Kb)
Download
Updated: 10-20-08 04:43 AM
Pictures
File Info
Updated:10-20-08 04:43 AM
Created:unknown
Downloads:4,105
Favorites:19
MD5:
naiColorize
Version: 0.2
by: Naitaeti [More]
Simple class colorizer

Adds class colors and level information (colored by difficulty) to the character names in the chat and battleground score frames. Level information is not displayed by default.

Configurable by editing the .lua file.

-- Changelog

0.2
- Works with WotLK / 3.0.2 and colorizes the Death Knight class
- Fixed an issue with other chat addons already removing the name delimiters.
- New version number scheme (again)

r21
- Make sure the player names are not set to nil before using them.

r19
- Use the original class name in cases where Babble-Class doesn't recognize it

r17
- Uses Babble-Class-3.0, should work with all locales now.

0.1
- Initial version
Optional Files (0)


Post A Reply Comment Options
Unread 07-27-09, 06:31 AM  
Strongbow
A Deviate Faerie Dragon
 
Strongbow's Avatar

Forum posts: 11
File comments: 111
Uploads: 0
Can this addon please be updated to use Class Colors http://www.wowinterface.com/download...nt&fileid=8450

-Strongbow-
Strongbow is offline Report comment to moderator  
Reply With Quote
Unread 04-21-09, 03:15 PM  
salkiri
A Kobold Labourer

Forum posts: 1
File comments: 11
Uploads: 0
Originally posted by Roath
for some reason this addon colorized deathknights grey... any idea where i have to edit something to remove that?
Is there any fix to this?
salkiri is offline Report comment to moderator  
Reply With Quote
Unread 03-01-09, 06:57 AM  
Graloth
Premium Member
 
Graloth's Avatar

Forum posts: 15
File comments: 31
Uploads: 2
for some reason this addon colorized deathknights grey... any idea where i have to edit something to remove that?
Graloth is offline Report comment to moderator  
Reply With Quote
Unread 12-12-08, 07:09 AM  
annagold
A Kobold Labourer
 
annagold's Avatar

Forum posts: 0
File comments: 1
Uploads: 0
I patched core.lua to provide an option to do name colouring like XChat, and a mod named TasteTheNaimbow which is now out of date (ChatFrame_OnEvent issues). Names are hashed into a number and that is used to pick the H value in an HSV colour. That way, a particular name is always coloured the same way and you can learn to spot their colour easily in chat channels. Not everybody's flavour, and possibly less useful in battlegrounds where class info is handy, but I like it.

Here's the patch:

Code:
--- core.lua.orig	2008-12-13 00:03:07.000000000 +1100
+++ core.lua	2008-12-13 00:05:38.000000000 +1100
@@ -33,6 +33,10 @@
 -- level delimiter, e.g. ":" gives "70:Character"
 local levelDelim = ":"
 
+-- assign unique random colors based on toon names like XChat IRC client and
+-- the TasteTheNaimbow addon (although with more pastelly colours)
+local colorizeHash = true
+
 --[[-------------------------------------------------------------------------------
 	Code
 ---------------------------------------------------------------------------------]]
@@ -136,15 +140,86 @@
 	return str and (strupper(strsub(str, 1, 1))..strlower(strsub(str, 2)))
 end
 
+local hsv2rgb = function(h, s, v)
+	local i
+	local f, p, q, t
+
+	if (s == 0) then
+		r = v
+		g = v
+		b = v
+		if not r then r = 0 end
+		if not g then g = 0 end
+		if not b then b = 0 end
+		return r, g, b
+	end
+
+	h = h/60			-- sector 0 to 5
+	i = math.floor(h)
+	f = h - i			-- factorial part of h
+	p = v * (1 - s)
+	q = v * (1 - s * f)
+	t = v * (1 - s * ( 1 - f))
+
+	if i == 0 then
+		r = v
+		g = t
+		b = p
+	elseif i == 1 then
+		r = q
+		g = v
+		b = p
+	elseif i == 2 then
+		r = formluap
+		g = v
+		b = t
+	elseif i == 3 then
+		r = p
+		g = q
+		b = v
+	elseif i == 4 then
+		r = t
+		g = p
+		b = v
+	elseif i == 5 then
+		r = v
+		g = p
+		b = q
+	else
+		DEFAULT_CHAT_FRAME:AddMessage("Error")
+	end
+	if not r then r = 0 end
+	if not g then g = 0 end
+	if not b then b = 0 end
+	return r, g, b
+end
+
+local calculateColorHash = function(name)
+	local currentHash = 5381
+	local nameLength = strlen(name)
+	for n = 1, nameLength do
+		currentHash = 33*currentHash + strbyte(name, n)
+	end
+	local h = math.fmod(currentHash, 360)
+	local s = 0.5 -- 50% white 50% colour, i.e. pastel
+	local v = 1 -- no black, keep them light and happy
+	return hsv2rgb(h, s, v)
+end
+
 local getColoredName = function(name, class)
-	local properclass
-	if class then
-		properclass = strupper(BC[propercase(class)] or class)
-		-- _AddMessage(ChatFrame1, format("color %s %s %s", class, propcls, properclass))
-	end
-	local r, b, g = 0.63, 0.63, 0.63
-	if properclass and RAID_CLASS_COLORS and RAID_CLASS_COLORS[properclass] then
-		r, g, b = RAID_CLASS_COLORS[properclass].r, RAID_CLASS_COLORS[properclass].g, RAID_CLASS_COLORS[properclass].b
+	local r, b, g
+	if colorizeHash then
+		r, b, g = calculateColorHash(name)
+	else
+		local properclass
+		if class then
+			properclass = strupper(BC[propercase(class)] or class)
+			-- _AddMessage(ChatFrame1, format("color %s %s %s", class, propcls, properclass))
+		end
+		r, b, g = 0.63, 0.63, 0.63
+		if properclass and RAID_CLASS_COLORS and RAID_CLASS_COLORS[properclass] then
+			r, g, b = RAID_CLASS_COLORS[properclass].r, RAID_CLASS_COLORS[properclass].g, RAID_CLASS_COLORS[properclass].b
+		end
 	end
   
 	local _, _, rname, realm = name:find("([^-]+)-([^-]+)")
annagold is offline Report comment to moderator  
Reply With Quote
Unread 05-19-08, 09:53 PM  
Naitaeti
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 38
Uploads: 7
Originally posted by Jerricka
It's happened since the restart this morning. Yes, latest version.
Weird, I still don't see how this would happen, but some of the functions the addon is calling has to return nil.

I've uploaded a new version (r21) that doesn't try to use the name in cases where it's nil, could you try this one and see if that solves the problem?
Naitaeti is offline Report comment to moderator  
Reply With Quote
Unread 05-19-08, 07:31 PM  
Jerricka
An Aku'mai Servant
 
Jerricka's Avatar

Forum posts: 30
File comments: 183
Uploads: 0
Originally posted by Naitaeti
This is with the latest version (r19) right? Meaning line 56 of core.lua reads

Code:
playerinfo[name] = info
I'm asking because "name" at this point should never be nil and I don't quite see why this would happen.

Also, does this happen often?
It's happened since the restart this morning. Yes, latest version.
Jerricka is offline Report comment to moderator  
Reply With Quote
Unread 05-19-08, 06:12 PM  
Naitaeti
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 38
Uploads: 7
Originally posted by Jerricka
US Server, speaking English, and now this error happens as well:

Date: 2008-05-19 15:20:11
ID: 50
Error occured in: Stubby
Count: 2
Message: Error: Original call failed after running hooks for: ChatFrame_OnEvent
..\AddOns\naiColorize\core.lua line 56:
table index is nil
Debug:
(tail call): ?
[string "*:OnEvent"]:1:
[string "*:OnEvent"]:1


...and still words I type do not show up in chat window until a ui reload.
This is with the latest version (r19) right? Meaning line 56 of core.lua reads

Code:
playerinfo[name] = info
I'm asking because "name" at this point should never be nil and I don't quite see why this would happen.

Also, does this happen often?
Naitaeti is offline Report comment to moderator  
Reply With Quote
Unread 05-19-08, 04:44 PM  
Jerricka
An Aku'mai Servant
 
Jerricka's Avatar

Forum posts: 30
File comments: 183
Uploads: 0
US Server, speaking English, and now this error happens as well:

Date: 2008-05-19 15:20:11
ID: 50
Error occured in: Stubby
Count: 2
Message: Error: Original call failed after running hooks for: ChatFrame_OnEvent
..\AddOns\naiColorize\core.lua line 56:
table index is nil
Debug:
(tail call): ?
[string "*:OnEvent"]:1:
[string "*:OnEvent"]:1


...and still words I type do not show up in chat window until a ui reload.
Last edited by Jerricka : 05-19-08 at 04:45 PM.
Jerricka is offline Report comment to moderator  
Reply With Quote
Unread 04-07-08, 05:40 PM  
Naitaeti
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 38
Uploads: 7
Originally posted by Jerricka
When this error happens (randomly) I can't see what anyone types in guild, party, raid, etc., afterwards. Please fix! Other than that a very cool mod.
Hm, this would only happen if Babble-Class doesn't recognize the class name. Are you using the English client or some other language?

Either way, I've uploaded a new version that should use the original class name so this shouldn't happen anymore.
Naitaeti is offline Report comment to moderator  
Reply With Quote
Unread 04-07-08, 03:12 PM  
Jerricka
An Aku'mai Servant
 
Jerricka's Avatar

Forum posts: 30
File comments: 183
Uploads: 0
When this error happens (randomly) I can't see what anyone types in guild, party, raid, etc., afterwards. Please fix! Other than that a very cool mod.

Date: 2008-04-07 14:10:13
ID: 51
Error occured in: Stubby
Count: 1
Message: Error: Original call failed after running hooks for: ChatFrame_OnEvent
..\AddOns\naiColorize\core.lua line 138:
bad argument #1 to 'strupper' (string expected, got nil)
Debug:
(tail call): ?
[string "*:OnEvent"]:1:
[string "*:OnEvent"]:1
AddOns:
AckisRecipeList, v0.70
AddonManager, v4
AtlasLoot, vAtlasLoot Enhanced v4.04.01
Auctioneer, v5.0.PRE.2995
Auditor2, v3.1.0
AutoProfitX, v2.03
Bagmeter, v20400
BankItems, v24000
Bartender3, v3.1.2 r65221
BeanCounter, v5.0.PRE.2995 (BillyGoat)
BookOfCrafts
ChatSettingsFix, v2.4.1.3
CritSound, v0.2
CrowBar, v1.0.50229
CTBuffMod, v2.4 (CTMod 2.0)
CTCore, v2.4 (CTMod 2.0)
CTExpenseHistory, v2.4 (CTMod 2.0)
CTMailMod, v3.02 (CTMod 2.0)
CTTimer, v2.4 (CTMod 2.0)
cyCircled, v0.5
cyCircledGoldOrbs, v1.0
cyCircledCross, v1.0
cyCircledOnyx, v2.3.0.0
cyCircledStoned, v0.1
cyCircledVol, v1.0
cyCircledWire, v0.1
Dailies, v2.4.03
DoubleWide
EasyCopy
EnchantWootOMatic
EnhTooltip, v5.0.PRE.2995
EquipCompare, v2.10
FactionGrinder, v1.9.0
FishingBuddy, v0.9.4a
FBOutfitDisplayFrame, v0.9.4
FBTrackingFrame, v0.9.3b
Fizzle, v20100-1
Fizzlebag, v20100-1
GFWAdSpace, v2.4
GFWFactionFriend, v2.4
FuBarAmmoFu, v2.0
FuBarAuditorFu, v3.1.0
FuBarBagBar, v1.5
BankItemsFu, vv20002
FuBarClockFu, v3.0
FuBarDurabilityFu, v2.0
FuBarFactionGrinderFu, v1.4
FuBarFactionsFu, v2.2
FuBarFishingBuddyFu, v2.2b
FuBarFuXPFu, v3
FuBarGroupFu, v1
FuBarItemBonusesFu, v2.1
FuBarLocationFu, v2.0
FuBarMailFu, v2.0
FuBarMoteFu, v2.2.0.7272.1
FuBarPerformanceFu, v2.0
FuBarPossessionsFu, v20100.3
FuBarRestFu, v2.0
FuBar, v60201
FuTextures, v2.0
Gatherer, v3.1.1
GatherSage, v20100-2
GemHelper, v1.6
GrinderCore, v1.3.0
HatTrick
Informant, v5.0.PRE.2995
ItemRack
KillLog, v2.6.2a
AbacusLib
Ace2
Babble22, v2.2.$Revision: 57539 $
CrayonLib
Deformat, v1.0 $Revision: 3817 $
DewdropLib
FuBarPlugin20, v2.0 $Revision: 54514 $
GratuityLib, vr$Revision: 49704 $
TabletLib
Waterfall10
LibBabbleSpell30
LightHeaded, v229
LootCount
Mendeleev, v2.0.65952
MetaMap, v20100-1
MetaMapBWP
MetaMapFWM
MetaMapNBK
MetaMapQST
MetaMapTRK
MetaMapWKB
MinimapButtonFrame, v1.7a
myReloadUI, v1.6
naiColorize
OfflineMail, v0.8.3.2
Omen, vOmen r68250 / Threat-2.0 r68197
AHShowBid, v20000 R.1
Possessions, v2.0.2n v2
PowerAuras, v2.45
PriceEach, v2.0.3
ProfessionLinks, vProfessionLinks v2.3
QuestAnnouncer, v0.5
RatingBuster, v1.3.7 (r66013)
RecipeRadar, v1.26
CharacterPaperdoll, v2.0.3
CharacterProfiler, v2.3.0
rSelfCastBB
SendSelf, v$VER$
simpleMinimap, v20100-6
SimpleMountEquip, v1.8
Skillet, v1.10-54727
Stackpack, v1.1
Stubby, v52
Swatter, v5.0.PRE.2995
TomTom, v132
TyMod
WeaponQuickSwap
WhoHas, v2.3.3
WIM, v2.4.9
XPerlArcaneBar
XPerlParty
XPerlPartyPet
XPerlPlayerBuffs
XPerlPlayer
XPerlPlayerPet
XPerlRaidAdmin
XPerlRaidHelper
XPerlRaidPets
XPerlRaidFrames
XPerlTarget
XPerlTargetTarget
XPerl, v2.4.1
Xolpass, v0.50
MoveIt, v20400.1
Last edited by Jerricka : 04-07-08 at 03:33 PM.
Jerricka is offline Report comment to moderator  
Reply With Quote
Unread 04-06-08, 09:16 PM  
Naitaeti
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 38
Uploads: 7
Originally posted by eiszeit
the problem is, german, french and so have female class names too... that is so shitty.. :x
Ok, instead of reinventing the wheel I decided to use Babble-Class-3.0, seems the new Ace3 stuff has way less dependencies than the old versions. This should make the class colors work with any locales. I hope at least, still can't test this myself.
Naitaeti is offline Report comment to moderator  
Reply With Quote
Unread 04-04-08, 07:18 PM  
Naitaeti
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 38
Uploads: 7
Originally posted by eiszeit
the problem is, german, french and so have female class names too... that is so shitty.. :x
I see. I suppose I could look up the class names in german/french etc. and add a a table for each locale that would translate the localized class name to the english one and then look up in RAID_CLASS_COLORS.

I wouldn't be able to test if this actually works myself though.
Last edited by Naitaeti : 04-04-08 at 07:18 PM.
Naitaeti is offline Report comment to moderator  
Reply With Quote
Unread 04-04-08, 10:52 AM  
eiszeit
A Flamescale Wyrmkin
 
eiszeit's Avatar
AddOn Author - Click to view AddOns

Forum posts: 140
File comments: 159
Uploads: 9
Originally posted by Naitaeti
Could very well be indeed, I don't have a german client to test with, but if RAID_CLASS_COLORS expects english class names and GetFriendInfo() returns german ones (or vice versa) then there'd be problems. I'd be willing to fix this but it's hard when just sitting on an english client.
the problem is, german, french and so have female class names too... that is so shitty.. :x
__________________
Lyn I'm a mess of unfinished thoughts
eiszeit is offline Report comment to moderator  
Reply With Quote
Unread 03-29-08, 06:22 PM  
Naitaeti
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 38
Uploads: 7
Originally posted by eiszeit
he was on my friendlist... could it be that this addon doesn't work with deDE client? if not, then problem solved haha.
Could very well be indeed, I don't have a german client to test with, but if RAID_CLASS_COLORS expects english class names and GetFriendInfo() returns german ones (or vice versa) then there'd be problems. I'd be willing to fix this but it's hard when just sitting on an english client.
Naitaeti is offline Report comment to moderator  
Reply With Quote
Unread 03-29-08, 07:19 AM  
eiszeit
A Flamescale Wyrmkin
 
eiszeit's Avatar
AddOn Author - Click to view AddOns

Forum posts: 140
File comments: 159
Uploads: 9
he was on my friendlist... could it be that this addon doesn't work with deDE client? if not, then problem solved haha.

anyway, nice addon
__________________
Lyn I'm a mess of unfinished thoughts
eiszeit is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: