mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 06:36:24 +00:00
fix(Core/ObjectMgr): warn trainer creature with no gossip_menu_option (#24336)
This commit is contained in:
@@ -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", " ");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user