diff options
Diffstat (limited to 'src')
7 files changed, 1078 insertions, 9 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 09e3f4eca11..e1c8af38d0c 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1343,15 +1343,12 @@ void ScriptMgr::Initialize() // Remove the used scripts from the given container. sScriptRegistryCompositum->RemoveUsedScriptsFromContainer(unusedScriptNames); - for (std::string const& scriptName : unusedScriptNames) - { - // Avoid complaining about empty script names since the - // script name container contains a placeholder as the 0 element. - if (scriptName.empty()) - continue; + // Avoid complaining about empty script names since the + // script name container contains a placeholder as the 0 element. + unusedScriptNames.erase(""); + for (std::string const& scriptName : unusedScriptNames) TC_LOG_ERROR("sql.sql", "Script '{}' is referenced by the database, but does not exist in the core!", scriptName); - } TC_LOG_INFO("server.loading", ">> Loaded {} C++ scripts in {} ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); @@ -2595,7 +2592,7 @@ BattlegroundMapScript::BattlegroundMapScript(char const* name, uint32 mapId) noe if (!GetEntry()) TC_LOG_ERROR("scripts", "Invalid BattlegroundMapScript for {}; no such map ID.", mapId); - if (GetEntry() && !GetEntry()->IsBattleground()) + if (GetEntry() && !GetEntry()->IsBattlegroundOrArena()) TC_LOG_ERROR("scripts", "BattlegroundMapScript for map {} is invalid.", mapId); ScriptRegistry<BattlegroundMapScript>::Instance()->AddScript(this); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 986c8376a00..c4260860fb3 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2948,7 +2948,10 @@ void Spell::TargetInfo::DoDamageAndTriggers(Spell* spell) if (MissCondition == SPELL_MISS_RESIST && spell->m_spellInfo->HasAttribute(SPELL_ATTR1_FAILURE_BREAKS_STEALTH) && spell->unitTarget->GetTypeId() == TYPEID_UNIT) { Unit* unitCaster = ASSERT_NOTNULL(spell->m_caster->ToUnit()); - unitCaster->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Interacting); + unitCaster->RemoveAppliedAuras([](AuraApplication const* aurApp) + { + return aurApp->GetBase()->GetSpellInfo()->Dispel == DISPEL_STEALTH; + }); spell->unitTarget->ToCreature()->EngageWithTarget(unitCaster); } } 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/NokhudonProvingGrounds/arena_nokhudon_proving_grounds.cpp b/src/server/scripts/Battlegrounds/NokhudonProvingGrounds/arena_nokhudon_proving_grounds.cpp new file mode 100644 index 00000000000..e681304f836 --- /dev/null +++ b/src/server/scripts/Battlegrounds/NokhudonProvingGrounds/arena_nokhudon_proving_grounds.cpp @@ -0,0 +1,303 @@ +/* + * 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 "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 NokhudonProvingGrounds +{ + namespace Actions + { + static constexpr uint32 ReactionTrigger = 1; + static constexpr uint32 ReactionDead = 2; + } + + namespace Creatures + { + static constexpr uint32 Malicia = 196670; + static constexpr uint32 NokhudCombatant = 196470; + } + + namespace GameObjects + { + static constexpr uint32 Door01 = 379282; + } + + namespace MapIds + { + static constexpr uint32 NokhudonProvingGrounds = 2563; + } + + namespace Spells + { + static constexpr uint32 ArenaLowHealthCooldownAura = 234031; + static constexpr uint32 NokhudonProvingGroundsVOCooldownAuraPlayerDeath = 391325; + static constexpr uint32 NokhudonProvingGroundsVOCooldownAura = 388904; + static constexpr uint32 NokhudonProvingGroundsReactionTrigger = 388970; + } + + namespace Texts + { + namespace Malicia + { + static constexpr uint8 Prepare = 0; + static constexpr uint8 Start = 1; + static constexpr uint8 ReactionNonGendered = 2; + } + } + + namespace Conversations + { + static constexpr std::array<uint32, 2> ReactionKill = { 20101, 20102 }; + } +} + +struct arena_nokhudon_proving_grounds : ArenaScript +{ + explicit arena_nokhudon_proving_grounds(BattlegroundMap* map) : ArenaScript(map) {} + + 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(_maliciaGUID)) + creature->AI()->Talk(NokhudonProvingGrounds::Texts::Malicia::Start); + } + + void DoAction(uint32 actionId, WorldObject* source, WorldObject* target) override + { + switch (actionId) + { + case NokhudonProvingGrounds::Actions::ReactionTrigger: + HandleReactionLowHealth(Object::ToPlayer(source)); + break; + case NokhudonProvingGrounds::Actions::ReactionDead: + HandleKill(Object::ToPlayer(target)); + break; + default: + break; + } + } + + void OnPrepareStage2() override + { + if (Creature const* creature = battlegroundMap->GetCreature(_maliciaGUID)) + creature->AI()->Talk(NokhudonProvingGrounds::Texts::Malicia::Prepare); + } + + void OnCreatureCreate(Creature* creature) override + { + switch (creature->GetEntry()) + { + case NokhudonProvingGrounds::Creatures::Malicia: + _maliciaGUID = creature->GetGUID(); + break; + case NokhudonProvingGrounds::Creatures::NokhudCombatant: + _nokhudCombatantGUIDs.emplace_back(creature->GetGUID()); + break; + default: + break; + } + } + + void OnGameObjectCreate(GameObject* gameobject) override + { + switch (gameobject->GetEntry()) + { + case NokhudonProvingGrounds::GameObjects::Door01: + _doorGUIDs.emplace_back(gameobject->GetGUID()); + break; + default: + break; + } + } + + void OnPlayerJoined(Player* player, bool /*inBattleground*/) override + { + player->CastSpell(nullptr, NokhudonProvingGrounds::Spells::NokhudonProvingGroundsReactionTrigger, 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(_maliciaGUID)) + { + if (creature->HasAura(NokhudonProvingGrounds::Spells::NokhudonProvingGroundsVOCooldownAuraPlayerDeath)) + return; + + uint32 conversationId = Trinity::Containers::SelectRandomContainerElement(NokhudonProvingGrounds::Conversations::ReactionKill); + Conversation::CreateConversation(conversationId, creature, creature->GetPosition(), ObjectGuid::Empty); + + creature->CastSpell(nullptr, NokhudonProvingGrounds::Spells::NokhudonProvingGroundsVOCooldownAuraPlayerDeath, 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(_maliciaGUID)) + { + if (creature->HasAura(NokhudonProvingGrounds::Spells::NokhudonProvingGroundsVOCooldownAura)) + return; + + creature->AI()->Talk(NokhudonProvingGrounds::Texts::Malicia::ReactionNonGendered, victim); + + creature->CastSpell(nullptr, NokhudonProvingGrounds::Spells::NokhudonProvingGroundsVOCooldownAura, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + } + + for (ObjectGuid const& guid : _nokhudCombatantGUIDs) + if (Creature* creature = battlegroundMap->GetCreature(guid)) + creature->AI()->DoAction(NokhudonProvingGrounds::Actions::ReactionTrigger); + } + +private: + GuidVector _doorGUIDs; + GuidVector _nokhudCombatantGUIDs; + ObjectGuid _maliciaGUID; +}; + +// 196470 - Nokhud Combatant +struct npc_nokhudon_proving_grounds_nokhud_combatant : ScriptedAI +{ + explicit npc_nokhudon_proving_grounds_nokhud_combatant(Creature* creature) : ScriptedAI(creature) { } + + void UpdateAI(uint32 diff) override + { + _scheduler.Update(diff); + } + + void DoAction(int32 param) override + { + switch (param) + { + case NokhudonProvingGrounds::Actions::ReactionTrigger: + HandleEmoteSequence(); + break; + default: + break; + } + } + + void HandleEmoteSequence() + { + if (me->GetStandState() != UNIT_STAND_STATE_SIT) + return; + + me->HandleEmoteCommand(EMOTE_ONESHOT_JUMPSTART); + me->SetStandState(UNIT_STAND_STATE_STAND); + + _scheduler.Schedule(2s, [&](TaskContext context) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); + if (context.GetRepeatCounter() < 2) + context.Repeat(1s); + else + { + context.Schedule(1s, [&](TaskContext) + { + me->SetStandState(UNIT_STAND_STATE_SIT); + }); + } + }); + } + +private: + TaskScheduler _scheduler; +}; + +// 388969 - Nokhudon Proving Grounds Reaction Trigger - Low Health +class spell_nokhudon_proving_grounds_trigger_low_health : public SpellScript +{ + bool Load() override + { + return GetCaster()->GetMapId() == NokhudonProvingGrounds::MapIds::NokhudonProvingGrounds; + } + + void HandleHit(SpellEffIndex /*effIndex*/) const + { + Unit* target = GetHitUnit(); + if (target->HasAura(NokhudonProvingGrounds::Spells::ArenaLowHealthCooldownAura)) + return; + + target->CastSpell(nullptr, NokhudonProvingGrounds::Spells::ArenaLowHealthCooldownAura, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR + }); + + if (ZoneScript* zoneScript = target->FindZoneScript()) + zoneScript->DoAction(NokhudonProvingGrounds::Actions::ReactionTrigger, GetCaster(), target); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_nokhudon_proving_grounds_trigger_low_health::HandleHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 388970 - Nokhudon Proving Grounds Reaction Trigger +class spell_nokhudon_proving_grounds_reaction_trigger : public AuraScript +{ + bool Load() override + { + return GetOwner()->GetMapId() == NokhudonProvingGrounds::MapIds::NokhudonProvingGrounds; + } + + void HandleProc(ProcEventInfo const& eventInfo) const + { + if (ZoneScript* zonescript = GetTarget()->FindZoneScript()) + zonescript->DoAction(NokhudonProvingGrounds::Actions::ReactionDead, eventInfo.GetActor(), eventInfo.GetProcTarget()); + } + + void Register() override + { + OnProc += AuraProcFn(spell_nokhudon_proving_grounds_reaction_trigger::HandleProc); + } +}; + +void AddSC_arena_nokhudon_proving_grounds() +{ + RegisterBattlegroundMapScript(arena_nokhudon_proving_grounds, NokhudonProvingGrounds::MapIds::NokhudonProvingGrounds); + RegisterCreatureAI(npc_nokhudon_proving_grounds_nokhud_combatant); + RegisterSpellScript(spell_nokhudon_proving_grounds_trigger_low_health); + RegisterSpellScript(spell_nokhudon_proving_grounds_reaction_trigger); +} diff --git a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp index c2c3d8b3439..1e84e622ffc 100644 --- a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp +++ b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp @@ -69,6 +69,9 @@ 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(); void AddSC_arena_cage_of_carnage(); @@ -126,6 +129,9 @@ void AddBattlegroundsScripts() AddSC_arena_the_robodrome(); AddSC_arena_maldraxxus_coliseum(); + AddSC_arena_enigma_crucible(); + + AddSC_arena_nokhudon_proving_grounds(); AddSC_arena_cage_of_carnage(); } diff --git a/src/server/scripts/BrokenIsles/zone_mardum.cpp b/src/server/scripts/BrokenIsles/zone_mardum.cpp index 536d1b02b60..2f0cdd852c5 100644 --- a/src/server/scripts/BrokenIsles/zone_mardum.cpp +++ b/src/server/scripts/BrokenIsles/zone_mardum.cpp @@ -27,6 +27,7 @@ #include "MapUtils.h" #include "MotionMaster.h" #include "ObjectAccessor.h" +#include "PathGenerator.h" #include "PassiveAI.h" #include "PhasingHandler.h" #include "Player.h" @@ -34,6 +35,7 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "SpellAuras.h" +#include "SpellMgr.h" #include "SpellScript.h" #include "TemporarySummon.h" @@ -1969,6 +1971,282 @@ CreatureAI* DemonHunterHiddenNoMoreAISelector(Creature* creature) return new NullCreatureAI(creature); }; +enum FelLordCazaData +{ + // Text + SAY_FEL_LORD_CAZA_AGGRO = 0, + SAY_FEL_LORD_CAZA_THROW_AXE = 1, + SAY_FEL_LORD_CAZA_DEATH = 2, + + // Spells + SPELL_FEL_LORD_CAZA_SWEEPING_SLASH = 197002, + SPELL_FEL_LORD_CAZA_FEL_INFUSION = 197180, + SPELL_FEL_LORD_CAZA_VIOLENT_FEL_ENERGY = 196989, + SPELL_FEL_LORD_CAZA_THROW_AXE_JUMP = 196875, + SPELL_FEL_LORD_CAZA_THROW_AXE_MISSILE = 196876, + SPELL_FEL_LORD_CAZA_THROW_AXE_KNOCKBACK = 196955, + SPELL_FEL_LORD_CAZA_DIES = 210101, + SPELL_FEL_LORD_CAZA_KILL_CREDIT = 210104, + SPELL_FEL_LORD_CAZA_TAKING_POWER = 210105, + SPELL_AREATRIGGER_DUMMY_FEL_LORD_CAZA = 197471, // Serverside + + // Events + EVENT_CAZA_SWEEPING_SLASH = 1, + EVENT_CAZA_FEL_INFUSION, + EVENT_CAZA_THROW_AXE_JUMP, + + NPC_FEL_LORD_CAZA = 96441, + + DATA_CAZA_AXE_TARGET_GUID = 0, + + ACTION_CAZA_AXE_RETRIEVED = 0, +}; + +// 96441 - Fel Lord Caza +struct npc_fel_lord_caza_cryptic_hollow : public ScriptedAI +{ + npc_fel_lord_caza_cryptic_hollow(Creature* creature) : ScriptedAI(creature) { } + + void JustEngagedWith(Unit* /*who*/) override + { + Talk(SAY_FEL_LORD_CAZA_AGGRO); + _events.ScheduleEvent(EVENT_CAZA_SWEEPING_SLASH, 6s); + _events.ScheduleEvent(EVENT_CAZA_FEL_INFUSION, 11s); + _events.ScheduleEvent(EVENT_CAZA_THROW_AXE_JUMP, 23s); + } + + void Reset() override + { + _events.Reset(); + _axeTarget = ObjectGuid::Empty; + } + + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_FEL_LORD_CAZA_DEATH); + DoCastSelf(SPELL_FEL_LORD_CAZA_DIES); + + for (ObjectGuid tapperGUID : me->GetTapList()) + { + if (Player* tapper = ObjectAccessor::GetPlayer(*me, tapperGUID)) + tapper->CastSpell(tapper, SPELL_FEL_LORD_CAZA_KILL_CREDIT, false); + } + } + + void OnSpellCast(SpellInfo const* spell) override + { + if (spell->Id == SPELL_FEL_LORD_CAZA_THROW_AXE_MISSILE) + me->SetReactState(REACT_AGGRESSIVE); + } + + void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override + { + if (spellInfo->Id == SPELL_AREATRIGGER_DUMMY_FEL_LORD_CAZA && target->GetTypeId() == TYPEID_PLAYER && !me->IsInCombat()) + me->AI()->AttackStart(target->ToUnit()); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CAZA_SWEEPING_SLASH: + DoCastVictim(SPELL_FEL_LORD_CAZA_SWEEPING_SLASH); + break; + case EVENT_CAZA_FEL_INFUSION: + DoCast(SPELL_FEL_LORD_CAZA_FEL_INFUSION); + break; + case EVENT_CAZA_THROW_AXE_JUMP: + Talk(SAY_FEL_LORD_CAZA_THROW_AXE); + me->SetReactState(REACT_PASSIVE); + DoCast(SPELL_FEL_LORD_CAZA_THROW_AXE_JUMP); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + } + + void DoAction(int32 param) override + { + if (param != ACTION_CAZA_AXE_RETRIEVED) + return; + + _events.ScheduleEvent(EVENT_CAZA_FEL_INFUSION, 400ms); + _events.ScheduleEvent(EVENT_CAZA_SWEEPING_SLASH, 8500ms); + _events.ScheduleEvent(EVENT_CAZA_THROW_AXE_JUMP, 12000ms); + } + + void SetGUID(ObjectGuid const& guid, int32 id) override + { + if (id != DATA_CAZA_AXE_TARGET_GUID) + return; + + _axeTarget = guid; + } + + ObjectGuid GetGUID(int32 id) const override + { + if (id != DATA_CAZA_AXE_TARGET_GUID) + return ObjectGuid::Empty; + + return _axeTarget; + } + +private: + EventMap _events; + ObjectGuid _axeTarget; +}; + +// ID - 169 +struct at_fel_lord_caza_intro : AreaTriggerAI +{ + using AreaTriggerAI::AreaTriggerAI; + + void OnUnitEnter(Unit* unit) override + { + Player* player = unit->ToPlayer(); + if (!player || player->IsGameMaster()) + return; + + Creature* caza = player->FindNearestCreature(NPC_FEL_LORD_CAZA, 100.0f); + if (!caza || caza->isDead()) + return; + + // This should have a cooldown of 2 minutes + caza->CastSpell(player, SPELL_AREATRIGGER_DUMMY_FEL_LORD_CAZA, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + } +}; + +// 197180 - Fel Infusion +// ID - 5315 +struct at_fel_lord_caza_fel_infusion : AreaTriggerAI +{ + using AreaTriggerAI::AreaTriggerAI; + + void OnUnitEnter(Unit* unit) override + { + if (!unit->IsPlayer()) + return; + + Unit* caster = at->GetCaster(); + if (!caster) + return; + + caster->CastSpell(unit, SPELL_FEL_LORD_CAZA_VIOLENT_FEL_ENERGY, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + } +}; + +// 196959 - Throw Axe +// ID - 5295 +struct at_fel_lord_caza_throw_axe_knockback : AreaTriggerAI +{ + using AreaTriggerAI::AreaTriggerAI; + + void OnInitialize() override + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(at->GetSpellId(), DIFFICULTY_NONE); + if (!spellInfo) + return; + + Unit* caster = at->GetCaster(); + if (!caster) + return; + + Unit* axeTarget = ObjectAccessor::GetUnit(*at, caster->GetAI()->GetGUID(DATA_CAZA_AXE_TARGET_GUID)); + if (!axeTarget) + return; + + Position destPos = at->GetFirstCollisionPosition(spellInfo->GetMaxRange(false, caster), at->GetRelativeAngle(axeTarget)); + PathGenerator path(at); + + path.CalculatePath(destPos.GetPositionX(), destPos.GetPositionY(), destPos.GetPositionZ(), false); + + at->InitSplines(path.GetPath()); + } + + void OnUnitEnter(Unit* unit) override + { + if (Unit* caster = at->GetCaster()) + if (caster->IsValidAttackTarget(unit)) + caster->CastSpell(unit, SPELL_FEL_LORD_CAZA_THROW_AXE_KNOCKBACK, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + } +}; + +// 196889 - Throw Axe +class spell_fel_lord_caza_throwing_axe_selector : public SpellScript +{ + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.remove_if([this](WorldObject* target) -> bool + { + return GetCaster()->GetDistance(target) <= 25.0f; + }); + } + + void HandleHit(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit()->GetPosition(), SPELL_FEL_LORD_CAZA_THROW_AXE_MISSILE, TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR); + GetCaster()->SetFacingToObject(GetHitUnit()); + GetCaster()->GetAI()->SetGUID(GetHitUnit()->GetGUID(), DATA_CAZA_AXE_TARGET_GUID); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_fel_lord_caza_throwing_axe_selector::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_fel_lord_caza_throwing_axe_selector::HandleHit, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 210103 - (Serverside/Non-DB2) Hidden No More: Fel Lord Caza Dies 02 +class spell_fel_lord_caza_dies_02 : public SpellScript +{ + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_FEL_LORD_CAZA_TAKING_POWER }); + } + + void HandleHitTarget(SpellEffIndex /*effIndex*/) const + { + Unit* target = GetHitUnit(); + target->CastSpell(target, SPELL_FEL_LORD_CAZA_TAKING_POWER, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .TriggeringSpell = GetSpell() + }); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_fel_lord_caza_dies_02::HandleHitTarget, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +// 196892 - Disarmed +class spell_fel_lord_caza_disarmed : public AuraScript +{ + void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->GetAI()->DoAction(ACTION_CAZA_AXE_RETRIEVED); + } + + void Register() override + { + AfterEffectRemove += AuraEffectRemoveFn(spell_fel_lord_caza_disarmed::AfterRemove, EFFECT_0, SPELL_AURA_MOD_MELEE_HASTE_3, AURA_EFFECT_HANDLE_REAL); + } +}; + void AddSC_zone_mardum() { // Creature @@ -1982,6 +2260,7 @@ void AddSC_zone_mardum() RegisterCreatureAI(npc_inquisitor_baleful_molten_shore); RegisterCreatureAI(npc_baleful_beaming_eye); RegisterCreatureAI(npc_sevis_brightflame_shivarra_gateway); + RegisterCreatureAI(npc_fel_lord_caza_cryptic_hollow); // AISelector new FactoryCreatureScript<CreatureAI, &KaynSunfuryNearLegionBannerAISelector>("npc_kayn_sunfury_ashtongue_intro"); @@ -1998,6 +2277,9 @@ void AddSC_zone_mardum() // AreaTrigger RegisterAreaTriggerAI(at_enter_the_illidari_ashtongue_allari_killcredit); RegisterAreaTriggerAI(at_enter_the_illidari_shivarra_conversation); + RegisterAreaTriggerAI(at_fel_lord_caza_intro); + RegisterAreaTriggerAI(at_fel_lord_caza_fel_infusion); + RegisterAreaTriggerAI(at_fel_lord_caza_throw_axe_knockback); // EventScript new event_sevis_sacrifice_player(); @@ -2026,4 +2308,7 @@ void AddSC_zone_mardum() RegisterSpellScriptWithArgs(spell_freed_killcredit_set_them_free<NPC_IZAL_WHITEMOON_FREED>, "spell_izal_whitemoon_killcredit_set_them_free"); RegisterSpellScriptWithArgs(spell_freed_killcredit_set_them_free<NPC_BELATH_DAWNBLADE_FREED>, "spell_belath_dawnblade_killcredit_set_them_free"); RegisterSpellScriptWithArgs(spell_freed_killcredit_set_them_free<NPC_MANNETHREL_DARKSTAR_FREED>, "spell_mannethrel_darkstar_killcredit_set_them_free"); + RegisterSpellScript(spell_fel_lord_caza_throwing_axe_selector); + RegisterSpellScript(spell_fel_lord_caza_dies_02); + RegisterSpellScript(spell_fel_lord_caza_disarmed); }; diff --git a/src/server/scripts/EasternKingdoms/zone_westfall.cpp b/src/server/scripts/EasternKingdoms/zone_westfall.cpp index 60162630e80..a4e8e5287be 100644 --- a/src/server/scripts/EasternKingdoms/zone_westfall.cpp +++ b/src/server/scripts/EasternKingdoms/zone_westfall.cpp @@ -30,6 +30,14 @@ namespace Creatures { static constexpr uint32 EnergizedHarvestReaper = 42342; static constexpr uint32 OverloadedHarvestGolem = 42601; + static constexpr uint32 JangolodeMineGlubtok = 42492; + static constexpr uint32 JangolodeMineFigure = 42515; +} + +namespace Spells +{ + static constexpr uint32 JangolodeMineSummonFigure = 79265; + static constexpr uint32 JangolodeMineSummonGlubtok = 79263; } namespace Events @@ -182,6 +190,105 @@ class spell_westfall_wake_harvest_golem : public SpellScript OnEffectHitTarget += SpellEffectFn(spell_westfall_wake_harvest_golem::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; + +// 79262 - Summon Lou's House +class spell_westfall_summon_lous_house : public SpellScript +{ + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + caster->CastSpell(nullptr, Spells::JangolodeMineSummonFigure, CastSpellExtraArgs(TRIGGERED_FULL_MASK)); + caster->CastSpell(nullptr, Spells::JangolodeMineSummonGlubtok, CastSpellExtraArgs(TRIGGERED_FULL_MASK)); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_westfall_summon_lous_house::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 79275 - Quest Credit: Jangolde Event +class spell_westfall_quest_credit_jangolode_event : public SpellScript +{ + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->ExitVehicle(); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_westfall_quest_credit_jangolode_event::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 79290 - General Trigger 1: Glubtok +// 79292 - General Trigger 2: Glubtok +// 79294 - General Trigger 3: Glubtok +// 79297 - General Trigger 4: Glubtok +class spell_westfall_livin_the_life_ping_glubtok : public SpellScript +{ + void FilterTargets(std::list<WorldObject*>& targets) + { + Player* player = Object::ToPlayer(GetCaster()); + if (!player) + return; + + targets.clear(); + if (Creature* creature = player->FindNearestCreatureWithOptions(50.0f, { .CreatureId = Creatures::JangolodeMineGlubtok, .OwnerGuid = player->GetGUID() })) + targets.push_back(creature); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_westfall_livin_the_life_ping_glubtok::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; + +// 79279 - General Trigger 1: Figure +// 79283 - General Trigger 2: Figure +// 79284 - General Trigger 3: Figure +// 79287 - General Trigger 4: Figure +class spell_westfall_livin_the_life_ping_figure : public SpellScript +{ + void FilterTargets(std::list<WorldObject*>& targets) + { + Player* player = Object::ToPlayer(GetCaster()); + if (!player) + return; + + targets.clear(); + if (Creature* creature = player->FindNearestCreatureWithOptions(50.0f, { .CreatureId = Creatures::JangolodeMineFigure, .OwnerGuid = player->GetGUID() })) + targets.push_back(creature); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_westfall_livin_the_life_ping_figure::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; + +// 79273 - Despawn Jangolode Actor +class spell_westfall_despawn_jangolode_actor : public SpellScript +{ + void FilterTargets(std::list<WorldObject*>& targets) + { + Player* player = Object::ToPlayer(GetCaster()); + if (!player) + return; + + targets.clear(); + if (Creature* creature = player->FindNearestCreatureWithOptions(50.0f, { .CreatureId = Creatures::JangolodeMineGlubtok, .OwnerGuid = player->GetGUID() })) + targets.push_back(creature); + + if (Creature* creature = player->FindNearestCreatureWithOptions(50.0f, { .CreatureId = Creatures::JangolodeMineFigure, .OwnerGuid = player->GetGUID() })) + targets.push_back(creature); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_westfall_despawn_jangolode_actor::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } +}; } void AddSC_westfall() @@ -195,4 +302,9 @@ void AddSC_westfall() RegisterSpellScript(spell_westfall_unbound_energy); RegisterSpellScript(spell_westfall_reaping_blows); RegisterSpellScript(spell_westfall_wake_harvest_golem); + RegisterSpellScript(spell_westfall_summon_lous_house); + RegisterSpellScript(spell_westfall_quest_credit_jangolode_event); + RegisterSpellScript(spell_westfall_despawn_jangolode_actor); + RegisterSpellScript(spell_westfall_livin_the_life_ping_glubtok); + RegisterSpellScript(spell_westfall_livin_the_life_ping_figure); } |