[10657] Separate quest_template.QuestFlags from SpecialFlags

Create enum for SpecialFlags (database flags and internally computed)
Added related functions for specialFlags and update code accordingly.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-10-30 01:13:45 +02:00
parent 1210c6d978
commit b6e367bf3c
8 changed files with 78 additions and 74 deletions

View file

@ -13344,7 +13344,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) const
// incomplete quest have status data
QuestStatusData const& q_status = q_itr->second;
if (qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_DELIVER))
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
{
for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
@ -13353,7 +13353,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) const
}
}
if (qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO))
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO))
{
for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
@ -13365,10 +13365,10 @@ bool Player::CanCompleteQuest(uint32 quest_id) const
}
}
if (qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT) && !q_status.m_explored)
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT) && !q_status.m_explored)
return false;
if (qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_TIMED) && q_status.m_timer == 0)
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_TIMED) && q_status.m_timer == 0)
return false;
if (qInfo->GetRewOrReqMoney() < 0)
@ -13392,7 +13392,7 @@ bool Player::CanCompleteRepeatableQuest(Quest const *pQuest) const
if (!CanTakeQuest(pQuest, false))
return false;
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_DELIVER))
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
if (pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i], pQuest->ReqItemCount[i]))
return false;
@ -13418,7 +13418,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, bool msg) const
return false;
// prevent receive reward with quest items in bank
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_DELIVER))
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
{
for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
@ -13501,13 +13501,13 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
questStatusData.m_status = QUEST_STATUS_INCOMPLETE;
questStatusData.m_explored = false;
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_DELIVER))
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
{
for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
questStatusData.m_itemcount[i] = 0;
}
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO))
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO))
{
for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
questStatusData.m_creatureOrGOcount[i] = 0;
@ -13522,7 +13522,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
GetReputationMgr().SetVisible(factionEntry);
uint32 qtime = 0;
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_TIMED))
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_TIMED))
{
uint32 limittime = pQuest->GetLimitTime();
@ -13765,7 +13765,7 @@ void Player::FailQuest(uint32 questId)
SetQuestSlotState(log_slot, QUEST_STATE_FAIL);
}
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_TIMED))
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_TIMED))
{
QuestStatusData& q_status = mQuestStatus[questId];
@ -13995,7 +13995,7 @@ bool Player::SatisfyQuestStatus(Quest const* qInfo, bool msg) const
bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) const
{
if (!m_timedquests.empty() && qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_TIMED))
if (!m_timedquests.empty() && qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_TIMED))
{
if (msg)
SendCanTakeQuestResponse(INVALIDREASON_QUEST_ONLY_ONE_TIMED);
@ -14288,7 +14288,7 @@ uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry)
void Player::AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& questStatusData )
{
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_DELIVER))
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
{
for(int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
@ -14369,7 +14369,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
continue;
Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid);
if (!qInfo || !qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_DELIVER))
if (!qInfo || !qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
continue;
for (int j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
@ -14406,7 +14406,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
Quest const* qInfo = sObjectMgr.GetQuestTemplate(questid);
if ( !qInfo )
continue;
if (!qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_DELIVER))
if (!qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
continue;
for (int j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
@ -14464,7 +14464,7 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid )
QuestStatusData& q_status = mQuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid()))
{
if (qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST))
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST))
{
for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
@ -14521,7 +14521,7 @@ void Player::CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id,
if (!original_caster && !qInfo->HasQuestFlag(QUEST_FLAGS_SHARABLE))
continue;
if (!qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST))
if (!qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST))
continue;
QuestStatusData& q_status = mQuestStatus[questid];
@ -14593,7 +14593,7 @@ void Player::TalkedToCreature( uint32 entry, ObjectGuid guid )
if ( q_status.m_status == QUEST_STATUS_INCOMPLETE )
{
if (qInfo->HasQuestFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO))
if (qInfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO))
{
for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
{
@ -16159,7 +16159,7 @@ void Player::_LoadQuestStatus(QueryResult *result)
time_t quest_time = time_t(fields[4].GetUInt64());
if (pQuest->HasQuestFlag(QUEST_MANGOS_FLAGS_TIMED) && !GetQuestRewardStatus(quest_id) && questStatusData.m_status != QUEST_STATUS_NONE)
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_TIMED) && !GetQuestRewardStatus(quest_id) && questStatusData.m_status != QUEST_STATUS_NONE)
{
AddTimedQuest( quest_id );