Skip to content

Commit

Permalink
[Core/Gossips] Sync gossio_menu struct with TC 3.3.5/master
Browse files Browse the repository at this point in the history
  • Loading branch information
leelf00 committed Aug 26, 2024
1 parent 674bed0 commit 8d13862
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
24 changes: 24 additions & 0 deletions sql/updates/world/2024_08_26_00_world.sql
Original file line number Diff line number Diff line change
@@ -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`;
5 changes: 3 additions & 2 deletions src/server/game/Entities/Creature/GossipDef.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/server/game/Entities/Creature/GossipDef.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -217,13 +217,13 @@ struct QuestMenuItem

typedef std::vector<QuestMenuItem> 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; }
Expand Down
15 changes: 4 additions & 11 deletions src/server/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Globals/ObjectMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
class AreaTrigger;
class Item;
class PhaseMgr;
enum GossipOptionIcon : uint8;
struct AccessRequirement;
struct PlayerLevelInfo;
struct DeclinedName;
Expand Down Expand Up @@ -577,7 +578,7 @@ struct GossipMenuItems
{
uint32 MenuID;
uint32 OptionID;
uint8 OptionIcon;
GossipOptionIcon OptionIcon;
std::string OptionText;
uint32 OptionBroadcastTextID;
uint32 OptionType;
Expand Down

0 comments on commit 8d13862

Please sign in to comment.