[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:
NoFantasy 2010-11-08 23:18:19 +01:00
parent 71b50e6e42
commit 7032423d6f
10 changed files with 23 additions and 12 deletions

View file

@ -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)
{