From 8d138627f4a9f5643ec160fa9a3503786fa7f874 Mon Sep 17 00:00:00 2001 From: lee Date: Mon, 26 Aug 2024 13:59:33 +0800 Subject: [PATCH] [Core/Gossips] Sync gossio_menu struct with TC 3.3.5/master --- sql/updates/world/2024_08_26_00_world.sql | 24 +++++++++++++++++++ .../game/Entities/Creature/GossipDef.cpp | 5 ++-- src/server/game/Entities/Creature/GossipDef.h | 8 +++---- src/server/game/Globals/ObjectMgr.cpp | 15 ++++-------- src/server/game/Globals/ObjectMgr.h | 3 ++- 5 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 sql/updates/world/2024_08_26_00_world.sql diff --git a/sql/updates/world/2024_08_26_00_world.sql b/sql/updates/world/2024_08_26_00_world.sql new file mode 100644 index 000000000..522849673 --- /dev/null +++ b/sql/updates/world/2024_08_26_00_world.sql @@ -0,0 +1,24 @@ +-- sync gossip_menu_option and creature_trainer structure with TC 3.3.5/master +ALTER TABLE `gossip_menu_option` CHANGE `MenuId` `MenuID` int(10) unsigned NOT NULL DEFAULT 0; +ALTER TABLE `gossip_menu_option` CHANGE `OptionIndex` `OptionID` int(10) unsigned NOT NULL DEFAULT 0; +ALTER TABLE `gossip_menu_option` CHANGE `OptionBroadcastTextId` `OptionBroadcastTextID` int(10) unsigned NOT NULL DEFAULT 0; +ALTER TABLE `gossip_menu_option` ADD `ActionMenuID` int(10) unsigned NOT NULL DEFAULT 0 AFTER `OptionNpcFlag`; +ALTER TABLE `gossip_menu_option` ADD `ActionPoiID` int(10) unsigned NOT NULL DEFAULT 0 AFTER `ActionMenuID`; +ALTER TABLE `gossip_menu_option` ADD `BoxCoded` tinyint(3) unsigned NOT NULL DEFAULT 0 AFTER `ActionPoiID`; +ALTER TABLE `gossip_menu_option` ADD `BoxMoney` int(10) unsigned NOT NULL DEFAULT 0 AFTER `BoxCoded`; +ALTER TABLE `gossip_menu_option` ADD `BoxText` mediumtext AFTER `BoxMoney`; +ALTER TABLE `gossip_menu_option` ADD `BoxBroadcastTextID` int(10) unsigned NOT NULL DEFAULT 0 AFTER `BoxText`; + +UPDATE `gossip_menu_option` gmo + LEFT JOIN `gossip_menu_option_action` gmoa ON gmo.`MenuID` = gmoa.`MenuId` AND gmo.`OptionID` = gmoa.`OptionIndex` + LEFT JOIN `gossip_menu_option_box` gmob ON gmo.`MenuId` = gmob.`MenuId` AND gmo.`OptionID` = gmob.`OptionIndex` + SET gmo.`ActionMenuID` = COALESCE(gmoa.`ActionMenuId`, 0), gmo.`ActionPoiID` = COALESCE(gmoa.`ActionPoiId`, 0), + gmo.`BoxCoded` = COALESCE(gmob.`BoxCoded`, 0), gmo.`BoxMoney` = COALESCE(gmob.`BoxMoney`, 0), gmo.`BoxText` = gmob.`BoxText`, gmo.`BoxBroadcastTextID` = COALESCE(gmob.`BoxBroadcastTextId`, 0); + +DROP TABLE `gossip_menu_option_action`; +DROP TABLE `gossip_menu_option_box`; + +ALTER TABLE `gossip_menu` +MODIFY COLUMN `VerifiedBuild` int NOT NULL DEFAULT 0 AFTER `TextID`; +ALTER TABLE `gossip_menu_option` +MODIFY COLUMN `VerifiedBuild` int NOT NULL DEFAULT 0 AFTER `BoxBroadcastTextID`; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 27d35aa44..85a2c919c 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -34,7 +34,7 @@ GossipMenu::~GossipMenu() ClearMenu(); } -void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/) +uint32 GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded /*= false*/) { ASSERT(_menuItems.size() <= GOSSIP_MAX_MENU_ITEMS); @@ -63,6 +63,7 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me menuItem.OptionType = action; menuItem.BoxMessage = boxMessage; menuItem.BoxMoney = boxMoney; + return menuItemId; } /** diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index 5aa236328..6c93a957b 100644 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.h @@ -1,5 +1,5 @@ /* -* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information +* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -53,7 +53,7 @@ enum Gossip_Option GOSSIP_OPTION_MAX }; -enum GossipOptionIcon +enum GossipOptionIcon : uint8 { GOSSIP_ICON_CHAT = 0, // white chat bubble GOSSIP_ICON_VENDOR = 1, // brown bag @@ -217,13 +217,13 @@ struct QuestMenuItem typedef std::vector QuestMenuItemList; -class GossipMenu +class TC_GAME_API GossipMenu { public: GossipMenu(); ~GossipMenu(); - void AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false); + uint32 AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false); void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action); void SetMenuId(uint32 menu_id) { _menuId = menu_id; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index d171559ec..8b0cd09e7 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -9273,16 +9273,9 @@ void ObjectMgr::LoadGossipMenuItems() _gossipMenuItemsStore.clear(); QueryResult result = WorldDatabase.Query( - // 0 1 2 3 4 5 6 - "SELECT o.MenuId, o.OptionIndex, o.OptionIcon, o.OptionText, o.OptionBroadcastTextId, o.OptionType, o.OptionNpcflag, " - // 7 8 - "oa.ActionMenuId, oa.ActionPoiId, " - // 9 10 11 12 - "ob.BoxCoded, ob.BoxMoney, ob.BoxText, ob.BoxBroadcastTextId " - "FROM gossip_menu_option o " - "LEFT JOIN gossip_menu_option_action oa ON o.MenuId = oa.MenuId AND o.OptionIndex = oa.OptionIndex " - "LEFT JOIN gossip_menu_option_box ob ON o.MenuId = ob.MenuId AND o.OptionIndex = ob.OptionIndex " - "ORDER BY o.MenuId, o.OptionIndex"); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 + "SELECT MenuID, OptionID, OptionIcon, OptionText, OptionBroadcastTextID, OptionType, OptionNpcFlag, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID " + "FROM gossip_menu_option ORDER BY MenuID, OptionID"); if (!result) { @@ -9298,7 +9291,7 @@ void ObjectMgr::LoadGossipMenuItems() gMenuItem.MenuID = fields[0].GetUInt32(); gMenuItem.OptionID = fields[1].GetUInt32(); - gMenuItem.OptionIcon = fields[2].GetUInt8(); + gMenuItem.OptionIcon = GossipOptionIcon(fields[2].GetUInt32()); gMenuItem.OptionText = fields[3].GetString(); gMenuItem.OptionBroadcastTextID = fields[4].GetUInt32(); gMenuItem.OptionType = fields[5].GetUInt32(); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index c41ac8931..b79c140d1 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -51,6 +51,7 @@ class AreaTrigger; class Item; class PhaseMgr; +enum GossipOptionIcon : uint8; struct AccessRequirement; struct PlayerLevelInfo; struct DeclinedName; @@ -577,7 +578,7 @@ struct GossipMenuItems { uint32 MenuID; uint32 OptionID; - uint8 OptionIcon; + GossipOptionIcon OptionIcon; std::string OptionText; uint32 OptionBroadcastTextID; uint32 OptionType;