Small cleanup in boss Ouro script.
[scriptdev2-git.git] / scripts / eastern_kingdoms / western_plaguelands.cpp
blobbc5f1c2a43495d26ad71d50bd8700165147c54f5
1 /* Copyright (C) 2006 - 2010 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 /* ScriptData
18 SDName: Western_Plaguelands
19 SD%Complete: 90
20 SDComment: Quest support: 5216,5219,5222,5225,5229,5231,5233,5235. To obtain Vitreous Focuser (could use more spesifics about gossip items)
21 SDCategory: Western Plaguelands
22 EndScriptData */
24 /* ContentData
25 npcs_dithers_and_arbington
26 npc_myranda_hag
27 npc_the_scourge_cauldron
28 EndContentData */
30 #include "precompiled.h"
32 /*######
33 ## npcs_dithers_and_arbington
34 ######*/
36 bool GossipHello_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature)
38 if (pCreature->isQuestGiver())
39 pPlayer->PrepareQuestMenu(pCreature->GetGUID());
40 if (pCreature->isVendor())
41 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
43 if (pPlayer->GetQuestRewardStatus(5237) || pPlayer->GetQuestRewardStatus(5238))
45 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What does the Felstone Field Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
46 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What does the Dalson's Tears Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
47 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What does the Writhing Haunt Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
48 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "What does the Gahrron's Withering Cauldron need?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
49 pPlayer->SEND_GOSSIP_MENU(3985, pCreature->GetGUID());
50 }else
51 pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
53 return true;
56 bool GossipSelect_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
58 switch(uiAction)
60 case GOSSIP_ACTION_TRADE:
61 pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
62 break;
63 case GOSSIP_ACTION_INFO_DEF+1:
64 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
65 pPlayer->SEND_GOSSIP_MENU(3980, pCreature->GetGUID());
66 break;
67 case GOSSIP_ACTION_INFO_DEF+2:
68 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
69 pPlayer->SEND_GOSSIP_MENU(3981, pCreature->GetGUID());
70 break;
71 case GOSSIP_ACTION_INFO_DEF+3:
72 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
73 pPlayer->SEND_GOSSIP_MENU(3982, pCreature->GetGUID());
74 break;
75 case GOSSIP_ACTION_INFO_DEF+4:
76 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Thanks, i need a Vitreous Focuser", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
77 pPlayer->SEND_GOSSIP_MENU(3983, pCreature->GetGUID());
78 break;
79 case GOSSIP_ACTION_INFO_DEF+5:
80 pPlayer->CLOSE_GOSSIP_MENU();
81 pCreature->CastSpell(pPlayer, 17529, false);
82 break;
84 return true;
87 /*######
88 ## npc_myranda_the_hag
89 ######*/
91 enum
93 QUEST_SUBTERFUGE = 5862,
94 QUEST_IN_DREAMS = 5944,
95 SPELL_SCARLET_ILLUSION = 17961
98 #define GOSSIP_ITEM_ILLUSION "I am ready for the illusion, Myranda."
100 bool GossipHello_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature)
102 if (pCreature->isQuestGiver())
103 pPlayer->PrepareQuestMenu(pCreature->GetGUID());
105 if (pPlayer->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE &&
106 !pPlayer->GetQuestRewardStatus(QUEST_IN_DREAMS) && !pPlayer->HasAura(SPELL_SCARLET_ILLUSION))
108 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ILLUSION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
109 pPlayer->SEND_GOSSIP_MENU(4773, pCreature->GetGUID());
110 return true;
112 else
113 pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
115 return true;
118 bool GossipSelect_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
120 if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
122 pPlayer->CLOSE_GOSSIP_MENU();
123 pCreature->CastSpell(pPlayer, SPELL_SCARLET_ILLUSION, false);
125 return true;
128 /*######
129 ## npc_the_scourge_cauldron
130 ######*/
132 struct MANGOS_DLL_DECL npc_the_scourge_cauldronAI : public ScriptedAI
134 npc_the_scourge_cauldronAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
136 void Reset() {}
138 void DoDie()
140 //summoner dies here
141 m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
142 //override any database `spawntimesecs` to prevent duplicated summons
143 uint32 rTime = m_creature->GetRespawnDelay();
144 if (rTime<600)
145 m_creature->SetRespawnDelay(600);
148 void MoveInLineOfSight(Unit *who)
150 if (!who || who->GetTypeId() != TYPEID_PLAYER)
151 return;
153 if (who->GetTypeId() == TYPEID_PLAYER)
155 switch(m_creature->GetAreaId())
157 case 199: //felstone
158 if (((Player*)who)->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE ||
159 ((Player*)who)->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE)
161 m_creature->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
162 DoDie();
164 break;
165 case 200: //dalson
166 if (((Player*)who)->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE ||
167 ((Player*)who)->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE)
169 m_creature->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
170 DoDie();
172 break;
173 case 201: //gahrron
174 if (((Player*)who)->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE ||
175 ((Player*)who)->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE)
177 m_creature->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000);
178 DoDie();
180 break;
181 case 202: //writhing
182 if (((Player*)who)->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE ||
183 ((Player*)who)->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE)
185 m_creature->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000);
186 DoDie();
188 break;
193 CreatureAI* GetAI_npc_the_scourge_cauldron(Creature* pCreature)
195 return new npc_the_scourge_cauldronAI(pCreature);
198 /*######
200 ######*/
202 void AddSC_western_plaguelands()
204 Script *newscript;
206 newscript = new Script;
207 newscript->Name = "npcs_dithers_and_arbington";
208 newscript->pGossipHello = &GossipHello_npcs_dithers_and_arbington;
209 newscript->pGossipSelect = &GossipSelect_npcs_dithers_and_arbington;
210 newscript->RegisterSelf();
212 newscript = new Script;
213 newscript->Name = "npc_myranda_the_hag";
214 newscript->pGossipHello = &GossipHello_npc_myranda_the_hag;
215 newscript->pGossipSelect = &GossipSelect_npc_myranda_the_hag;
216 newscript->RegisterSelf();
218 newscript = new Script;
219 newscript->Name = "npc_the_scourge_cauldron";
220 newscript->GetAI = &GetAI_npc_the_scourge_cauldron;
221 newscript->RegisterSelf();