aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaddley <64811442+Naddley@users.noreply.github.com>2025-10-02 19:04:55 +0200
committerGitHub <noreply@github.com>2025-10-02 19:04:55 +0200
commit47df5bdc22cd62120afb21af29fd1aa0f30bf251 (patch)
tree889b9a361d962ff0472751f185bc7d5953065e3d
parenta89b995c09b105de9c679e6d730489ac690f7b3c (diff)
Scripts/Gilneas: Implement Quest: "Evacuate the Merchant Square" (#31324)
Closes #30091 Co-authored-by: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
-rw-r--r--sql/updates/world/master/2025_10_02_01_world.sql27
-rw-r--r--src/server/scripts/EasternKingdoms/Gilneas/gilneas_chapter_1.cpp177
-rw-r--r--src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp2
3 files changed, 206 insertions, 0 deletions
diff --git a/sql/updates/world/master/2025_10_02_01_world.sql b/sql/updates/world/master/2025_10_02_01_world.sql
new file mode 100644
index 00000000000..b8afeedea3a
--- /dev/null
+++ b/sql/updates/world/master/2025_10_02_01_world.sql
@@ -0,0 +1,27 @@
+-- Template
+DELETE FROM `smart_scripts` WHERE `entryorguid`= 34981;
+UPDATE `creature_template` SET `AIName`= '', `ScriptName`= 'npc_frightened_citizen' WHERE `entry` IN (34981, 35836);
+
+-- Rampaging Worgen fixups
+UPDATE `creature_template` SET `flags_extra` = `flags_extra` | 2 WHERE `entry`= 34884;
+
+-- SpellScriptName
+DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gilneas_knocking');
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(67869, 'spell_gilneas_knocking');
+
+-- Creature Text
+DELETE FROM `creature_text` WHERE `CreatureID` IN (34981, 35836);
+INSERT INTO `creature_text` (`CreatureID`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `comment`) VALUES
+(34981, 0, 0, 'What in the world? Let''s get out of here!', 12, 0, 100, 1, 0, 0, 35235, 'Frightened Citizen to Player'),
+(34981, 0, 1, 'Let''s go!', 12, 0, 100, 1, 0, 0, 35236, 'Frightened Citizen to Player'),
+(34981, 0, 2, 'No time to waste!', 12, 0, 100, 1, 0, 0, 35237, 'Frightened Citizen to Player'),
+(34981, 0, 3, 'Worgen! Worgen everywhere!', 12, 0, 100, 1, 0, 0, 35238, 'Frightened Citizen to Player'),
+(34981, 0, 4, 'Flee! They''re everywhere!', 12, 0, 100, 1, 0, 0, 35240, 'Frightened Citizen to Player'),
+(34981, 0, 5, 'This place isn''t safe. Let''s leave!', 12, 0, 100, 1, 0, 0, 35239, 'Frightened Citizen to Player'),
+(34981, 0, 6, 'Protect me, please!', 12, 0, 100, 1, 0, 0, 35234, 'Frightened Citizen to Player'),
+(35836, 0, 0, 'It''s coming right for me!!', 12, 0, 100, 1, 0, 0, 36037, 'Frightened Citizen to Player'),
+(35836, 0, 1, 'Help me, please!', 12, 0, 100, 1, 0, 0, 36038, 'Frightened Citizen to Player'),
+(35836, 0, 2, 'There''s one after me!', 12, 0, 100, 1, 0, 0, 36039, 'Frightened Citizen to Player'),
+(35836, 0, 3, 'Help!', 12, 0, 100, 1, 0, 0, 36040, 'Frightened Citizen to Player'),
+(35836, 0, 4, 'I don''t want to die!', 12, 0, 100, 1, 0, 0, 36041, 'Frightened Citizen to Player');
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