View Single Post
03-20-20, 08:38 PM   #16
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi,

I did it infact in the version I published:


Lua Code:
  1. -- GUILD
  2. row,col = tooltip:AddLine(_G["NAME"],_G["LEVEL"],_G["ZONE"],_G["RANK"])
  3.  
  4. -- BNET
  5. row,col = tooltip:AddLine(_G["NAME"],_G["BATTLETAG"],_G["ZONE"],_G["GAME"])
  6.  
  7. -- FRIENDS
  8. row,col = tooltip:AddLine(_G["NAME"],_G["LEVEL"],_G["ZONE"],_G["CLASS"])

I have find some problems in the color by class because the C_BattleNet.GetFriendAccountInfo return the class name in the format not suitable for checking the raid colors (especially if you have a non english client).

But I have found a snippet by phanx (which I miss so much really that works great to fix this.

Lua Code:
  1. local classes = {}
  2. for class in pairs(RAID_CLASS_COLORS) do
  3.    tinsert(classes, class)
  4. end
  5. sort(classes)
  6.  
  7. local classTokens = {}
  8. for token, class in pairs(LOCALIZED_CLASS_NAMES_MALE) do
  9.    classTokens[class] = token
  10. end
  11. for token, class in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do
  12.    classTokens[class] = token
  13. end
  14.  
  15. function GetClassToken(className)
  16.    return className and classTokens[className]
  17. end

In this way the GetClassToken(class) works always for class coloring the names and do the jobs always instead of my ugly solution I have found and that works only in english clients.

Lua Code:
  1. class = strupper(class):gsub("%s+","")

BTW: if you want to check it is here:
https://www.wowinterface.com/downloa...ldFriends.html

Any comments are welcome.
Thanks so much for your time.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote