Hey,
I'm trying to put next to the player name the class icon using GetPlayerInfoByGUID. So it would look this:
class icon - unit whispers: message
but instead it is shown like this:
|Hplayer: - icon - unit - :2103 - icon - unit whispers: message
2103 seems to be the lineID (
http://www.wowwiki.com/CHAT_MSG_CHAN...AT_MSG_CHANNEL) but I can't figure out where the |Hplayer: comes from.
However it looks only this odd whenever I put the icon next to the player name (it works if the icon is in the message)
Maybe a screenshot will explain better what I mean:
(in the chat message)
http://img641.imageshack.us/f/doesntwork.jpg
(next to the player name)
http://img59.imageshack.us/f/workj.jpg
Code:
local classIcons = {
DEATHKNIGHT = "Interface\\Icons\\Spell_Deathknight_ClassIcon",
DRUID = "Interface\\Icons\\INV_Misc_MonsterClaw_04",
WARLOCK = "Interface\\Icons\\Spell_Nature_FaerieFire",
HUNTER = "Interface\\Icons\\INV_Weapon_Bow_07",
MAGE = "Interface\\Icons\\INV_Staff_13",
PRIEST = "Interface\\Icons\\INV_Staff_30",
WARRIOR = "Interface\\Icons\\INV_Sword_27",
SHAMAN = "Interface\\Icons\\Spell_Nature_BloodLust",
PALADIN = "Interface\\AddOns\\addon\\UI-CharacterCreate-Classes_Paladin",
ROGUE = "Interface\\AddOns\\addon\\UI-CharacterCreate-Classes_Rogue",
}
function addPlayerIcons(self, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)
local _, fontSize = GetChatWindowInfo(self:GetID())
local _, class = GetPlayerInfoByGUID(arg12)
local arg2 = "|T"..classIcons[class]..":"..fontSize.."|t"..arg2
return false, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", addPlayerIcons)
ChatFrame_AddMessageEventFilter("CHAT_MSG_SAY", addPlayerIcons)
ChatFrame_AddMessageEventFilter("CHAT_MSG_YELL", addPlayerIcons)
ChatFrame_AddMessageEventFilter("CHAT_MSG_GUILD", addPlayerIcons)
ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", addPlayerIcons)