aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroffl <11556157+offl@users.noreply.github.com>2021-08-10 11:18:28 +0300
committerGitHub <noreply@github.com>2021-08-10 10:18:28 +0200
commit8186e6deca7a42403db8b45b341c655cec9c8a73 (patch)
tree0c20b95a7da4e12155ebdc8d61f9d30dc4211886 /src
parentc7ae9d761a3c9a7523d4bd195979f294f8c9e7cd (diff)
Scripts/Spells: Fix support for 'Teleport This!' (10857) (#26789)
Co-authored-by: offl <offl@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Outland/zone_netherstorm.cpp76
1 files changed, 73 insertions, 3 deletions
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);
}