Originally Posted by klaro00
Hi,
I'm about to write an addon which displays the player's Alliance, Race and Class in a tooltip. For each of them I display the localized name plus the respective icon/symbol.
Alliance and Class is not a problem since I get both a localized text and a numeric type value. I use the type to lookup the icon texture in a table.
My problem: I cannot find a way to get the player's race as a numeric type. All I find is function
GetUnitRace("player") which returns the localized race. This is not really helpful because I cannot use this as an index for a table with race icon textures.
How would I manage to get the race information in a more abstract way (not only as a localized text), or is there a way to get the 64x64 race icon directly?
For illustration of the purpose of my question see attachment.
Regards,
Klaro
|
AFAIK there is no other function which you can use. You will have to stick with GetUnitRace(unitTag).
You will probably need to make a lookup table such as:
Lua Code:
-- breton = "esoui/art/charactercreate/charactercreate_bretonicon_up.dds",
-- orc = "esoui/art/charactercreate/charactercreate_orcicon_up.dds",
-- redguard = "esoui/art/charactercreate/charactercreate_redguardicon_up.dds",
-- altmer = "esoui/art/charactercreate/charactercreate_altmericon_up.dds",
-- bosmer = "esoui/art/charactercreate/charactercreate_bosmericon_up.dds",
-- kajiit = "esoui/art/charactercreate/charactercreate_khajiiticon_up.dds",
-- argonian = "esoui/art/charactercreate/charactercreate_argonianicon_up.dds",
-- dunmer = "esoui/art/charactercreate/charactercreate_dunmericon_up.dds",
-- nord = "esoui/art/charactercreate/charactercreate_nordicon_up.dds",
-- imperial = "esoui/art/charactercreate/charactercreate_imperialicon_up.dds",
local raceTable = {
["Breton"] = "breton",
["Bretone"] = "breton", --de, male
["Bretonin"] = "breton", --de, female
["Bréton"] = "breton", --fr, male
["Brétonne"] = "breton", --fr, female
["Orc"] = "orc",
["Ork"] = "orc", --de, male/female
["Orque"] = "orc", --fr, male/female
["Redguard"] = "redguard",
["Rothwardone"] = "redguard", --de, male
["Rothwardonin"] = "redguard", --de, female
["Rougegarde"] = "redguard", --fr, male/female
["High Elf"] = "altmer",
["Hochelf"] = "altmer", --de, male
["Hochelfin"] = "altmer", --de, female
["Haut-Elfe"] = "altmer", --fr, male
["Haute-Elfe"] = "altmer", --fr, female
["Wood Elf"] = "bosmer",
["Waldelf"] = "bosmer", --de, male
["Waldelfin"] = "bosmer", --de, female
["Elfe des bois"] = "bosmer", --fr, male/female
["Khajiit"] = "khajiit",
["Argonian"] = "argonian",
["Argonier"] = "argonian", --de, male
["Argonierin"] = "argonian", --de, female
["Argonien"] = "argonian", --fr, male
["Argonienne"] = "argonian", --fr, female
["Dark Elf"] = "dunmer",
["Dunkelelf"] = "dunmer", --de, male
["Dunkelelfin"] = "dunmer", --de, female
["Elfe Noir"] = "dunmer", --fr, male
["Elfe Noire"] = "dunmer", --fr, female
["Nord"] = "nord",
["Nordique"] = "nord", --fr, male/female
["Imperial"] = "imperial",
["Kaiserlicher"] = "imperial", --de, male
["Kaiserliche"] = "imperial", --de, female
["Impérial"] = "imperial", --fr, male
["Impériale"] = "imperial", --fr, female
}
local race = zo_strformat(SI_RACE_NAME, GetUnitRace("player"))
local raceCode = raceTable[race]
local texture = "esoui/art/charactercreate/charactercreate_" .. raceCode .. "icon_up.dds"
d(texture)