From cc1f20f63c9eef2a1e93f6db50b83b7a1d74eba3 Mon Sep 17 00:00:00 2001 From: Miraco Date: Thu, 15 Feb 2024 14:14:27 +0100 Subject: [PATCH] [Quest] modernize 'Protect the Shipment' escort quest Closes https://github.com/cmangos/mangos-tbc/pull/663 --- sql/scriptdev2/scriptdev2.sql | 29 -------- .../scripts/eastern_kingdoms/loch_modan.cpp | 70 ++++++++++--------- 2 files changed, 38 insertions(+), 61 deletions(-) diff --git a/sql/scriptdev2/scriptdev2.sql b/sql/scriptdev2/scriptdev2.sql index e5c8e913430..7c4bedd0462 100644 --- a/sql/scriptdev2/scriptdev2.sql +++ b/sql/scriptdev2/scriptdev2.sql @@ -2536,11 +2536,6 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,broadc ('-1000569','Niby, you'' re an idiot.','0','0','0','0','9637','SAY_IMPSY_1'), ('-1000570','Silence, servant! Vengeance will be mine! Death to Stormwind! Death by chicken!','0','0','0','0','9638','SAY_NIBY_3'), -('-1000571','Help! I''ve only one hand to defend myself with.','0','0','0','0','510','SAY_MIRAN_1'), -('-1000572','Feel the power of the Dark Iron Dwarves!','0','0','0','0','1936','SAY_DARK_IRON_DWARF'), -('-1000573','Send them on! I''m not afraid of some scrawny beasts!','0','0','0','0','511','SAY_MIRAN_2'), -('-1000574','Ah, here at last! It''s going to feel so good to get rid of these barrels.','0','0','0','0','498','SAY_MIRAN_3'), - ('-1000575','Together we will fight our way out of here. Are you ready?','0','0','0','0','24310','Lurgglbr - SAY_START_1'), ('-1000576','Then we leave.','0','0','0','0','24311','Lurgglbr - SAY_START_2'), ('-1000577','This is far enough. I can make it on my own from here.','0','0','0','0','24312','Lurgglbr - SAY_END_1'), @@ -7236,30 +7231,6 @@ INSERT INTO gossip_texts (entry,content_default,comment) VALUES TRUNCATE script_waypoint; INSERT INTO script_waypoint (Entry, PathId, Point, PositionX, PositionY, PositionZ, Orientation, WaitTime, ScriptId, Comment) VALUES -(1379,0,1,-5751.12,-3441.01,301.743,0,0,0,''), -(1379,0,2,-5738.58,-3485.14,302.41,0,0,0,''), -(1379,0,3,-5721.62,-3507.85,304.011,0,0,0,''), -(1379,0,4,-5710.21,-3527.97,304.708,0,0,0,''), -(1379,0,5,-5706.92,-3542.89,304.871,0,0,0,''), -(1379,0,6,-5701.53,-3551.24,305.962,0,0,0,''), -(1379,0,7,-5699.53,-3555.69,306.505,0,0,0,''), -(1379,0,8,-5690.56,-3571.98,309.035,0,0,0,''), -(1379,0,9,-5678.61,-3587.17,310.607,0,0,0,''), -(1379,0,10,-5677.05,-3594.35,311.527,0,0,0,''), -(1379,0,11,-5674.39,-3605.19,312.239,0,0,0,''), -(1379,0,12,-5674.45,-3614.39,312.337,0,0,0,''), -(1379,0,13,-5673.05,-3630.56,311.105,0,0,0,''), -(1379,0,14,-5680.34,-3645.44,315.185,0,0,0,''), -(1379,0,15,-5684.46,-3650.05,314.687,0,0,0,''), -(1379,0,16,-5693.9,-3674.14,313.03,0,0,0,''), -(1379,0,17,-5701.43,-3712.54,313.959,0,0,0,''), -(1379,0,18,-5698.79,-3720.88,316.943,0,0,0,''), -(1379,0,19,-5699.95,-3733.63,318.597,0,0,0,'Protecting the Shipment - Ambush'), -(1379,0,20,-5698.61,-3754.74,322.047,0,0,0,''), -(1379,0,21,-5688.68,-3769,323.957,0,0,0,''), -(1379,0,22,-5688.14,-3782.65,322.667,0,0,0,''), -(1379,0,23,-5699.23,-3792.65,322.448,0,30000,0,'Protecting the Shipment - End'), -(1379,0,24,-5700.8,-3792.78,322.588,0,0,5000,''), (1840,0,1,2689.68,-1937.47,72.14,0,0,0,''), (1840,0,2,2683.11,-1926.82,72.14,0,0,0,''), (1840,0,3,2678.73,-1919.42,68.86,2.11887,1000,0,'escort paused'), diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp index 1920dead44e..0a674c50458 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp @@ -36,12 +36,14 @@ enum { QUEST_PROTECTING_THE_SHIPMENT = 309, - SAY_MIRAN_1 = -1000571, - SAY_DARK_IRON_DWARF = -1000572, - SAY_MIRAN_2 = -1000573, - SAY_MIRAN_3 = -1000574, + SAY_MIRAN_1 = 510, + SAY_MIRAN_2 = 511, + SAY_MIRAN_3 = 498, - NPC_DARK_IRON_DWARF = 2149 + SAY_DARK_IRON_RAIDER = 512, + NPC_DARK_IRON_RAIDER = 2149, + + MIRAN_ESCORT_PATH = 1379 }; struct Location @@ -51,13 +53,13 @@ struct Location static const Location m_afAmbushSpawn[] = { - { -5691.93f, -3745.91f, 319.159f, 2.21f}, - { -5706.98f, -3745.39f, 318.728f, 1.04f} + { -5705.012f, -3736.6575f, 318.56738f, 0.57595f}, + { -5696.1943f, -3736.78f, 318.58145f, 2.40855f} }; struct npc_miranAI: public npc_escortAI { - npc_miranAI(Creature* pCreature): npc_escortAI(pCreature) + npc_miranAI(Creature* creature): npc_escortAI(creature) { Reset(); } @@ -74,57 +76,61 @@ struct npc_miranAI: public npc_escortAI { switch (uiPointId) { - case 19: - DoScriptText(SAY_MIRAN_1, m_creature); - m_creature->SummonCreature(NPC_DARK_IRON_DWARF, m_afAmbushSpawn[0].m_fX, m_afAmbushSpawn[0].m_fY, m_afAmbushSpawn[0].m_fZ, m_afAmbushSpawn[0].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); - m_creature->SummonCreature(NPC_DARK_IRON_DWARF, m_afAmbushSpawn[1].m_fX, m_afAmbushSpawn[1].m_fY, m_afAmbushSpawn[1].m_fZ, m_afAmbushSpawn[1].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); + case 16: + DoBroadcastText(SAY_MIRAN_1, m_creature); break; - case 23: - DoScriptText(SAY_MIRAN_3, m_creature); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->RewardPlayerAndGroupAtEventExplored(QUEST_PROTECTING_THE_SHIPMENT, m_creature); + case 17: + SetEscortPaused(true); + m_creature->SummonCreature(NPC_DARK_IRON_RAIDER, m_afAmbushSpawn[0].m_fX, m_afAmbushSpawn[0].m_fY, m_afAmbushSpawn[0].m_fZ, m_afAmbushSpawn[0].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); + m_creature->SummonCreature(NPC_DARK_IRON_RAIDER, m_afAmbushSpawn[1].m_fX, m_afAmbushSpawn[1].m_fY, m_afAmbushSpawn[1].m_fZ, m_afAmbushSpawn[1].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); break; - case 24: - m_creature->ForcedDespawn(5000); + case 21: + DoBroadcastText(SAY_MIRAN_3, m_creature); + if (Player* player = GetPlayerForEscort()) + player->RewardPlayerAndGroupAtEventExplored(QUEST_PROTECTING_THE_SHIPMENT, m_creature); + SetEscortPaused(true); + m_creature->ForcedDespawn(15000); break; } } - void SummonedCreatureJustDied(Creature* pSummoned) override + void SummonedCreatureJustDied(Creature* summoned) override { - if (pSummoned->GetEntry() == NPC_DARK_IRON_DWARF) + if (summoned->GetEntry() == NPC_DARK_IRON_RAIDER) { --m_uiDwarves; if (!m_uiDwarves) - DoScriptText(SAY_MIRAN_2, m_creature); + { + DoBroadcastText(SAY_MIRAN_2, m_creature); + SetEscortPaused(false); + } } } - void JustSummoned(Creature* pSummoned) override + void JustSummoned(Creature* summoned) override { - if (pSummoned->GetEntry() == NPC_DARK_IRON_DWARF) + if (summoned->GetEntry() == NPC_DARK_IRON_RAIDER) { - if (!m_uiDwarves) - DoScriptText(SAY_DARK_IRON_DWARF, pSummoned); ++m_uiDwarves; - pSummoned->AI()->AttackStart(m_creature); + summoned->AI()->AttackStart(m_creature); + DoBroadcastText(SAY_DARK_IRON_RAIDER, summoned); } } }; -bool QuestAccept_npc_miran(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +bool QuestAccept_npc_miran(Player* player, Creature* creature, const Quest* quest) { - if (pQuest->GetQuestId() == QUEST_PROTECTING_THE_SHIPMENT) + if (quest->GetQuestId() == QUEST_PROTECTING_THE_SHIPMENT) { - if (npc_miranAI* pEscortAI = dynamic_cast(pCreature->AI())) - pEscortAI->Start(false, pPlayer, pQuest); + if (npc_miranAI* pEscortAI = dynamic_cast(creature->AI())) + pEscortAI->Start(false, player, quest, false, false, MIRAN_ESCORT_PATH); } return true; } -UnitAI* GetAI_npc_miran(Creature* pCreature) +UnitAI* GetAI_npc_miran(Creature* creature) { - return new npc_miranAI(pCreature); + return new npc_miranAI(creature); } void AddSC_loch_modan()