From 11ef556320edfc1c925c4fcc14fd09a5cd24776a Mon Sep 17 00:00:00 2001 From: click Date: Fri, 30 Apr 2010 23:53:37 +0200 Subject: [PATCH] Add support for quest 12832 (Bitter Departure) - closes issue #804 Patch by supabad --HG-- branch : trunk --- sql/updates/8052_world_creature.sql | 3 + sql/updates/8052_world_creature_template.sql | 2 + sql/updates/8052_world_script_texts.sql | 5 + sql/updates/8052_world_script_waypoint.sql | 29 ++++++ src/scripts/northrend/storm_peaks.cpp | 102 +++++++++++++++++++ 5 files changed, 141 insertions(+) create mode 100644 sql/updates/8052_world_creature.sql create mode 100644 sql/updates/8052_world_creature_template.sql create mode 100644 sql/updates/8052_world_script_texts.sql create mode 100644 sql/updates/8052_world_script_waypoint.sql diff --git a/sql/updates/8052_world_creature.sql b/sql/updates/8052_world_creature.sql new file mode 100644 index 00000000000..0cad6812abf --- /dev/null +++ b/sql/updates/8052_world_creature.sql @@ -0,0 +1,3 @@ +DELETE FROM `creature` WHERE `id`=29434; +INSERT INTO `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `DeathState`, `MovementType`) VALUES +(29434, 571, 1, 1, 0, 254, 6629.44, -1251.64, 395.942, 5.38386, 25, 0, 0, 9416, 0, 0, 2); diff --git a/sql/updates/8052_world_creature_template.sql b/sql/updates/8052_world_creature_template.sql new file mode 100644 index 00000000000..7ffb0f4717b --- /dev/null +++ b/sql/updates/8052_world_creature_template.sql @@ -0,0 +1,2 @@ +UPDATE `creature_template` SET `MovementType` = '2', `ScriptName` = 'npc_injured_goblin' WHERE `creature_template`.`entry`=29434; + diff --git a/sql/updates/8052_world_script_texts.sql b/sql/updates/8052_world_script_texts.sql new file mode 100644 index 00000000000..879e4218e91 --- /dev/null +++ b/sql/updates/8052_world_script_texts.sql @@ -0,0 +1,5 @@ +DELETE FROM `script_texts` WHERE `npc_entry`= 29434; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) VALUES +('29434', '-1800042', 'Let me know when you''re ready. I''d prefer sooner than later... what with the slowly dying from poison and all. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '0', '0', '0', 'injured goblin SAY_QUEST_START'), +('29434', '-1800043', 'I''m going to bring the venom sack to Ricket... and then... you know... collapse. Thank you for helping me! ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '0', '0', '0', 'injured goblin SAY_END_WP_REACHED'); + diff --git a/sql/updates/8052_world_script_waypoint.sql b/sql/updates/8052_world_script_waypoint.sql new file mode 100644 index 00000000000..3c2d016102c --- /dev/null +++ b/sql/updates/8052_world_script_waypoint.sql @@ -0,0 +1,29 @@ +DELETE FROM `script_waypoint` WHERE `entry` =29434; +INSERT INTO `script_waypoint` (`entry`, `pointid`, `location_x`, `location_y`, `location_z`, `waittime`, `point_comment`) VALUES +(29434, 1, 6645.47, -1263.66, 396.938, 0, 0), +(29434, 2, 6662.06, -1274.13, 397.319, 0, 0), +(29434, 3, 6666.29, -1254.59, 396.11, 0, 0), +(29434, 4, 6669.33, -1240.06, 397.789, 0, 0), +(29434, 5, 6654.31, -1205.01, 399.823, 0, 0), +(29434, 6, 6657.03, -1170.15, 398.755, 0, 0), +(29434, 7, 6667.33, -1146.28, 399.014, 0, 0), +(29434, 8, 6670.9, -1138.68, 397.125, 0, 0), +(29434, 9, 6685.09, -1103.95, 396.828, 0, 0), +(29434, 10, 6688.71, -1094.32, 395.019, 0, 0), +(29434, 11, 6684.75, -1084.31, 396.916, 0, 0), +(29434, 12, 6679.3, -1074.4, 404.284, 0, 0), +(29434, 13, 6691.91, -1051.96, 407.983, 0, 0), +(29434, 14, 6696.28, -1016.54, 414.823, 0, 0), +(29434, 15, 6675.32, -1005.06, 414.844, 0, 0), +(29434, 16, 6661.01, -1007.41, 414.946, 0, 0), +(29434, 17, 6643.75, -1010.24, 420.508, 0, 0), +(29434, 18, 6620.76, -1012.59, 424.378, 0, 0), +(29434, 19, 6610.33, -996.992, 428.116, 0, 0), +(29434, 20, 6581.3, -1005.9, 434.257, 0, 0), +(29434, 21, 6570.74, -1013, 434.076, 0, 0), +(29434, 22, 6551.68, -1012.38, 433.218, 0, 0), +(29434, 23, 6530.83, -1024.99, 433.04, 0, 0), +(29434, 24, 6510.05, -1031.23, 435.824, 0, 0), +(29434, 25, 6491.5, -1032.46, 434.226, 0, 0), +(29434, 26, 6475.58, -1023.13, 434.759, 0, 0), +(29434, 27, 6451.81, -1025.43, 431.502, 10000, 0); \ No newline at end of file diff --git a/src/scripts/northrend/storm_peaks.cpp b/src/scripts/northrend/storm_peaks.cpp index 2d674c81652..f71f3d2b935 100644 --- a/src/scripts/northrend/storm_peaks.cpp +++ b/src/scripts/northrend/storm_peaks.cpp @@ -16,6 +16,7 @@ */ #include "ScriptedPch.h" +#include "ScriptedEscortAI.h" /*###### ## npc_agnetta_tyrsdottar @@ -346,6 +347,99 @@ bool GossipSelect_npc_loklira_crone(Player* pPlayer, Creature* pCreature, uint32 return true; } +///////////////////// +///npc_injured_goblin +///////////////////// + +enum eInjuredGoblin +{ + QUEST_BITTER_DEPARTURE = 12832, + SAY_QUEST_ACCEPT = -1800042, + SAY_END_WP_REACHED = -1800043 +}; + +#define GOSSIP_ITEM_1 "I am ready, lets get you out of here" + +struct npc_injured_goblinAI : public npc_escortAI +{ + npc_injured_goblinAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + switch (i) + { + case 26: + DoScriptText(SAY_END_WP_REACHED, m_creature, pPlayer); + break; + case 27: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_BITTER_DEPARTURE, m_creature); + break; + } + } + + void EnterCombat(Unit* pWho) {} + + void Reset() {} + + void JustDied(Unit* pKiller) + { + Player* pPlayer = GetPlayerForEscort(); + if (HasEscortState(STATE_ESCORT_ESCORTING) && pPlayer) + pPlayer->FailQuest(QUEST_BITTER_DEPARTURE); + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_npc_injured_goblin(Creature* pCreature) +{ + return new npc_injured_goblinAI(pCreature); +} + +bool GossipHello_npc_injured_goblin(Player* pPlayer, Creature* pCreature) +{ + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_BITTER_DEPARTURE) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->PlayerTalkClass->SendGossipMenu(9999999, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(999999, pCreature->GetGUID()); + return true; +} + +bool QuestAccept_npc_injured_goblin(Player* pPlayer, Creature* pCreature, Quest const *quest) +{ + if (quest->GetQuestId() == QUEST_BITTER_DEPARTURE) + DoScriptText(SAY_QUEST_ACCEPT, pCreature); + + return false; +} + +bool GossipSelect_npc_injured_goblin(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblinAI, pCreature->AI()); + + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pEscortAI->Start(true, true, pPlayer->GetGUID()); + pCreature->setFaction(113); + } + return true; +} + + void AddSC_storm_peaks() { Script* newscript; @@ -386,4 +480,12 @@ void AddSC_storm_peaks() newscript->pGossipHello = &GossipHello_npc_loklira_crone; newscript->pGossipSelect = &GossipSelect_npc_loklira_crone; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_injured_goblin"; + newscript->GetAI = &GetAI_npc_injured_goblin; + newscript->pGossipHello = &GossipHello_npc_injured_goblin; + newscript->pGossipSelect = &GossipSelect_npc_injured_goblin; + newscript->pQuestAccept = &QuestAccept_npc_injured_goblin; + newscript->RegisterSelf(); }