Colouring should be working now again.

simenon [06-27-14 - 22:14]
Colouring should be working now again.
Filename
GuildChat.lua
GuildChat.txt
Libs/libGuildInfo/LibGuildInfo.lua
diff --git a/GuildChat.lua b/GuildChat.lua
index 8080141..5cc01d6 100644
--- a/GuildChat.lua
+++ b/GuildChat.lua
@@ -5,60 +5,41 @@ local LGI = LibStub("LibGuildInfo-1.0")
 local LAM = LibStub("LibAddonMenu-1.0")

 local AllianceColours = { ["Aldmeri Dominion"] = "|cffff00", ["Daggerfall Convenant"]= "|c4169E1", ["Ebonhart Pact"] = "|c8B0000"}
-local ClassColours = {["Dragon Knight"] = "ca0000", ["Sorcerer"] = "0096ff", ["Nightblade"] = "9900f1", ["Templar"] = "efefef"}
+local ClassColours = {["Dragon Knight"] = "|cCA0000", ["Sorcerer"] = "|c0096FF", ["Nightblade"] = "|c9900F1", ["Templar"] = "|cEFEFEF"}
+
+local ChannelInfo = ZO_ChatSystem_GetChannelInfo()
+local CategoryMapping = ZO_ChatSystem_GetEventCategoryMappings()

 function GuildChat:GetLevel(name)
 	return LGI:GetLevelByMemberName(name) or 0
 end

 function GuildChat:GetClassColour(name)
-	return ClassColours[LGI:GetClassNameByMemberName(name)] or "ffffff"
-end
-
-function GuildChat:GetLevelColour(name)
-	return "|c9932CC"
+	return ClassColours[LGI:GetClassNameByMemberName(name)] or "|cffffff"
 end

 function GuildChat:GetAtColour(name)
-	return AllianceColours[LGI:GetAllianceNameByMemberName(name)] or "ffffff"
-end
-
-function GuildChat:GetPrintName(name)
-	if GuildChat.settings.characterName == "character" then
-		local guildmember = LGI:GetGuildMemberByMemberName("@" ..name)
-		return guildmember and guildmember.characterName or name
-	end
-	return name
+	return AllianceColours[LGI:GetAllianceNameByMemberName(name)] or "|cffffff"
 end

-function GuildChat:GetGuildRank(name)
-	return LGI:GetGuildRankByMemberName(name)
-end

-local ChanInfoArray = ZO_ChatSystem_GetChannelInfo()
-local CategoryMapping = ZO_ChatSystem_GetEventCategoryMappings()

 function GuildChat:GetName(channelId, fromName, text)
-	local info = ChanInfoArray[channelId]
-	local r,g,b = GetChatCategoryColor(CategoryMapping[EVENT_CHAT_MESSAGE_CHANNEL][channelId])
-	local baseColour = ZO_ColorDef:New(r, g, b, 1)
-
-	local nameLink = (info.playerLinkable and not fromName:find("%[")) and ZO_LinkHandler_CreatePlayerLink(fromName:gsub("%^.+", "")) or fromName
+	local channelInfo = ChannelInfo[channelId]
+	if channelInfo.format ~= 1723 then return ZO_LinkHandler_CreatePlayerLink(fromName) end

-	local formattedName = nil
-
-	local  colour, display, charname, name = nameLink:match("^|H([^:]-):([^\[]-)%[([^@]-)@([^\]]-)%]|h")
-		if colour then
-			formattedName = "|c" .. baseColour:ToHex() .."[" .. GuildChat:GetLevelColour("@" .. name) .. GuildChat:GetLevel("@" .. name) .. "|c" .. baseColour:ToHex() .. "]" ..
-							"[" .. (charname or "") .. GuildChat:GetAtColour("@" .. name) .."@" ..
-							"|H" .. GuildChat:GetClassColour("@" .. name) .. ":" .. display .. GuildChat:GetPrintName(name) .. "|h" ..
-							"|c" .. baseColour:ToHex() .. "]"
-			if GuildChat.settings.guildRank then
-				formattedName = "[" .. GuildChat:GetGuildRank("@" .. name) .. "]" .. formattedName
-			end
-		end
-
-	return formattedName or nameLink
+	--if GuildChat:GetLevel(fromName) == 0 then return ZO_LinkHandler_CreatePlayerLink(fromName) end
+
+	local r,g,b = GetChatCategoryColor(CategoryMapping[EVENT_CHAT_MESSAGE_CHANNEL][channelId])
+	local baseColour = ZO_ColorDef:New(r, g, b, 1)
+
+	local formattedName = GuildChat:GetAtColour(fromName) ..  "[" .. GuildChat:GetLevel(fromName) .. "]" .. "|r" ..
+						  GuildChat:GetClassColour(fromName) ..  ZO_LinkHandler_CreatePlayerLink(fromName) ..  "|r"
+	if GuildChat.settings.guildRank then
+		formattedName = "[" .. LGI:GetGuildRankByMemberName(fromName) .. "]" .. formattedName
+	end
+
+	return formattedName
 end

 function GuildChat:Register()
diff --git a/GuildChat.txt b/GuildChat.txt
index 9c8ce6c..4067cd0 100644
--- a/GuildChat.txt
+++ b/GuildChat.txt
@@ -1,6 +1,6 @@
 ## Title: |cFFFFB0Guild Chat|r by |c00C000CrazyDutchGuy & Wobin|r
 ## Author: CrazyDutchGuy & Wobin
-## Version: v4.0
+## Version: v4.1
 ## APIVersion: 100007
 ## SavedVariables: GuildChat_Settings

diff --git a/Libs/libGuildInfo/LibGuildInfo.lua b/Libs/libGuildInfo/LibGuildInfo.lua
index 58c6de0..769bfd2 100644
--- a/Libs/libGuildInfo/LibGuildInfo.lua
+++ b/Libs/libGuildInfo/LibGuildInfo.lua
@@ -24,7 +24,7 @@ function LibGuildInfo:GetLevelByMemberName(name)
 	local member = self:GetGuildMemberByMemberName(name)
 	if member then
 		if member.level < 50 then return member.level end
-		return "v" .. member.veteranRank
+		return "V" .. member.veteranRank
 	end
 end