aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 3e8fc531ac7..c414d8100eb 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -23,6 +23,8 @@
*/
#include "ScriptMgr.h"
+#include "AreaTrigger.h"
+#include "AreaTriggerAI.h"
#include "Battleground.h"
#include "BattlePetMgr.h"
#include "CellImpl.h"
@@ -40,6 +42,7 @@
#include "ObjectMgr.h"
#include "Pet.h"
#include "ReputationMgr.h"
+#include "PathGenerator.h"
#include "SkillDiscovery.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
@@ -5496,6 +5499,62 @@ class spell_gen_saddlechute : public AuraScript
}
};
+enum SpatialRiftSpells
+{
+ SPELL_SPATIAL_RIFT_TELEPORT = 257034,
+ SPELL_SPATIAL_RIFT_AREATRIGGER = 256948
+};
+
+// 257040 - Spatial Rift
+class spell_gen_spatial_rift : public SpellScript
+{
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo({ SPELL_SPATIAL_RIFT_TELEPORT, SPELL_SPATIAL_RIFT_AREATRIGGER });
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/) const
+ {
+ Unit* caster = GetCaster();
+
+ AreaTrigger* at = caster->GetAreaTrigger(SPELL_SPATIAL_RIFT_AREATRIGGER);
+ if (!at)
+ return;
+
+ caster->CastSpell(at->GetPosition(), SPELL_SPATIAL_RIFT_TELEPORT, CastSpellExtraArgsInit{
+ .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR,
+ .TriggeringSpell = GetSpell()
+ });
+
+ at->SetDuration(0);
+ }
+
+ void Register() override
+ {
+ OnEffectHit += SpellEffectFn(spell_gen_spatial_rift::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+};
+
+struct at_gen_spatial_rift : AreaTriggerAI
+{
+ using AreaTriggerAI::AreaTriggerAI;
+
+ void OnInitialize() override
+ {
+ SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(at->GetSpellId(), DIFFICULTY_NONE);
+ if (!spellInfo)
+ return;
+
+ Position destPos = at->GetPosition();
+ at->MovePositionToFirstCollision(destPos, spellInfo->GetMaxRange(), 0.0f);
+
+ PathGenerator path(at);
+ path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), true);
+
+ at->InitSplines(path.GetPath());
+ }
+};
+
void AddSC_generic_spell_scripts()
{
RegisterSpellScript(spell_gen_absorb0_hitlimit1);
@@ -5679,4 +5738,6 @@ void AddSC_generic_spell_scripts()
RegisterSpellAndAuraScriptPair(spell_bg_defending_cart_aura, spell_bg_defending_cart_aura_AuraScript);
RegisterSpellScript(spell_gen_comfortable_riders_barding);
RegisterSpellScript(spell_gen_saddlechute);
+ RegisterSpellScript(spell_gen_spatial_rift);
+ RegisterAreaTriggerAI(at_gen_spatial_rift);
}