mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
RequestLoadCreatureByID asynchronously fetches an uncached creature: issues SMSG_CREATURE_QUERY and fires CREATURE_DATA_LOAD_RESULT(id, success) when the response lands (or on timeout); fires success synchronously on a cache hit. Mirrors C_Item.RequestLoadItemData. New Cache::QueryLoad dispatcher generalizes Item::Data's pending/timeout/event machinery so multiple query caches share one response-handler hook. MinHook allows only one hook per target, and the creature/gameobject (and other non-item/quest) caches all route their SMSG_*_QUERY_RESPONSE through the generic parser FUN_00556E20 — so we hook it once and dispatch by cache instance to the right pending set + completion event. Item/quest use their own parsers, so no collision. The gameobject cache will register on this same dispatcher. Verified in-game: RequestLoadCreatureByID(10184) on an uncached Onyxia returned true, fired CREATURE_DATA_LOAD_RESULT, and populated the cache (type 2 Dragonkin, rank 3 world boss, displayID 8570).