diff options
-rw-r--r-- | sql/updates/world/3.3.5/2021_08_09_55_world.sql | 8 | ||||
-rw-r--r-- | src/server/scripts/Outland/zone_netherstorm.cpp | 76 |
2 files changed, 81 insertions, 3 deletions
diff --git a/sql/updates/world/3.3.5/2021_08_09_55_world.sql b/sql/updates/world/3.3.5/2021_08_09_55_world.sql new file mode 100644 index 00000000000..b496ad82055 --- /dev/null +++ b/sql/updates/world/3.3.5/2021_08_09_55_world.sql @@ -0,0 +1,8 @@ +-- +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (16943,20928) AND `source_type` = 0 AND `id` IN (3,4,5); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (22348,22350,22351) AND `source_type` = 0; +UPDATE `creature_template` SET `AIName` = '' WHERE `entry` IN (22348,22350,22351); + +DELETE FROM `spell_script_names` WHERE `spell_id` = 38920 AND `ScriptName` = 'spell_detonate_teleporter'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(38920,'spell_detonate_teleporter'); diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 4d410948ae0..6afb401adf8 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -27,13 +27,11 @@ npc_commander_dawnforge EndContentData */ #include "ScriptMgr.h" -#include "GameObject.h" -#include "GameObjectAI.h" #include "Log.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" -#include "ScriptedGossip.h" +#include "SpellScript.h" /*###### ## npc_commander_dawnforge @@ -461,9 +459,81 @@ public: }; }; +/*###### +## Quest 10857: Teleport This! +######*/ + +enum DetonateTeleporter +{ + SPELL_TELEPORTER_KILL_CREDIT_1 = 38982, // 22348 + SPELL_TELEPORTER_KILL_CREDIT_2 = 38983, // 22351 + SPELL_TELEPORTER_KILL_CREDIT_3 = 38984, // 22350 + NPC_WESTERN_TELEPORTER_CREDIT = 22348, + NPC_EASTERN_TELEPORTER_CREDIT = 22351, + NPC_CENTRAL_TELEPORTER_CREDIT = 22350 +}; + +// 38920 - Detonate Teleporter +class spell_detonate_teleporter : public SpellScript +{ + PrepareSpellScript(spell_detonate_teleporter); + + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo( + { + SPELL_TELEPORTER_KILL_CREDIT_1, + SPELL_TELEPORTER_KILL_CREDIT_2, + SPELL_TELEPORTER_KILL_CREDIT_3 + }); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* creature = GetHitCreature()) + { + if (Unit* charmer = GetCaster()->GetCharmerOrOwner()) + { + if (Player* player = charmer->ToPlayer()) + { + uint32 spellId = 0; + + switch (creature->GetEntry()) + { + case NPC_WESTERN_TELEPORTER_CREDIT: + spellId = SPELL_TELEPORTER_KILL_CREDIT_1; + break; + case NPC_EASTERN_TELEPORTER_CREDIT: + spellId = SPELL_TELEPORTER_KILL_CREDIT_2; + break; + case NPC_CENTRAL_TELEPORTER_CREDIT: + spellId = SPELL_TELEPORTER_KILL_CREDIT_3; + break; + default: + return; + } + + player->CastSpell(player, spellId); + } + } + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_detonate_teleporter::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + void AddSC_netherstorm() { new npc_commander_dawnforge(); new at_commander_dawnforge(); new npc_phase_hunter(); + RegisterSpellScript(spell_detonate_teleporter); } |