mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
CGUnit_C::GetUnitName (0x00609210) takes a realm out-pointer as its stack argument, not the flags word Offsets.h called it. For a player whose name-cache record has a non-empty server name (record +0x30) it stores a pointer to that string, and otherwise leaves the pointer alone (0x0060926B-0x00609283). Vanilla's Script_UnitName (0x00517020) passes &realm there and returns it as UnitName's second value. The record's server name is the realm string SMSG_NAME_QUERY_RESPONSE carries: Tortoise sends it empty, a cross-realm server fills it. UnitNameFromGUID pushed a hard-coded "" instead. NameFromGuid now passes the out-pointer through, as Script_UnitName does, and gains a step between the friends list and the persistent cache: the engine name cache record itself (FUN_PLAYER_INFO_LOOKUP with no callback, a passive peek), which also gives the realm for players out of range. Before, a player who whispered from far away resolved only with the persistent cache on. UnitSpellTargetName shares NameFromGuid and finds those players too. The realm is "" when the record has none, or when the name came from the friends list or the persistent cache, which stores no realm. Retail documents both returns as non-nil strings. GetNameAndServerNameFromGUID in the addon's PlayerUtil returned GetRealmName(), the local realm, for every GUID. It now returns GetPlayerInfoByGUID's realm, as retail's UnitUtil does, so a player on the local realm gets "" and code that appends "-" .. realm only when it is non-empty works. Seven files declared their own function-pointer type for 0x00609210, all with the wrong int *outFlags argument. Unit::Identity::NameForUnit is now the one wrapper. The other six callers pass no realm and behave as before. Offsets.h gives the getter's real signature (RET 4) and what it stores. API.md's GetPlayerInfoByGUID and UnitNameFromGUID entries describe the realm and the four sources.