diff options
| author | Wyreth <32145860+Wyreth@users.noreply.github.com> | 2017-10-22 14:23:29 +0200 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2021-01-13 22:04:52 +0100 |
| commit | 3c898d9e011903f9f1408b1152e7d75b60c99ad7 (patch) | |
| tree | 82704eea9e4be2f16e26d499668b4bd41b81cff5 | |
| parent | d8804418ce9d54c9bc6c897771be900278159bb6 (diff) | |
Scripts/Quest: Captain Tyralius improvements (#20419)
Update: #12352
(cherry picked from commit 398e67cbca3960603cc498e8b0e40bd6a7625d6e)
| -rw-r--r-- | sql/updates/world/master/2021_01_09_00_world_2017_10_22_00_world.sql | 4 | ||||
| -rw-r--r-- | src/server/scripts/Outland/zone_netherstorm.cpp | 63 |
2 files changed, 64 insertions, 3 deletions
diff --git a/sql/updates/world/master/2021_01_09_00_world_2017_10_22_00_world.sql b/sql/updates/world/master/2021_01_09_00_world_2017_10_22_00_world.sql new file mode 100644 index 00000000000..7dbd71c3e73 --- /dev/null +++ b/sql/updates/world/master/2021_01_09_00_world_2017_10_22_00_world.sql @@ -0,0 +1,4 @@ +-- +UPDATE `creature_template` SET `unit_flags`=512, `ScriptName`="npc_captain_tyralius" WHERE `entry`=20787; +UPDATE `creature_template` SET `AIName`="" WHERE `entry`=20825; +DELETE FROM `creature` WHERE `id` IN (20787, 20825); diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index 76f8e1d5959..2e8cfb2c3bd 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -667,7 +667,11 @@ public: enum CaptainTyralius { NPC_CAPTAIN_TYRALIUS = 20787, + NPC_ETHEREUM_PRISONER = 20825, + SPELL_TELEPORT_VISUAL = 51347, SAY_FREE = 0, + ACTION_FREED = 0, + EVENT_TELEPORT = 1 }; class go_captain_tyralius_prison : public GameObjectScript @@ -679,15 +683,26 @@ class go_captain_tyralius_prison : public GameObjectScript { go_captain_tyralius_prisonAI(GameObject* go) : GameObjectAI(go) { } + void Reset() override + { + me->SummonCreature(NPC_CAPTAIN_TYRALIUS, me->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN); + me->SummonCreature(NPC_ETHEREUM_PRISONER, me->GetPosition(), TEMPSUMMON_MANUAL_DESPAWN); + } + bool GossipHello(Player* player) override { - me->UseDoorOrButton(); + me->SetRespawnTime(60); + me->SetLootState(GO_JUST_DEACTIVATED); + if (Creature* tyralius = me->FindNearestCreature(NPC_CAPTAIN_TYRALIUS, 1.0f)) { player->KilledMonsterCredit(NPC_CAPTAIN_TYRALIUS); - tyralius->AI()->Talk(SAY_FREE); - tyralius->DespawnOrUnsummon(8000); + tyralius->AI()->DoAction(ACTION_FREED); } + + if (Creature* prisoner = me->FindNearestCreature(NPC_ETHEREUM_PRISONER, 1.0f)) + prisoner->DespawnOrUnsummon(0); + return true; } }; @@ -698,6 +713,47 @@ class go_captain_tyralius_prison : public GameObjectScript } }; +class npc_captain_tyralius : public CreatureScript +{ +public: + npc_captain_tyralius() : CreatureScript("npc_captain_tyralius") { } + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_captain_tyraliusAI(creature); + } + + struct npc_captain_tyraliusAI : public ScriptedAI + { + npc_captain_tyraliusAI(Creature* creature) : ScriptedAI(creature) { } + + void DoAction(int32 /*action*/) override + { + Talk(SAY_FREE); + _events.ScheduleEvent(EVENT_TELEPORT, Seconds(5)); + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + if (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TELEPORT: + DoCastSelf(SPELL_TELEPORT_VISUAL); + me->DespawnOrUnsummon(Seconds(2)); + break; + } + } + } + + private: + EventMap _events; + }; +}; + void AddSC_netherstorm() { new npc_commander_dawnforge(); @@ -706,4 +762,5 @@ void AddSC_netherstorm() new npc_bessy(); new npc_maxx_a_million_escort(); new go_captain_tyralius_prison(); + new npc_captain_tyralius(); } |
