mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 10:37:01 +00:00
[10631] Small code style cleanup in quest related functions
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
da07caba28
commit
2fe87fc3c7
2 changed files with 125 additions and 103 deletions
|
|
@ -13284,12 +13284,12 @@ bool Player::CanSeeStartQuest( Quest const *pQuest ) const
|
|||
|
||||
bool Player::CanTakeQuest(Quest const *pQuest, bool msg) const
|
||||
{
|
||||
return SatisfyQuestStatus( pQuest, msg ) && SatisfyQuestExclusiveGroup( pQuest, msg )
|
||||
&& SatisfyQuestClass(pQuest, msg) && SatisfyQuestRace(pQuest, msg) && SatisfyQuestLevel(pQuest, msg)
|
||||
&& SatisfyQuestSkill(pQuest, msg) && SatisfyQuestReputation(pQuest, msg)
|
||||
&& SatisfyQuestPreviousQuest( pQuest, msg ) && SatisfyQuestTimed( pQuest, msg )
|
||||
&& SatisfyQuestNextChain( pQuest, msg ) && SatisfyQuestPrevChain( pQuest, msg )
|
||||
&& SatisfyQuestDay( pQuest, msg ) && SatisfyQuestWeek( pQuest, msg );
|
||||
return SatisfyQuestStatus(pQuest, msg) && SatisfyQuestExclusiveGroup(pQuest, msg) &&
|
||||
SatisfyQuestClass(pQuest, msg) && SatisfyQuestRace(pQuest, msg) && SatisfyQuestLevel(pQuest, msg) &&
|
||||
SatisfyQuestSkill(pQuest, msg) && SatisfyQuestReputation(pQuest, msg) &&
|
||||
SatisfyQuestPreviousQuest(pQuest, msg) && SatisfyQuestTimed(pQuest, msg) &&
|
||||
SatisfyQuestNextChain(pQuest, msg) && SatisfyQuestPrevChain(pQuest, msg) &&
|
||||
SatisfyQuestDay(pQuest, msg) && SatisfyQuestWeek(pQuest, msg);
|
||||
}
|
||||
|
||||
bool Player::CanAddQuest(Quest const *pQuest, bool msg) const
|
||||
|
|
@ -13425,6 +13425,7 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL, pQuest->ReqItemId[i]);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -13715,6 +13716,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
|
||||
if (pQuest->GetZoneOrSort() > 0)
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, pQuest->GetZoneOrSort());
|
||||
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, pQuest->GetQuestId());
|
||||
|
||||
|
|
@ -13800,8 +13802,10 @@ bool Player::SatisfyQuestLevel( Quest const* qInfo, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -13863,6 +13867,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -13894,6 +13899,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -13931,14 +13937,18 @@ bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const
|
|||
bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg) const
|
||||
{
|
||||
uint32 reqraces = qInfo->GetRequiredRaces();
|
||||
|
||||
if (reqraces == 0)
|
||||
return true;
|
||||
|
||||
if ((reqraces & getRaceMask()) == 0)
|
||||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_WRONG_RACE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -13949,6 +13959,7 @@ bool Player::SatisfyQuestReputation( Quest const* qInfo, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -13957,6 +13968,7 @@ bool Player::SatisfyQuestReputation( Quest const* qInfo, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -13966,12 +13978,15 @@ bool Player::SatisfyQuestReputation( Quest const* qInfo, bool msg ) const
|
|||
bool Player::SatisfyQuestStatus(Quest const* qInfo, bool msg) const
|
||||
{
|
||||
QuestStatusMap::const_iterator itr = mQuestStatus.find(qInfo->GetQuestId());
|
||||
|
||||
if (itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE)
|
||||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_QUEST_ALREADY_ON);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -13984,6 +13999,7 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) const
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -13995,7 +14011,7 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) const
|
|||
|
||||
ExclusiveQuestGroupsMapBounds bounds = sObjectMgr.GetExclusiveQuestGroupsMapBounds(qInfo->GetExclusiveGroup());
|
||||
|
||||
MANGOS_ASSERT(bounds.first != bounds.second); // always must be found if qInfo->ExclusiveGroup != 0
|
||||
MANGOS_ASSERT(bounds.first != bounds.second); // must always be found if qInfo->ExclusiveGroup != 0
|
||||
|
||||
for(ExclusiveQuestGroupsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||
{
|
||||
|
|
@ -14011,20 +14027,23 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find(exclude_Id);
|
||||
|
||||
// alternative quest already started or completed
|
||||
if (i_exstatus != mQuestStatus.end()
|
||||
&& (i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE))
|
||||
if (i_exstatus != mQuestStatus.end() &&
|
||||
(i_exstatus->second.m_status == QUEST_STATUS_COMPLETE || i_exstatus->second.m_status == QUEST_STATUS_INCOMPLETE))
|
||||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -14035,11 +14054,12 @@ bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg ) const
|
|||
|
||||
// next quest in chain already started or completed
|
||||
QuestStatusMap::const_iterator itr = mQuestStatus.find(qInfo->GetNextQuestInChain());
|
||||
if (itr != mQuestStatus.end()
|
||||
&& (itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE))
|
||||
if (itr != mQuestStatus.end() &&
|
||||
(itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE))
|
||||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -14064,6 +14084,7 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -14097,6 +14118,7 @@ bool Player::SatisfyQuestDay( Quest const* qInfo, bool msg ) const
|
|||
{
|
||||
if (msg)
|
||||
SendCanTakeQuestResponse(INVALIDREASON_DAILY_QUESTS_REMAINING);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10630"
|
||||
#define REVISION_NR "10631"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue