Core/Quests: implement the option to cast spells upon abandoning quests (#434)

* Core/Quest: Implement a way to cast Spells on Quest Abandon.

* Core/Player: add a missing ;

* Core/Quest: moved the Abandon Spell away from a own table into quest_template_addon.
This commit is contained in:
sevi authored and GitHub committed 2023-12-01 16:07:39 +01:00
1 parent b4811b7a5d
commit 986c129bc0
5 files changed
+32 -2

No files matched your search

+19 -2
View File
@@ -4092,8 +4092,8 @@ void ObjectMgr::LoadQuests()
// 0 1 2 3 4 5 6 7 8 9
{ "ID, MaxLevel, AllowableClasses, SourceSpellID, PrevQuestID, NextQuestID, ExclusiveGroup, BreadcrumbForQuestId, RewardMailTemplateID, RewardMailDelay,"
// 10 11 12 13 14 15 16 17 18 19
" RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, SpecialFlags, AllowableRaces, TimeAllowed", "quest_template_addon", "template addons", &Quest::LoadQuestTemplateAddon },
// 10 11 12 13 14 15 16 17 18 19 20
" RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, SpecialFlags, AllowableRaces, TimeAllowed, AbandonSpellID", "quest_template_addon", "template addons", &Quest::LoadQuestTemplateAddon },
// 0 1
{ "QuestId, RewardMailSenderEntry", "quest_mail_sender", "mail sender entries", &Quest::LoadQuestMailSender }
@@ -4757,6 +4757,23 @@ void ObjectMgr::LoadQuests()
}
}
if (qinfo->_questAbandonSpell)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->_questAbandonSpell);
if (!spellInfo)
{
TC_LOG_ERROR("sql.sql", "Quest %u has `QuestAbandonSpell` = %u but spell %u doesn't exist, quest abandon Spell can't be work.",
qinfo->GetQuestId(), qinfo->_questAbandonSpell, qinfo->_questAbandonSpell);
qinfo->_questAbandonSpell = 0; // quest can't be done for this requirement
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
TC_LOG_ERROR("sql.sql", "Quest %u has `QuestAbandonSpell` = %u but spell %u is broken, quest abandon Spell can't be work",
qinfo->GetQuestId(), qinfo->_questAbandonSpell, qinfo->_questAbandonSpell);
qinfo->_questAbandonSpell = 0; // quest can't be done for this requirement
}
}
// fill additional data stores
if (uint32 prevQuestId = std::abs(qinfo->_prevQuestId))
{