aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Battlegrounds/MaldraxxusColiseum/arena_maldraxxus_coliseum.cpp125
-rw-r--r--src/server/scripts/Battlegrounds/TheRobodrome/arena_the_robodrome.cpp136
-rw-r--r--src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp6
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp16
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp4
-rw-r--r--src/server/scripts/Commands/cs_mmaps.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp177
-rw-r--r--src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/zone_westfall.cpp148
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp10
10 files changed, 626 insertions, 19 deletions
diff --git a/src/server/scripts/Battlegrounds/MaldraxxusColiseum/arena_maldraxxus_coliseum.cpp b/src/server/scripts/Battlegrounds/MaldraxxusColiseum/arena_maldraxxus_coliseum.cpp
new file mode 100644
index 00000000000..643f582e3fa
--- /dev/null
+++ b/src/server/scripts/Battlegrounds/MaldraxxusColiseum/arena_maldraxxus_coliseum.cpp
@@ -0,0 +1,125 @@
+/*
+ * 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 "Creature.h"
+#include "GameObject.h"
+#include "Map.h"
+#include "MotionMaster.h"
+#include "ScriptMgr.h"
+
+namespace MaldraxxusColiseum
+{
+ namespace MapIds
+ {
+ static constexpr uint32 MaldraxxusColiseum = 2509;
+ }
+
+ namespace Creatures
+ {
+ static constexpr uint32 MaldraxxianGladiator = 185764;
+ }
+
+ namespace GameObjects
+ {
+ static constexpr uint32 Door = 375890;
+ }
+
+ namespace Destinations
+ {
+ static constexpr Position Guard1 = { 2875.89f, 2285.57f, 3260.1755f };
+ static constexpr Position Guard2 = { 2816.69f, 2300.51f, 3260.1885f };
+ static constexpr Position Guard3 = { 2873.62f, 2219.39f, 3260.7085f };
+ static constexpr Position Guard4 = { 2823.31f, 2204.30f, 3260.0960f };
+ }
+
+ namespace StringIds
+ {
+ static constexpr std::string_view Guard1 = "arena_maldraxxus_coliseum_1";
+ static constexpr std::string_view Guard2 = "arena_maldraxxus_coliseum_2";
+ static constexpr std::string_view Guard3 = "arena_maldraxxus_coliseum_3";
+ static constexpr std::string_view Guard4 = "arena_maldraxxus_coliseum_4";
+ }
+}
+
+struct arena_maldraxxus_coliseum : ArenaScript
+{
+ explicit arena_maldraxxus_coliseum(BattlegroundMap* map) : ArenaScript(map) { }
+
+ void OnStart() override
+ {
+ for (ObjectGuid const& guid : _doorGUIDs)
+ {
+ if (GameObject* door = battlegroundMap->GetGameObject(guid))
+ {
+ door->UseDoorOrButton();
+ door->DespawnOrUnsummon(5s);
+ }
+ }
+
+ for (ObjectGuid const& guid : _gladiatorGUIDs)
+ {
+ if (Creature* creature = battlegroundMap->GetCreature(guid))
+ {
+ if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard1))
+ creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard1);
+ else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard2))
+ creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard2);
+ else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard3))
+ creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard3);
+ else if (creature->HasStringId(MaldraxxusColiseum::StringIds::Guard4))
+ creature->GetMotionMaster()->MovePoint(1, MaldraxxusColiseum::Destinations::Guard4);
+
+ creature->DespawnOrUnsummon(2s);
+ }
+ }
+ }
+
+ void OnCreatureCreate(Creature* creature) override
+ {
+ switch (creature->GetEntry())
+ {
+ case MaldraxxusColiseum::Creatures::MaldraxxianGladiator:
+ _gladiatorGUIDs.emplace_back(creature->GetGUID());
+ break;
+ default:
+ break;
+ }
+ }
+
+ void OnGameObjectCreate(GameObject* gameobject) override
+ {
+ switch (gameobject->GetEntry())
+ {
+ case MaldraxxusColiseum::GameObjects::Door:
+ _doorGUIDs.emplace_back(gameobject->GetGUID());
+ break;
+ default:
+ break;
+ }
+ }
+
+private:
+ GuidVector _doorGUIDs;
+ GuidVector _gladiatorGUIDs;
+};
+
+void AddSC_arena_maldraxxus_coliseum()
+{
+ RegisterBattlegroundMapScript(arena_maldraxxus_coliseum, MaldraxxusColiseum::MapIds::MaldraxxusColiseum);
+}
diff --git a/src/server/scripts/Battlegrounds/TheRobodrome/arena_the_robodrome.cpp b/src/server/scripts/Battlegrounds/TheRobodrome/arena_the_robodrome.cpp
new file mode 100644
index 00000000000..b7e00b73969
--- /dev/null
+++ b/src/server/scripts/Battlegrounds/TheRobodrome/arena_the_robodrome.cpp
@@ -0,0 +1,136 @@
+/*
+ * 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 "Creature.h"
+#include "CreatureAI.h"
+#include "GameObject.h"
+#include "Map.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "SpellScript.h"
+#include "TaskScheduler.h"
+
+namespace TheRobodrome
+{
+ namespace MapIds
+ {
+ static constexpr uint32 TheRobodrome = 2167;
+ }
+
+ namespace Creatures
+ {
+ static constexpr uint32 PowerCoil = 154593;
+ }
+
+ namespace GameObjects
+ {
+ static constexpr uint32 Door01 = 329742;
+ static constexpr uint32 Door02 = 329743;
+ }
+
+ namespace Spells
+ {
+ static constexpr uint32 Zap = 300642;
+ }
+}
+
+struct arena_the_robodrome : ArenaScript
+{
+ explicit arena_the_robodrome(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);
+ }
+ }
+
+ _scheduler.Schedule(5s, [&](TaskContext context)
+ {
+ for (ObjectGuid const& guid : _powerCoilGUIDs)
+ if (Creature* coil = battlegroundMap->GetCreature(guid))
+ coil->CastSpell(nullptr, TheRobodrome::Spells::Zap);
+
+ context.Repeat();
+ });
+ }
+
+ void OnGameObjectCreate(GameObject* gameobject) override
+ {
+ switch (gameobject->GetEntry())
+ {
+ case TheRobodrome::GameObjects::Door01:
+ case TheRobodrome::GameObjects::Door02:
+ _doorGUIDs.emplace_back(gameobject->GetGUID());
+ break;
+ default:
+ break;
+ }
+ }
+
+ void OnCreatureCreate(Creature* creature) override
+ {
+ switch (creature->GetEntry())
+ {
+ case TheRobodrome::Creatures::PowerCoil:
+ _powerCoilGUIDs.emplace_back(creature->GetGUID());
+ break;
+ default:
+ break;
+ }
+ }
+
+private:
+ GuidVector _doorGUIDs;
+ GuidVector _powerCoilGUIDs;
+
+ TaskScheduler _scheduler;
+};
+
+// 300642 - Zap (Damage mod)
+class spell_the_robodrome_zap_damage : public SpellScript
+{
+ void HandleHitTarget(SpellEffIndex /*effIndex*/)
+ {
+ uint32 basePct = 16;
+ uint32 stackCount = GetHitUnit()->GetAuraCount(TheRobodrome::Spells::Zap);
+
+ SetEffectValue(basePct + basePct * stackCount);
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_the_robodrome_zap_damage::HandleHitTarget, EFFECT_2, SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT);
+ }
+};
+
+void AddSC_arena_the_robodrome()
+{
+ RegisterBattlegroundMapScript(arena_the_robodrome, TheRobodrome::MapIds::TheRobodrome);
+ RegisterSpellScript(spell_the_robodrome_zap_damage);
+}
diff --git a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp
index 65f831fae9e..5bf00c0a80a 100644
--- a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp
+++ b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp
@@ -66,6 +66,9 @@ void AddSC_battleground_deephaul_ravine();
void AddSC_arena_blades_edge_legion();
void AddSC_arena_mugambala();
+void AddSC_arena_the_robodrome();
+
+void AddSC_arena_maldraxxus_coliseum();
// The name of this function should match:
// void Add${NameOfDirectory}Scripts()
@@ -118,4 +121,7 @@ void AddBattlegroundsScripts()
AddSC_arena_blades_edge_legion();
AddSC_arena_mugambala();
+ AddSC_arena_the_robodrome();
+
+ AddSC_arena_maldraxxus_coliseum();
}
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 68020eb435d..3785f81f70a 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -39,6 +39,7 @@ EndScriptData */
#include "GridNotifiersImpl.h"
#include "InstanceScript.h"
#include "Language.h"
+#include "LFG.h"
#include "Log.h"
#include "M2Stores.h"
#include "MapManager.h"
@@ -856,9 +857,20 @@ public:
return true;
}
- static bool HandleDebugArenaCommand(ChatHandler* /*handler*/)
+ static bool HandleDebugArenaCommand(ChatHandler* handler, uint32 battlemasterListId)
{
- sBattlegroundMgr->ToggleArenaTesting();
+ bool successful = sBattlegroundMgr->ToggleArenaTesting(battlemasterListId);
+ if (!successful)
+ {
+ handler->PSendSysMessage("BattlemasterListId %u does not exist or is not an arena.", battlemasterListId);
+ handler->SetSentErrorMessage(true);
+ return true;
+ }
+
+ if (!battlemasterListId || !handler || !handler->GetSession())
+ return true;
+
+ BattlegroundMgr::QueuePlayerForArena(handler->GetSession()->GetPlayer(), 0, lfg::PLAYER_ROLE_DAMAGE);
return true;
}
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 3e5fe709ee0..5e87cf376fb 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -32,7 +32,7 @@
#include "ItemBonusMgr.h"
#include "Language.h"
#include "MiscPackets.h"
-#include "MMapFactory.h"
+#include "MMapManager.h"
#include "MotionMaster.h"
#include "MovementDefines.h"
#include "ObjectAccessor.h"
@@ -258,7 +258,7 @@ public:
uint32 haveMap = TerrainInfo::ExistMap(mapId, gridX, gridY) ? 1 : 0;
uint32 haveVMap = TerrainInfo::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
- uint32 haveMMap = (DisableMgr::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) ? 1 : 0;
+ uint32 haveMMap = (DisableMgr::IsPathfindingEnabled(mapId) && MMAP::MMapManager::instance()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) ? 1 : 0;
if (haveVMap)
{
diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp
index 94004eb8125..d30bfcdc746 100644
--- a/src/server/scripts/Commands/cs_mmaps.cpp
+++ b/src/server/scripts/Commands/cs_mmaps.cpp
@@ -29,7 +29,7 @@
#include "ChatCommand.h"
#include "DisableMgr.h"
#include "GridNotifiersImpl.h"
-#include "MMapFactory.h"
+#include "MMapManager.h"
#include "PathGenerator.h"
#include "PhasingHandler.h"
#include "Player.h"
@@ -66,7 +66,7 @@ public:
static bool HandleMmapPathCommand(ChatHandler* handler, char const* args)
{
- if (!MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
+ if (!MMAP::MMapManager::instance()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()))
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
return true;
@@ -138,13 +138,14 @@ public:
float x, y, z;
player->GetPosition(x, y, z);
- handler->PSendSysMessage("%04u%02i%02i.mmtile", player->GetMapId(), gx, gy);
- handler->PSendSysMessage("tileloc [%i, %i]", gy, gx);
-
// calculate navmesh tile location
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMapId(), player->GetMap()->GetTerrain(), x, y);
- dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(terrainMapId);
- dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(terrainMapId, player->GetMapId(), player->GetInstanceId());
+
+ handler->PSendSysMessage("%04u%02i%02i.mmtile", terrainMapId, gx, gy);
+ handler->PSendSysMessage("tileloc [%i, %i]", gy, gx);
+
+ dtNavMesh const* navmesh = MMAP::MMapManager::instance()->GetNavMesh(terrainMapId);
+ dtNavMeshQuery const* navmeshquery = MMAP::MMapManager::instance()->GetNavMeshQuery(terrainMapId, player->GetMapId(), player->GetInstanceId());
if (!navmesh || !navmeshquery)
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
@@ -194,8 +195,8 @@ public:
{
Player* player = handler->GetSession()->GetPlayer();
uint32 terrainMapId = PhasingHandler::GetTerrainMapId(player->GetPhaseShift(), player->GetMapId(), player->GetMap()->GetTerrain(), player->GetPositionX(), player->GetPositionY());
- dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(terrainMapId);
- dtNavMeshQuery const* navmeshquery = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMeshQuery(terrainMapId, player->GetMapId(), player->GetInstanceId());
+ dtNavMesh const* navmesh = MMAP::MMapManager::instance()->GetNavMesh(terrainMapId);
+ dtNavMeshQuery const* navmeshquery = MMAP::MMapManager::instance()->GetNavMeshQuery(terrainMapId, player->GetMapId(), player->GetInstanceId());
if (!navmesh || !navmeshquery)
{
handler->PSendSysMessage("NavMesh not loaded for current map.");
@@ -223,7 +224,7 @@ public:
handler->PSendSysMessage("mmap stats:");
handler->PSendSysMessage(" global mmap pathfinding is %sabled", DisableMgr::IsPathfindingEnabled(player->GetMapId()) ? "en" : "dis");
- MMAP::MMapManager* manager = MMAP::MMapFactory::createOrGetMMapManager();
+ MMAP::MMapManager* manager = MMAP::MMapManager::instance();
handler->PSendSysMessage(" %u maps loaded with %u tiles overall", manager->getLoadedMapsCount(), manager->getLoadedTilesCount());
dtNavMesh const* navmesh = manager->GetNavMesh(terrainMapId);
diff --git a/src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp b/src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp
new file mode 100644
index 00000000000..915c48f09f6
--- /dev/null
+++ b/src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp
@@ -0,0 +1,177 @@
+/*
+* 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 "ScriptMgr.h"
+#include "CreatureAIImpl.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
+#include "Player.h"
+#include "PhasingHandler.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
+
+namespace Scripts::EasternKingdoms::Gilneas::Chapter1
+{
+ namespace Creatures
+ {
+ static constexpr uint32 EvacuationStalkerFirst = 35830;
+ static constexpr uint32 EvacuationStalkerNear = 35010;
+ static constexpr uint32 EvacuationStalkerFar = 35011;
+ }
+
+ namespace Events
+ {
+ namespace EvacuateTheMerchantSquare
+ {
+ static constexpr uint32 TalkFrightened = 1;
+ static constexpr uint32 MoveToNearStalker = 2;
+ static constexpr uint32 MoveToFarStalker = 3;
+ static constexpr uint32 FrightenedDespawn = 4;
+ }
+ }
+
+ namespace Texts
+ {
+ namespace FrightenedCitizen
+ {
+ static constexpr uint32 SayFrightenedCitizenRescue = 0;
+ }
+ }
+
+ namespace Points
+ {
+ static constexpr uint32 PointStalkerFirst = 1;
+ static constexpr uint32 PointStalkerNear = 2;
+ static constexpr uint32 PointStalkerFar = 3;
+ }
+
+// 34981 - Frightened Citizen
+// 35836 - Frightened Citizen
+struct npc_frightened_citizen : public ScriptedAI
+{
+ npc_frightened_citizen(Creature* creature) : ScriptedAI(creature) {}
+
+ void IsSummonedBy(WorldObject* /*summoner*/) override
+ {
+ me->SetReactState(REACT_PASSIVE);
+
+ if (Creature* stalkerNear = me->FindNearestCreature(Creatures::EvacuationStalkerFirst, 20.0f))
+ me->GetMotionMaster()->MovePoint(Points::PointStalkerFirst, stalkerNear->GetPosition(), true);
+ }
+
+ void MovementInform(uint32 type, uint32 id) override
+ {
+ if (type != POINT_MOTION_TYPE)
+ return;
+
+ switch (id)
+ {
+ case Points::PointStalkerFirst:
+ _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::TalkFrightened, 1s);
+ break;
+ case Points::PointStalkerNear:
+ _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::MoveToFarStalker, 1ms);
+ break;
+ case Points::PointStalkerFar:
+ _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::FrightenedDespawn, 1ms);
+ break;
+ default:
+ break;
+ }
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case Events::EvacuateTheMerchantSquare::TalkFrightened:
+ if (TempSummon* summon = me->ToTempSummon())
+ {
+ if (Unit* summoner = summon->GetSummonerUnit())
+ {
+ if (Player* player = summoner->ToPlayer())
+ {
+ player->KilledMonsterCredit(Creatures::EvacuationStalkerFirst);
+ Talk(Texts::FrightenedCitizen::SayFrightenedCitizenRescue, summoner);
+ }
+ }
+ }
+ _events.ScheduleEvent(Events::EvacuateTheMerchantSquare::MoveToNearStalker, 2s);
+ break;
+ case Events::EvacuateTheMerchantSquare::MoveToNearStalker:
+ if (Creature* stalker = me->FindNearestCreature(Creatures::EvacuationStalkerFar, 50.0f))
+ me->GetMotionMaster()->MovePoint(Points::PointStalkerFar, stalker->GetPosition(), true);
+ else if (Creature* stalker = me->FindNearestCreature(Creatures::EvacuationStalkerNear, 100.0f))
+ me->GetMotionMaster()->MovePoint(Points::PointStalkerNear, stalker->GetPosition(), true);
+ break;
+ case Events::EvacuateTheMerchantSquare::MoveToFarStalker:
+ if (Creature* stalker = me->FindNearestCreature(Creatures::EvacuationStalkerFar, 500.0f))
+ me->GetMotionMaster()->MovePoint(Points::PointStalkerFar, stalker->GetPosition(), true);
+ break;
+ case Events::EvacuateTheMerchantSquare::FrightenedDespawn:
+ me->DespawnOrUnsummon();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+private:
+ EventMap _events;
+};
+
+// 67869 - Knocking
+class spell_gilneas_knocking : public SpellScript
+{
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellInfo(
+ {
+ uint32(spellInfo->GetEffect(EFFECT_1).CalcValue()),
+ uint32(spellInfo->GetEffect(EFFECT_2).CalcValue())
+ });
+ }
+
+ void HandleEffect()
+ {
+ if (SpellInfo const* spellInfo = GetSpellInfo())
+ GetCaster()->CastSpell(GetCaster(), spellInfo->GetEffect(RAND(EFFECT_1, EFFECT_2)).CalcValue(), true);
+ }
+
+ void Register() override
+ {
+ OnCast += SpellCastFn(spell_gilneas_knocking::HandleEffect);
+ }
+};
+}
+
+void AddSC_gilneas_chapter_1()
+{
+ using namespace Scripts::EasternKingdoms::Gilneas::Chapter1;
+
+ // Creatures
+ RegisterCreatureAI(npc_frightened_citizen);
+
+ // Spells
+ RegisterSpellScript(spell_gilneas_knocking);
+}
diff --git a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp
index 283eed704a0..13f41362243 100644
--- a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp
+++ b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp
@@ -65,6 +65,7 @@ void AddSC_boss_chromaggus();
void AddSC_boss_nefarian();
void AddSC_instance_blackwing_lair();
void AddSC_instance_deadmines(); //Deadmines
+void AddSC_gilneas_chapter_1(); //Gilneas
void AddSC_gnomeregan(); //Gnomeregan
void AddSC_instance_gnomeregan();
void AddSC_instance_grim_batol(); //Grim Batol
@@ -264,6 +265,7 @@ void AddEasternKingdomsScripts()
AddSC_boss_nefarian();
AddSC_instance_blackwing_lair();
AddSC_instance_deadmines(); //Deadmines
+ AddSC_gilneas_chapter_1(); //Gilneas
AddSC_gnomeregan(); //Gnomeregan
AddSC_instance_gnomeregan();
AddSC_instance_grim_batol(); //Grim Batol
diff --git a/src/server/scripts/EasternKingdoms/zone_westfall.cpp b/src/server/scripts/EasternKingdoms/zone_westfall.cpp
index 17b5a2de406..60162630e80 100644
--- a/src/server/scripts/EasternKingdoms/zone_westfall.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_westfall.cpp
@@ -15,11 +15,45 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "CombatAI.h"
#include "Containers.h"
+#include "CreatureAIImpl.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
+#include "SpellAuraEffects.h"
#include "SpellScript.h"
+namespace Scripts::EasternKingdoms::Westfall
+{
+namespace Creatures
+{
+ static constexpr uint32 EnergizedHarvestReaper = 42342;
+ static constexpr uint32 OverloadedHarvestGolem = 42601;
+}
+
+namespace Events
+{
+ namespace ItsAlive
+ {
+ static constexpr uint32 CheckArea = 1;
+ static constexpr uint32 DespawnHarvester = 2;
+ }
+}
+
+namespace Text
+{
+ namespace HarvestGolem
+ {
+ static constexpr uint32 AnnounceOutOfArea = 0;
+ }
+}
+
+namespace Area
+{
+ static constexpr uint32 TheMoestFarm = 918;
+}
+
// 79084 - Unbound Energy
class spell_westfall_unbound_energy : public SpellScript
{
@@ -44,7 +78,121 @@ class spell_westfall_unbound_energy : public SpellScript
}
};
+// 42601 - Overloaded Harvest Golem
+struct npc_westfall_overloaded_harvest_golem : public ScriptedAI
+{
+ npc_westfall_overloaded_harvest_golem(Creature* creature) : ScriptedAI(creature) {}
+
+ void JustAppeared() override
+ {
+ _events.ScheduleEvent(Events::ItsAlive::CheckArea, 1s);
+ }
+
+ void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool apply) override
+ {
+ if (!apply)
+ me->DespawnOrUnsummon();
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ _events.Update(diff);
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case Events::ItsAlive::CheckArea:
+ if (me->GetAreaId() != Area::TheMoestFarm)
+ {
+ if (Unit* owner = me->GetCharmerOrOwner())
+ Talk(Text::HarvestGolem::AnnounceOutOfArea, owner);
+ _events.ScheduleEvent(Events::ItsAlive::DespawnHarvester, 8s);
+ }
+ else
+ _events.Repeat(1s);
+ break;
+ case Events::ItsAlive::DespawnHarvester:
+ if (me->GetAreaId() != Area::TheMoestFarm)
+ me->DespawnOrUnsummon();
+ else
+ _events.ScheduleEvent(Events::ItsAlive::CheckArea, 1s);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+private:
+ EventMap _events;
+};
+
+// 79425 - Reaping Blows
+class spell_westfall_reaping_blows : public AuraScript
+{
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } }) && ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_1).TriggerSpell) });
+ }
+
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
+ {
+ // HACK
+ // periodic ticks are forcing to cast the spell onto himself instead of target
+ // ref AuraEffect::HandlePeriodicTriggerSpellAuraTick
+ PreventDefaultAction();
+ if (Creature* reaper = GetTarget()->FindNearestCreature(Creatures::EnergizedHarvestReaper, 5.f, true))
+ GetTarget()->CastSpell(reaper, GetSpellInfo()->GetEffect(EFFECT_1).TriggerSpell, true);
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_westfall_reaping_blows::HandlePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+};
+
+// 79436 - Wake Harvest Golem
+class spell_westfall_wake_harvest_golem : public SpellScript
+{
+ SpellCastResult CheckTarget()
+ {
+ Unit* target = GetExplTargetUnit();
+ if (!target || !target->IsCreature())
+ return SPELL_FAILED_BAD_TARGETS;
+
+ return SPELL_CAST_OK;
+ }
+
+ void HandleScriptEffect(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster || !caster->IsPlayer())
+ return;
+
+ if (Creature* target = GetHitCreature())
+ {
+ caster->ToPlayer()->KilledMonsterCredit(Creatures::OverloadedHarvestGolem);
+ target->DespawnOrUnsummon(100ms);
+ }
+ }
+
+ void Register() override
+ {
+ OnCheckCast += SpellCheckCastFn(spell_westfall_wake_harvest_golem::CheckTarget);
+ OnEffectHitTarget += SpellEffectFn(spell_westfall_wake_harvest_golem::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+};
+}
+
void AddSC_westfall()
{
+ using namespace Scripts::EasternKingdoms::Westfall;
+
+ // Creature
+ RegisterCreatureAI(npc_westfall_overloaded_harvest_golem);
+
+ // Spells
RegisterSpellScript(spell_westfall_unbound_energy);
+ RegisterSpellScript(spell_westfall_reaping_blows);
+ RegisterSpellScript(spell_westfall_wake_harvest_golem);
}
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
index f586c3c50a4..065c65a3110 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
@@ -24,11 +24,11 @@
DungeonEncounterData const encounters[] =
{
- { DATA_COMMANDER, {{ 519 }} },
- { DATA_MAGUS_TELESTRA, {{ 520, 521, 2010 }} },
- { DATA_ANOMALUS, {{ 522, 523, 2009 }} },
- { DATA_ORMOROK, {{ 524, 525, 2012 }} },
- { DATA_KERISTRASZA, {{ 526, 527, 2011 }} }
+ { DATA_COMMANDER, {{ 519, 3017 }} },
+ { DATA_MAGUS_TELESTRA, {{ 2010 }} },
+ { DATA_ANOMALUS, {{ 2009 }} },
+ { DATA_ORMOROK, {{ 2012 }} },
+ { DATA_KERISTRASZA, {{ 2011 }} }
};
class instance_nexus : public InstanceMapScript