aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-06-10 20:31:33 +0200
committerShauren <shauren.trinity@gmail.com>2023-06-10 20:31:33 +0200
commit4d4c7e68935df9ca40bd5539d602ac4e779f53d5 (patch)
treecba70a6e20bb52a33815204d40d929220ac4ab0c /src/server/game/Globals/ObjectMgr.cpp
parent39bebe6a653bdd65160aa7f9fef6501d43884079 (diff)
Core/Quests: Quest flag fixups
* Update flag names * Implemented QUEST_FLAGS_COMPLETION_NO_DEATH and QUEST_FLAGS_FAIL_ON_LOGOUT * Started using QUEST_FLAGS_COMPLETION_EVENT and QUEST_FLAGS_COMPLETION_AREA_TRIGGER instead of a custom SpeclalFlag * Renamed Quest::IsAutoComplete to Quest::IsTurnIn to better describe what it means (a quest that can be turned in without accepting it to quest log) * Implemented QUEST_FLAGS_UPDATE_PHASESHIFT and removed forced phaseshift updates on every quest status change * Implemented QUEST_FLAGS_LAUNCH_GOSSIP_ACCEPT - reopens gossip menu with questgiver
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp54
1 files changed, 9 insertions, 45 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 94f0b5cd966..fb004f8b6eb 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -4645,7 +4645,7 @@ void ObjectMgr::LoadQuests()
// additional quest integrity checks (GO, creature_template and items must be loaded already)
- if (qinfo->GetQuestType() >= MAX_QUEST_TYPES)
+ if (qinfo->GetQuestType() >= MAX_DB_ALLOWED_QUEST_TYPES)
TC_LOG_ERROR("sql.sql", "Quest {} has `Method` = {}, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestType());
if (qinfo->_specialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED)
@@ -4688,7 +4688,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 )
@@ -5283,35 +5283,7 @@ void ObjectMgr::LoadQuests()
}
}
- // check QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
- for (SpellNameEntry const* spellNameEntry : sSpellNameStore)
- {
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellNameEntry->ID, DIFFICULTY_NONE);
- if (!spellInfo)
- continue;
-
- for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects())
- {
- if (spellEffectInfo.Effect != SPELL_EFFECT_QUEST_COMPLETE)
- continue;
-
- uint32 quest_id = spellEffectInfo.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: {}) have SPELL_EFFECT_QUEST_COMPLETE for quest {}, 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
// Make all paragon reward quests repeatable
for (ParagonReputationEntry const* paragonReputation : sParagonReputationStore)
@@ -5620,15 +5592,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 `{}` has quest (ID: {}) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id {}, 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.",
+ TC_LOG_ERROR("sql.sql", "Table `{}` has quest (ID: {}) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id {}, but quest not have QUEST_FLAGS_COMPLETION_EVENT or QUEST_FLAGS_COMPLETION_AREA_TRIGGER in quest flags. Script command will do nothing.",
tableName, 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)
@@ -6543,14 +6511,10 @@ void ObjectMgr::LoadQuestAreaTriggers()
continue;
}
- if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
+ if (!quest->HasFlag(QUEST_FLAGS_COMPLETION_AREA_TRIGGER) && !quest->HasQuestObjectiveType(QUEST_OBJECTIVE_AREATRIGGER))
{
- TC_LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: {}) for not quest {}, 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: {}) for not quest {}, but quest not have flag QUEST_FLAGS_COMPLETION_AREA_TRIGGER and no objective with type QUEST_OBJECTIVE_AREATRIGGER. Trigger is obsolete, skipped.", trigger_ID, quest_ID);
+ continue;
}
_questAreaTriggerStore[trigger_ID].insert(quest_ID);