Small cleanup in boss Ouro script.
[scriptdev2-git.git] / scripts / outland / terokkar_forest.cpp
blobcd840fc258984653872128a9b98c69fe535532e6
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: Terokkar_Forest
19 SD%Complete: 80
20 SDComment: Quest support: 9889, 10009, 10873, 10896, 10446/10447, 10887, 10922, 11096. Skettis->Ogri'la Flight
21 SDCategory: Terokkar Forest
22 EndScriptData */
24 /* ContentData
25 mob_unkor_the_ruthless
26 mob_infested_root_walker
27 mob_rotting_forest_rager
28 mob_netherweb_victim
29 npc_akuno
30 npc_floon
31 npc_letoll
32 npc_mana_bomb_exp_trigger
33 go_mana_bomb
34 npc_skyguard_handler_deesak
35 npc_slim
36 EndContentData */
38 #include "precompiled.h"
39 #include "escort_ai.h"
41 /*######
42 ## mob_unkor_the_ruthless
43 ######*/
45 #define SAY_SUBMIT -1000194
47 #define FACTION_HOSTILE 45
48 #define FACTION_FRIENDLY 35
49 #define QUEST_DONTKILLTHEFATONE 9889
51 #define SPELL_PULVERIZE 2676
52 //#define SPELL_QUID9889 32174
54 struct MANGOS_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI
56 mob_unkor_the_ruthlessAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
58 bool CanDoQuest;
59 uint32 UnkorUnfriendly_Timer;
60 uint32 Pulverize_Timer;
62 void Reset()
64 CanDoQuest = false;
65 UnkorUnfriendly_Timer = 0;
66 Pulverize_Timer = 3000;
67 m_creature->SetStandState(UNIT_STAND_STATE_STAND);
68 m_creature->setFaction(FACTION_HOSTILE);
71 void DoNice()
73 DoScriptText(SAY_SUBMIT, m_creature);
74 m_creature->setFaction(FACTION_FRIENDLY);
75 m_creature->SetStandState(UNIT_STAND_STATE_SIT);
76 m_creature->RemoveAllAuras();
77 m_creature->DeleteThreatList();
78 m_creature->CombatStop(true);
79 UnkorUnfriendly_Timer = 60000;
82 void DamageTaken(Unit *done_by, uint32 &damage)
84 if (done_by->GetTypeId() == TYPEID_PLAYER)
85 if ((m_creature->GetHealth()-damage)*100 / m_creature->GetMaxHealth() < 30)
87 if (Group* pGroup = ((Player*)done_by)->GetGroup())
89 for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
91 Player *pGroupie = itr->getSource();
92 if (pGroupie &&
93 pGroupie->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE &&
94 pGroupie->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10)
96 pGroupie->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE);
97 if (!CanDoQuest)
98 CanDoQuest = true;
101 } else
102 if (((Player*)done_by)->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE &&
103 ((Player*)done_by)->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10)
105 ((Player*)done_by)->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE);
106 CanDoQuest = true;
111 void UpdateAI(const uint32 diff)
113 if (CanDoQuest)
115 if (!UnkorUnfriendly_Timer)
117 //DoCastSpellIfCan(m_creature,SPELL_QUID9889); //not using spell for now
118 DoNice();
120 else
122 if (UnkorUnfriendly_Timer <= diff)
124 EnterEvadeMode();
125 }else UnkorUnfriendly_Timer -= diff;
129 if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
130 return;
132 if (Pulverize_Timer < diff)
134 DoCastSpellIfCan(m_creature,SPELL_PULVERIZE);
135 Pulverize_Timer = 9000;
136 }else Pulverize_Timer -= diff;
138 DoMeleeAttackIfReady();
142 CreatureAI* GetAI_mob_unkor_the_ruthless(Creature* pCreature)
144 return new mob_unkor_the_ruthlessAI(pCreature);
147 /*######
148 ## mob_infested_root_walker
149 ######*/
151 struct MANGOS_DLL_DECL mob_infested_root_walkerAI : public ScriptedAI
153 mob_infested_root_walkerAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
155 void Reset() { }
157 void DamageTaken(Unit *done_by, uint32 &damage)
159 if (done_by && done_by->GetTypeId() == TYPEID_PLAYER)
160 if (m_creature->GetHealth() <= damage)
161 if (urand(0, 3))
162 //Summon Wood Mites
163 m_creature->CastSpell(m_creature,39130,true);
166 CreatureAI* GetAI_mob_infested_root_walker(Creature* pCreature)
168 return new mob_infested_root_walkerAI(pCreature);
171 /*######
172 ## mob_rotting_forest_rager
173 ######*/
175 struct MANGOS_DLL_DECL mob_rotting_forest_ragerAI : public ScriptedAI
177 mob_rotting_forest_ragerAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
179 void Reset() { }
181 void DamageTaken(Unit *done_by, uint32 &damage)
183 if (done_by->GetTypeId() == TYPEID_PLAYER)
184 if (m_creature->GetHealth() <= damage)
185 if (urand(0, 3))
186 //Summon Lots of Wood Mights
187 m_creature->CastSpell(m_creature,39134,true);
190 CreatureAI* GetAI_mob_rotting_forest_rager(Creature* pCreature)
192 return new mob_rotting_forest_ragerAI(pCreature);
195 /*######
196 ## mob_netherweb_victim
197 ######*/
199 enum
201 NPC_FREED_WARRIOR = 22459,
202 QUEST_TAKEN_IN_NIGHT = 10873
203 //SPELL_FREE_WEBBED = 38950
206 const uint32 netherwebVictims[6] =
208 18470, 16805, 21242, 18452, 22482, 21285
210 struct MANGOS_DLL_DECL mob_netherweb_victimAI : public ScriptedAI
212 mob_netherweb_victimAI(Creature* pCreature) : ScriptedAI(pCreature)
214 SetCombatMovement(false);
215 Reset();
218 void Reset() { }
219 void MoveInLineOfSight(Unit* pWho) { }
221 void JustDied(Unit* pKiller)
223 if (pKiller->GetTypeId() == TYPEID_PLAYER)
225 if (((Player*)pKiller)->GetQuestStatus(QUEST_TAKEN_IN_NIGHT) == QUEST_STATUS_INCOMPLETE)
227 if (!urand(0, 3))
229 m_creature->SummonCreature(NPC_FREED_WARRIOR, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
230 ((Player*)pKiller)->KilledMonsterCredit(NPC_FREED_WARRIOR, m_creature->GetGUID());
232 else
233 m_creature->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000);
239 CreatureAI* GetAI_mob_netherweb_victim(Creature* pCreature)
241 return new mob_netherweb_victimAI(pCreature);
244 /*#####
245 ## npc_akuno
246 #####*/
248 enum
250 SAY_AKU_START = -1000477,
251 SAY_AKU_AMBUSH_A = -1000478,
252 SAY_AKU_AMBUSH_B = -1000479,
253 SAY_AKU_AMBUSH_B_REPLY = -1000480,
254 SAY_AKU_COMPLETE = -1000481,
256 SPELL_CHAIN_LIGHTNING = 39945,
258 QUEST_ESCAPING_TOMB = 10887,
259 NPC_CABAL_SKIRMISHER = 21661
262 static float m_afAmbushB1[]= {-2895.525879f, 5336.431641f, -11.800f};
263 static float m_afAmbushB2[]= {-2890.604980f, 5331.938965f, -11.282f};
265 struct MANGOS_DLL_DECL npc_akunoAI : public npc_escortAI
267 npc_akunoAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); }
269 uint32 m_uiChainLightningTimer;
271 void Reset()
273 m_uiChainLightningTimer = 1000;
276 void WaypointReached(uint32 uiPointId)
278 switch(uiPointId)
280 case 5:
281 DoScriptText(SAY_AKU_AMBUSH_A, m_creature);
282 m_creature->SummonCreature(NPC_CABAL_SKIRMISHER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
283 break;
284 case 14:
285 DoScriptText(SAY_AKU_AMBUSH_B, m_creature);
287 if (Creature* pTemp = m_creature->SummonCreature(NPC_CABAL_SKIRMISHER, m_afAmbushB1[0], m_afAmbushB1[1], m_afAmbushB1[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000))
288 DoScriptText(SAY_AKU_AMBUSH_B_REPLY, pTemp);
290 m_creature->SummonCreature(NPC_CABAL_SKIRMISHER, m_afAmbushB2[0], m_afAmbushB2[1], m_afAmbushB2[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
291 break;
292 case 15:
293 SetRun();
294 break;
295 case 18:
296 DoScriptText(SAY_AKU_COMPLETE, m_creature);
298 if (Player* pPlayer = GetPlayerForEscort())
299 pPlayer->GroupEventHappens(QUEST_ESCAPING_TOMB, m_creature);
301 break;
305 void JustSummoned(Creature* pSummoned)
307 pSummoned->AI()->AttackStart(m_creature);
310 void UpdateEscortAI(const uint32 uiDiff)
312 if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
313 return;
315 if (m_uiChainLightningTimer < uiDiff)
317 DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING);
318 m_uiChainLightningTimer = urand(7000, 14000);
320 else
321 m_uiChainLightningTimer -= uiDiff;
323 DoMeleeAttackIfReady();
327 bool QuestAccept_npc_akuno(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
329 if (pQuest->GetQuestId() == QUEST_ESCAPING_TOMB)
331 if (npc_akunoAI* pEscortAI = dynamic_cast<npc_akunoAI*>(pCreature->AI()))
333 pCreature->SetStandState(UNIT_STAND_STATE_STAND);
334 pCreature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
336 DoScriptText(SAY_AKU_START, pCreature);
337 pEscortAI->Start(true, false, pPlayer->GetGUID(), pQuest);
340 return true;
343 CreatureAI* GetAI_npc_akuno(Creature* pCreature)
345 return new npc_akunoAI(pCreature);
348 /*######
349 ## npc_floon
350 ######*/
352 enum
354 SAY_FLOON_ATTACK = -1000195,
356 SPELL_SILENCE = 6726,
357 SPELL_FROSTBOLT = 9672,
358 SPELL_FROST_NOVA = 11831,
360 FACTION_HOSTILE_FL = 1738,
361 QUEST_CRACK_SKULLS = 10009
364 #define GOSSIP_FLOON1 "You owe Sim'salabim money. Hand them over or die!"
365 #define GOSSIP_FLOON2 "Hand over the money or die...again!"
367 struct MANGOS_DLL_DECL npc_floonAI : public ScriptedAI
369 npc_floonAI(Creature* pCreature) : ScriptedAI(pCreature)
371 m_uiNormFaction = pCreature->getFaction();
372 Reset();
375 uint32 m_uiNormFaction;
376 uint32 m_uiSilence_Timer;
377 uint32 m_uiFrostbolt_Timer;
378 uint32 m_uiFrostNova_Timer;
380 void Reset()
382 m_uiSilence_Timer = 2000;
383 m_uiFrostbolt_Timer = 4000;
384 m_uiFrostNova_Timer = 9000;
386 if (m_creature->getFaction() != m_uiNormFaction)
387 m_creature->setFaction(m_uiNormFaction);
390 void UpdateAI(const uint32 uiDiff)
392 if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
393 return;
395 if (m_uiSilence_Timer < uiDiff)
397 DoCastSpellIfCan(m_creature->getVictim(),SPELL_SILENCE);
398 m_uiSilence_Timer = 30000;
399 }else m_uiSilence_Timer -= uiDiff;
401 if (m_uiFrostNova_Timer < uiDiff)
403 DoCastSpellIfCan(m_creature,SPELL_FROST_NOVA);
404 m_uiFrostNova_Timer = 20000;
405 }else m_uiFrostNova_Timer -= uiDiff;
407 if (m_uiFrostbolt_Timer < uiDiff)
409 DoCastSpellIfCan(m_creature->getVictim(),SPELL_FROSTBOLT);
410 m_uiFrostbolt_Timer = 5000;
411 }else m_uiFrostbolt_Timer -= uiDiff;
413 DoMeleeAttackIfReady();
417 CreatureAI* GetAI_npc_floon(Creature* pCreature)
419 return new npc_floonAI(pCreature);
422 bool GossipHello_npc_floon(Player* pPlayer, Creature* pCreature)
424 if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE)
425 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
427 pPlayer->SEND_GOSSIP_MENU(9442, pCreature->GetGUID());
428 return true;
431 bool GossipSelect_npc_floon(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
433 if (uiAction == GOSSIP_ACTION_INFO_DEF)
435 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
436 pPlayer->SEND_GOSSIP_MENU(9443, pCreature->GetGUID());
438 if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
440 pPlayer->CLOSE_GOSSIP_MENU();
441 pCreature->setFaction(FACTION_HOSTILE_FL);
442 DoScriptText(SAY_FLOON_ATTACK, pCreature, pPlayer);
443 ((npc_floonAI*)pCreature->AI())->AttackStart(pPlayer);
445 return true;
448 /*######
449 ## npc_skyguard_handler_deesak
450 ######*/
452 #define GOSSIP_SKYGUARD "Fly me to Ogri'la please"
454 bool GossipHello_npc_skyguard_handler_deesak(Player* pPlayer, Creature* pCreature)
456 if (pCreature->isQuestGiver())
457 pPlayer->PrepareQuestMenu(pCreature->GetGUID());
459 if (pPlayer->GetReputationRank(1031) >= REP_HONORED)
460 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SKYGUARD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
462 pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
464 return true;
467 bool GossipSelect_npc_skyguard_handler_deesak(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
469 if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
471 pPlayer->CLOSE_GOSSIP_MENU();
472 pPlayer->CastSpell(pPlayer,41279,true); //TaxiPath 705 (Taxi - Skettis to Skyguard Outpost)
474 return true;
477 /*######
478 ## npc_letoll
479 ######*/
481 enum
483 SAY_LE_START = -1000511,
484 SAY_LE_KEEP_SAFE = -1000512,
485 SAY_LE_NORTH = -1000513,
486 SAY_LE_ARRIVE = -1000514,
487 SAY_LE_BURIED = -1000515,
488 SAY_LE_ALMOST = -1000516,
489 SAY_LE_DRUM = -1000517,
490 SAY_LE_DRUM_REPLY = -1000518,
491 SAY_LE_DISCOVERY = -1000519,
492 SAY_LE_DISCOVERY_REPLY = -1000520,
493 SAY_LE_NO_LEAVE = -1000521,
494 SAY_LE_NO_LEAVE_REPLY1 = -1000522,
495 SAY_LE_NO_LEAVE_REPLY2 = -1000523,
496 SAY_LE_NO_LEAVE_REPLY3 = -1000524,
497 SAY_LE_NO_LEAVE_REPLY4 = -1000525,
498 SAY_LE_SHUT = -1000526,
499 SAY_LE_REPLY_HEAR = -1000527,
500 SAY_LE_IN_YOUR_FACE = -1000528,
501 SAY_LE_HELP_HIM = -1000529,
502 EMOTE_LE_PICK_UP = -1000530,
503 SAY_LE_THANKS = -1000531,
505 QUEST_DIGGING_BONES = 10922,
507 NPC_RESEARCHER = 22464,
508 NPC_BONE_SIFTER = 22466,
510 MAX_RESEARCHER = 4
513 //Some details still missing from here, and will also have issues if followers evade for any reason.
514 struct MANGOS_DLL_DECL npc_letollAI : public npc_escortAI
516 npc_letollAI(Creature* pCreature) : npc_escortAI(pCreature)
518 m_uiEventTimer = 5000;
519 m_uiEventCount = 0;
520 Reset();
523 std::list<Creature*> m_lResearchersList;
525 uint32 m_uiEventTimer;
526 uint32 m_uiEventCount;
528 void Reset() {}
530 //will make them follow, but will only work until they enter combat with any unit
531 void SetFormation()
533 uint32 uiCount = 0;
535 for(std::list<Creature*>::iterator itr = m_lResearchersList.begin(); itr != m_lResearchersList.end(); ++itr)
537 float fAngle = uiCount < MAX_RESEARCHER ? M_PI/MAX_RESEARCHER - (uiCount*2*M_PI/MAX_RESEARCHER) : 0.0f;
539 if ((*itr)->isAlive() && !(*itr)->isInCombat())
540 (*itr)->GetMotionMaster()->MoveFollow(m_creature, 2.5f, fAngle);
542 ++uiCount;
546 Creature* GetAvailableResearcher(uint8 uiListNum)
548 if (!m_lResearchersList.empty())
550 uint8 uiNum = 1;
552 for(std::list<Creature*>::iterator itr = m_lResearchersList.begin(); itr != m_lResearchersList.end(); ++itr)
554 if (uiListNum && uiListNum != uiNum)
556 ++uiNum;
557 continue;
560 if ((*itr)->isAlive() && (*itr)->IsWithinDistInMap(m_creature, 20.0f))
561 return (*itr);
565 return NULL;
568 void JustStartedEscort()
570 m_uiEventTimer = 5000;
571 m_uiEventCount = 0;
573 m_lResearchersList.clear();
575 GetCreatureListWithEntryInGrid(m_lResearchersList, m_creature, NPC_RESEARCHER, 25.0f);
577 if (!m_lResearchersList.empty())
578 SetFormation();
581 void WaypointReached(uint32 uiPointId)
583 switch(uiPointId)
585 case 0:
586 if (Player* pPlayer = GetPlayerForEscort())
587 DoScriptText(SAY_LE_KEEP_SAFE, m_creature, pPlayer);
588 break;
589 case 1:
590 DoScriptText(SAY_LE_NORTH, m_creature);
591 break;
592 case 10:
593 DoScriptText(SAY_LE_ARRIVE, m_creature);
594 break;
595 case 12:
596 DoScriptText(SAY_LE_BURIED, m_creature);
597 SetEscortPaused(true);
598 break;
599 case 13:
600 SetRun();
601 break;
605 void Aggro(Unit* pWho)
607 if (pWho->isInCombat() && pWho->GetTypeId() == TYPEID_UNIT && pWho->GetEntry() == NPC_BONE_SIFTER)
608 DoScriptText(SAY_LE_HELP_HIM, m_creature);
611 void JustSummoned(Creature* pSummoned)
613 Player* pPlayer = GetPlayerForEscort();
615 if (pPlayer && pPlayer->isAlive())
616 pSummoned->AI()->AttackStart(pPlayer);
617 else
618 pSummoned->AI()->AttackStart(m_creature);
621 void UpdateEscortAI(const uint32 uiDiff)
623 if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
625 if (HasEscortState(STATE_ESCORT_PAUSED))
627 if (m_uiEventTimer < uiDiff)
629 m_uiEventTimer = 7000;
631 switch(m_uiEventCount)
633 case 0:
634 DoScriptText(SAY_LE_ALMOST, m_creature);
635 break;
636 case 1:
637 DoScriptText(SAY_LE_DRUM, m_creature);
638 break;
639 case 2:
640 if (Creature* pResearcher = GetAvailableResearcher(0))
641 DoScriptText(SAY_LE_DRUM_REPLY, pResearcher);
642 break;
643 case 3:
644 DoScriptText(SAY_LE_DISCOVERY, m_creature);
645 break;
646 case 4:
647 if (Creature* pResearcher = GetAvailableResearcher(0))
648 DoScriptText(SAY_LE_DISCOVERY_REPLY, pResearcher);
649 break;
650 case 5:
651 DoScriptText(SAY_LE_NO_LEAVE, m_creature);
652 break;
653 case 6:
654 if (Creature* pResearcher = GetAvailableResearcher(1))
655 DoScriptText(SAY_LE_NO_LEAVE_REPLY1, pResearcher);
656 break;
657 case 7:
658 if (Creature* pResearcher = GetAvailableResearcher(2))
659 DoScriptText(SAY_LE_NO_LEAVE_REPLY2, pResearcher);
660 break;
661 case 8:
662 if (Creature* pResearcher = GetAvailableResearcher(3))
663 DoScriptText(SAY_LE_NO_LEAVE_REPLY3, pResearcher);
664 break;
665 case 9:
666 if (Creature* pResearcher = GetAvailableResearcher(4))
667 DoScriptText(SAY_LE_NO_LEAVE_REPLY4, pResearcher);
668 break;
669 case 10:
670 DoScriptText(SAY_LE_SHUT, m_creature);
671 break;
672 case 11:
673 if (Creature* pResearcher = GetAvailableResearcher(0))
674 DoScriptText(SAY_LE_REPLY_HEAR, pResearcher);
675 break;
676 case 12:
677 DoScriptText(SAY_LE_IN_YOUR_FACE, m_creature);
678 m_creature->SummonCreature(NPC_BONE_SIFTER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
679 break;
680 case 13:
681 DoScriptText(EMOTE_LE_PICK_UP, m_creature);
683 if (Player* pPlayer = GetPlayerForEscort())
685 DoScriptText(SAY_LE_THANKS, m_creature, pPlayer);
686 pPlayer->GroupEventHappens(QUEST_DIGGING_BONES, m_creature);
689 SetEscortPaused(false);
690 break;
693 ++m_uiEventCount;
695 else
696 m_uiEventTimer -= uiDiff;
699 return;
702 DoMeleeAttackIfReady();
706 CreatureAI* GetAI_npc_letoll(Creature* pCreature)
708 return new npc_letollAI(pCreature);
711 bool QuestAccept_npc_letoll(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
713 if (pQuest->GetQuestId() == QUEST_DIGGING_BONES)
715 if (npc_letollAI* pEscortAI = dynamic_cast<npc_letollAI*>(pCreature->AI()))
717 DoScriptText(SAY_LE_START, pCreature);
718 pCreature->setFaction(FACTION_ESCORT_N_NEUTRAL_PASSIVE);
720 pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest, true);
724 return true;
727 /*######
728 ## npc_mana_bomb_exp_trigger
729 ######*/
731 enum
733 SAY_COUNT_1 = -1000472,
734 SAY_COUNT_2 = -1000473,
735 SAY_COUNT_3 = -1000474,
736 SAY_COUNT_4 = -1000475,
737 SAY_COUNT_5 = -1000476,
739 SPELL_MANA_BOMB_LIGHTNING = 37843,
740 SPELL_MANA_BOMB_EXPL = 35513,
742 NPC_MANA_BOMB_EXPL_TRIGGER = 20767,
743 NPC_MANA_BOMB_KILL_TRIGGER = 21039
746 struct MANGOS_DLL_DECL npc_mana_bomb_exp_triggerAI : public ScriptedAI
748 npc_mana_bomb_exp_triggerAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
750 GameObject* pManaBomb;
752 bool m_bIsActivated;
753 uint32 m_uiEventTimer;
754 uint32 m_uiEventCounter;
756 void Reset()
758 pManaBomb = NULL;
759 m_bIsActivated = false;
760 m_uiEventTimer = 1000;
761 m_uiEventCounter = 0;
764 void DoTrigger(Player* pPlayer, GameObject* pGo)
766 if (m_bIsActivated)
767 return;
769 m_bIsActivated = true;
771 pPlayer->KilledMonsterCredit(NPC_MANA_BOMB_KILL_TRIGGER, 0);
773 pManaBomb = pGo;
776 void UpdateAI(const uint32 uiDiff)
778 if (!m_bIsActivated)
779 return;
781 if (m_uiEventTimer < uiDiff)
783 m_uiEventTimer = 1000;
785 if (m_uiEventCounter < 10)
786 m_creature->CastSpell(m_creature, SPELL_MANA_BOMB_LIGHTNING, false);
788 switch(m_uiEventCounter)
790 case 5:
791 if (pManaBomb)
792 pManaBomb->SetGoState(GO_STATE_ACTIVE);
794 DoScriptText(SAY_COUNT_1, m_creature);
795 break;
796 case 6:
797 DoScriptText(SAY_COUNT_2, m_creature);
798 break;
799 case 7:
800 DoScriptText(SAY_COUNT_3, m_creature);
801 break;
802 case 8:
803 DoScriptText(SAY_COUNT_4, m_creature);
804 break;
805 case 9:
806 DoScriptText(SAY_COUNT_5, m_creature);
807 break;
808 case 10:
809 m_creature->CastSpell(m_creature, SPELL_MANA_BOMB_EXPL, false);
810 break;
811 case 30:
812 if (pManaBomb)
813 pManaBomb->SetGoState(GO_STATE_READY);
815 Reset();
816 break;
819 ++m_uiEventCounter;
821 else
822 m_uiEventTimer -= uiDiff;
826 CreatureAI* GetAI_npc_mana_bomb_exp_trigger(Creature* pCreature)
828 return new npc_mana_bomb_exp_triggerAI(pCreature);
831 /*######
832 ## go_mana_bomb
833 ######*/
835 bool GOHello_go_mana_bomb(Player* pPlayer, GameObject* pGo)
837 if (Creature* pCreature = GetClosestCreatureWithEntry(pGo, NPC_MANA_BOMB_EXPL_TRIGGER, INTERACTION_DISTANCE))
839 if (npc_mana_bomb_exp_triggerAI* pBombAI = dynamic_cast<npc_mana_bomb_exp_triggerAI*>(pCreature->AI()))
840 pBombAI->DoTrigger(pPlayer, pGo);
843 return true;
846 /*######
847 ## npc_slim
848 ######*/
850 enum
852 FACTION_CONSORTIUM = 933
855 bool GossipHello_npc_slim(Player* pPlayer, Creature* pCreature)
857 if (pCreature->isVendor() && pPlayer->GetReputationRank(FACTION_CONSORTIUM) >= REP_FRIENDLY)
859 pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
860 pPlayer->SEND_GOSSIP_MENU(9896, pCreature->GetGUID());
862 else
863 pPlayer->SEND_GOSSIP_MENU(9895, pCreature->GetGUID());
865 return true;
868 bool GossipSelect_npc_slim(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
870 if (uiAction == GOSSIP_ACTION_TRADE)
871 pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
873 return true;
876 void AddSC_terokkar_forest()
878 Script *newscript;
880 newscript = new Script;
881 newscript->Name = "mob_unkor_the_ruthless";
882 newscript->GetAI = &GetAI_mob_unkor_the_ruthless;
883 newscript->RegisterSelf();
885 newscript = new Script;
886 newscript->Name = "mob_infested_root_walker";
887 newscript->GetAI = &GetAI_mob_infested_root_walker;
888 newscript->RegisterSelf();
890 newscript = new Script;
891 newscript->Name = "mob_rotting_forest_rager";
892 newscript->GetAI = &GetAI_mob_rotting_forest_rager;
893 newscript->RegisterSelf();
895 newscript = new Script;
896 newscript->Name = "mob_netherweb_victim";
897 newscript->GetAI = &GetAI_mob_netherweb_victim;
898 newscript->RegisterSelf();
900 newscript = new Script;
901 newscript->Name = "npc_akuno";
902 newscript->GetAI = &GetAI_npc_akuno;
903 newscript->pQuestAccept = &QuestAccept_npc_akuno;
904 newscript->RegisterSelf();
906 newscript = new Script;
907 newscript->Name = "npc_floon";
908 newscript->GetAI = &GetAI_npc_floon;
909 newscript->pGossipHello = &GossipHello_npc_floon;
910 newscript->pGossipSelect = &GossipSelect_npc_floon;
911 newscript->RegisterSelf();
913 newscript = new Script;
914 newscript->Name = "npc_letoll";
915 newscript->GetAI = &GetAI_npc_letoll;
916 newscript->pQuestAccept = &QuestAccept_npc_letoll;
917 newscript->RegisterSelf();
919 newscript = new Script;
920 newscript->Name = "npc_mana_bomb_exp_trigger";
921 newscript->GetAI = &GetAI_npc_mana_bomb_exp_trigger;
922 newscript->RegisterSelf();
924 newscript = new Script;
925 newscript->Name = "go_mana_bomb";
926 newscript->pGOHello = &GOHello_go_mana_bomb;
927 newscript->RegisterSelf();
929 newscript = new Script;
930 newscript->Name = "npc_skyguard_handler_deesak";
931 newscript->pGossipHello = &GossipHello_npc_skyguard_handler_deesak;
932 newscript->pGossipSelect = &GossipSelect_npc_skyguard_handler_deesak;
933 newscript->RegisterSelf();
935 newscript = new Script;
936 newscript->Name = "npc_slim";
937 newscript->pGossipHello = &GossipHello_npc_slim;
938 newscript->pGossipSelect = &GossipSelect_npc_slim;
939 newscript->RegisterSelf();