mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
The persistent name cache copied every name reply into its own map, so each player the engine named this session was held twice. The copy also went stale. On a rename the server sends SMSG_INVALIDATE_PLAYER (0x31C) and HandleNameInvalidate 0x00555600 frees the engine's record, but our copy kept the old name, and GetPlayerInfoByGUID / UnitNameFromGUID fell through to it. The store now holds only the players the engine's name cache (0x00C0E228) does not: - A Net::PacketDispatch subscriber reads SMSG_NAME_QUERY_RESPONSE (0x51) in the same order as HandleNameQueryResponse 0x005551A0 and drops our entry just before the engine stores its record. This replaces the hook on NameCacheStore 0x0055F310. The backstop save runs before the drop, so no save misses the player. - The same subscriber drops our entry on SMSG_INVALIDATE_PLAYER. - The engine empties its cache only at world entry: NameCacheClear 0x00560400, called from CGGameUI::InitializeGame through 0x00555740. A hook there copies the engine's records into the store first, while the store still holds the realm they came from. - At exit the engine frees the cache from its atexit handler (NameCacheSave 0x0055EC70). Storm's exit handler 0x0064CC30 runs every atexit handler before ExitProcess, so DLL_PROCESS_DETACH was too late to read it. At the first world entry the clear hook registers our save with the exe's own _atexit (0x00409AEF). Handlers run newest first, so ours runs before the engine's. Detach now calls Shutdown, which never reads the engine's cache. - A save writes our store, then the engine's records, so a load applies the engine's data over ours. - C_PlayerCache.RememberPlayer leaves alone a player the engine holds. One hook removed (0x0055F310), one added (0x00560400).