[11822] Add more functionality to CONDITION_QUESTTAKEN

Add options 1/ 2 in second argument to check if a quest is INCOMPLETE/ COMPLETE, default will behave like currently

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
PSZ 2011-10-14 18:05:17 +02:00 committed by Schmoozerd
parent 4ad879a3da
commit 1606bb2e45
4 changed files with 20 additions and 6 deletions

View file

@ -7503,7 +7503,7 @@ bool PlayerCondition::Meets(Player const * player) const
return player->GetQuestRewardStatus(value1);
case CONDITION_QUESTTAKEN:
{
return player->IsCurrentQuest(value1);
return player->IsCurrentQuest(value1, value2);
}
case CONDITION_AD_COMMISSION_AURA:
{
@ -7770,7 +7770,7 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
return false;
}
if (value2)
if (value2 && condition != CONDITION_QUESTTAKEN)
sLog.outErrorDb("Quest condition (%u) has useless data in value2 (%u)!", condition, value2);
break;
}

View file

@ -13522,13 +13522,21 @@ 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
bool Player::IsCurrentQuest(uint32 quest_id, uint8 completed_or_not) const
{
QuestStatusMap::const_iterator itr = mQuestStatus.find(quest_id);
if (itr == mQuestStatus.end())
return false;
switch (completed_or_not)
{
case 1:
return itr->second.m_status == QUEST_STATUS_INCOMPLETE;
case 2:
return itr->second.m_status == QUEST_STATUS_COMPLETE && !itr->second.m_rewarded;
default:
return itr->second.m_status == QUEST_STATUS_INCOMPLETE || (itr->second.m_status == QUEST_STATUS_COMPLETE && !itr->second.m_rewarded);
}
}
Quest const* Player::GetNextQuest(ObjectGuid guid, Quest const *pQuest)

View file

@ -1320,7 +1320,13 @@ class MANGOS_DLL_SPEC Player : public Unit
void PrepareQuestMenu(ObjectGuid guid );
void SendPreparedQuest(ObjectGuid guid);
bool IsActiveQuest( uint32 quest_id ) const; // can be taken or taken
bool IsCurrentQuest( uint32 quest_id ) const; // taken and not yet rewarded
// Quest is taken and not yet rewarded
// if completed_or_not = 0 (or any other value except 1 or 2) - returns true, if quest is taken and doesn't depend if quest is completed or not
// if completed_or_not = 1 - returns true, if quest is taken but not completed
// if completed_or_not = 2 - returns true, if quest is taken and already completed
bool IsCurrentQuest(uint32 quest_id, uint8 completed_or_not = 0) const; // taken and not yet rewarded
Quest const *GetNextQuest(ObjectGuid 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 "11821"
#define REVISION_NR "11822"
#endif // __REVISION_NR_H__