mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[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:
parent
5eabf12111
commit
a7b80733df
4 changed files with 24 additions and 29 deletions
|
|
@ -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,18 +13943,12 @@ 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 (IsCurrentQuest(prevId))
|
||||
{
|
||||
// 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 (msg)
|
||||
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
|
||||
return false;
|
||||
}
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse( INVALIDREASON_DONT_HAVE_REQ );
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue