diff --git a/sql/mangos.sql b/sql/mangos.sql index 680dfc169..51aec8b84 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_10682_01_mangos_item_convert` bit(1) default NULL + `required_10704_01_mangos_gossip_menu_option` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -2042,7 +2042,7 @@ CREATE TABLE gossip_menu_option ( option_text text, option_id tinyint(3) unsigned NOT NULL default '0', npc_option_npcflag int(10) unsigned NOT NULL default '0', - action_menu_id mediumint(8) unsigned NOT NULL default '0', + action_menu_id mediumint(8) NOT NULL default '0', action_poi_id mediumint(8) unsigned NOT NULL default '0', action_script_id mediumint(8) unsigned NOT NULL default '0', box_coded tinyint(3) unsigned NOT NULL default '0', diff --git a/sql/updates/10704_01_mangos_gossip_menu_option.sql b/sql/updates/10704_01_mangos_gossip_menu_option.sql new file mode 100644 index 000000000..38774b842 --- /dev/null +++ b/sql/updates/10704_01_mangos_gossip_menu_option.sql @@ -0,0 +1,3 @@ +ALTER TABLE db_version CHANGE COLUMN required_10682_01_mangos_item_convert required_10704_01_mangos_gossip_menu_option bit; + +ALTER TABLE gossip_menu_option CHANGE COLUMN action_menu_id action_menu_id MEDIUMINT(8) NOT NULL DEFAULT '0'; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 7f43ad61a..5c1f420ee 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -117,6 +117,7 @@ pkgdata_DATA = \ 10679_01_mangos_npc_vendor_template.sql \ 10679_02_mangos_creature_template.sql \ 10682_01_mangos_item_convert.sql \ + 10704_01_mangos_gossip_menu_option.sql \ README ## Additional files to include when running 'make dist' @@ -214,4 +215,5 @@ EXTRA_DIST = \ 10679_01_mangos_npc_vendor_template.sql \ 10679_02_mangos_creature_template.sql \ 10682_01_mangos_item_convert.sql \ + 10704_01_mangos_gossip_menu_option.sql \ README diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index c0acf8f76..d4fe69794 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -52,7 +52,7 @@ void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSe m_gItems.push_back(gItem); } -void GossipMenu::AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script) +void GossipMenu::AddGossipMenuItemData(int32 action_menu, uint32 action_poi, uint32 action_script) { GossipMenuItemData pItemData; diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h index e49830b07..c46667365 100644 --- a/src/game/GossipDef.h +++ b/src/game/GossipDef.h @@ -139,7 +139,7 @@ typedef std::vector GossipMenuItemList; struct GossipMenuItemData { - uint32 m_gAction_menu; + int32 m_gAction_menu; // negative for close gossip uint32 m_gAction_poi; uint32 m_gAction_script; }; @@ -172,7 +172,7 @@ class MANGOS_DLL_SPEC GossipMenu void SetMenuId(uint32 menu_id) { m_gMenuId = menu_id; } uint32 GetMenuId() { return m_gMenuId; } - void AddGossipMenuItemData(uint32 action_menu, uint32 action_poi, uint32 action_script); + void AddGossipMenuItemData(int32 action_menu, uint32 action_poi, uint32 action_script); unsigned int MenuItemCount() const { diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 90dece52b..cb6a4ad52 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -9117,7 +9117,7 @@ void ObjectMgr::LoadGossipMenuItems() gMenuItem.option_text = fields[3].GetCppString(); gMenuItem.option_id = fields[4].GetUInt32(); gMenuItem.npc_option_npcflag = fields[5].GetUInt32(); - gMenuItem.action_menu_id = fields[6].GetUInt32(); + gMenuItem.action_menu_id = fields[6].GetInt32(); gMenuItem.action_poi_id = fields[7].GetUInt32(); gMenuItem.action_script_id = fields[8].GetUInt32(); gMenuItem.box_coded = fields[9].GetUInt8() != 0; diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index d56654274..1740d80f4 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -519,7 +519,7 @@ struct GossipMenuItems std::string option_text; uint32 option_id; uint32 npc_option_npcflag; - uint32 action_menu_id; + int32 action_menu_id; uint32 action_poi_id; uint32 action_script_id; bool box_coded; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a22132e3b..2f7965059 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12739,7 +12739,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) switch(itr->second.option_id) { case GOSSIP_OPTION_GOSSIP: - if (itr->second.action_menu_id) // has sub menu, so do not "talk" with this NPC yet + if (itr->second.action_menu_id != 0) // has sub menu (or close gossip), so do not "talk" with this NPC yet canTalkToCredit = false; break; case GOSSIP_OPTION_QUESTGIVER: @@ -12950,11 +12950,17 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me if (pMenuData.m_gAction_poi) PlayerTalkClass->SendPointOfInterest(pMenuData.m_gAction_poi); - if (pMenuData.m_gAction_menu) + // send new menu || close gossip || stay at current menu + if (pMenuData.m_gAction_menu > 0) { - PrepareGossipMenu(pSource, pMenuData.m_gAction_menu); + PrepareGossipMenu(pSource, uint32(pMenuData.m_gAction_menu)); SendPreparedGossip(pSource); } + else if (pMenuData.m_gAction_menu < 0) + { + PlayerTalkClass->CloseGossip(); + TalkedToCreature(pSource->GetEntry(), pSource->GetGUID()); + } if (pMenuData.m_gAction_script) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9d74850e0..e83e0178c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10703" + #define REVISION_NR "10704" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 43b887dd7..ceb8c0f7a 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_10664_01_characters_arena_team_stats" - #define REVISION_DB_MANGOS "required_10682_01_mangos_item_convert" + #define REVISION_DB_MANGOS "required_10704_01_mangos_gossip_menu_option" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #endif // __REVISION_SQL_H__