mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[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:
parent
1210c6d978
commit
b6e367bf3c
8 changed files with 78 additions and 74 deletions
|
|
@ -3654,47 +3654,45 @@ void ObjectMgr::LoadQuests()
|
|||
sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod());
|
||||
}
|
||||
|
||||
if (qinfo->QuestFlags & ~QUEST_MANGOS_FLAGS_DB_ALLOWED)
|
||||
if (qinfo->SpecialFlags > QUEST_SPECIAL_FLAG_DB_ALLOWED)
|
||||
{
|
||||
sLog.outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
|
||||
qinfo->GetQuestId(),qinfo->QuestFlags >> 24,QUEST_MANGOS_FLAGS_DB_ALLOWED >> 24);
|
||||
qinfo->QuestFlags &= QUEST_MANGOS_FLAGS_DB_ALLOWED;
|
||||
sLog.outErrorDb("Quest %u has `SpecialFlags` = %u, above max flags not allowed for database.", qinfo->GetQuestId(), qinfo->SpecialFlags);
|
||||
}
|
||||
|
||||
if (qinfo->QuestFlags & QUEST_FLAGS_DAILY && qinfo->QuestFlags & QUEST_FLAGS_WEEKLY)
|
||||
if (qinfo->HasQuestFlag(QUEST_FLAGS_DAILY) && qinfo->HasQuestFlag(QUEST_FLAGS_WEEKLY))
|
||||
{
|
||||
sLog.outErrorDb("Weekly Quest %u is marked as daily quest in `QuestFlags`, removed daily flag.",qinfo->GetQuestId());
|
||||
qinfo->QuestFlags &= ~QUEST_FLAGS_DAILY;
|
||||
}
|
||||
|
||||
if (qinfo->QuestFlags & QUEST_FLAGS_DAILY)
|
||||
if (qinfo->HasQuestFlag(QUEST_FLAGS_DAILY))
|
||||
{
|
||||
if (!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE))
|
||||
if (!qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_REPEATABLE))
|
||||
{
|
||||
sLog.outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId());
|
||||
qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE;
|
||||
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_REPEATABLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (qinfo->QuestFlags & QUEST_FLAGS_WEEKLY)
|
||||
if (qinfo->HasQuestFlag(QUEST_FLAGS_WEEKLY))
|
||||
{
|
||||
if (!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE))
|
||||
if (!qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_REPEATABLE))
|
||||
{
|
||||
sLog.outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId());
|
||||
qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE;
|
||||
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_REPEATABLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (qinfo->QuestFlags & QUEST_MANGOS_FLAGS_MONTHLY)
|
||||
if (qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_MONTHLY))
|
||||
{
|
||||
if (!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE))
|
||||
if (!qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_REPEATABLE))
|
||||
{
|
||||
sLog.outErrorDb("Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
|
||||
qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE;
|
||||
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_REPEATABLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (qinfo->QuestFlags & QUEST_FLAGS_AUTO_REWARDED)
|
||||
if (qinfo->HasQuestFlag(QUEST_FLAGS_AUTO_REWARDED))
|
||||
{
|
||||
// at auto-reward can be rewarded only RewChoiceItemId[0]
|
||||
for(int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
|
||||
|
|
@ -3896,7 +3894,7 @@ void ObjectMgr::LoadQuests()
|
|||
// no changes, quest can't be done for this requirement
|
||||
}
|
||||
|
||||
qinfo->SetFlag(QUEST_MANGOS_FLAGS_DELIVER);
|
||||
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER);
|
||||
|
||||
if (!sItemStorage.LookupEntry<ItemPrototype>(id))
|
||||
{
|
||||
|
|
@ -3962,12 +3960,12 @@ void ObjectMgr::LoadQuests()
|
|||
|
||||
if (found)
|
||||
{
|
||||
if (!qinfo->HasQuestFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT))
|
||||
{
|
||||
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1);
|
||||
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1);
|
||||
|
||||
// this will prevent quest completing without objective
|
||||
const_cast<Quest*>(qinfo)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
|
||||
const_cast<Quest*>(qinfo)->SetSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -4001,7 +3999,7 @@ void ObjectMgr::LoadQuests()
|
|||
{
|
||||
// In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast
|
||||
|
||||
qinfo->SetFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO);
|
||||
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO);
|
||||
|
||||
if (!qinfo->ReqCreatureOrGOCount[j])
|
||||
{
|
||||
|
|
@ -4205,10 +4203,10 @@ void ObjectMgr::LoadQuests()
|
|||
m_ExclusiveQuestGroups.insert(ExclusiveQuestGroupsMap::value_type(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
|
||||
|
||||
if (qinfo->LimitTime)
|
||||
qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED);
|
||||
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAG_TIMED);
|
||||
}
|
||||
|
||||
// check QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
|
||||
// check QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
|
||||
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
|
||||
|
|
@ -4228,15 +4226,15 @@ void ObjectMgr::LoadQuests()
|
|||
if (!quest)
|
||||
continue;
|
||||
|
||||
if (!quest->HasQuestFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT))
|
||||
{
|
||||
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest does not have SpecialFlags QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT (2) set. Quest SpecialFlags should be corrected to enable this objective.", spellInfo->Id, quest_id);
|
||||
sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest does not have SpecialFlags QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT (2) set. Quest SpecialFlags should be corrected to enable this objective.", spellInfo->Id, quest_id);
|
||||
|
||||
// The below forced alteration has been disabled because of spell 33824 / quest 10162.
|
||||
// A startup error will still occur with proper data in quest_template, but it will be possible to sucessfully complete the quest with the expected data.
|
||||
|
||||
// this will prevent quest completing without objective
|
||||
// const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
|
||||
// const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4517,12 +4515,12 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!quest->HasQuestFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", tablename, tmp.questExplored.questId, tmp.id);
|
||||
sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", tablename, tmp.questExplored.questId, tmp.id);
|
||||
|
||||
// this will prevent quest completing without objective
|
||||
const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
|
||||
const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT);
|
||||
|
||||
// continue; - quest objective requirement set and command can be allowed
|
||||
}
|
||||
|
|
@ -5424,12 +5422,12 @@ void ObjectMgr::LoadQuestAreaTriggers()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!quest->HasQuestFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT))
|
||||
{
|
||||
sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.",trigger_ID,quest_ID);
|
||||
sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.",trigger_ID,quest_ID);
|
||||
|
||||
// this will prevent quest completing without objective
|
||||
const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
|
||||
const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT);
|
||||
|
||||
// continue; - quest modified to required objective and trigger can be allowed.
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue