diff options
3 files changed, 481 insertions, 0 deletions
diff --git a/sql/updates/world/master/2025_10_18_01_world.sql b/sql/updates/world/master/2025_10_18_01_world.sql new file mode 100644 index 00000000000..f733152ec18 --- /dev/null +++ b/sql/updates/world/master/2025_10_18_01_world.sql @@ -0,0 +1,116 @@ +SET @CGUID := 8000869; +SET @OGUID := 8000133; +SET @WORLD_SAFE_LOC_ID := 100105; +SET @SPAWN_GROUP := 1275; + +SET @AT_WIDTH := 25; +SET @AT_LENGTH := 30; +SET @AT_HEIGHT := 15; +SET @AT_ID := 175; +SET @AT_PROP_ID := 168; +SET @AT_SPAWN_ID = 272; + +DELETE FROM `areatrigger_template` WHERE `Id` = @AT_ID AND `IsCustom` = 1; +INSERT INTO `areatrigger_template` (`Id`, `IsCustom`) VALUES +(@AT_ID, 1); + +DELETE FROM `areatrigger_create_properties` WHERE `Id` = @AT_PROP_ID AND `IsCustom` = 1; +INSERT INTO `areatrigger_create_properties` (`Id`, `IsCustom`, `AreaTriggerId`, `IsAreatriggerCustom`, `Shape`, `ShapeData0`, `ShapeData1`, `ShapeData2`, `ShapeData3`, `ShapeData4`, `ShapeData5`, `ShapeData6`, `ShapeData7`) VALUES +(@AT_PROP_ID, 1, @AT_ID, 1, 1, @AT_LENGTH, @AT_WIDTH, @AT_HEIGHT, @AT_LENGTH, @AT_WIDTH, @AT_HEIGHT, 0, 0); + +DELETE FROM `areatrigger_template_actions` WHERE `AreaTriggerId` = @AT_ID AND `IsCustom` = 1; +INSERT INTO `areatrigger_template_actions` (`AreaTriggerId`, `IsCustom`, `ActionType`, `ActionParam`, `TargetType`) VALUES +(@AT_ID, 1, 0, 228212, 0); -- Arena Starting Area Marker + +DELETE FROM `areatrigger` WHERE `SpawnId` BETWEEN @AT_SPAWN_ID+0 AND @AT_SPAWN_ID+1; +INSERT INTO `areatrigger` (`SpawnId`, `AreaTriggerCreatePropertiesId`, `IsCustom`, `MapId`, `PosX`, `PosY`, `PosZ`, `Orientation`, `Comment`) VALUES +(@AT_SPAWN_ID+0, @AT_PROP_ID, 1, 2547, 367, 265.875, 97.10447, 3.1415927, 'Enigma Crucible - Entrance Purple'), -- 370 265 95 +(@AT_SPAWN_ID+1, @AT_PROP_ID, 1, 2547, 160, 268.20486, 100.78489, 0, 'Enigma Crucible - Entrance Gold'); -- 155 268 97 +1 + +DELETE FROM `world_safe_locs` WHERE `ID` BETWEEN @WORLD_SAFE_LOC_ID + 0 AND @WORLD_SAFE_LOC_ID + 1; +INSERT INTO `world_safe_locs` (`ID`, `MapID`, `LocX`, `LocY`, `LocZ`, `Facing`, `Comment`) VALUES +(@WORLD_SAFE_LOC_ID+0, 2547, 358.15277, 265.875, 95.10447, DEGREES(3.1415927), 'Enigma Crucible - Purple Team'), +(@WORLD_SAFE_LOC_ID+1, 2547, 167.88716, 268.20486, 97.78489, DEGREES(0), 'Enigma Crucible - Gold Team'); + +DELETE FROM `battleground_scripts` WHERE `MapId` = 2547 AND `BattlemasterListId` = 0; +INSERT INTO `battleground_scripts` (`MapId`, `BattlemasterListId`, `ScriptName`) VALUES +(2547, 0, 'arena_enigma_crucible'); + +DELETE FROM `battleground_template` WHERE `ID` = 1076; +INSERT INTO `battleground_template` (`ID`, `AllianceStartLoc`, `HordeStartLoc`, `StartMaxDist`, `Weight`, `Comment`) VALUES +(1076, @WORLD_SAFE_LOC_ID+0, @WORLD_SAFE_LOC_ID+1, 0, 1, 'Enigma Crucible'); + +DELETE FROM `gameobject_template_addon` WHERE `entry` IN (376125 /*Enigma Arena - Door*/, 376877 /*ProgenitorArena_Button01*/, 376876 /*Enigma Arena Door 01*/, 376866 /*ProgenitorArena_Button_Trim*/, 376861 /*Enigma Arena Door 02*/); +INSERT INTO `gameobject_template_addon` (`entry`, `faction`, `flags`, `WorldEffectID`, `AIAnimKitID`) VALUES +(376125, 114, 0x0, 0, 0), -- Enigma Arena - Door +(376877, 0, 0x10000000, 0, 0), -- ProgenitorArena_Button01 +(376876, 0, 0x20, 0, 0), -- Enigma Arena Door 01 +(376866, 0, 0x10000000, 0, 0), -- ProgenitorArena_Button_Trim +(376861, 0, 0x20, 0, 0); -- Enigma Arena Door 02 + +DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+0; +INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnDifficulties`, `PhaseId`, `PhaseGroup`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `MovementType`, `npcflag`, `unit_flags`, `unit_flags2`, `unit_flags3`, `VerifiedBuild`) VALUES +(@CGUID+0, 188479, 2547, 14083, 14083, '0', '0', 0, 0, 0, 218.295135498046875, 373.328125, 115.2203521728515625, 5.345910549163818359, 7200, 0, 0, 0, NULL, NULL, NULL, NULL, 63305); -- Zo'sorg (Area: Enigma Crucible - Difficulty: 0) CreateObject1 (Auras: ) + +DELETE FROM `creature_addon` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+0; + +DELETE FROM `creature_template_addon` WHERE `entry` IN (188479 /*188479 (Zo'sorg)*/); +INSERT INTO `creature_template_addon` (`entry`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES +(188479, 0, 0, 0, 3, 0, 1, 0, 0, 12224, 0, 0, 0, ''); -- 188479 (Zo'sorg) + +DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+7; +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnDifficulties`, `PhaseId`, `PhaseGroup`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES +(@OGUID+0, 376861, 2547, 14083, 14083, '0', '0', 0, 336.84027099609375, 266.173614501953125, 90.4921875, 0, 0, 0, 0, 1, 7200, 255, 1, 63305), -- Enigma Arena Door 02 (Area: Enigma Crucible - Difficulty: 0) CreateObject1 +(@OGUID+1, 376866, 2547, 14083, 14083, '0', '0', 0, 266.302093505859375, 266.734375, 89.8592529296875, 0, 0, 0, 0, 1, 7200, 255, 1, 63305), -- ProgenitorArena_Button_Trim (Area: Enigma Crucible - Difficulty: 0) CreateObject1 +(@OGUID+2, 376876, 2547, 14083, 14083, '0', '0', 0, 188.095489501953125, 266.3663330078125, 92.7468109130859375, 0, 0, 0, 0, 1, 7200, 255, 1, 63305), -- Enigma Arena Door 01 (Area: Enigma Crucible - Difficulty: 0) CreateObject1 +(@OGUID+3, 376877, 2547, 14083, 14083, '0', '0', 0, 266.302093505859375, 266.734375, 89.80551910400390625, 0, 0, 0, 0, 1, 7200, 255, 0, 63305), -- ProgenitorArena_Button01 (Area: Enigma Crucible - Difficulty: 0) CreateObject1 +(@OGUID+4, 376125, 2547, 14083, 14083, '0', '0', 0, 336.744781494140625, 265.102447509765625, 90.0426025390625, 0, 0, 0, 0, 1, 7200, 255, 1, 63305), -- Enigma Arena - Door (Area: Enigma Crucible - Difficulty: 0) CreateObject2 +(@OGUID+5, 376125, 2547, 14083, 14083, '0', '0', 0, 185.748260498046875, 268.041656494140625, 93.93752288818359375, 0, 0, 0, 0, 1, 7200, 255, 1, 63305), -- Enigma Arena - Door (Area: Enigma Crucible - Difficulty: 0) CreateObject1 +(@OGUID+6, 184663, 2547, 14083, 14083, '0', '0', 0, 265.744781494140625, 199.90625, 89.2678985595703125, 0, 0, 0, 0, 1, 360, 255, 1, 63305), -- Shadow Sight (Area: Enigma Crucible - Difficulty: 0) CreateObject2 +(@OGUID+7, 184663, 2547, 14083, 14083, '0', '0', 0, 265.467010498046875, 334.057281494140625, 89.2678985595703125, 0, 0, 0, 0, 1, 360, 255, 1, 63305); -- Shadow Sight (Area: Enigma Crucible - Difficulty: 0) CreateObject2 + +DELETE FROM `gameobject_addon` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+7; + +DELETE FROM `creature_template_addon` WHERE `entry` IN (185800 /*185800 (Past Self)*/, 188479 /*188479 (Zo'sorg)*/); +INSERT INTO `creature_template_addon` (`entry`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES +(185800, 0, 0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0, ''), -- 185800 (Past Self) +(188479, 0, 0, 0, 3, 0, 1, 0, 0, 12224, 0, 0, 0, ''); -- 188479 (Zo'sorg) + +UPDATE `creature_template_difficulty` SET `ContentTuningID`=807, `StaticFlags1`=0x20000000, `VerifiedBuild`=63305 WHERE (`Entry`=188479 AND `DifficultyID`=0); -- 188479 (Zo'sorg) - Floating +UPDATE `creature_template` SET `faction`=35, `BaseAttackTime`=2000, `unit_flags`=0x2000000, `unit_flags2`=0x800 WHERE `entry`=188479; -- Zo'sorg + +DELETE FROM `creature_text` WHERE `CreatureID` IN (188479); +INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES +(188479, 0, 0, 'Mortals, I present a lucrative opportunity for those who prove themselves worthy of the task.', 12, 0, 100, 1, 0, 188957, 214980, 3, 'Zo\'sorg'), +(188479, 1, 0, 'Many in the cartel are wagering on who are the greater combatants. Care to influence the outcome?', 12, 0, 100, 0, 0, 188958, 214991, 3, 'Zo\'sorg'), +(188479, 2, 0, 'Do not let the cartel down, we expect a return on our investment.', 12, 0, 100, 0, 0, 188954, 214995, 3, 'Zo\'sorg'), +(188479, 3, 0, 'Victory is clear, our bargain is upheld.', 12, 0, 100, 0, 0, 188955, 214998, 3, 'Zo\'sorg to Player'), +(188479, 3, 1, 'No matter who wins, we profit.', 12, 0, 100, 0, 0, 188956, 215067, 3, 'Zo\'sorg to Player'); + +DELETE FROM `spawn_group_template` WHERE `groupId` BETWEEN @SPAWN_GROUP+0 AND @SPAWN_GROUP+1; +INSERT INTO `spawn_group_template` (`groupId`, `groupName`, `groupFlags`) VALUES +(@SPAWN_GROUP+0, 'Enigma Crucible - Shadow sight', 0x20), +(@SPAWN_GROUP+1, 'Enigma Crucible - Collision Walls', 0x20); + +DELETE FROM `spawn_group` WHERE `groupId` BETWEEN @SPAWN_GROUP+0 AND @SPAWN_GROUP+1; +INSERT INTO `spawn_group` (`groupId`, `spawnType`, `spawnId`) VALUES +(@SPAWN_GROUP, 1, @OGUID+6), +(@SPAWN_GROUP, 1, @OGUID+7), +(@SPAWN_GROUP+1, 1, @OGUID+4), +(@SPAWN_GROUP+1, 1, @OGUID+5); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 33 AND `SourceEntry` BETWEEN @SPAWN_GROUP+0 AND @SPAWN_GROUP+1;; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceEntry`, `SourceGroup`, `ConditionTypeOrReference`, `ConditionValue1`, `ScriptName`) VALUES +(33, @SPAWN_GROUP, 0, 0, 0, 'condition_is_shadow_sight_enabled'), +(33, @SPAWN_GROUP+1, 0, 0, 0, 'condition_enigma_arena_collision_doors'); + +DELETE FROM `spell_proc` WHERE `SpellId` IN (371601); +INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`ProcFlags2`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES +(371601,0x00,0,0x00000000,0x00000000,0x00000000,0x00000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0,0,0,0); -- Enigma Arena Reaction Trigger + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_enigma_arena_reaction_trigger', 'spell_enigma_arena_reaction_trigger_low_health', 'spell_enigma_arena_warning_countdown', 'spell_enigma_arena_warning_teleport'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(371602, 'spell_enigma_arena_reaction_trigger_low_health'), +(371601, 'spell_enigma_arena_reaction_trigger'), +(370437, 'spell_enigma_arena_warning_countdown'), +(371319, 'spell_enigma_arena_warning_teleport'); diff --git a/src/server/scripts/Battlegrounds/EnigmaCrucible/arena_enigma_crucible.cpp b/src/server/scripts/Battlegrounds/EnigmaCrucible/arena_enigma_crucible.cpp new file mode 100644 index 00000000000..f8765e39769 --- /dev/null +++ b/src/server/scripts/Battlegrounds/EnigmaCrucible/arena_enigma_crucible.cpp @@ -0,0 +1,363 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "Battleground.h" +#include "BattlegroundScript.h" +#include "ConditionMgr.h" +#include "Containers.h" +#include "Conversation.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" +#include "Map.h" +#include "Player.h" +#include "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "SpellScript.h" + +namespace EnigmaCrucible +{ + namespace Actions + { + static constexpr uint32 ReactionTrigger = 1; + static constexpr uint32 ReactionDead = 2; + } + + namespace Creatures + { + static constexpr uint32 ZoSorg = 188479; + } + + namespace GameObjects + { + static constexpr uint32 Door01 = 376876; + static constexpr uint32 Door02 = 376861; + } + + namespace MapIds + { + static constexpr uint32 EnigmaCrucible = 2547; + } + + namespace Positions + { + static constexpr Position PurpleWarningTeleport = { 327.70486f, 278.69965f, 90.0686f, 3.1415927f }; + static constexpr Position GoldWarningTeleport = { 201.601f, 268.516f, 90.0686f, 0.0f }; + } + + namespace Spells + { + static constexpr uint32 ArenaLowHealthCooldownAura = 234031; + static constexpr uint32 EnigmaArenaVOCooldownAura = 371330; + static constexpr uint32 EnigmaArenaReactionTrigger = 371601; + static constexpr uint32 Warning = 370437; + static constexpr uint32 WarningTeleport = 371319; + static constexpr uint32 ArenaStartingAreaMarker = 228212; + } + + namespace Texts + { + namespace ZoSorg + { + static constexpr uint8 Prepare = 0; + static constexpr uint8 Prepare2 = 1; + static constexpr uint8 Start = 2; + static constexpr uint8 ReactionTrigger = 3; + } + } +} + +struct arena_enigma_crucible : ArenaScript +{ + explicit arena_enigma_crucible(BattlegroundMap* map) : ArenaScript(map) { } + + void OnUpdate(uint32 diff) override + { + _scheduler.Update(diff); + } + + void OnStart() override + { + for (ObjectGuid const& guid : _doorGUIDs) + { + if (GameObject* door = battlegroundMap->GetGameObject(guid)) + { + door->UseDoorOrButton(); + door->DespawnOrUnsummon(5s); + } + } + + if (Creature const* creature = battlegroundMap->GetCreature(_zoSorgGUID)) + creature->AI()->Talk(EnigmaCrucible::Texts::ZoSorg::Start); + + _scheduler.Schedule(10s, [&](TaskContext context) + { + battlegroundMap->DoOnPlayers([&](Player* player) + { + if (!player->HasAura(EnigmaCrucible::Spells::ArenaStartingAreaMarker)) + return; + + if (player->HasAura(EnigmaCrucible::Spells::Warning)) + return; + + player->CastSpell(nullptr, EnigmaCrucible::Spells::Warning, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + }); + + context.Repeat(); + }); + } + + void DoAction(uint32 actionId, WorldObject* source, WorldObject* target) override + { + switch (actionId) + { + case EnigmaCrucible::Actions::ReactionTrigger: + HandleReactionLowHealth(Object::ToPlayer(source)); + break; + case EnigmaCrucible::Actions::ReactionDead: + HandleKill(Object::ToPlayer(target)); + break; + default: + break; + } + } + + void OnPrepareStage2() override + { + if (Creature const* creature = battlegroundMap->GetCreature(_zoSorgGUID)) + creature->AI()->Talk(EnigmaCrucible::Texts::ZoSorg::Prepare); + + _scheduler.Schedule(10s, [&](TaskContext) + { + if (Creature const* creature = battlegroundMap->GetCreature(_zoSorgGUID)) + creature->AI()->Talk(EnigmaCrucible::Texts::ZoSorg::Prepare2); + }); + } + + void OnCreatureCreate(Creature* creature) override + { + switch (creature->GetEntry()) + { + case EnigmaCrucible::Creatures::ZoSorg: + _zoSorgGUID = creature->GetGUID(); + break; + default: + break; + } + } + + void OnGameObjectCreate(GameObject* gameobject) override + { + switch (gameobject->GetEntry()) + { + case EnigmaCrucible::GameObjects::Door01: + case EnigmaCrucible::GameObjects::Door02: + _doorGUIDs.emplace_back(gameobject->GetGUID()); + break; + default: + break; + } + } + + void OnPlayerJoined(Player* player, bool /*inBattleground*/) override + { + player->CastSpell(nullptr, EnigmaCrucible::Spells::EnigmaArenaReactionTrigger, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + + void HandleKill(Player const* victim) const + { + if (!victim) + return; + + if (Creature* creature = battlegroundMap->GetCreature(_zoSorgGUID)) + { + if (creature->HasAura(EnigmaCrucible::Spells::EnigmaArenaVOCooldownAura)) + return; + + creature->AI()->Talk(EnigmaCrucible::Texts::ZoSorg::ReactionTrigger, victim); + + creature->CastSpell(nullptr, EnigmaCrucible::Spells::EnigmaArenaVOCooldownAura, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + } + + void HandleReactionLowHealth(Player const* victim) const + { + if (!victim) + return; + + if (Creature* creature = battlegroundMap->GetCreature(_zoSorgGUID)) + { + if (creature->HasAura(EnigmaCrucible::Spells::EnigmaArenaVOCooldownAura)) + return; + + creature->AI()->Talk(EnigmaCrucible::Texts::ZoSorg::ReactionTrigger, victim); + + creature->CastSpell(nullptr, EnigmaCrucible::Spells::EnigmaArenaVOCooldownAura, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + } + +private: + GuidVector _doorGUIDs; + ObjectGuid _zoSorgGUID; + + TaskScheduler _scheduler; +}; + +// 371602 - Enigma Arena Reaction Trigger - Low Health +class spell_enigma_arena_reaction_trigger_low_health : public SpellScript +{ + bool Load() override + { + return GetCaster()->GetMapId() == EnigmaCrucible::MapIds::EnigmaCrucible; + } + + void HandleHit(SpellEffIndex /*effIndex*/) const + { + Unit* target = GetHitUnit(); + if (target->HasAura(EnigmaCrucible::Spells::ArenaLowHealthCooldownAura)) + return; + + target->CastSpell(nullptr, EnigmaCrucible::Spells::ArenaLowHealthCooldownAura, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + + if (ZoneScript* zoneScript = target->FindZoneScript()) + zoneScript->DoAction(EnigmaCrucible::Actions::ReactionTrigger, GetCaster(), target); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_enigma_arena_reaction_trigger_low_health::HandleHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 371601 - Enigma Arena Reaction Trigger +class spell_enigma_arena_reaction_trigger : public AuraScript +{ + bool Load() override + { + return GetOwner()->GetMapId() == EnigmaCrucible::MapIds::EnigmaCrucible; + } + + void HandleProc(ProcEventInfo const& eventInfo) const + { + if (ZoneScript* zonescript = GetTarget()->FindZoneScript()) + zonescript->DoAction(EnigmaCrucible::Actions::ReactionDead, eventInfo.GetActor(), eventInfo.GetProcTarget()); + } + + void Register() override + { + OnProc += AuraProcFn(spell_enigma_arena_reaction_trigger::HandleProc); + } +}; + +// 370437 - Warning (countdown) +class spell_enigma_arena_warning_countdown : public AuraScript +{ + bool Load() override + { + return GetOwner()->GetMapId() == EnigmaCrucible::MapIds::EnigmaCrucible; + } + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ EnigmaCrucible::Spells::WarningTeleport }); + } + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) const + { + Player* target = GetTarget()->ToPlayer(); + if (!target) + return; + + if (!target->HasAura(EnigmaCrucible::Spells::ArenaStartingAreaMarker)) + return; + + target->CastSpell(nullptr, EnigmaCrucible::Spells::WarningTeleport, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + + void Register() override + { + OnEffectRemove += AuraEffectRemoveFn(spell_enigma_arena_warning_countdown::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } +}; + +// 371319 - Warning Teleport +class spell_enigma_arena_warning_teleport : public SpellScript +{ + bool Load() override + { + return GetCaster()->GetMapId() == EnigmaCrucible::MapIds::EnigmaCrucible; + } + + void HandleTeleport(SpellEffIndex /*effIndex*/) const + { + Player* target = GetHitPlayer(); + if (!target) + return; + + if (target->GetBGTeam() == ALLIANCE) + target->NearTeleportTo(EnigmaCrucible::Positions::PurpleWarningTeleport); + else + target->NearTeleportTo(EnigmaCrucible::Positions::GoldWarningTeleport); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_enigma_arena_warning_teleport::HandleTeleport, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +class condition_enigma_arena_collision_doors : public ConditionScript +{ +public: + condition_enigma_arena_collision_doors() : ConditionScript("condition_enigma_arena_collision_doors") {} + + bool OnConditionCheck(Condition const* /*condition*/, ConditionSourceInfo& sourceInfo) override + { + if (!sourceInfo.mConditionMap) + return false; + + if (BattlegroundMap const* bgMap = sourceInfo.mConditionMap->ToBattlegroundMap()) + if (Battleground const* bg = bgMap->GetBG()) + if (bg->GetStatus() >= STATUS_IN_PROGRESS) + return bg->GetInProgressDuration() >= 15s; + + return false; + } +}; + +void AddSC_arena_enigma_crucible() +{ + RegisterBattlegroundMapScript(arena_enigma_crucible, EnigmaCrucible::MapIds::EnigmaCrucible); + RegisterSpellScript(spell_enigma_arena_reaction_trigger_low_health); + RegisterSpellScript(spell_enigma_arena_reaction_trigger); + RegisterSpellScript(spell_enigma_arena_warning_countdown); + RegisterSpellScript(spell_enigma_arena_warning_teleport); + + new condition_enigma_arena_collision_doors(); +} diff --git a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp index 5b858d76341..1e84e622ffc 100644 --- a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp +++ b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp @@ -69,6 +69,7 @@ void AddSC_arena_mugambala(); void AddSC_arena_the_robodrome(); void AddSC_arena_maldraxxus_coliseum(); +void AddSC_arena_enigma_crucible(); void AddSC_arena_nokhudon_proving_grounds(); @@ -128,6 +129,7 @@ void AddBattlegroundsScripts() AddSC_arena_the_robodrome(); AddSC_arena_maldraxxus_coliseum(); + AddSC_arena_enigma_crucible(); AddSC_arena_nokhudon_proving_grounds(); |