fix(core/quest): improved egg collection (#12640)

* fix(core/quest): improved egg collection

* .

* Update rev_1659836460796753400.sql

* update
This commit is contained in:
Grimgravy
2022-09-25 10:46:24 -03:00
committed by GitHub
parent fbf65ebc9d
commit 7400338ecb
3 changed files with 56 additions and 0 deletions
@@ -0,0 +1,4 @@
--
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q4735_collect_rookery_egg';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(15958, 'spell_q4735_collect_rookery_egg');
@@ -4391,6 +4391,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->SpellFamilyName = SPELLFAMILY_POTION; spellInfo->SpellFamilyName = SPELLFAMILY_POTION;
}); });
// Collect Rookery Egg
ApplySpellFix({ 15958 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_1].Effect = 0;
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{ {
SpellInfo* spellInfo = mSpellInfoMap[i]; SpellInfo* spellInfo = mSpellInfoMap[i];
+46
View File
@@ -2403,6 +2403,51 @@ class spell_q5056_summon_shy_rotam : public SpellScript
} }
}; };
enum RookeryEgg
{
ITEM_COLLECTED_DRAGON_EGG = 12241,
QUEST_EGG_COLLECTION = 4735,
GO_ROOKERY_EGG = 175124
};
class spell_q4735_collect_rookery_egg : public SpellScript
{
PrepareSpellScript(spell_q4735_collect_rookery_egg);
SpellCastResult CheckCast()
{
if (GameObject* rookery = GetCaster()->FindNearestGameObject(GO_ROOKERY_EGG, 5.0f, true))
{
if (rookery->GetGoState() != GO_STATE_ACTIVE_ALTERNATIVE)
return SPELL_FAILED_BAD_TARGETS;
}
return SPELL_CAST_OK;
}
SpellCastResult CheckQuest()
{
if (Player* playerCaster = GetCaster()->ToPlayer())
{
if (playerCaster->GetQuestStatus(QUEST_EGG_COLLECTION) == QUEST_STATUS_INCOMPLETE)
return SPELL_CAST_OK;
}
return SPELL_FAILED_DONT_REPORT;
}
void HandleActiveObject(SpellEffIndex /*effIndex*/)
{
if (Player* playerCaster = GetCaster()->ToPlayer())
playerCaster->AddItem(ITEM_COLLECTED_DRAGON_EGG, 1);
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_q4735_collect_rookery_egg::CheckQuest);
OnCheckCast += SpellCheckCastFn(spell_q4735_collect_rookery_egg::CheckCast);
OnEffectHit += SpellEffectFn(spell_q4735_collect_rookery_egg::HandleActiveObject, EFFECT_0, SPELL_EFFECT_ACTIVATE_OBJECT);
}
};
void AddSC_quest_spell_scripts() void AddSC_quest_spell_scripts()
{ {
RegisterSpellAndAuraScriptPair(spell_q11065_wrangle_some_aether_rays, spell_q11065_wrangle_some_aether_rays_aura); RegisterSpellAndAuraScriptPair(spell_q11065_wrangle_some_aether_rays, spell_q11065_wrangle_some_aether_rays_aura);
@@ -2473,4 +2518,5 @@ void AddSC_quest_spell_scripts()
RegisterSpellScript(spell_q12919_gymers_grab); RegisterSpellScript(spell_q12919_gymers_grab);
RegisterSpellScript(spell_q12919_gymers_throw); RegisterSpellScript(spell_q12919_gymers_throw);
RegisterSpellScript(spell_q5056_summon_shy_rotam); RegisterSpellScript(spell_q5056_summon_shy_rotam);
RegisterSpellScript(spell_q4735_collect_rookery_egg);
} }