game,warden,assets: fix unknown player names, warden heap overlap, and Vanilla Item.dbc

- game: clear pendingNameQueries on player out-of-range and DESTROY_OBJECT so
  re-entering players get a fresh name query instead of being silently skipped
- game: add 5s periodic name resync scan that re-queries players with empty names
  and no pending query, recovering from dropped CMSG_NAME_QUERY responses
- warden: fix UC_ERR_MAP by moving HEAP_BASE from 0x200000 to 0x20000000; the old
  heap [0x200000, 0x1200000) overlapped the module at 0x400000, causing Unicorn to
  reject the heap mapping and abort emulator initialisation
- warden: add early overlap check between module and heap regions to catch future
  layout bugs at init time
- assets: add loadDBCOptional() which logs at DEBUG level when a DBC is absent,
  for files that are not distributed on all expansions
- assets: use loadDBCOptional for Item.dbc (absent on Vanilla 1.12 clients) and
  fall back to server-sent itemInfoCache displayInfoId for NPC weapon resolution
This commit is contained in:
Kelsi 2026-03-10 07:00:43 -07:00
parent dc2aab5e90
commit 3cdaf78369
5 changed files with 114 additions and 3 deletions

View file

@ -3365,7 +3365,9 @@ bool Application::tryAttachCreatureVirtualWeapons(uint64_t guid, uint32_t instan
auto itemDisplayDbc = assetManager->loadDBC("ItemDisplayInfo.dbc");
if (!itemDisplayDbc) return false;
auto itemDbc = assetManager->loadDBC("Item.dbc");
// Item.dbc is not distributed to clients in Vanilla 1.12; on those expansions
// item display IDs are resolved via the server-sent item cache instead.
auto itemDbc = assetManager->loadDBCOptional("Item.dbc");
const auto* idiL = pipeline::getActiveDBCLayout()
? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr;
const auto* itemL = pipeline::getActiveDBCLayout()
@ -3373,7 +3375,7 @@ bool Application::tryAttachCreatureVirtualWeapons(uint64_t guid, uint32_t instan
auto resolveDisplayInfoId = [&](uint32_t rawId) -> uint32_t {
if (rawId == 0) return 0;
// AzerothCore uses item entries in UNIT_VIRTUAL_ITEM_SLOT_ID.
// Primary path: AzerothCore uses item entries in UNIT_VIRTUAL_ITEM_SLOT_ID.
// Resolve strictly through Item.dbc entry -> DisplayID to avoid
// accidental ItemDisplayInfo ID collisions (staff/hilt mismatches).
if (itemDbc) {
@ -3386,6 +3388,17 @@ bool Application::tryAttachCreatureVirtualWeapons(uint64_t guid, uint32_t instan
}
}
}
// Fallback: Vanilla 1.12 does not distribute Item.dbc to clients.
// Items arrive via SMSG_ITEM_QUERY_SINGLE_RESPONSE and are cached in
// itemInfoCache_. Use the server-sent displayInfoId when available.
if (!itemDbc && gameHandler) {
if (const auto* info = gameHandler->getItemInfo(rawId)) {
uint32_t displayIdB = info->displayInfoId;
if (displayIdB != 0 && itemDisplayDbc->findRecordById(displayIdB) >= 0) {
return displayIdB;
}
}
}
return 0;
};