[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); return player->GetQuestRewardStatus(value1);
case CONDITION_QUESTTAKEN: case CONDITION_QUESTTAKEN:
{ {
QuestStatus status = player->GetQuestStatus(value1); return player->IsCurrentQuest(value1);
return (status == QUEST_STATUS_INCOMPLETE);
} }
case CONDITION_AD_COMMISSION_AURA: 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; 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 ) Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
{ {
Object *pObject; Object *pObject;
@ -13760,8 +13769,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
return true; return true;
} }
// If any of the negative previous quests active, return true // If any of the negative previous quests active, return true
if (*iter < 0 && (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE if (*iter < 0 && IsCurrentQuest(prevId))
|| (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId))))
{ {
// skip one-from-all exclusive group // skip one-from-all exclusive group
if (qPrevInfo->GetExclusiveGroup() >= 0) if (qPrevInfo->GetExclusiveGroup() >= 0)
@ -13782,12 +13790,8 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
if (exclude_Id == prevId) if (exclude_Id == prevId)
continue; continue;
QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id );
// alternative quest from group also must be active // alternative quest from group also must be active
if (i_exstatus == mQuestStatus.end() || if (!IsCurrentQuest(exclude_Id))
i_exstatus->second.m_status != QUEST_STATUS_INCOMPLETE &&
(i_prevstatus->second.m_status != QUEST_STATUS_COMPLETE || GetQuestRewardStatus(prevId)))
{ {
if (msg) if (msg)
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ ); SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
@ -13939,18 +13943,12 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) const
{ {
uint32 prevId = *iter; uint32 prevId = *iter;
QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId ); // If any of the previous quests in chain active, return false
if (IsCurrentQuest(prevId))
if (i_prevstatus != mQuestStatus.end())
{ {
// If any of the previous quests in chain active, return false if (msg)
if (i_prevstatus->second.m_status == QUEST_STATUS_INCOMPLETE SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
|| (i_prevstatus->second.m_status == QUEST_STATUS_COMPLETE && !GetQuestRewardStatus(prevId))) return false;
{
if (msg)
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
return false;
}
} }
// check for all quests further down the chain // check for all quests further down the chain
@ -14083,13 +14081,10 @@ QuestStatus Player::GetQuestStatus( uint32 quest_id ) const
bool Player::CanShareQuest(uint32 quest_id) const bool Player::CanShareQuest(uint32 quest_id) const
{ {
Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id); if (Quest const* qInfo = sObjectMgr.GetQuestTemplate(quest_id))
if( qInfo && qInfo->HasFlag(QUEST_FLAGS_SHARABLE) ) if (qInfo->HasFlag(QUEST_FLAGS_SHARABLE))
{ return IsCurrentQuest(quest_id);
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;
}
return false; return false;
} }

View file

@ -1324,7 +1324,8 @@ class MANGOS_DLL_SPEC Player : public Unit
void PrepareQuestMenu( uint64 guid ); void PrepareQuestMenu( uint64 guid );
void SendPreparedQuest( 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 ); Quest const *GetNextQuest( uint64 guid, Quest const *pQuest );
bool CanSeeStartQuest( Quest const *pQuest ) const; bool CanSeeStartQuest( Quest const *pQuest ) const;
bool CanTakeQuest( Quest const *pQuest, bool msg ) const; bool CanTakeQuest( Quest const *pQuest, bool msg ) const;

View file

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