[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 <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-03-02 00:08:10 +01:00
parent a5d83cea08
commit ceaca46604
2 changed files with 21 additions and 6 deletions

View file

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