fix(Core/ObjectMgr): warn trainer creature with no gossip_menu_option (#24336)

This commit is contained in:
sogladev
2026-01-14 13:52:01 +01:00
committed by GitHub
parent e1685a23f5
commit 45c8f242c2
2 changed files with 87 additions and 0 deletions

View File

@@ -9629,6 +9629,28 @@ void ObjectMgr::LoadGossipMenuItems()
_gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuID, gMenuItem));
} while (result->NextRow());
// Warn if any trainer creature templates reference a GossipMenuId that has no gossip_menu_option entries
// This will cause the gossip menu to fallback to MenuID 0 at runtime which will display: "I wish to unlearn my talents."
std::set<uint32> checkedMenuIds;
for (auto const& [entry, tmpl] : _creatureTemplateStore)
{
uint32 menuId = tmpl.GossipMenuId;
if (!menuId)
continue;
if (!(tmpl.npcflag & UNIT_NPC_FLAG_TRAINER))
continue;
if (checkedMenuIds.contains(menuId))
continue;
checkedMenuIds.insert(menuId);
auto [first, second] = _gossipMenuItemsStore.equal_range(menuId);
if (first == second)
LOG_WARN("server.loading", "Trainer creature template references GossipMenuId {} has no `gossip_menu_option` entries. This will fallback to MenuID 0.", menuId);
}
LOG_INFO("server.loading", ">> Loaded {} gossip_menu_option entries in {} ms", uint32(_gossipMenuItemsStore.size()), GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server.loading", " ");
}