forked from insider42/scriptdev2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshadowmoon_valley.cpp
More file actions
1628 lines (1376 loc) · 51.3 KB
/
shadowmoon_valley.cpp
File metadata and controls
1628 lines (1376 loc) · 51.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Shadowmoon_Valley
SD%Complete: 100
SDComment: Quest support: 10519, 10583, 10601, 10781, 10814, 10804, 10854, 11082, 10458, 10480, 10481. Vendor Drake Dealer Hurlunk.
SDCategory: Shadowmoon Valley
EndScriptData */
/* ContentData
mob_mature_netherwing_drake
mob_enslaved_netherwing_drake
npc_dragonmaw_peon
npc_drake_dealer_hurlunk
npcs_flanis_swiftwing_and_kagrosh
npc_murkblood_overseer
npc_neltharaku
npc_karynaku
npc_oronok_tornheart
npc_wilda
mob_torloth
npc_totem_of_spirits
event_spell_soul_captured_credit
npc_lord_illidan_stormrage
go_crystal_prison
EndContentData */
#include "precompiled.h"
#include "escort_ai.h"
#include "pet_ai.h"
/*#####
# mob_mature_netherwing_drake
#####*/
enum
{
SAY_JUST_EATEN = -1000175,
SPELL_PLACE_CARCASS = 38439,
SPELL_JUST_EATEN = 38502,
SPELL_NETHER_BREATH = 38467,
POINT_ID = 1,
QUEST_KINDNESS = 10804,
NPC_EVENT_PINGER = 22131
};
struct MANGOS_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI
{
mob_mature_netherwing_drakeAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
uint64 uiPlayerGUID;
bool bCanEat;
bool bIsEating;
uint32 EatTimer;
uint32 CastTimer;
void Reset()
{
uiPlayerGUID = 0;
bCanEat = false;
bIsEating = false;
EatTimer = 5000;
CastTimer = 5000;
}
void SpellHit(Unit* pCaster, SpellEntry const* pSpell)
{
if (bCanEat || bIsEating)
return;
if (pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_PLACE_CARCASS && !m_creature->HasAura(SPELL_JUST_EATEN))
{
uiPlayerGUID = pCaster->GetGUID();
bCanEat = true;
}
}
void MovementInform(uint32 type, uint32 id)
{
if (type != POINT_MOTION_TYPE)
return;
if (id == POINT_ID)
{
bIsEating = true;
EatTimer = 7000;
m_creature->HandleEmote(EMOTE_ONESHOT_ATTACKUNARMED);
}
}
void UpdateAI(const uint32 diff)
{
if (bCanEat || bIsEating)
{
if (EatTimer < diff)
{
if (bCanEat && !bIsEating)
{
if (Player* pPlayer = m_creature->GetMap()->GetPlayer(uiPlayerGUID))
{
GameObject* pGo = pPlayer->GetGameObject(SPELL_PLACE_CARCASS);
// Workaround for broken function GetGameObject
if (!pGo)
{
const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_PLACE_CARCASS);
uint32 uiGameobjectEntry = pSpell->EffectMiscValue[EFFECT_INDEX_0];
pGo = GetClosestGameObjectWithEntry(pPlayer, uiGameobjectEntry, 2*INTERACTION_DISTANCE);
}
if (pGo)
{
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MoveIdle();
m_creature->StopMoving();
float fX, fY, fZ;
pGo->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE);
m_creature->GetMotionMaster()->MovePoint(POINT_ID, fX, fY, fZ);
}
}
bCanEat = false;
}
else if (bIsEating)
{
DoCastSpellIfCan(m_creature, SPELL_JUST_EATEN);
DoScriptText(SAY_JUST_EATEN, m_creature);
if (Player* pPlayer = m_creature->GetMap()->GetPlayer(uiPlayerGUID))
pPlayer->KilledMonsterCredit(NPC_EVENT_PINGER, m_creature->GetObjectGuid());
Reset();
m_creature->GetMotionMaster()->Clear();
}
}
else
EatTimer -= diff;
return;
}
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
if (CastTimer < diff)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_NETHER_BREATH);
CastTimer = 5000;
}else CastTimer -= diff;
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_mob_mature_netherwing_drake(Creature* pCreature)
{
return new mob_mature_netherwing_drakeAI(pCreature);
}
/*###
# mob_enslaved_netherwing_drake
####*/
enum
{
FACTION_DEFAULT = 62,
FACTION_FRIENDLY = 1840, // Not sure if this is correct, it was taken off of Mordenai.
SPELL_HIT_FORCE_OF_NELTHARAKU = 38762,
SPELL_FORCE_OF_NELTHARAKU = 38775,
QUEST_FORCE_OF_NELT = 10854,
NPC_DRAGONMAW_SUBJUGATOR = 21718,
NPC_ESCAPE_DUMMY = 21348
};
struct MANGOS_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI
{
mob_enslaved_netherwing_drakeAI(Creature* pCreature) : ScriptedAI(pCreature)
{
PlayerGUID = 0;
Tapped = false;
Reset();
}
uint64 PlayerGUID;
uint32 FlyTimer;
bool Tapped;
void Reset()
{
if (!Tapped)
m_creature->setFaction(FACTION_DEFAULT);
FlyTimer = 2500;
}
void SpellHit(Unit* pCaster, const SpellEntry* pSpell)
{
if (pSpell->Id == SPELL_HIT_FORCE_OF_NELTHARAKU && !Tapped)
{
if (Player* pPlayer = pCaster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
Tapped = true;
PlayerGUID = pPlayer->GetGUID();
m_creature->setFaction(FACTION_FRIENDLY);
if (Creature* pDragonmaw = GetClosestCreatureWithEntry(m_creature, NPC_DRAGONMAW_SUBJUGATOR, 50.0f))
AttackStart(pDragonmaw);
}
}
}
void MovementInform(uint32 type, uint32 id)
{
if (type != POINT_MOTION_TYPE)
return;
if (id == 1)
m_creature->ForcedDespawn();
}
void UpdateAI(const uint32 diff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
if (Tapped)
{
if (FlyTimer <= diff)
{
Tapped = false;
if (Player* pPlayer = m_creature->GetMap()->GetPlayer(PlayerGUID))
{
if (pPlayer->GetQuestStatus(QUEST_FORCE_OF_NELT) == QUEST_STATUS_INCOMPLETE)
{
DoCastSpellIfCan(pPlayer, SPELL_FORCE_OF_NELTHARAKU, CAST_TRIGGERED);
PlayerGUID = 0;
float dx, dy, dz;
if (Creature* EscapeDummy = GetClosestCreatureWithEntry(m_creature, NPC_ESCAPE_DUMMY, 30.0f))
EscapeDummy->GetPosition(dx, dy, dz);
else
{
m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 20, dx, dy, dz);
dz += 25;
}
m_creature->GetMotionMaster()->MovePoint(1, dx, dy, dz);
}
}
}
else
FlyTimer -= diff;
}
return;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_mob_enslaved_netherwing_drake(Creature* pCreature)
{
return new mob_enslaved_netherwing_drakeAI(pCreature);
}
/*#####
# npc_dragonmaw_peon
#####*/
enum
{
SAY_PEON_1 = -1000652,
SAY_PEON_2 = -1000653,
SAY_PEON_3 = -1000654,
SAY_PEON_4 = -1000655,
SAY_PEON_5 = -1000656,
SPELL_SERVING_MUTTON = 40468,
NPC_DRAGONMAW_KILL_CREDIT = 23209,
EQUIP_ID_MUTTON = 2202,
POINT_DEST = 1
};
struct MANGOS_DLL_DECL npc_dragonmaw_peonAI : public ScriptedAI
{
npc_dragonmaw_peonAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
uint64 m_uiPlayerGUID;
uint32 m_uiPoisonTimer;
uint32 m_uiMoveTimer;
uint32 m_uiEatTimer;
void Reset()
{
m_uiPlayerGUID = 0;
m_uiPoisonTimer = 0;
m_uiMoveTimer = 0;
m_uiEatTimer = 0;
SetEquipmentSlots(true);
}
bool SetPlayerTarget(uint64 uiPlayerGUID)
{
if (m_uiPlayerGUID)
return false;
m_uiPlayerGUID = uiPlayerGUID;
m_uiMoveTimer = 500;
return true;
}
void MovementInform(uint32 uiType, uint32 uiPointId)
{
if (uiType != POINT_MOTION_TYPE)
return;
if (uiPointId == POINT_DEST)
{
m_uiEatTimer = 2000;
m_uiPoisonTimer = 3000;
switch(urand(0, 4))
{
case 0: DoScriptText(SAY_PEON_1, m_creature); break;
case 1: DoScriptText(SAY_PEON_2, m_creature); break;
case 2: DoScriptText(SAY_PEON_3, m_creature); break;
case 3: DoScriptText(SAY_PEON_4, m_creature); break;
case 4: DoScriptText(SAY_PEON_5, m_creature); break;
}
}
}
void UpdateAI(const uint32 uiDiff)
{
if (!m_creature->isAlive())
return;
if (m_uiMoveTimer)
{
if (m_uiMoveTimer <= uiDiff)
{
if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_uiPlayerGUID))
{
GameObject* pMutton = pPlayer->GetGameObject(SPELL_SERVING_MUTTON);
// Workaround for broken function GetGameObject
if (!pMutton)
{
const SpellEntry* pSpell = GetSpellStore()->LookupEntry(SPELL_SERVING_MUTTON);
uint32 uiGameobjectEntry = pSpell->EffectMiscValue[EFFECT_INDEX_0];
// this can fail, but very low chance
pMutton = GetClosestGameObjectWithEntry(pPlayer, uiGameobjectEntry, 2*INTERACTION_DISTANCE);
}
if (pMutton)
{
float fX, fY, fZ;
pMutton->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE);
m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
m_creature->GetMotionMaster()->MovePoint(POINT_DEST, fX, fY, fZ);
}
}
m_uiMoveTimer = 0;
}
else
m_uiMoveTimer -= uiDiff;
}
else if (m_uiEatTimer)
{
if (m_uiEatTimer <= uiDiff)
{
SetEquipmentSlots(false, EQUIP_ID_MUTTON, EQUIP_UNEQUIP);
m_creature->HandleEmote(EMOTE_ONESHOT_EAT_NOSHEATHE);
m_uiEatTimer = 0;
}
else
m_uiEatTimer -= uiDiff;
}
else if (m_uiPoisonTimer)
{
if (m_uiPoisonTimer <= uiDiff)
{
if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_uiPlayerGUID))
pPlayer->KilledMonsterCredit(NPC_DRAGONMAW_KILL_CREDIT, m_creature->GetObjectGuid());
m_uiPoisonTimer = 0;
// dies
m_creature->SetDeathState(JUST_DIED);
m_creature->SetHealth(0);
}
else
m_uiPoisonTimer -= uiDiff;
}
}
};
CreatureAI* GetAI_npc_dragonmaw_peon(Creature* pCreature)
{
return new npc_dragonmaw_peonAI(pCreature);
}
bool EffectDummyCreature_npc_dragonmaw_peon(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget)
{
if (uiEffIndex != EFFECT_INDEX_1 || uiSpellId != SPELL_SERVING_MUTTON || pCaster->GetTypeId() != TYPEID_PLAYER)
return false;
npc_dragonmaw_peonAI* pPeonAI = dynamic_cast<npc_dragonmaw_peonAI*>(pCreatureTarget->AI());
if (!pPeonAI)
return false;
if (pPeonAI->SetPlayerTarget(pCaster->GetGUID()))
{
pCreatureTarget->HandleEmote(EMOTE_ONESHOT_NONE);
return true;
}
return false;
}
/*######
## npc_drake_dealer_hurlunk
######*/
bool GossipHello_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isVendor() && pPlayer->GetReputationRank(1015) == REP_EXALTED)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
if (uiAction == GOSSIP_ACTION_TRADE)
pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
return true;
}
/*######
## npc_flanis_swiftwing_and_kagrosh
######*/
bool GossipHello_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* pCreature)
{
if (pPlayer->GetQuestStatus(10583) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30658,1,true))
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Take Flanis's Pack", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
if (pPlayer->GetQuestStatus(10601) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30659,1,true))
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Take Kagrosh's Pack", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
return true;
}
bool GossipSelect_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
{
if (Item* pItem = pPlayer->StoreNewItemInInventorySlot(30658, 1))
pPlayer->SendNewItem(pItem, 1, true, false);
pPlayer->CLOSE_GOSSIP_MENU();
}
if (uiAction == GOSSIP_ACTION_INFO_DEF+2)
{
if (Item* pItem = pPlayer->StoreNewItemInInventorySlot(30659, 1))
pPlayer->SendNewItem(pItem, 1, true, false);
pPlayer->CLOSE_GOSSIP_MENU();
}
return true;
}
/*######
## npc_murkblood_overseer
######*/
#define QUEST_11082 11082
bool GossipHello_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature)
{
if (pPlayer->GetQuestStatus(QUEST_11082) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I am here for you, overseer.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF+1:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "How dare you question an overseer of the Dragonmaw!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
//correct id not known
pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Who speaks of me? What are you talking about, broken?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
//correct id not known
pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Continue please.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
//correct id not known
pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Who are these bidders?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
//correct id not known
pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Well... yes.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
//correct id not known
pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+6:
//correct id not known
pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID());
pCreature->CastSpell(pPlayer,41121,false);
pPlayer->AreaExploredOrEventHappens(QUEST_11082);
break;
}
return true;
}
/*######
## npc_neltharaku
######*/
bool GossipHello_npc_neltharaku(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
if (pPlayer->GetQuestStatus(10814) == QUEST_STATUS_INCOMPLETE)
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I am listening, dragon", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(10613, pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_neltharaku(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_INFO_DEF+1:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "But you are dragons! How could orcs do this to you?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
pPlayer->SEND_GOSSIP_MENU(10614, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Your mate?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
pPlayer->SEND_GOSSIP_MENU(10615, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I have battled many beasts, dragon. I will help you.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
pPlayer->SEND_GOSSIP_MENU(10616, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->AreaExploredOrEventHappens(10814);
break;
}
return true;
}
/*######
## npc_oronok
######*/
#define GOSSIP_ORONOK1 "I am ready to hear your story, Oronok."
#define GOSSIP_ORONOK2 "How do I find the cipher?"
#define GOSSIP_ORONOK3 "How do you know all of this?"
#define GOSSIP_ORONOK4 "Yet what? What is it, Oronok?"
#define GOSSIP_ORONOK5 "Continue, please."
#define GOSSIP_ORONOK6 "So what of the cipher now? And your boys?"
#define GOSSIP_ORONOK7 "I will find your boys and the cipher, Oronok."
bool GossipHello_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetGUID());
if (pCreature->isVendor())
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
if (pPlayer->GetQuestStatus(10519) == QUEST_STATUS_INCOMPLETE)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ORONOK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
pPlayer->SEND_GOSSIP_MENU(10312, pCreature->GetGUID());
}else
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
return true;
}
bool GossipSelect_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
switch(uiAction)
{
case GOSSIP_ACTION_TRADE:
pPlayer->SEND_VENDORLIST(pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ORONOK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(10313, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+1:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ORONOK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
pPlayer->SEND_GOSSIP_MENU(10314, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ORONOK4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
pPlayer->SEND_GOSSIP_MENU(10315, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ORONOK5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
pPlayer->SEND_GOSSIP_MENU(10316, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ORONOK6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
pPlayer->SEND_GOSSIP_MENU(10317, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ORONOK7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
pPlayer->SEND_GOSSIP_MENU(10318, pCreature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+6:
pPlayer->CLOSE_GOSSIP_MENU();
pPlayer->AreaExploredOrEventHappens(10519);
break;
}
return true;
}
/*####
# npc_karynaku
####*/
enum
{
QUEST_ALLY_OF_NETHER = 10870,
TAXI_PATH_ID = 649
};
bool QuestAccept_npc_karynaku(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_ALLY_OF_NETHER)
pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID);
return true;
}
/*######
# npc_wilda
######*/
enum
{
SAY_WIL_START = -1000381,
SAY_WIL_AGGRO1 = -1000382,
SAY_WIL_AGGRO2 = -1000383,
SAY_WIL_PROGRESS1 = -1000384,
SAY_WIL_PROGRESS2 = -1000385,
SAY_WIL_FIND_EXIT = -1000386,
SAY_WIL_PROGRESS4 = -1000387,
SAY_WIL_PROGRESS5 = -1000388,
SAY_WIL_JUST_AHEAD = -1000389,
SAY_WIL_END = -1000390,
SPELL_CHAIN_LIGHTNING = 16006,
SPELL_EARTHBING_TOTEM = 15786,
SPELL_FROST_SHOCK = 12548,
SPELL_HEALING_WAVE = 12491,
QUEST_ESCAPE_COILSCAR = 10451,
NPC_COILSKAR_ASSASSIN = 21044,
FACTION_EARTHEN = 1726 //guessed
};
//this script needs verification
struct MANGOS_DLL_DECL npc_wildaAI : public npc_escortAI
{
npc_wildaAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); }
uint32 m_uiHealingTimer;
void Reset()
{
m_uiHealingTimer = 0;
}
void WaypointReached(uint32 uiPointId)
{
Player* pPlayer = GetPlayerForEscort();
if (!pPlayer)
return;
switch(uiPointId)
{
case 13:
DoScriptText(SAY_WIL_PROGRESS1, m_creature, pPlayer);
DoSpawnAssassin();
break;
case 14:
DoSpawnAssassin();
break;
case 15:
DoScriptText(SAY_WIL_FIND_EXIT, m_creature, pPlayer);
break;
case 19:
DoRandomSay();
break;
case 20:
DoSpawnAssassin();
break;
case 26:
DoRandomSay();
break;
case 27:
DoSpawnAssassin();
break;
case 33:
DoRandomSay();
break;
case 34:
DoSpawnAssassin();
break;
case 37:
DoRandomSay();
break;
case 38:
DoSpawnAssassin();
break;
case 39:
DoScriptText(SAY_WIL_JUST_AHEAD, m_creature, pPlayer);
break;
case 43:
DoRandomSay();
break;
case 44:
DoSpawnAssassin();
break;
case 50:
DoScriptText(SAY_WIL_END, m_creature, pPlayer);
pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, m_creature);
break;
}
}
void JustSummoned(Creature* pSummoned)
{
if (pSummoned->GetEntry() == NPC_COILSKAR_ASSASSIN)
pSummoned->AI()->AttackStart(m_creature);
}
//this is very unclear, random say without no real relevance to script/event
void DoRandomSay()
{
switch(urand(0, 2))
{
case 0: DoScriptText(SAY_WIL_PROGRESS2, m_creature); break;
case 1: DoScriptText(SAY_WIL_PROGRESS4, m_creature); break;
case 2: DoScriptText(SAY_WIL_PROGRESS5, m_creature); break;
}
}
void DoSpawnAssassin()
{
//unknown where they actually appear
float fX, fY, fZ;
m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 15.0f, fX, fY, fZ);
m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, fX, fY, fZ, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
}
void Aggro(Unit* pWho)
{
//don't always use
if (urand(0, 4))
return;
//only aggro text if not player
if (pWho->GetTypeId() != TYPEID_PLAYER)
{
//appears to be random
switch(urand(0, 3))
{
case 0: DoScriptText(SAY_WIL_AGGRO1, m_creature, pWho); break;
case 1: DoScriptText(SAY_WIL_AGGRO2, m_creature, pWho); break;
}
}
}
void UpdateEscortAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
//TODO: add more abilities
if (m_creature->GetHealthPercent() <= 30.0f)
{
if (m_uiHealingTimer < uiDiff)
{
DoCastSpellIfCan(m_creature, SPELL_HEALING_WAVE);
m_uiHealingTimer = 15000;
}
else
m_uiHealingTimer -= uiDiff;
}
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_npc_wilda(Creature* pCreature)
{
return new npc_wildaAI(pCreature);
}
bool QuestAccept_npc_wilda(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_ESCAPE_COILSCAR)
{
DoScriptText(SAY_WIL_START, pCreature, pPlayer);
pCreature->setFaction(FACTION_EARTHEN);
if (npc_wildaAI* pEscortAI = dynamic_cast<npc_wildaAI*>(pCreature->AI()))
pEscortAI->Start(false, pPlayer->GetGUID(), pQuest);
}
return true;
}
/*#####
# Quest: Battle of the Crimson Watch
#####*/
enum
{
QUEST_BATTLE_OF_THE_CRIMSON_WATCH = 10781,
EVENT_COOLDOWN = 30000,
SAY_TORLOTH_DIALOGUE1 = -1000532,
SAY_TORLOTH_DIALOGUE2 = -1000533,
SAY_TORLOTH_DIALOGUE3 = -1000534,
SAY_ILLIDAN_DIALOGUE = -1000535,
SAY_ILLIDAN_SUMMON1 = -1000536,
SAY_ILLIDAN_SUMMON2 = -1000537,
SAY_ILLIDAN_SUMMON3 = -1000538,
SAY_ILLIDAN_SUMMON4 = -1000539,
SAY_EVENT_COMPLETED = -1000540,
MODEL_ID_FELGUARD = 18654,
MODEL_ID_DREADLORD = 19991,
NPC_ILLIDARI_SOLDIER = 22075,
NPC_ILLIDARI_MIND_BREAKER = 22074,
NPC_ILLIDARI_HIGHLORD = 19797,
NPC_TORLOTH_THE_MAGNIFICENT = 22076,
NPC_LORD_ILLIDAN = 22083
};
enum CinematicCreature
{
LORD_ILLIDAN = 1,
TORLOTH = 0
};
const float EVENT_AREA_RADIUS = 65.0;
struct TorlothCinematic
{
int32 iTextId;
uint32 uiCreature;
uint32 uiTimer;
};
static TorlothCinematic TorlothAnim[]=
{
{SAY_TORLOTH_DIALOGUE1, TORLOTH, 2000},
{SAY_ILLIDAN_DIALOGUE, LORD_ILLIDAN, 7000},
{SAY_TORLOTH_DIALOGUE2, TORLOTH, 3000},
{0, TORLOTH, 2000}, // Torloth stand
{SAY_TORLOTH_DIALOGUE3, TORLOTH, 1000},
{0, TORLOTH, 3000},
{0, TORLOTH, 0}
};
struct Location
{
float fLocX;
float fLocY;
float fLocZ;
float fOrient;
};
static Location SpawnLocation[]=
{
{-4615.8556f, 1342.2532f, 139.9f, 1.612f}, // Illidari Soldier
{-4598.9365f, 1377.3182f, 139.9f, 3.917f}, // Illidari Soldier
{-4598.4697f, 1360.8999f, 139.9f, 2.427f}, // Illidari Soldier
{-4589.3599f, 1369.1061f, 139.9f, 3.165f}, // Illidari Soldier
{-4608.3477f, 1386.0076f, 139.9f, 4.108f}, // Illidari Soldier
{-4633.1889f, 1359.8033f, 139.9f, 0.949f}, // Illidari Soldier
{-4623.5791f, 1351.4574f, 139.9f, 0.971f}, // Illidari Soldier
{-4607.2988f, 1351.6099f, 139.9f, 2.416f}, // Illidari Soldier
{-4633.7764f, 1376.0417f, 139.9f, 5.608f}, // Illidari Soldier
{-4600.2461f, 1369.1240f, 139.9f, 3.056f}, // Illidari Mind Breaker
{-4631.7808f, 1367.9459f, 139.9f, 0.020f}, // Illidari Mind Breaker
{-4600.2461f, 1369.1240f, 139.9f, 3.056f}, // Illidari Highlord
{-4631.7808f, 1367.9459f, 139.9f, 0.020f}, // Illidari Highlord
{-4615.5586f, 1353.0031f, 139.9f, 1.540f}, // Illidari Highlord
{-4616.4736f, 1384.2170f, 139.9f, 4.971f}, // Illidari Highlord
{-4627.1240f, 1378.8752f, 139.9f, 2.544f} // Torloth The Magnificent
};
struct WaveData
{
uint8 uiSpawnCount;
uint8 uiUsedSpawnPoint;
uint32 uiCreatureId;
uint32 uiSpawnTimer;
uint32 uiYellTimer;
int32 iTextId;
};
static WaveData WavesInfo[]=
{
// Illidari Soldier
{9, 0, NPC_ILLIDARI_SOLDIER, 10000, 7000, SAY_ILLIDAN_SUMMON1},
// Illidari Mind Breaker
{2, 9, NPC_ILLIDARI_MIND_BREAKER, 10000, 7000, SAY_ILLIDAN_SUMMON2},
// Illidari Highlord
{4, 11, NPC_ILLIDARI_HIGHLORD, 10000, 7000, SAY_ILLIDAN_SUMMON3},
// Torloth The Magnificent
{1, 15, NPC_TORLOTH_THE_MAGNIFICENT, 10000, 7000, SAY_ILLIDAN_SUMMON4}
};
/*######
# mob_torloth
#####*/
enum
{
SPELL_CLEAVE = 15284,
SPELL_SHADOWFURY = 39082,
SPELL_SPELL_REFLECTION = 33961
};
struct MANGOS_DLL_DECL mob_torlothAI : public ScriptedAI
{
mob_torlothAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
uint64 m_uiLordIllidanGUID;
uint64 m_uiPlayerGUID;
uint32 m_uiCleaveTimer;
uint32 m_uiShadowfuryTimer;