aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp276
1 files changed, 135 insertions, 141 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index e3828d7930b..1e2cfed0166 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -4012,7 +4012,7 @@ void ObjectMgr::LoadQuests()
_questTemplates[newQuest->GetQuestId()] = newQuest;
} while (result->NextRow());
- std::map<uint32, uint32> usedMailTemplates;
+ std::unordered_map<uint32, uint32> usedMailTemplates;
// Load `quest_details`
// 0 1 2 3 4 5 6 7 8
@@ -4109,258 +4109,260 @@ void ObjectMgr::LoadQuests()
}
// Post processing
- for (QuestMap::iterator iter = _questTemplates.begin(); iter != _questTemplates.end(); ++iter)
+ for (auto iter = _questTemplates.begin(); iter != _questTemplates.end(); ++iter)
{
// skip post-loading checks for disabled quests
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, nullptr))
continue;
- Quest * qinfo = iter->second;
+ Quest* qinfo = iter->second;
// 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->SpecialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED)
+ if (qinfo->_specialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
- qinfo->GetQuestId(), qinfo->SpecialFlags, QUEST_SPECIAL_FLAGS_DB_ALLOWED);
- qinfo->SpecialFlags &= QUEST_SPECIAL_FLAGS_DB_ALLOWED;
+ qinfo->GetQuestId(), qinfo->_specialFlags, QUEST_SPECIAL_FLAGS_DB_ALLOWED);
+ qinfo->_specialFlags &= QUEST_SPECIAL_FLAGS_DB_ALLOWED;
}
- if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY)
+ if (qinfo->_flags & QUEST_FLAGS_DAILY && qinfo->_flags & QUEST_FLAGS_WEEKLY)
{
TC_LOG_ERROR("sql.sql", "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId());
- qinfo->Flags &= ~QUEST_FLAGS_DAILY;
+ qinfo->_flags &= ~QUEST_FLAGS_DAILY;
}
- if (qinfo->Flags & QUEST_FLAGS_DAILY)
+ if (qinfo->_flags & QUEST_FLAGS_DAILY)
{
- if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE))
+ if (!(qinfo->_specialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE))
{
TC_LOG_ERROR("sql.sql", "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
- qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE;
+ qinfo->_specialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE;
}
}
- if (qinfo->Flags & QUEST_FLAGS_WEEKLY)
+ if (qinfo->_flags & QUEST_FLAGS_WEEKLY)
{
- if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE))
+ if (!(qinfo->_specialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE))
{
TC_LOG_ERROR("sql.sql", "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
- qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE;
+ qinfo->_specialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE;
}
}
- if (qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_MONTHLY)
+ if (qinfo->_specialFlags & QUEST_SPECIAL_FLAGS_MONTHLY)
{
- if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE))
+ if (!(qinfo->_specialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE))
{
TC_LOG_ERROR("sql.sql", "Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
- qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE;
+ qinfo->_specialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE;
}
}
- if (qinfo->Flags & QUEST_FLAGS_TRACKING)
+ if (qinfo->_flags & QUEST_FLAGS_TRACKING)
{
// at auto-reward can be rewarded only RewardChoiceItemId[0]
- for (int j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j )
+ for (uint32 j = 1; j < QUEST_REWARD_CHOICES_COUNT; ++j)
{
if (uint32 id = qinfo->RewardChoiceItemId[j])
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_TRACKING.",
- qinfo->GetQuestId(), j+1, id, j+1);
+ qinfo->GetQuestId(), j + 1, id, j + 1);
// no changes, quest ignore this data
}
}
}
// client quest log visual (area case)
- if (qinfo->ZoneOrSort > 0)
+ if (qinfo->_zoneOrSort > 0)
{
- if (!sAreaTableStore.LookupEntry(qinfo->ZoneOrSort))
+ if (!sAreaTableStore.LookupEntry(qinfo->_zoneOrSort))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.",
- qinfo->GetQuestId(), qinfo->ZoneOrSort);
+ qinfo->GetQuestId(), qinfo->_zoneOrSort);
// no changes, quest not dependent from this value but can have problems at client
}
}
// client quest log visual (sort case)
- if (qinfo->ZoneOrSort < 0)
+ if (qinfo->_zoneOrSort < 0)
{
- QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort));
+ QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->_zoneOrSort));
if (!qSort)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.",
- qinfo->GetQuestId(), qinfo->ZoneOrSort);
+ qinfo->GetQuestId(), qinfo->_zoneOrSort);
// no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check)
}
//check for proper RequiredSkillId value (skill case)
- if (uint32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort)))
+ if (uint32 skill_id = SkillByQuestSort(-qinfo->_zoneOrSort))
{
- if (qinfo->RequiredSkillId != skill_id)
+ if (qinfo->_requiredSkillId != skill_id)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).",
- qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id);
+ qinfo->GetQuestId(), qinfo->_zoneOrSort, skill_id);
//override, and force proper value here?
}
}
}
// RequiredClasses, can be 0/CLASSMASK_ALL_PLAYABLE to allow any class
- if (qinfo->RequiredClasses)
+ if (qinfo->_requiredClasses)
{
- if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE))
+ if (!(qinfo->_requiredClasses & CLASSMASK_ALL_PLAYABLE))
{
- TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
- qinfo->RequiredClasses = 0;
+ TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->_requiredClasses);
+ qinfo->_requiredClasses = 0;
}
}
+
// AllowableRaces, can be 0/RACEMASK_ALL_PLAYABLE to allow any race
- if (qinfo->AllowableRaces)
+ if (qinfo->_allowableRaces)
+ {
+ if (!(qinfo->_allowableRaces & RACEMASK_ALL_PLAYABLE))
{
- if (!(qinfo->AllowableRaces & RACEMASK_ALL_PLAYABLE))
- {
- TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable races in `AllowableRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->AllowableRaces);
- qinfo->AllowableRaces = 0;
- }
+ TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable races in `AllowableRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->_allowableRaces);
+ qinfo->_allowableRaces = 0;
}
+ }
+
// RequiredSkillId, can be 0
- if (qinfo->RequiredSkillId)
+ if (qinfo->_requiredSkillId)
{
- if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId))
+ if (!sSkillLineStore.LookupEntry(qinfo->_requiredSkillId))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillId` = %u but this skill does not exist",
- qinfo->GetQuestId(), qinfo->RequiredSkillId);
+ qinfo->GetQuestId(), qinfo->_requiredSkillId);
}
}
- if (qinfo->RequiredSkillPoints)
+ if (qinfo->_requiredSkillPoints)
{
- if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue())
+ if (qinfo->_requiredSkillPoints > sWorld->GetConfigMaxSkillValue())
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue());
+ qinfo->GetQuestId(), qinfo->_requiredSkillPoints, sWorld->GetConfigMaxSkillValue());
// no changes, quest can't be done for this requirement
}
}
// else Skill quests can have 0 skill level, this is ok
- if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2))
+ if (qinfo->_requiredFactionId2 && !sFactionStore.LookupEntry(qinfo->_requiredFactionId2))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2);
+ qinfo->GetQuestId(), qinfo->_requiredFactionId2, qinfo->_requiredFactionId2);
// no changes, quest can't be done for this requirement
}
- if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1))
+ if (qinfo->_requiredFactionId1 && !sFactionStore.LookupEntry(qinfo->_requiredFactionId1))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1);
+ qinfo->GetQuestId(), qinfo->_requiredFactionId1, qinfo->_requiredFactionId1);
// no changes, quest can't be done for this requirement
}
- if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction))
+ if (qinfo->_requiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->_requiredMinRepFaction))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction);
+ qinfo->GetQuestId(), qinfo->_requiredMinRepFaction, qinfo->_requiredMinRepFaction);
// no changes, quest can't be done for this requirement
}
- if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction))
+ if (qinfo->_requiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->_requiredMaxRepFaction))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction);
+ qinfo->GetQuestId(), qinfo->_requiredMaxRepFaction, qinfo->_requiredMaxRepFaction);
// no changes, quest can't be done for this requirement
}
- if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap)
+ if (qinfo->_requiredMinRepValue && qinfo->_requiredMinRepValue > ReputationMgr::Reputation_Cap)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap);
+ qinfo->GetQuestId(), qinfo->_requiredMinRepValue, ReputationMgr::Reputation_Cap);
// no changes, quest can't be done for this requirement
}
- if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue)
+ if (qinfo->_requiredMinRepValue && qinfo->_requiredMaxRepValue && qinfo->_requiredMaxRepValue <= qinfo->_requiredMinRepValue)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
- qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue);
+ qinfo->GetQuestId(), qinfo->_requiredMaxRepValue, qinfo->_requiredMinRepValue);
// no changes, quest can't be done for this requirement
}
- if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0)
+ if (!qinfo->_requiredFactionId1 && qinfo->_requiredFactionValue1 != 0)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect",
- qinfo->GetQuestId(), qinfo->RequiredFactionValue1);
+ qinfo->GetQuestId(), qinfo->_requiredFactionValue1);
// warning
}
- if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0)
+ if (!qinfo->_requiredFactionId2 && qinfo->_requiredFactionValue2 != 0)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect",
- qinfo->GetQuestId(), qinfo->RequiredFactionValue2);
+ qinfo->GetQuestId(), qinfo->_requiredFactionValue2);
// warning
}
- if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0)
+ if (!qinfo->_requiredMinRepFaction && qinfo->_requiredMinRepValue != 0)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
- qinfo->GetQuestId(), qinfo->RequiredMinRepValue);
+ qinfo->GetQuestId(), qinfo->_requiredMinRepValue);
// warning
}
- if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0)
+ if (!qinfo->_requiredMaxRepFaction && qinfo->_requiredMaxRepValue != 0)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
- qinfo->GetQuestId(), qinfo->RequiredMaxRepValue);
+ qinfo->GetQuestId(), qinfo->_requiredMaxRepValue);
// warning
}
- if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId))
+ if (qinfo->_rewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->_rewardTitleId))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId());
- qinfo->RewardTitleId = 0;
+ qinfo->_rewardTitleId = 0;
// quest can't reward this title
}
- if (qinfo->StartItem)
+ if (qinfo->_startItem)
{
- if (!sObjectMgr->GetItemTemplate(qinfo->StartItem))
+ if (!sObjectMgr->GetItemTemplate(qinfo->_startItem))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `StartItem` = %u but item with entry %u does not exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->StartItem, qinfo->StartItem);
- qinfo->StartItem = 0; // quest can't be done for this requirement
+ qinfo->GetQuestId(), qinfo->_startItem, qinfo->_startItem);
+ qinfo->_startItem = 0; // quest can't be done for this requirement
}
- else if (qinfo->StartItemCount == 0)
+ else if (qinfo->_startItemCount == 0)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `StartItem` = %u but `StartItemCount` = 0, set to 1 but need fix in DB.",
- qinfo->GetQuestId(), qinfo->StartItem);
- qinfo->StartItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB
+ qinfo->GetQuestId(), qinfo->_startItem);
+ qinfo->_startItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB
}
}
- else if (qinfo->StartItemCount>0)
+ else if (qinfo->_startItemCount > 0)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `StartItem` = 0 but `StartItemCount` = %u, useless value.",
- qinfo->GetQuestId(), qinfo->StartItemCount);
- qinfo->StartItemCount=0; // no quest work changes in fact
+ qinfo->GetQuestId(), qinfo->_startItemCount);
+ qinfo->_startItemCount = 0; // no quest work changes in fact
}
- if (qinfo->SourceSpellid)
+ if (qinfo->_sourceSpellid)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->_sourceSpellid);
if (!spellInfo)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.",
- qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid);
- qinfo->SourceSpellid = 0; // quest can't be done for this requirement
+ qinfo->GetQuestId(), qinfo->_sourceSpellid, qinfo->_sourceSpellid);
+ qinfo->_sourceSpellid = 0; // quest can't be done for this requirement
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.",
- qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid);
- qinfo->SourceSpellid = 0; // quest can't be done for this requirement
+ qinfo->GetQuestId(), qinfo->_sourceSpellid, qinfo->_sourceSpellid);
+ qinfo->_sourceSpellid = 0; // quest can't be done for this requirement
}
}
@@ -4512,7 +4514,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RewardFactionId[j])
{
- if (abs(qinfo->RewardFactionValueId[j]) > 9)
+ if (std::abs(qinfo->RewardFactionValueId[j]) > 9)
{
TC_LOG_ERROR("sql.sql", "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]);
}
@@ -4531,126 +4533,118 @@ void ObjectMgr::LoadQuests()
}
}
- if (qinfo->RewardDisplaySpell)
+ if (qinfo->_rewardDisplaySpell)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardDisplaySpell);
-
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->_rewardDisplaySpell);
if (!spellInfo)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u does not exist, spell removed as display reward.",
- qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell);
- qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest
+ qinfo->GetQuestId(), qinfo->_rewardDisplaySpell, qinfo->_rewardDisplaySpell);
+ qinfo->_rewardDisplaySpell = 0; // no spell reward will display for this quest
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is broken, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell);
- qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest
+ qinfo->GetQuestId(), qinfo->_rewardDisplaySpell, qinfo->_rewardDisplaySpell);
+ qinfo->_rewardDisplaySpell = 0; // no spell reward will display for this quest
}
- else if (GetTalentSpellCost(qinfo->RewardDisplaySpell))
+ else if (GetTalentSpellCost(qinfo->_rewardDisplaySpell))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell);
- qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest
+ qinfo->GetQuestId(), qinfo->_rewardDisplaySpell, qinfo->_rewardDisplaySpell);
+ qinfo->_rewardDisplaySpell = 0; // no spell reward will display for this quest
}
}
- if (qinfo->RewardSpell > 0)
+ if (qinfo->_rewardSpell > 0)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewardSpell);
-
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->_rewardSpell);
if (!spellInfo)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u does not exist, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
- qinfo->RewardSpell = 0; // no spell will be cast on player
+ qinfo->GetQuestId(), qinfo->_rewardSpell, qinfo->_rewardSpell);
+ qinfo->_rewardSpell = 0; // no spell will be cast on player
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
- qinfo->RewardSpell = 0; // no spell will be cast on player
+ qinfo->GetQuestId(), qinfo->_rewardSpell, qinfo->_rewardSpell);
+ qinfo->_rewardSpell = 0; // no spell will be cast on player
}
- else if (GetTalentSpellCost(qinfo->RewardSpell))
+ else if (GetTalentSpellCost(qinfo->_rewardSpell))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.",
- qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
- qinfo->RewardSpell = 0; // no spell will be cast on player
+ qinfo->GetQuestId(), qinfo->_rewardSpell, qinfo->_rewardSpell);
+ qinfo->_rewardSpell = 0; // no spell will be cast on player
}
}
- if (qinfo->RewardMailTemplateId)
+ if (qinfo->_rewardMailTemplateId)
{
- if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId))
+ if (!sMailTemplateStore.LookupEntry(qinfo->_rewardMailTemplateId))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.",
- qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId);
- qinfo->RewardMailTemplateId = 0; // no mail will send to player
- qinfo->RewardMailDelay = 0; // no mail will send to player
- qinfo->RewardMailSenderEntry = 0;
+ qinfo->GetQuestId(), qinfo->_rewardMailTemplateId, qinfo->_rewardMailTemplateId);
+ qinfo->_rewardMailTemplateId = 0; // no mail will send to player
+ qinfo->_rewardMailDelay = 0; // no mail will send to player
+ qinfo->_rewardMailSenderEntry = 0;
}
- else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end())
+ else if (usedMailTemplates.find(qinfo->_rewardMailTemplateId) != usedMailTemplates.end())
{
- std::map<uint32, uint32>::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId);
+ auto used_mt_itr = usedMailTemplates.find(qinfo->_rewardMailTemplateId);
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.",
- qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second);
- qinfo->RewardMailTemplateId = 0; // no mail will send to player
- qinfo->RewardMailDelay = 0; // no mail will send to player
- qinfo->RewardMailSenderEntry = 0;
+ qinfo->GetQuestId(), qinfo->_rewardMailTemplateId, qinfo->_rewardMailTemplateId, used_mt_itr->second);
+ qinfo->_rewardMailTemplateId = 0; // no mail will send to player
+ qinfo->_rewardMailDelay = 0; // no mail will send to player
+ qinfo->_rewardMailSenderEntry = 0;
}
else
- usedMailTemplates[qinfo->RewardMailTemplateId] = qinfo->GetQuestId();
+ usedMailTemplates.emplace(qinfo->_rewardMailTemplateId, qinfo->GetQuestId());
}
- if (qinfo->RewardNextQuest)
+ if (qinfo->_rewardNextQuest)
{
- QuestMap::iterator qNextItr = _questTemplates.find(qinfo->RewardNextQuest);
+ auto qNextItr = _questTemplates.find(qinfo->_rewardNextQuest);
if (qNextItr == _questTemplates.end())
{
TC_LOG_ERROR("sql.sql", "Quest %u has `RewardNextQuest` = %u but quest %u does not exist, quest chain will not work.",
- qinfo->GetQuestId(), qinfo->RewardNextQuest, qinfo->RewardNextQuest);
- qinfo->RewardNextQuest = 0;
+ qinfo->GetQuestId(), qinfo->_rewardNextQuest, qinfo->_rewardNextQuest);
+ qinfo->_rewardNextQuest = 0;
}
else
- qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId());
+ qNextItr->second->PrevChainQuests.push_back(qinfo->GetQuestId());
}
// fill additional data stores
- if (qinfo->PrevQuestId)
+ if (qinfo->_prevQuestId)
{
- if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end())
- {
- TC_LOG_ERROR("sql.sql", "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId());
- }
+ if (_questTemplates.find(std::abs(qinfo->_prevQuestId)) == _questTemplates.end())
+ TC_LOG_ERROR("sql.sql", "Quest %u has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->_prevQuestId);
else
- {
- qinfo->prevQuests.push_back(qinfo->PrevQuestId);
- }
+ qinfo->PrevQuests.push_back(qinfo->_prevQuestId);
}
- if (qinfo->NextQuestId)
+ if (qinfo->_nextQuestId)
{
- QuestMap::iterator qNextItr = _questTemplates.find(abs(qinfo->GetNextQuestId()));
+ auto qNextItr = _questTemplates.find(std::abs(qinfo->GetNextQuestId()));
if (qNextItr == _questTemplates.end())
- {
- TC_LOG_ERROR("sql.sql", "Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
- }
+ TC_LOG_ERROR("sql.sql", "Quest %u has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
else
{
- int32 signedQuestId = qinfo->NextQuestId < 0 ? -int32(qinfo->GetQuestId()) : int32(qinfo->GetQuestId());
- qNextItr->second->prevQuests.push_back(signedQuestId);
+ int32 signedQuestId = qinfo->_nextQuestId < 0 ? -int32(qinfo->GetQuestId()) : int32(qinfo->GetQuestId());
+ qNextItr->second->PrevQuests.push_back(signedQuestId);
}
}
- if (qinfo->ExclusiveGroup)
- mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
- if (qinfo->TimeAllowed)
+ if (qinfo->_exclusiveGroup)
+ mExclusiveQuestGroups.emplace(qinfo->_exclusiveGroup, qinfo->GetQuestId());
+ if (qinfo->_timeAllowed)
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_TIMED);
- if (qinfo->RequiredPlayerKills)
+ if (qinfo->_requiredPlayerKills)
qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_PLAYER_KILL);
}