diff --git a/data/sql/updates/pending_db_world/rev_1722989630849981700.sql b/data/sql/updates/pending_db_world/rev_1722989630849981700.sql new file mode 100644 index 000000000..90f862a80 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1722989630849981700.sql @@ -0,0 +1,8 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_item_skyguard_blasting_charges'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(39844, 'spell_item_skyguard_blasting_charges'); + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 39844) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 30) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 185549) AND (`ConditionValue2` = 30) AND (`ConditionValue3` = 0); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(17, 0, 39844, 0, 0, 30, 0, 185549, 30, 0, 0, 0, 0, '', ' Launch a blasting charge from your flying mount at monstrous kaliri eggs.'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 4a92e2a13..5b50c509e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -4051,6 +4051,46 @@ class spell_item_gor_dreks_ointment : public SpellScript } }; +enum Skettis +{ + QUEST_FIRES_OVER_SKETTIS = 11008 +}; + +class spell_item_skyguard_blasting_charges : public SpellScript +{ + PrepareSpellScript(spell_item_skyguard_blasting_charges); + + void HandleOpenObject(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (GameObject* go = GetHitGObj()) + go->UseDoorOrButton(); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* kaliri = GetHitUnit()) + kaliri->ToCreature()->DespawnOrUnsummon(0s, 30s); + } + + SpellCastResult CheckQuest() + { + if (Player* playerCaster = GetCaster()->ToPlayer()) + { + if (playerCaster->GetQuestStatus(QUEST_FIRES_OVER_SKETTIS) == QUEST_STATUS_INCOMPLETE) + return SPELL_CAST_OK; + } + return SPELL_FAILED_DONT_REPORT; + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_skyguard_blasting_charges::HandleOpenObject, EFFECT_1, SPELL_EFFECT_ACTIVATE_OBJECT); + OnEffectHitTarget += SpellEffectFn(spell_item_skyguard_blasting_charges::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_item_skyguard_blasting_charges::CheckQuest); + } +}; + void AddSC_item_spell_scripts() { RegisterSpellScript(spell_item_massive_seaforium_charge); @@ -4175,4 +4215,5 @@ void AddSC_item_spell_scripts() RegisterSpellAndAuraScriptPair(spell_item_eye_of_grillok, spell_item_eye_of_grillok_aura); RegisterSpellScript(spell_item_fel_mana_potion); RegisterSpellScript(spell_item_gor_dreks_ointment); + RegisterSpellScript(spell_item_skyguard_blasting_charges); }