From ceaca46604e941a1e643ea5f07a2a585988b1122 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Wed, 2 Mar 2011 00:08:10 +0100 Subject: [PATCH] [11213] Always PrepareQuestMenu in PrepareGossipMenu when no conditions are set This will make life easier for DB devs, as GOSSIP_OPTION_QUESTGIVER no longer need to be filled in to gossip_menu_option table. Menu option with GOSSIP_OPTION_QUESTGIVER and conditions will work as before. Signed-off-by: NoFantasy --- src/game/Player.cpp | 25 ++++++++++++++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f33cc9c7b..80af040e8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12858,8 +12858,11 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) GossipMenuItemsMapBounds pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(menuId); - // if default menuId and no menu options exist for this, use options from default options - if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource)) + // prepares quest menu when true + bool canSeeQuests = menuId == GetDefaultGossipMenuForSource(pSource); + + // if canSeeQuests (the default, top level menu) and no menu options exist for this, use options from default options + if (pMenuItemBounds.first == pMenuItemBounds.second && canSeeQuests) pMenuItemBounds = sObjectMgr.GetGossipMenuItemsMapBounds(0); bool canTalkToCredit = pSource->GetTypeId() == TYPEID_UNIT; @@ -12869,13 +12872,25 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) bool hasMenuItem = true; if (itr->second.cond_1 && !sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_1)) + { + if (itr->second.option_id == GOSSIP_OPTION_QUESTGIVER) + canSeeQuests = false; continue; + } if (itr->second.cond_2 && !sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_2)) + { + if (itr->second.option_id == GOSSIP_OPTION_QUESTGIVER) + canSeeQuests = false; continue; + } if (itr->second.cond_3 && !sObjectMgr.IsPlayerMeetToCondition(this, itr->second.cond_3)) + { + if (itr->second.option_id == GOSSIP_OPTION_QUESTGIVER) + canSeeQuests = false; continue; + } if (pSource->GetTypeId() == TYPEID_UNIT) { @@ -12893,7 +12908,6 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) canTalkToCredit = false; break; case GOSSIP_OPTION_QUESTGIVER: - PrepareQuestMenu(pSource->GetObjectGuid()); hasMenuItem = false; break; case GOSSIP_OPTION_ARMORER: @@ -12970,8 +12984,6 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) switch(itr->second.option_id) { case GOSSIP_OPTION_QUESTGIVER: - if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) - PrepareQuestMenu(pSource->GetObjectGuid()); hasMenuItem = false; break; case GOSSIP_OPTION_GOSSIP: @@ -13010,6 +13022,9 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) } } + if (canSeeQuests) + PrepareQuestMenu(pSource->GetObjectGuid()); + if (canTalkToCredit) { if (pSource->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b481f99f7..d41c50bd9 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 "11212" + #define REVISION_NR "11213" #endif // __REVISION_NR_H__