mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10704] Add the option to close gossip window in gossip system
Field action_menu_id in gossip_menu_option table can be set to -1 where close gossip is expected, instead of sending a new menu. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
71b50e6e42
commit
7032423d6f
10 changed files with 23 additions and 12 deletions
|
|
@ -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',
|
||||
|
|
|
|||
3
sql/updates/10704_01_mangos_gossip_menu_option.sql
Normal file
3
sql/updates/10704_01_mangos_gossip_menu_option.sql
Normal file
|
|
@ -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';
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ typedef std::vector<GossipMenuItem> 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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10703"
|
||||
#define REVISION_NR "10704"
|
||||
#endif // __REVISION_NR_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__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue