WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Party members with server name? (https://www.wowinterface.com/forums/showthread.php?t=57826)

Zax 02-18-20 09:24 AM

Party members with server name?
 
Hello,

Is there a way to retreive party members' name with realm name (something like "Leroy-KirinTor")?
API GetHomePartyInfo() only returns names.

Thanks.

Fizzlemizz 02-18-20 09:47 AM

UnitName
If the realm return is nil then they are on your realm (GetRealmName)

Zax 02-18-20 10:08 AM

OK, so if I well understand, the only way is to loop on GetHomePartyInfo() result?
I can't check right now but what happen if, let's say, "Leroy" from Kirin Tor, and "Leroy" from Aggramar are in the same party?

Fizzlemizz 02-18-20 12:09 PM

A general idea.
Code:

local unit = "player"
local name = UnitName(unit)
local realm = GetRealmName()
print(unit, name, "from", realm)
for i=1, 4 do
        unit = "party"..i
        if UnitExists(unit) then
                name, realm = UnitName(unit)
                if not realm then
                        realm = GetRealmName()
                end
                print(unit, name, "from", realm)
        end
end


SDPhantom 02-18-20 02:37 PM

If you want the normalized name for your realm (used for whisper targets), you can use GetNormalizedRealmName(). Normalized realm names generally have spaces removed. I don't know if special characters like hyphens and apostrophes are removed as well.

Zax 02-19-20 07:29 AM

Thank you for your answers :)

I finally use: name, realm = UnitFullName(unit), in order to have the "condensed" form of server name, without space.


All times are GMT -6. The time now is 02:53 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI