[10043] Fixed share quest in case completed objectives.

* Also fixed CONDITION_QUESTTAKEN for same case.
* Aslo fixed exclusive prev quests check.
This commit is contained in:
VladimirMangos 2010-06-07 23:40:08 +04:00
parent 5eabf12111
commit a7b80733df
4 changed files with 24 additions and 29 deletions

View file

@ -7397,8 +7397,7 @@ bool PlayerCondition::Meets(Player const * player) const
return player->GetQuestRewardStatus(value1);
case CONDITION_QUESTTAKEN:
{
QuestStatus status = player->GetQuestStatus(value1);
return (status == QUEST_STATUS_INCOMPLETE);
return player->IsCurrentQuest(value1);
}
case CONDITION_AD_COMMISSION_AURA:
{

View file

@ -13086,6 +13086,15 @@ bool Player::IsActiveQuest( uint32 quest_id ) const
return itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE;
}
bool Player::IsCurrentQuest( uint32 quest_id ) const
{
QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id);
if (itr == mQuestStatus.end())
return false;
return itr->second.m_status == QUEST_STATUS_INCOMPLETE || itr->second.m_status == QUEST_STATUS_COMPLETE && !itr->second.m_rewarded;
}
Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
{
Object *pObject;
@ -13760,8 +13769,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
return true;
}
// If any of the negative previous quests active, return true
if (*iter < 0 && (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE
|| (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId))))
if (*iter < 0 && IsCurrentQuest(prevId))
{
// skip one-from-all exclusive group
if (qPrevInfo->GetExclusiveGroup() >= 0)
@ -13782,12 +13790,8 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
if (exclude_Id == prevId)
continue;
QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id );
// alternative quest from group also must be active
if (i_exstatus == mQuestStatus.end() ||
i_exstatus->second.m_status != QUEST_STATUS_INCOMPLETE &&
(i_prevstatus->second.m_status != QUEST_STATUS_COMPLETE || GetQuestRewardStatus(prevId)))
if (!IsCurrentQuest(exclude_Id))
{
if (msg)
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
@ -13939,19 +13943,13 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) const
{
uint32 prevId = *iter;
QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId );
if (i_prevstatus != mQuestStatus.end())
{
// If any of the previous quests in chain active, return false
if (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE
|| (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId)))
if (IsCurrentQuest(prevId))
{
if (msg)
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
}
// check for all quests further down the chain
// only necessary if there are quest chains with more than one quest that can be skipped
@ -14083,13 +14081,10 @@ QuestStatus Player::GetQuestStatus( uint32 quest_id ) const
bool Player::CanShareQuest(uint32 quest_id) const
{
Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id);
if( qInfo && qInfo->HasFlag(QUEST_FLAGS_SHARABLE) )
{
QuestStatusMap::const_iterator itr = mQuestStatus.find( quest_id );
if( itr != mQuestStatus.end() )
return itr->second.m_status == QUEST_STATUS_NONE || itr->second.m_status == QUEST_STATUS_INCOMPLETE;
}
if (Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id))
if (qInfo->HasFlag(QUEST_FLAGS_SHARABLE))
return IsCurrentQuest(quest_id);
return false;
}

View file

@ -1324,7 +1324,8 @@ class MANGOS_DLL_SPEC Player : public Unit
void PrepareQuestMenu( uint64 guid );
void SendPreparedQuest( uint64 guid );
bool IsActiveQuest( uint32 quest_id ) const;
bool IsActiveQuest( uint32 quest_id ) const; // can be taken or taken
bool IsCurrentQuest( uint32 quest_id ) const; // taken and not yet rewarded
Quest const *GetNextQuest( uint64 guid, Quest const *pQuest );
bool CanSeeStartQuest( Quest const *pQuest ) const;
bool CanTakeQuest( Quest const *pQuest, bool msg ) const;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10042"
#define REVISION_NR "10043"
#endif // __REVISION_NR_H__