Core/Quests: ported quest flag and visbility update changes from master branch
This commit is contained in:
1 parent
833b77c05e
commit
a3dd0d75cf
16 files changed
+282
-278
No files matched your search
@@ -4119,8 +4119,8 @@ void ObjectMgr::LoadQuests()
|
||||
|
||||
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
|
||||
|
||||
if (qinfo->GetQuestMethod() >= 3)
|
||||
TC_LOG_ERROR("sql.sql", "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
|
||||
if (qinfo->GetQuestType() >= MAX_DB_ALLOWED_QUEST_TYPES)
|
||||
TC_LOG_ERROR("sql.sql", "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestType());
|
||||
|
||||
if (qinfo->_specialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED)
|
||||
{
|
||||
@@ -4162,7 +4162,7 @@ void ObjectMgr::LoadQuests()
|
||||
}
|
||||
}
|
||||
|
||||
if (qinfo->_flags & QUEST_FLAGS_TRACKING)
|
||||
if (qinfo->_flags & QUEST_FLAGS_TRACKING_EVENT)
|
||||
{
|
||||
// at auto-reward can be rewarded only RewardChoiceItemId[0]
|
||||
for (uint32 j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j)
|
||||
@@ -4445,7 +4445,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->SetSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO);
|
||||
qinfo->SetSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO));
|
||||
|
||||
if (!qinfo->RequiredNpcOrGoCount[j])
|
||||
{
|
||||
@@ -4784,7 +4784,8 @@ void ObjectMgr::LoadQuests()
|
||||
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL);
|
||||
|
||||
// Special flag to determine if quest is completed from the start, used to determine if we can fail timed quest if it is completed
|
||||
if (!qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO | QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!qinfo->HasSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAGS_KILL | QUEST_SPECIAL_FLAGS_CAST | QUEST_SPECIAL_FLAGS_SPEAKTO)) &&
|
||||
!qinfo->HasFlag(QUEST_FLAGS_COMPLETION_AREA_TRIGGER | QUEST_FLAGS_COMPLETION_EVENT))
|
||||
{
|
||||
bool addFlag = true;
|
||||
if (qinfo->HasSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER))
|
||||
@@ -4836,35 +4837,7 @@ void ObjectMgr::LoadQuests()
|
||||
}
|
||||
}
|
||||
|
||||
// check QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
|
||||
for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
{
|
||||
if (spellInfo->Effects[j].Effect != SPELL_EFFECT_QUEST_COMPLETE)
|
||||
continue;
|
||||
|
||||
uint32 quest_id = spellInfo->Effects[j].MiscValue;
|
||||
|
||||
Quest const* quest = GetQuestTemplate(quest_id);
|
||||
|
||||
// some quest referenced in spells not exist (outdated spells)
|
||||
if (!quest)
|
||||
continue;
|
||||
|
||||
if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
|
||||
|
||||
// this will prevent quest completing without objective
|
||||
const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
// don't check spells with SPELL_EFFECT_QUEST_COMPLETE, a lot of invalid db2 data
|
||||
|
||||
TC_LOG_INFO("server.loading", ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
@@ -5033,15 +5006,11 @@ void ObjectMgr::LoadScripts(ScriptsType type)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!quest->HasFlag(QUEST_FLAGS_COMPLETION_EVENT) && !quest->HasFlag(QUEST_FLAGS_COMPLETION_AREA_TRIGGER))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",
|
||||
tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id);
|
||||
|
||||
// this will prevent quest completing without objective
|
||||
const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT);
|
||||
|
||||
// continue; - quest objective requirement set and command can be allowed
|
||||
continue;
|
||||
}
|
||||
|
||||
if (float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE)
|
||||
@@ -6007,14 +5976,10 @@ void ObjectMgr::LoadQuestAreaTriggers()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!quest->HasFlag(QUEST_FLAGS_COMPLETION_AREA_TRIGGER))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_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)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT);
|
||||
|
||||
// continue; - quest modified to required objective and trigger can be allowed.
|
||||
TC_LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_FLAGS_COMPLETION_AREA_TRIGGER. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
|
||||
continue;
|
||||
}
|
||||
|
||||
_questAreaTriggerStore[trigger_ID] = quest_ID;
|
||||
|
||||
Reference in new issue
Block a user