mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Implement racial spell "Spatial Rift" (#30583)
This commit is contained in:
11
sql/updates/world/master/2025_01_11_01_world.sql
Normal file
11
sql/updates/world/master/2025_01_11_01_world.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_spatial_rift';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(257040, 'spell_gen_spatial_rift');
|
||||
|
||||
DELETE FROM `areatrigger_template` WHERE `Id` = 16670;
|
||||
INSERT INTO `areatrigger_template` (`Id`, `IsCustom`, `Flags`, `ActionSetId`, `ActionSetFlags`, `VerifiedBuild`) VALUES
|
||||
(16670, 0, 0, 0, 0, 58238);
|
||||
|
||||
DELETE FROM `areatrigger_create_properties` WHERE `Id` = 11983;
|
||||
INSERT INTO `areatrigger_create_properties` (`Id`, `IsCustom`, `AreaTriggerId`, `IsAreaTriggerCustom`, `Flags`, `MoveCurveId`, `ScaleCurveId`, `MorphCurveId`, `FacingCurveId`, `AnimId`, `AnimKitId`, `DecalPropertiesId`, `SpellForVisuals`, `TimeToTargetScale`, `Speed`, `Shape`, `ShapeData0`, `ShapeData1`, `ShapeData2`, `ShapeData3`, `ShapeData4`, `ShapeData5`, `ShapeData6`, `ShapeData7`, `ScriptName`, `VerifiedBuild`) VALUES
|
||||
(11983, 0, 16670, 0, 0, 0, 0, 0, 0, 0, -1, 0, 256948, 8000, 18, 0, 3, 3, 0, 0, 0, 0, 0, 0, 'at_gen_spatial_rift', 58238); -- SpellForVisuals: 256948
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user