diff options
author | Aqua Deus <95978183+aquadeus@users.noreply.github.com> | 2022-10-11 22:16:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 22:16:02 +0200 |
commit | 4772c4817f1b34553f1c697e2aedc0372af9aea2 (patch) | |
tree | 9f7ed43aba6c4be3460e2de5097204ea0fbccf82 /src/server/game/Globals/ObjectMgr.cpp | |
parent | 8262d6be23811eddfd280b7d9341e2cac01a6e83 (diff) |
Core/Garrisons: Implement SMSG_GARRISON_OPEN_TALENT_NPC opcode (#28256)
Co-authored-by: ModoX <moardox@gmail.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 96db3bfa064..08763fe8aeb 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -9701,7 +9701,7 @@ void ObjectMgr::LoadGossipMenuItems() TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " gossip_menu_option entries in %u ms", _gossipMenuItemsStore.size(), GetMSTimeDiffToNow(oldMSTime)); } -void ObjectMgr::LoadGossipMenuFriendshipFactions() +void ObjectMgr::LoadGossipMenuAddon() { uint32 oldMSTime = getMSTime(); @@ -9744,6 +9744,44 @@ void ObjectMgr::LoadGossipMenuFriendshipFactions() TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_addon IDs in %u ms", uint32(_gossipMenuAddonStore.size()), GetMSTimeDiffToNow(oldMSTime)); } +void ObjectMgr::LoadGossipMenuItemAddon() +{ + uint32 oldMSTime = getMSTime(); + + _gossipMenuItemAddonStore.clear(); + + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT MenuID, OptionId, GarrTalentTreeID FROM gossip_menu_option_addon"); + + if (!result) + { + TC_LOG_INFO("server.loading", ">> Loaded 0 gossip_menu_option_addon IDs. DB table `gossip_menu_option_addon` is empty!"); + return; + } + + do + { + Field* fields = result->Fetch(); + + uint32 menuId = fields[0].GetUInt32(); + uint32 optionId = fields[1].GetUInt32(); + GossipMenuItemAddon& addon = _gossipMenuItemAddonStore[{ menuId, optionId }]; + if (!fields[2].IsNull()) + { + addon.GarrTalentTreeID = fields[2].GetInt32(); + + if (!sGarrTalentTreeStore.LookupEntry(*addon.GarrTalentTreeID)) + { + TC_LOG_ERROR("sql.sql", "Table gossip_menu_option_addon: MenuID %u OptionID %u is using non-existing GarrTalentTree %d", + menuId, optionId, *addon.GarrTalentTreeID); + addon.GarrTalentTreeID.reset(); + } + } + } while (result->NextRow()); + + TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option_addon IDs in %u ms", uint32(_gossipMenuItemAddonStore.size()), GetMSTimeDiffToNow(oldMSTime)); +} + Trainer::Trainer const* ObjectMgr::GetTrainer(uint32 trainerId) const { return Trinity::Containers::MapGetValuePtr(_trainers, trainerId); |