View difference between Paste ID: J1ecccEp and HbmfXYmR
SHOW: | | - or go back to the newest paste.
1
#include "ScriptPCH.h"
2
#include "Player.h"
3
#include "ScriptMgr.h"
4
#include "Creature.h"
5
#include "ScriptedCreature.h"
6
#include "../Global.h"
7
#include "Item.h"
8
#include "ScriptedGossip.h"
9
#include "MapManager.h"
10
#include "Map.h"
11
#include "Quest.h"
12
13
Position const finalBossPos = { 1452.521729f, 1046.348877f, 33.847805f, 4.314608f};
14
Position const spawnPosIron = { 1436.746338f, 1021.107483f, 34.471546f, 4.888280f };
15
16
enum RageFireCreaIds
17
{
18
    //gob squad
19
    NPC_PATCH = 70607,
20
    NPC_GRIT = 70605,
21
    NPC_NEWT = 70606,
22
    NPC_TICKER = 70609,
23
    NPC_VOLT = 70608,
24
    //stage 3
25
    NPC_MATID_BOMB = 71174,
26
    NPC_CANNON_BALLS = 71176,
27
    NPC_BATTERY = 71195,
28
    NPC_POOL_PONY = 71175,
29
    NPC_EGG_YOLK = 71197,
30
31
    //stage 4
32
    NPC_TRIGGER_1 = 98000,
33
    NPC_TRIGGER_2 = 98001,
34
    NPC_TRIGGER_3 = 98002,
35
    NPC_TRIGGER_4 = 98003,
36
    NPC_TRIGGER_5 = 98004,
37
38
    NPC_KORKRON_SHADOWBLADE = 71244,
39
    NPC_KOR_KRON_DIRE_SOLDIER = 70665,
40
    NPC_DARK_SHAMAN = 71245,
41
    NPC_FLAME_HOUND = 70702,
42
    NPC_EMBER_GUARD = 70798,
43
    NPC_OVERSEER_ELAGLO = 71030,
44
    NPC_IRON_BODY_PONSHU_RAGEFIRE = 98005,
45
};
46
47
enum RageFireGobIds
48
{
49
    GOBJ_INITIAL_TELEPORTER = 220065,
50
    GOBJ_EMERGENCY_TELEPORTER = 220066,
51
};
52
53
enum ragefireCoreCriteriaIds
54
{
55
    //stage 1
56
    CRITERIA_DETONATION = 23213,
57
    CRITERIA_ENEMY_FORCES = 23216,
58
    //stage 2
59
    CRITERIA_PROTO_DRAKE = 23254,
60
    CRITERIA_SUPPLY_CRATES = 23255,
61
    CRITERIA_PANDARIA_ARTIFACTS = 23256,
62
    //stage 3
63
    CRITERIA_MEET_UP = 23313,
64
    CRITERIA_CANNON_BALLS = 23307,
65
    CRITERIA_BATTERIES = 23310,
66
    CRITERIA_POOL_PONY = 23308,
67
    CRITERIA_EGG_YOLK = 23309,
68
    //stage 4
69
    CRITERIA_GOB_SQUAD_DEFEATED = 23311,
70
};
71
72
enum stage3SpellIds
73
{
74
    SPELL_CANNON_BALL = 141832,
75
    SPELL_THROW_CANNON_BALL = 141937,
76
    SPELL_ATTACH_CANNON_BALL1 = 141879,
77
    SPELL_ATTACH_CANNON_BALL2 = 141880,
78
    SPELL_ATTACH_CANNON_BALL3 = 141881,
79
    SPELL_ATTACH_BATTERY1 = 141887,
80
    SPELL_ATTACH_BATTERY2 = 141888,
81
    SPELL_BATTERY = 141904,
82
    SPELL_THROW_BATTERY = 141949,
83
    SPELL_POOL_PONY = 141898,
84
    SPELL_ATTACH_POOL_PONY = 141889,
85
    SPELL_THROW_POOL_PONY = 141951,
86
    SPELL_EGG_YOLK = 141914,
87
    SPELL_ATTACH_EGG_YOLK = 141891,
88
    SPELL_HUGE_EXPLOSION = 141954,//mantid bomb
89
    SPELL_MASSIVE_EXPLOSION = 142438,
90
    SPELL_GHOST_AURA = 137125,
91
};
92
93
class instance_ragefire_core : public InstanceMapScript
94
{
95
public:
96
    instance_ragefire_core() : InstanceMapScript("instance_ragefire_core", 1131) { }
97
98
    struct instance_ragefire_core_InstanceScript : public InstanceScript
99
    {
100
        instance_ragefire_core_InstanceScript(Map* map) : InstanceScript(map), m_scenario(map, 219, STEP_4), _map(map)
101
        {
102
            squadGuids.clear();
103
            bombGuids.clear();
104
            darkShamanAddsGuids.clear();
105
            ragefirePeonGuids.clear();
106
            stage3DeliveryGuids.clear();
107
            stage4Entries.clear();
108
            stage4_1Guids.clear();
109
            stage4_2Guids.clear();
110
            stage4_3Guids.clear();
111
            stage4_4Guids.clear();
112
113
            stage4Entries.push_back(NPC_KOR_KRON_DIRE_SOLDIER);
114
            stage4Entries.push_back(NPC_DARK_SHAMAN);
115
            stage4Entries.push_back(NPC_FLAME_HOUND);
116
            stage4Entries.push_back(NPC_EMBER_GUARD);
117
118
            stageOneKills = 0;
119
            stageTwoKills = 0;
120
            stageThreeKills = 0;
121
            stageFourKills = 0;
122
            stageFourLevel = 0;
123
            onStageFour = false;
124
125
            m_scenario.GetStep(STEP_1).AddCriteria(CRITERIA_DETONATION, 1);//32525
126
            m_scenario.GetStep(STEP_1).AddCriteria(CRITERIA_ENEMY_FORCES, 1);//32556
127
            m_scenario.GetStep(STEP_2).AddCriteria(CRITERIA_PROTO_DRAKE, 1);//32588
128
            m_scenario.GetStep(STEP_2).AddCriteria(CRITERIA_SUPPLY_CRATES, 1);
129
            m_scenario.GetStep(STEP_2).AddCriteria(CRITERIA_PANDARIA_ARTIFACTS, 1);
130
            m_scenario.GetStep(STEP_3).AddCriteria(CRITERIA_MEET_UP, 1);//meet up with patch
131
            m_scenario.GetStep(STEP_3).AddCriteria(CRITERIA_CANNON_BALLS, 3);//cannon balls
132
            m_scenario.GetStep(STEP_3).AddCriteria(CRITERIA_BATTERIES, 2);//batteries del
133
            m_scenario.GetStep(STEP_3).AddCriteria(CRITERIA_POOL_PONY, 1);//pool pony
134
            m_scenario.GetStep(STEP_3).AddCriteria(CRITERIA_EGG_YOLK, 1);//egg yolk
135
            m_scenario.GetStep(STEP_4).AddCriteria(CRITERIA_GOB_SQUAD_DEFEATED, 1);//gob squad defeated
136
        }
137
138
        Map* _map;
139
        ScenarioController m_scenario;
140
141
        std::vector<uint64> squadGuids;
142
        std::vector<uint64> bombGuids;
143
        std::vector<uint64> darkShamanAddsGuids;
144
        std::vector<uint64> ragefirePeonGuids;
145
        std::vector<uint64> stage3DeliveryGuids;
146
        ///stage 4 Ids
147
        std::vector<uint32> stage4Entries;
148
        std::vector<uint64> stage4_1Guids;
149
        std::vector<uint64> stage4_2Guids;
150
        std::vector<uint64> stage4_3Guids;
151
        std::vector<uint64> stage4_4Guids;
152
153
        uint64 darkShamanXorenthGuid;
154
        uint64 matidBombGuid;
155
        uint32 stageOneKills;
156
        uint32 stageTwoKills;
157
        uint32 stageThreeKills;
158
        uint32 stageFourKills;
159
        uint32 stageFourLevel;
160
        bool onStageFour;
161
162
        void CompleteScenario()
163
        {  
164
            //@TODO
165
            if (Player* player = instance->GetPlayers().getFirst()->getSource())
166
            {
167
                if (Creature* creature = instance->SummonCreature(NPC_IRON_BODY_PONSHU_RAGEFIRE, spawnPosIron))
168
                {
169
                    creature->CastSpell(creature, SPELL_GHOST_AURA);
170
                    creature->GetAI()->DoAction(1);
171
                }
172
            }
173
        }
174
175
        void checkStageTwo()
176
        {
177
            if (stageTwoKills == 3)
178
            {
179
                if (Creature* c = instance->GetCreature(matidBombGuid))
180
                    c->SetVisible(true);
181
                for (uint64 guid : squadGuids)
182
                    if (Creature* creature = instance->GetCreature(guid))
183
                        creature->GetAI()->DoAction(13);
184
                for (uint64 guid : stage3DeliveryGuids)
185
                    if (Creature* c = instance->GetCreature(guid))
186
                        c->GetAI()->DoAction(1);
187
            }
188
        }
189
190
        void checkStageThree()
191
        {
192
            if (stageThreeKills >= 7)
193
                for (uint64 guid : stage3DeliveryGuids)
194
                    if (Creature* c = instance->GetCreature(guid))
195
                        c->DespawnOrUnsummon();
196
        }
197
198
        void checkStageFour()
199
        {
200
            ++stageFourKills;
201
            switch (stageFourLevel)
202
            {
203
            case 0:
204
                if (stageFourKills == 5)
205
                {
206
                    stageFourKills = 0;
207
                    stageFourLevel = 1;
208
                    startStageFour();
209
                }
210
                break;
211
            case 1:
212
                if (stageFourKills == 4)
213
                {
214
                    stageFourKills = 0;
215
                    stageFourLevel = 2;
216
                    startStageFour();
217
                }
218
                break;
219
            case 2:
220
                if (stageFourKills == 3)
221
                {
222
                    stageFourKills = 0;
223
                    stageFourLevel = 3;
224
                    startStageFour();
225
                }
226
                break;
227
            case 3:
228
                if (stageFourKills == 4)
229
                {
230
                    stageFourKills = 0;
231
                    stageFourLevel = 4;
232
                    startStageFour();
233
                }
234
                break;
235
            }
236
        }
237
238
        void startStageFour()
239
        {
240
            if (!onStageFour)
241
                onStageFour = true;
242
            switch (stageFourLevel)
243
            {
244
            case 0:
245
                for (uint64 guid : stage4_1Guids)
246
                    if (Creature* c = instance->GetCreature(guid))
247
                        c->GetAI()->DoAction(10);
248
                break;
249
            case 1:
250
                for (uint64 guid : stage4_2Guids)
251
                    if (Creature* c = instance->GetCreature(guid))
252
                        c->GetAI()->DoAction(10);
253
                break;
254
            case 2:
255
                for (uint64 guid : stage4_3Guids)
256
                    if (Creature* c = instance->GetCreature(guid))
257
                        c->GetAI()->DoAction(10);
258
                break;
259
            case 3:
260
                for (uint64 guid : stage4_4Guids)
261
                    if (Creature* c = instance->GetCreature(guid))
262
                        c->GetAI()->DoAction(10);
263
                break;
264
            case 4:
265
                instance->SummonCreature(NPC_OVERSEER_ELAGLO, finalBossPos);
266
                break;
267
            }
268
        }
269
270
        void OnPlayerEnter(Player* player)
271
        {
272
            m_scenario.SendScenarioState(player);
273
274
            if (!player->isGMChat() && !player->IsGameMaster())
275
            {
276
                player->CastSpell(player, 140714, true);
277
                for (auto it : _map->GetCreatureBySpawnIdStore())
278
                {
279
                    Creature* creature = it.second;
280
                    if (creature && !creature->isInCombat() && creature->isAlive())
281
                    {
282
                        uint32 hvalue = creature->GetCreateHealth();
283
                        uint32 level = player->getLevel();
284
                        creature->SetCanModifyStats(true);
285
                        creature->UpdateAllStats();
286
                        creature->SetLevel(level);
287
                        hvalue *= (1 + ((level - 80) / 2));
288
                        creature->SetMaxHealth(hvalue);
289
                        creature->SetFullHealth();
290
                        creature->m_mgWorth = sObjectMgr->GetCreatureTemplate(creature->GetEntry())->mg + ((level - 80) / 2);
291
                    }
292
                }
293
            }
294
        }
295
296
        void OnGameObjectCreate(GameObject* go)
297
        {
298
            switch (go->GetEntry())
299
            {
300
            case 220066:
301
                break;
302
            }
303
        }
304
305
        void insertGuidsInVectorFromCreatureEntryArray(WorldObject* o, std::vector<uint64> &guids, std::vector<uint32> entries, float range)
306
        {
307
            for (uint32 entry : entries)
308
            {
309
                std::list<Creature*> mobs;
310
                o->GetCreatureListWithEntryInGrid(mobs, entry, range);
311
                for (Creature* c : mobs)
312
                    guids.push_back(c->GetGUID());
313
                mobs.clear();
314
            }
315
        }
316
317
        void OnCreatureCreate(Creature* creature) override
318
        {
319
            switch (creature->GetEntry())
320
            {
321
            case NPC_PATCH:
322
            case NPC_GRIT:
323
            case NPC_NEWT:
324
            case NPC_TICKER:
325
            case NPC_VOLT:
326
                squadGuids.push_back(creature->GetGUID());
327
                break;
328
            case 70672://bomb
329
                bombGuids.push_back(creature->GetGUID());
330
                break;
331
            case 71244://shadowblade
332
            case 71245://dark shaman
333
                darkShamanAddsGuids.push_back(creature->GetGUID());
334
                break;
335
            case 70683:
336
                darkShamanXorenthGuid = creature->GetGUID();
337
                break;
338
            case 71097:
339
                ragefirePeonGuids.push_back(creature->GetGUID());
340
                break;
341
            case NPC_MATID_BOMB:
342
                matidBombGuid = creature->GetGUID();
343
                creature->SetVisible(false);
344
                break;
345
            case NPC_CANNON_BALLS:
346
            case NPC_BATTERY:
347
            case NPC_POOL_PONY:
348
            case NPC_EGG_YOLK:
349
                stage3DeliveryGuids.push_back(creature->GetGUID());
350
                break;
351
            case NPC_TRIGGER_1:
352
                insertGuidsInVectorFromCreatureEntryArray(creature, stage4_1Guids, stage4Entries, 10.0f);
353
                break;
354
            case NPC_TRIGGER_2:
355
                insertGuidsInVectorFromCreatureEntryArray(creature, stage4_2Guids, stage4Entries, 10.0f);
356
                break;
357
            case NPC_TRIGGER_4:
358
                insertGuidsInVectorFromCreatureEntryArray(creature, stage4_3Guids, stage4Entries, 10.0f);
359
                break;
360
            case NPC_TRIGGER_5:
361
                insertGuidsInVectorFromCreatureEntryArray(creature, stage4_4Guids, stage4Entries, 10.0f);
362
                break;
363
            }
364
        }
365
366
        void SetData(uint32 type, uint32 data) override
367
        {
368
            if (data == SPECIAL)
369
            {
370
                switch (type)
371
                {
372
                case NPC_KOR_KRON_DIRE_SOLDIER:
373
                case NPC_DARK_SHAMAN:
374
                case NPC_FLAME_HOUND:
375
                case NPC_EMBER_GUARD:
376
                    checkStageFour();
377
                    break;
378
                case 70672://bombs
379
                    for (uint64 guid : bombGuids)
380
                        if (Creature* creature = instance->GetCreature(guid))
381
                            creature->GetAI()->DoAction(2);//rather than casting spell, which is wrong one in first place, setentry, then cast explosion. so after 5 secs cast spell, and entry set to will be 71098
382
                                                           //      creature->CastSpell(creature, 103546, true);
383
384
                    break;
385
                case 70683:
386
                    for (uint64 guid : ragefirePeonGuids)
387
                        if (Creature* creature = instance->GetCreature(guid))
388
                            creature->GetMotionMaster()->MovePoint(1, 1501.083374f, 1001.316284f, 38.346649f);
389
                    break;
390
                case NPC_KORKRON_SHADOWBLADE:
391
                    for (uint64 guid : squadGuids)
392
                        if (Creature* creature = instance->GetCreature(guid))
393
                        {
394
                            creature->SetReactState(REACT_AGGRESSIVE);
395
                            if (Creature* enemy = creature->FindNearestCreature(71244, 350.0f))
396
                            {
397
                                creature->SetInCombatWith(enemy);
398
                                creature->Attack(enemy, true);
399
                            }
400
                        }
401
                    break;
402
                }
403
            }
404
405
            if (data == DONE)
406
            {
407
                switch (type)
408
                {
409
                case 70662://denotator
410
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_DETONATION, 1);//Breach the main chamber
411
                    for (uint64 guid : squadGuids)
412
                        if (Creature* creature = instance->GetCreature(guid))
413
                            creature->GetAI()->DoAction(4);
414
                    break;
415
                case 70683://dark shaman xorenth
416
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_ENEMY_FORCES, 1);//defeated enemy forces
417
                    for (uint64 guid : squadGuids)
418
                        if (Creature* creature = instance->GetCreature(guid))
419
                            creature->GetAI()->DoAction(9);//activate step 2: reconnaissance
420
                    break;
421
                case 71244:
422
                case 71245:
423
                    stageOneKills++;
424
                    if (stageOneKills == 5)
425
                        if (Creature* c = instance->GetCreature(darkShamanXorenthGuid))
426
                            c->GetAI()->DoAction(2);
427
                    break;
428
                case 71203:
429
                    stageTwoKills++;
430
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_SUPPLY_CRATES, 1);
431
                    checkStageTwo();
432
                    break;
433
                case 71208:
434
                    stageTwoKills++;
435
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_PROTO_DRAKE, 1);
436
                    checkStageTwo();
437
                    break;
438
                case 71209:
439
                    stageTwoKills++;
440
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_PANDARIA_ARTIFACTS, 1);
441
                    checkStageTwo();
442
                    break;
443
                case NPC_PATCH:
444
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_MEET_UP);
445
                    break;
446
                case NPC_CANNON_BALLS:
447
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_CANNON_BALLS);
448
                    ++stageThreeKills;
449
                    checkStageThree();
450
                    break;
451
                case NPC_BATTERY:
452
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_BATTERIES);
453
                    ++stageThreeKills;
454
                    checkStageThree();
455
                    break;
456
                case NPC_POOL_PONY:
457
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_POOL_PONY);
458
                    ++stageThreeKills;
459
                    checkStageThree();
460
                    break;
461
                case NPC_EGG_YOLK:
462
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_EGG_YOLK);
463
                    ++stageThreeKills;
464
                    checkStageThree();
465
                    break;
466
                case NPC_MATID_BOMB:
467
                    startStageFour();
468
                    break;
469
                case NPC_OVERSEER_ELAGLO:
470
                    m_scenario.UpdateCurrentStepCriteria(CRITERIA_GOB_SQUAD_DEFEATED);
471
                    break;
472
                }
473
            }
474
475
            if (data == IN_PROGRESS)
476
            {
477
                switch (type)
478
                {
479
                case 70683://dark shaman xorenth
480
                {
481
                    for (uint64 cGuid : darkShamanAddsGuids)
482
                    {
483
                        if (Creature* c = instance->GetCreature(cGuid))
484
                        {
485
                            c->GetAI()->DoAction(1);//Set in combat.
486
                        }
487
                    }
488
                }
489
                case NPC_PATCH:
490
                    for (uint64 guid : squadGuids)
491
                        if (Creature* creature = instance->GetCreature(guid))
492
                        {
493
                            creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());//if the player is noob and dies, just stay there.. 
494
                            creature->GetAI()->DoAction(6);
495
                        }
496
                    break;
497
                }
498
            }
499
500
501
            if (m_scenario.IsCompleted())
502
                CompleteScenario();
503
        }
504
    };
505
506
    InstanceScript* GetInstanceScript(InstanceMap* map) const
507
    {
508
        return new instance_ragefire_core_InstanceScript(map);
509
    }
510
};
511
512
class ragefire_core_detonator : public CreatureScript
513
{
514
public:
515
    ragefire_core_detonator() : CreatureScript("ragefire_core_detonator") { }
516
517
    struct ragefire_core_detonatorAI : public ScriptedAI
518
    {
519
        ragefire_core_detonatorAI(Creature* creature) : ScriptedAI(creature), startTicking(false), msg("5") { }
520
521
        void OnSpellClick(Unit* /*clicker*/) override
522
        {
523
            me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
524
            if (!startTicking)
525
            {
526
                startTicking = true;
527
                me->GetInstanceScript()->SetData(70672, SPECIAL);
528
                events.ScheduleEvent(1, 5000);
529
                std::list<Creature*> bombList;
530
                me->GetCreatureListWithEntryInGrid(bombList, 71098, 50.0f);
531
                for (Creature* c : bombList)
532
                {
533
                    c->SetMaxHealth(999999);
534
                    c->SetFullHealth();
535
                    DoCast(c, 141624);//ignite the bombs spell
536
                }
537
            }
538
        }
539
540
        void UpdateAI(const uint32 diff) override
541
        {
542
            if (!startTicking)
543
                return;
544
545
            events.Update(diff);
546
547
            while (uint32 eventId = events.ExecuteEvent())
548
            {
549
                switch (eventId)
550
                {
551
                case 1:
552
                    if (GameObject* pDoor = me->FindNearestGameObject(220168, 40.0f))
553
                    {
554
                        pDoor->SetLootState(GO_READY);
555
                        pDoor->UseDoorOrButton(10000 * 999, false, me);
556
                        pDoor->CastSpell(me, 148964);
557
                    }
558
                    me->GetInstanceScript()->SetData(me->GetEntry(), DONE);
559
                    DoCastAOE(137548);
560
                    me->DespawnOrUnsummon();
561
                    break;
562
                case 2:
563
                    SendNotifiactionToMap(me->GetMap(), "");
564
                    break;
565
                }
566
            }
567
        }
568
569
    private:
570
        std::string msg;
571
        bool startTicking;
572
    };
573
574
    CreatureAI* GetAI(Creature* creature) const
575
    {
576
        return new ragefire_core_detonatorAI(creature);
577
    }
578
};
579
580
class ragefire_core_ticking_bomb : public CreatureScript
581
{
582
public:
583
    ragefire_core_ticking_bomb() : CreatureScript("ragefire_core_ticking_bomb") { }
584
585
    struct ragefire_core_ticking_bombAI : public ScriptedAI
586
    {
587
        ragefire_core_ticking_bombAI(Creature* creature) : ScriptedAI(creature), startTicking(false) { }
588
589
        void Reset()
590
        {
591
            //   me->SetVisible(false);
592
        }
593
594
        void DoAction(const int32 action) override
595
        {
596
            switch (action)
597
            {
598
            case 1:
599
                me->SetVisible(true);
600
                break;
601
            case 2:
602
                startTicking = true;
603
                me->SetEntry(71098);
604
                DoCast(142072);
605
                events.ScheduleEvent(1, 5000);
606
                break;
607
            }
608
        }
609
610
        void UpdateAI(const uint32 diff) override
611
        {
612
            if (!startTicking)
613
                return;
614
615
            events.Update(diff);
616
617
            while (uint32 eventId = events.ExecuteEvent())
618
            {
619
                switch (eventId)
620
                {
621
                case 1:
622
                    DoCast(149353);
623
624
                    me->DespawnOrUnsummon();
625
                    break;
626
                }
627
            }
628
        }
629
630
    private:
631
        bool startTicking;
632
    };
633
    CreatureAI* GetAI(Creature* creature) const
634
    {
635
        return new ragefire_core_ticking_bombAI(creature);
636
    }
637
};
638
639
class ragefire_core_npc_patch : public CreatureScript
640
{
641
public:
642
    ragefire_core_npc_patch() : CreatureScript("ragefire_core_npc_patch") { }
643
644
    struct ragefire_core_npc_patchAI : public ScriptedAI
645
    {
646
        ragefire_core_npc_patchAI(Creature* creature) : ScriptedAI(creature)
647
        {
648
            instance = me->GetInstanceScript();
649
            events.ScheduleEvent(1, 3000);
650
            me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
651
        }
652
653
        void Reset() override
654
        {
655
656
        }
657
658
        InstanceScript* instance;
659
660
        void MovementInform(uint32 /*type*/, uint32 id)
661
        {
662
            switch (id)
663
            {
664
            case 1:
665
                Say(me, "Newt, we need this door open now.");
666
                if (Creature* c = NearestCreature(me, NPC_NEWT))
667
                    c->GetAI()->DoAction(2);
668
                break;
669
            case 2:
670
                me->SetOrientation(1.768873f);
671
                me->GetMotionMaster()->MovePoint(3, 1424.620850f, 864.095642f, 38.610504f);
672
                break;
673
            case 4:
674
                Say(me, "What the..");
675
                if (Creature* boss = me->FindNearestCreature(70683, 120.0f))
676
                    boss->GetAI()->DoAction(1);
677
                if (Creature* c = NearestCreature(me, NPC_TICKER))
678
                    c->GetAI()->DoAction(5);
679
                break;
680
            }
681
        }
682
683
        void DoAction(const int32 action) override
684
        {
685
            switch (action)
686
            {
687
            case 1:
688
                events.ScheduleEvent(2, 2000);
689
                break;
690
            case 2:
691
                events.ScheduleEvent(3, 2000);
692
                break;
693
            case 3:
694
                events.ScheduleEvent(7, 1000);
695
                break;
696
            case 4:
697
                Yell(me, "Move! Move! Move!");
698
                events.ScheduleEvent(8, 1000);
699
                break;
700
            case 5:
701
                events.ScheduleEvent(9, 4000);
702
                break;
703
            case 6:
704
                if (Creature* enemy = me->FindNearestCreature(71244, 50.0f))
705
                {
706
                    me->SetInCombatWith(enemy);
707
                    me->Attack(enemy, true);
708
                    me->AddThreat(enemy, 500.0f);
709
                }
710
                break;
711
            case 7:
712
                events.ScheduleEvent(10, 3000);
713
                break;
714
            case 8:
715
                events.ScheduleEvent(12, 3000);
716
                break;
717
            case 9:
718
                me->GetMotionMaster()->Clear();
719
                me->GetMotionMaster()->MovePoint(0, 1412.650635f, 1043.317871f, 34.165894f);
720
                events.ScheduleEvent(13, 2000);
721
                break;
722
            case 12:
723
                Say(me, "These supply crates came from Orgrimmar. What is Garrosh planning to do with so many war supplies?");
724
                break;
725
            case 13:
726
                me->GetMotionMaster()->MovePoint(5, 1489.619629f, 1004.998657f, 38.381786f);
727
                break;
728
            }
729
        }
730
731
        void UpdateAI(const uint32 diff) override
732
        {
733
            events.Update(diff);
734
735
            while (uint32 eventId = events.ExecuteEvent())
736
            {
737
                switch (eventId)
738
                {
739
                case 1:
740
                    Say(me, "Newt, get that door open.");
741
                    me->PlayOneShotAnimKit(25); //point
742
                    if (Creature* c = NearestCreature(me, NPC_NEWT))
743
                        c->GetAI()->DoAction(1);
744
                    break;
745
                case 2:
746
                    Say(me, "Grit, Ticker and Volt, you three back her up.");
747
                    if (Creature* c = NearestCreature(me, NPC_TICKER))
748
                        c->GetAI()->DoAction(1);
749
                    break;
750
                case 3:
751
                    if (Player* p = me->FindNearestPlayer(150.0f))//warning gms will trigger this
752
                        me->MonsterSay("Recruit $n, you're with me", 0, p->GetGUID());
753
                    events.ScheduleEvent(4, 3000);
754
                    break;
755
                case 4:
756
                    Say(me, "We've tracked the recent disappearences in Durotar to this abandoned section of Ragefire.");
757
                    events.ScheduleEvent(5, 4000);
758
                    break;
759
                case 5:
760
                    Say(me, "It's our job to find out who's behind these abductions and put a stop to them.");
761
                    events.ScheduleEvent(6, 4000);
762
                    break;
763
                case 6:
764
                    Say(me, "Stay close.");
765
                    me->GetMotionMaster()->MovePoint(1, 1417.978516f, 870.028076f, 38.061775f);
766
                    break;
767
                case 7:
768
                    me->GetMotionMaster()->MovePoint(2, 1425.401001f, 862.816650f, 38.733353f);
769
                    break;
770
                case 8:
771
                    me->GetMotionMaster()->MovePoint(4, 1409.4255659f, 925.447998f, 36.675375f);
772
                    break;
773
                case 9:
774
                    Yell(me, "Gob Squad, defend yourselves!");
775
                    if (instance)
776
                        instance->SetData(me->GetEntry(), IN_PROGRESS);
777
                    break;
778
                case 10:
779
                    Yell(me, "We arn't your enemy, Xorenth!");
780
                    events.ScheduleEvent(11, 3000);
781
                    break;
782
                case 11:
783
                    if (Creature* c = NearestCreature(me, 70683))
784
                        c->GetAI()->DoAction(3);
785
                    break;
786
                case 12:
787
                    Yell(me, "We'll show you who's lesser!");
788
                    break;
789
                case 13:
790
                    Say(me, "This is bad.");
791
                    events.ScheduleEvent(14, 2000);
792
                    break;
793
                case 14:
794
                    Say(me, "All of you fan out and search the chamber. If Garrosh is behind this we're going to need proof.");
795
                    break;
796
                }
797
                if (UpdateVictim())
798
                    DoMeleeAttackIfReady();
799
            }
800
        }
801
    };
802
    CreatureAI* GetAI(Creature* creature) const
803
    {
804
        return new ragefire_core_npc_patchAI(creature);
805
    }
806
};
807
class ragefire_core_npc_newt : public CreatureScript
808
{
809
public:
810
    ragefire_core_npc_newt() : CreatureScript("ragefire_core_npc_newt") { }
811
812
    struct ragefire_core_npc_newtAI : public ScriptedAI
813
    {
814
        ragefire_core_npc_newtAI(Creature* creature) : ScriptedAI(creature) { }
815
816
        void Reset() override
817
        {
818
819
        }
820
821
        void MovementInform(uint32 /*type*/, uint32 id)
822
        {
823
            switch (id)
824
            {
825
            case 1:
826
827
                break;
828
            case 2:
829
                Say(me, "The charges are all set; hit the detonator as soon as you're ready!");
830
                me->SummonCreature(70662, 1420.861450f, 865.418701f, 38.158325f, TEMPSUMMON_MANUAL_DESPAWN);
831
                me->SetOrientation(1.768873f);
832
                me->GetMotionMaster()->MovePoint(3, 1420.794434f, 864.493469f, 38.186062f);
833
                break;
834
            case 3:
835
836
                break;
837
            }
838
        }
839
840
        void DoAction(const int32 action) override
841
        {
842
            switch (action)
843
            {
844
            case 1:
845
                events.ScheduleEvent(1, 3000);
846
                break;
847
            case 2:
848
                events.ScheduleEvent(6, 2000);
849
                break;
850
            case 4:
851
                if (Creature* c = NearestCreature(me, NPC_PATCH))
852
                    me->GetMotionMaster()->MoveFollow(c, 5.0f, 3.0f);
853
                break;
854
            case 6:
855
                if (Creature* enemy = me->FindNearestCreature(71244, 50.0f))
856
                {
857
                    me->SetInCombatWith(enemy);
858
                    DoZoneInCombat(enemy);
859
                    me->Attack(enemy, true);
860
                }
861
                break;
862
            case 9:
863
                me->GetMotionMaster()->Clear();
864
                me->GetMotionMaster()->MovePoint(0, 1453.287476f, 1059.285400f, 34.403152f);
865
                break;
866
            case 13:
867
                me->GetMotionMaster()->MovePoint(5, 1487.163818f, 1002.904053f, 37.929745f);
868
                break;
869
            }
870
        }
871
872
        void UpdateAI(const uint32 diff) override
873
        {
874
            events.Update(diff);
875
876
            while (uint32 eventId = events.ExecuteEvent())
877
            {
878
                switch (eventId)
879
                {
880
                case 1:
881
                    Say(me, "Yes, Sir!");
882
                    if (Creature* c = NearestCreature(me, NPC_PATCH))
883
                        c->GetAI()->DoAction(1);
884
                    events.ScheduleEvent(2, 2000);
885
                    break;
886
                case 2:
887
                    me->GetMotionMaster()->MovePoint(1, 1417.096069f, 885.688904f, 37.775940f);
888
                    break;
889
                case 3://SPELLID ticking timebomb: 141601
890
                case 4:
891
                case 5://planting bombs TODO
892
                    break;
893
                case 6:
894
                    Say(me, "I'm setting the last charge now, sir!");
895
                    me->GetMotionMaster()->MovePoint(2, 1420.563965f, 864.112671f, 38.187874f);
896
                    if (Creature* c = NearestCreature(me, NPC_PATCH))
897
                        c->GetAI()->DoAction(3);
898
                    break;
899
                }
900
            }
901
            if (UpdateVictim())
902
                DoMeleeAttackIfReady();
903
        }
904
    };
905
    CreatureAI* GetAI(Creature* creature) const
906
    {
907
        return new ragefire_core_npc_newtAI(creature);
908
    }
909
};
910
911
class ragefire_core_npc_grit : public CreatureScript
912
{
913
public:
914
    ragefire_core_npc_grit() : CreatureScript("ragefire_core_npc_grit") { }
915
916
    struct ragefire_core_npc_gritAI : public ScriptedAI
917
    {
918
        ragefire_core_npc_gritAI(Creature* creature) : ScriptedAI(creature) { }
919
920
        void Reset() override
921
        {
922
            me->LoadEquipment(62249);
923
        }
924
925
        void MovementInform(uint32 /*type*/, uint32 id)
926
        {
927
            switch (id)
928
            {
929
            case 1:
930
931
                break;
932
            }
933
        }
934
935
        void DoAction(const int32 action) override
936
        {
937
            switch (action)
938
            {
939
            case 1:
940
                events.ScheduleEvent(1, 10);
941
                break;
942
            case 4:
943
                if (Creature* c = NearestCreature(me, NPC_PATCH))
944
                    me->GetMotionMaster()->MoveFollow(c, 5.0f, 4.0f);
945
                break;
946
            case 6:
947
                if (Creature* enemy = me->FindNearestCreature(71244, 50.0f))
948
                {
949
                    me->SetInCombatWith(enemy);
950
                    DoZoneInCombat(enemy);
951
                    me->Attack(enemy, true);
952
                }
953
                break;
954
955
            case 9:
956
                events.ScheduleEvent(2, 2000);
957
                break;
958
959
            case 13:
960
                me->GetMotionMaster()->MovePoint(5, 1489.619629f, 997.013855f, 39.032120f);
961
                break;
962
            }
963
        }
964
965
        void UpdateAI(const uint32 diff) override
966
        {
967
            events.Update(diff);
968
969
            while (uint32 eventId = events.ExecuteEvent())
970
            {
971
                switch (eventId)
972
                {
973
                case 1:
974
                    me->GetMotionMaster()->MovePoint(1, 1401.851074f, 861.117004f, 38.370773f);
975
                    break;
976
                }
977
            }
978
            if (UpdateVictim())
979
                DoMeleeAttackIfReady();
980
        }
981
    };
982
    CreatureAI* GetAI(Creature* creature) const
983
    {
984
        return new ragefire_core_npc_gritAI(creature);
985
    }
986
};
987
988
class ragefire_core_npc_ticker : public CreatureScript
989
{
990
public:
991
    ragefire_core_npc_ticker() : CreatureScript("ragefire_core_npc_ticker") { }
992
993
    struct ragefire_core_npc_tickerAI : public ScriptedAI
994
    {
995
        ragefire_core_npc_tickerAI(Creature* creature) : ScriptedAI(creature), _cannonBalls(0), meetUp(false), _batteries(0), _poolPony(false), _eggYolk(false), _count(0)
996
        {
997
            instance = me->GetInstanceScript();
998
        }
999
1000
        void Reset() override
1001
        {
1002
            me->LoadEquipment(62249);
1003
        }
1004
1005
        InstanceScript* instance;
1006
1007
        void MovementInform(uint32 /*type*/, uint32 id)
1008
        {
1009
            switch (id)
1010
            {
1011
            case 5:
1012
                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
1013
                Say(me, "Recruit, bring me that pool pony, three cannon balls, two batteries and some of that protodrake egg yolk.");
1014
                events.ScheduleEvent(20, 10000);
1015
                break;
1016
            }
1017
        }
1018
1019
        void DoAction(const int32 action) override
1020
        {
1021
            switch (action)
1022
            {
1023
            case 1:
1024
                events.ScheduleEvent(1, 3000);
1025
                break;
1026
            case 4:
1027
                if (Creature* c = NearestCreature(me, NPC_PATCH))
1028
                    me->GetMotionMaster()->MoveFollow(c, 5.0f, 1.0f);
1029
                break;
1030
            case 5:
1031
                events.ScheduleEvent(3, 1000);
1032
                break;
1033
            case 6:
1034
                if (Creature* enemy = me->FindNearestCreature(71244, 50.0f))
1035
                {
1036
                    me->SetInCombatWith(enemy);
1037
                    DoZoneInCombat(enemy);
1038
                    me->Attack(enemy, true);
1039
                }
1040
                break;
1041
            case 13:
1042
                me->GetMotionMaster()->MovePoint(5, 1496.913818f, 1001.985840f, 38.286098f);
1043
                break;
1044
            }
1045
        }
1046
1047
        void UpdateAI(const uint32 diff) override
1048
        {
1049
            events.Update(diff);
1050
1051
            while (uint32 eventId = events.ExecuteEvent())
1052
            {
1053
                switch (eventId)
1054
                {
1055
                case 1:
1056
                    Say(me, "On it.");
1057
                    if (Creature* c = NearestCreature(me, NPC_PATCH))
1058
                        c->GetAI()->DoAction(2);
1059
                    events.ScheduleEvent(2, 2000);
1060
                    break;
1061
                case 2:
1062
                    if (Creature* c = NearestCreature(me, NPC_GRIT))
1063
                        c->GetAI()->DoAction(1);
1064
                    if (Creature* c = NearestCreature(me, NPC_VOLT))
1065
                        c->GetAI()->DoAction(1);
1066
                    me->GetMotionMaster()->MovePoint(1, 1411.282471f, 858.3328825f, 37.793259f);
1067
                    break;
1068
                case 3:
1069
                    Yell(me, "Sir, these Kor'kron don't seem very friendly!");
1070
                    if (Creature* c = NearestCreature(me, NPC_PATCH))
1071
                        c->GetAI()->DoAction(5);
1072
                    break;
1073
1074
                case 20://move to ticker LOL
1075
                    if (_count >= 7)
1076
                    {
1077
                        Yell(me, "My masterpiece is finished!");
1078
                        events.ScheduleEvent(21, 2000);
1079
                    }
1080
                    else
1081
                        events.ScheduleEvent(20, 3000);
1082
                    break;
1083
                case 21:
1084
                    if (Creature* c = NearestCreature(me, NPC_VOLT))
1085
                        Yell(c, "It's... it's beautiful!");
1086
                    if (Creature* c = NearestCreature(me, NPC_NEWT))
1087
                        Say(c, "What the heck is the pool pony for?");
1088
                    events.ScheduleEvent(22, 2000);
1089
                    break;
1090
                case 22:
1091
                    Say(me, "Don't question my genius!");
1092
                    events.ScheduleEvent(23, 2000);
1093
                    break;
1094
                case 23:
1095
                    if (Creature* c = NearestCreature(me, NPC_GRIT))
1096
                        Say(c, "I don't care what it's for, is it going to get this door open?");
1097
                    events.ScheduleEvent(24, 4000);
1098
                    break;
1099
                case 24:
1100
                    Say(me, "This thing could open Gallywix's personal safe!");
1101
                    if (Creature* c = NearestCreature(me, NPC_MATID_BOMB))
1102
                        c->CastSpell(c, SPELL_MASSIVE_EXPLOSION);
1103
1104
                    events.ScheduleEvent(25, 2000);
1105
                    break;
1106
                case 25:
1107
                    if (Creature* c = NearestCreature(me, NPC_MATID_BOMB))
1108
                        c->GetAI()->DoAction(1);
1109
                    Say(me, "Once the detonator goes off in... err... NOW!");
1110
                    break;
1111
                }
1112
            }
1113
            if (UpdateVictim())
1114
                DoMeleeAttackIfReady();
1115
        }
1116
1117
        void mantidBombCast(uint32 spellId)
1118
        {
1119
            if (Creature* c = me->FindNearestCreature(NPC_MATID_BOMB, 60.0f))
1120
                c->CastSpell(c, spellId, false);
1121
            _count++;
1122
        }
1123
1124
        void sGossipHello(Player* player) override
1125
        {
1126
            if (player->isGameMaster())
1127
            {
1128
                instance->SetData(NPC_CANNON_BALLS, DONE);
1129
                instance->SetData(NPC_CANNON_BALLS, DONE);
1130
                instance->SetData(NPC_CANNON_BALLS, DONE);
1131
                instance->SetData(NPC_BATTERY, DONE);
1132
                instance->SetData(NPC_POOL_PONY, DONE);
1133
                instance->SetData(NPC_EGG_YOLK, DONE);
1134
                instance->SetData(NPC_BATTERY, DONE);
1135
                instance->SetData(NPC_BATTERY, DONE);
1136
                _count = 7;
1137
            }
1138
1139
            if (!meetUp)
1140
            {
1141
                meetUp = true;
1142
                instance->SetData(NPC_PATCH, DONE);
1143
            }
1144
1145
            if (player->HasAura(SPELL_CANNON_BALL))
1146
            {
1147
                player->RemoveAura(SPELL_CANNON_BALL);
1148
                if (_cannonBalls < 3)
1149
                {
1150
                    instance->SetData(NPC_CANNON_BALLS, DONE);
1151
                    mantidBombCast(SPELL_ATTACH_CANNON_BALL1 + _cannonBalls);
1152
                    switch (_cannonBalls)
1153
                    {
1154
                    case 0:
1155
                        Say(me, "That's exactly what we needed!");
1156
                        break;
1157
                    case 1:
1158
                        Say(me, "Careful! This isn't a toy!");
1159
                        break;
1160
                    case 2:
1161
                        Say(me, "This may be my greatest work yet!");
1162
                        break;
1163
                    }
1164
                    ++_cannonBalls;
1165
                }
1166
            }
1167
1168
            if (player->HasAura(SPELL_BATTERY))
1169
            {
1170
                player->RemoveAura(SPELL_BATTERY);
1171
                if (_batteries < 2)
1172
                {
1173
                    instance->SetData(NPC_BATTERY, DONE);
1174
                    mantidBombCast(SPELL_ATTACH_BATTERY1 + _batteries);
1175
                    switch (_batteries)
1176
                    {
1177
                    case 0:
1178
                        Say(me, "Just a little more power...");
1179
                        break;
1180
                    case 1:
1181
                        Say(me, "This should give us enough power to disable the stabilization matrix");
1182
                        break;
1183
                    }
1184
                    _batteries++;
1185
                }
1186
            }
1187
1188
            if (player->HasAura(SPELL_POOL_PONY))
1189
            {
1190
                player->RemoveAura(SPELL_POOL_PONY);
1191
                if (!_poolPony)
1192
                {
1193
                    Say(me, "The most important ingredient!");
1194
                    mantidBombCast(SPELL_ATTACH_POOL_PONY);
1195
                    _poolPony = true;
1196
                    instance->SetData(NPC_POOL_PONY, DONE);
1197
                }
1198
            }
1199
1200
            if (player->HasAura(SPELL_EGG_YOLK))
1201
            {
1202
                player->RemoveAura(SPELL_EGG_YOLK);
1203
                if (!_eggYolk)
1204
                {
1205
                    _eggYolk = true;
1206
                    mantidBombCast(SPELL_ATTACH_EGG_YOLK);
1207
                    Say(me, "You carried that with your hands?! Uh... you should probably see a medic when we get back...");
1208
                    instance->SetData(NPC_EGG_YOLK, DONE);
1209
                }
1210
            }
1211
1212
            player->CLOSE_GOSSIP_MENU();
1213
        }
1214
    private:
1215
        uint32 _cannonBalls;
1216
        uint32 _batteries;
1217
        bool _poolPony;
1218
        bool _eggYolk;
1219
        bool meetUp;
1220
        uint32 _count;
1221
    };
1222
    CreatureAI* GetAI(Creature* creature) const
1223
    {
1224
        return new ragefire_core_npc_tickerAI(creature);
1225
    }
1226
};
1227
1228
class ragefire_core_npc_volt : public CreatureScript
1229
{
1230
public:
1231
    ragefire_core_npc_volt() : CreatureScript("ragefire_core_npc_volt") { }
1232
1233
    struct ragefire_core_npc_voltAI : public ScriptedAI
1234
    {
1235
        ragefire_core_npc_voltAI(Creature* creature) : ScriptedAI(creature) { }
1236
1237
        void Reset() override
1238
        {
1239
            me->LoadEquipment(62249);
1240
        }
1241
1242
        void MovementInform(uint32 /*type*/, uint32 id)
1243
        {
1244
            switch (id)
1245
            {
1246
            case 1:
1247
1248
                break;
1249
            }
1250
        }
1251
1252
        void DoAction(const int32 action) override
1253
        {
1254
            switch (action)
1255
            {
1256
            case 1:
1257
                events.ScheduleEvent(1, 10);
1258
                break;
1259
1260
            case 4:
1261
                if (Creature* c = NearestCreature(me, NPC_PATCH))
1262
                    me->GetMotionMaster()->MoveFollow(c, 5.0f, 5.0f);
1263
                break;
1264
            case 6:
1265
                if (Creature* enemy = me->FindNearestCreature(71244, 50.0f))
1266
                {
1267
                    me->SetInCombatWith(enemy);
1268
                    DoZoneInCombat(enemy);
1269
                    me->Attack(enemy, true);
1270
                }
1271
                break;
1272
            case 9:
1273
                Say(me, "Sir these are Garrosh's men.");
1274
                me->GetMotionMaster()->Clear();
1275
                me->GetMotionMaster()->MovePoint(0, 1392.202026f, 999.338257f, 33.381569f);
1276
                break;
1277
            case 13:
1278
                me->GetMotionMaster()->MovePoint(5, 1482.913818f, 998.0f, 38.286098f);
1279
                break;
1280
            }
1281
        }
1282
1283
        void UpdateAI(const uint32 diff) override
1284
        {
1285
            events.Update(diff);
1286
1287
            while (uint32 eventId = events.ExecuteEvent())
1288
            {
1289
                switch (eventId)
1290
                {
1291
                case 1:
1292
                    me->GetMotionMaster()->MovePoint(1, 1421.058228f, 853.469604f, 38.675117f);
1293
                    break;
1294
                }
1295
            }
1296
            if (UpdateVictim())
1297
                DoMeleeAttackIfReady();
1298
        }
1299
    };
1300
    CreatureAI* GetAI(Creature* creature) const
1301
    {
1302
        return new ragefire_core_npc_voltAI(creature);
1303
    }
1304
};
1305
1306
enum darkShamanXorenthSpells
1307
{
1308
    SPELL_GLACIAL_TOTEM = 142320,
1309
    SPELL_RUINED_EARTH = 142306,
1310
    SPELL_TWISTED_ELEMENTS = 142296,
1311
};
1312
1313
class boss_ragefire_dark_shaman_xorenth : public CreatureScript
1314
{
1315
public:
1316
    boss_ragefire_dark_shaman_xorenth() : CreatureScript("boss_ragefire_dark_shaman_xorenth") { }
1317
1318
    CreatureAI* GetAI(Creature* pCreature) const
1319
    {
1320
        return new boss_ragefire_dark_shaman_xorenthAI(pCreature);
1321
    }
1322
    /*
1323
    Introduction
1324
    Dark Shaman Xorenth yells: Intruders! Stop them!
1325
    Ticker yells: These Kor'kron don't seem very friendly!
1326
    Patch yells: Gob Squad, defend yourselves!
1327
    Aggro
1328
    Dark Shaman Xorenth yells: Weaklings!
1329
    Dark Shaman Xorenth yells: Seal the gate, and inform the overseer immediately.
1330
    Patch yells: We aren't your enemy, Xorenth!
1331
    Dark Shaman Xorenth yells: All lesser races are enemies of the true Horde!
1332
    Patch yells: Lesser? We'll show you who's lesser!
1333
    */
1334
    struct boss_ragefire_dark_shaman_xorenthAI : public BossAI
1335
    {
1336
        boss_ragefire_dark_shaman_xorenthAI(Creature* pCreature) : BossAI(pCreature, 0), intro(false), _startCombat(false)
1337
        {
1338
            instance = me->GetInstanceScript();
1339
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
1340
            me->SetReactState(REACT_DEFENSIVE);
1341
        }
1342
1343
        void DoAction(const int32 action) override
1344
        {
1345
            switch (action)
1346
            {
1347
            case 1:
1348
                if (!intro)
1349
                {
1350
                    intro = true;
1351
                    Yell(me, "Intruders! Stop them!");
1352
                }
1353
                if (instance)
1354
                    instance->SetData(me->GetEntry(), IN_PROGRESS);
1355
                break;
1356
            case 2:
1357
                me->SetReactState(REACT_AGGRESSIVE);
1358
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
1359
                me->SetInCombatWithZone();
1360
                EnterCombat(me);
1361
                break;
1362
            case 3:
1363
                Yell(me, "All lesser races are enemies of the true horde!");
1364
                if (Creature* c = NearestCreature(me, NPC_PATCH))
1365
                    c->GetAI()->DoAction(8);
1366
                break;
1367
            }
1368
        }
1369
1370
        void Reset()
1371
        {
1372
            if (instance)
1373
                instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
1374
1375
            if (intro)
1376
            {
1377
                me->SetReactState(REACT_AGGRESSIVE);
1378
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
1379
            }
1380
1381
            _Reset();
1382
        }
1383
1384
        void EnterCombat(Unit* /*attacker*/) override
1385
        {
1386
            if (!_startCombat)
1387
            {
1388
                _startCombat = true;
1389
                Yell(me, "Seal the gate, and inform the overseer immediately.");
1390
                instance->SetData(me->GetEntry(), SPECIAL);
1391
                if (Creature* c = NearestCreature(me, NPC_PATCH))
1392
                    c->GetAI()->DoAction(7);
1393
            }
1394
            if (instance)
1395
                instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me);
1396
1397
            events.Reset();
1398
            events.ScheduleEvent(1, urand(8000, 12000));
1399
            events.ScheduleEvent(2, urand(14000, 27000));
1400
            events.ScheduleEvent(3, urand(8000, 9000));
1401
            events.ScheduleEvent(4, 10);//not correct at all but it should be fine for now, more of a visual
1402
        }
1403
1404
        void JustDied(Unit* /*killer*/) override
1405
        {
1406
            if (instance)
1407
                instance->SetData(me->GetEntry(), DONE);
1408
        }
1409
1410
        void UpdateAI(const uint32 diff) override
1411
        {
1412
            if (!UpdateVictim())
1413
                return;
1414
1415
            if (me->HasUnitState(UNIT_STATE_CASTING))
1416
                return;
1417
1418
            events.Update(diff);
1419
1420
            while (uint32 eventId = events.ExecuteEvent())
1421
            {
1422
                switch (eventId)
1423
                {
1424
                case 1://Twisted Elements
1425
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 15.0f, true))
1426
                        DoCast(target, SPELL_TWISTED_ELEMENTS);
1427
                    events.ScheduleEvent(1, urand(4000, 7000));
1428
                    break;
1429
                case 2://Glacial Freeze Totem
1430
                    DoCast(SPELL_GLACIAL_TOTEM);
1431
                    events.ScheduleEvent(2, urand(14000, 27000));
1432
                    break;
1433
                case 3://Ruined Earth
1434
                    DoCast(SPELL_RUINED_EARTH);
1435
                    events.ScheduleEvent(3, urand(8000, 9000));
1436
                    break;
1437
                case 4:
1438
                    if (GameObject* pDoor = me->FindNearestGameObject(220169, 440.0f))
1439
                    {
1440
                        pDoor->SetLootState(GO_READY);
1441
                        pDoor->UseDoorOrButton(10000 * 999, false, me);
1442
                    }
1443
                    break;
1444
                }
1445
            }
1446
            DoMeleeAttackIfReady();
1447
        }
1448
    private:
1449
        bool intro;
1450
        bool _startCombat;
1451
        InstanceScript* instance;
1452
    };
1453
};
1454
1455
class spell_ruined_earth_71262 : public CreatureScript
1456
{
1457
public:
1458
    spell_ruined_earth_71262() : CreatureScript("spell_ruined_earth_71262") { }
1459
1460
    struct spell_ruined_earth_71262AI : public ScriptedAI
1461
    {
1462
        spell_ruined_earth_71262AI(Creature* creature) : ScriptedAI(creature)
1463
        {
1464
            me->SetReactState(REACT_DEFENSIVE);
1465
        }
1466
1467
        void Reset() override
1468
        {
1469
            DoCast(142310);
1470
            events.ScheduleEvent(1, 6000);
1471
        }
1472
1473
        void UpdateAI(const uint32 diff) override
1474
        {
1475
            events.Update(diff);
1476
1477
            while (uint32 eventId = events.ExecuteEvent())
1478
            {
1479
                switch (eventId)
1480
                {
1481
                case 1:
1482
                    me->RemoveAura(142310);
1483
                    DoCast(142311);
1484
                    break;
1485
                }
1486
            }
1487
        }
1488
    };
1489
    CreatureAI* GetAI(Creature* creature) const
1490
    {
1491
        return new spell_ruined_earth_71262AI(creature);
1492
    }
1493
};
1494
1495
class npc_glacial_freeze_totem : public CreatureScript
1496
{
1497
public:
1498
    npc_glacial_freeze_totem() : CreatureScript("npc_glacial_freeze_totem") { }
1499
1500
    struct npc_glacial_freeze_totemAI : public ScriptedAI
1501
    {
1502
        npc_glacial_freeze_totemAI(Creature* creature) : ScriptedAI(creature)
1503
        {
1504
            me->SetReactState(REACT_PASSIVE);
1505
        }
1506
1507
        void Reset() override
1508
        {
1509
            events.ScheduleEvent(1, 2000);
1510
        }
1511
1512
        void UpdateAI(const uint32 diff) override
1513
        {
1514
            events.Update(diff);
1515
1516
            while (uint32 eventId = events.ExecuteEvent())
1517
            {
1518
                switch (eventId)
1519
                {
1520
                case 1:
1521
                    DoCast(142322);
1522
                    events.ScheduleEvent(1, 2000);
1523
                    break;
1524
                }
1525
            }
1526
        }
1527
    };
1528
    CreatureAI* GetAI(Creature* creature) const
1529
    {
1530
        return new npc_glacial_freeze_totemAI(creature);
1531
    }
1532
};
1533
1534
class ragefire_core_npc_korkron_shadowblade : public CreatureScript
1535
{
1536
public:
1537
    ragefire_core_npc_korkron_shadowblade() : CreatureScript("ragefire_core_npc_korkron_shadowblade") { }
1538
1539
    struct ragefire_core_npc_korkron_shadowbladeAI : public ScriptedAI
1540
    {
1541
        ragefire_core_npc_korkron_shadowbladeAI(Creature* creature) : ScriptedAI(creature)
1542
        {
1543
            instance = me->GetInstanceScript();
1544
        }
1545
1546
        InstanceScript* instance;
1547
1548
        void Reset()
1549
        {
1550
            events.Reset();
1551
            _shadowStep = true;
1552
        }        
1553
1554
        void MovementInform(uint32 /*type*/, uint32 id) override
1555
        {
1556
            if (id == 22)
1557
            {
1558
                me->SetInCombatWithZone();
1559
                me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
1560
            }
1561
        }
1562
1563
        void JustDied(Unit* /*killer*/) override
1564
        {
1565
            if (instance)
1566
                instance->SetData(me->GetEntry(), DONE);
1567
        }
1568
1569
        void EnterCombat(Unit* /*attacker*/) override
1570
        {
1571
            events.ScheduleEvent(1, urand(13000, 15000));
1572
            instance->SetData(me->GetEntry(), SPECIAL);
1573
        }
1574
1575
        void DoAction(const int32 action) override
1576
        {
1577
            switch (action)
1578
            {
1579
            case 1:
1580
                if (Creature* boss = me->FindNearestCreature(70683, 28.0f))
1581
                {
1582
                    me->SetInCombatWithZone();
1583
                }
1584
                break;
1585
            case 10:
1586
                events.ScheduleEvent(10, 1000);
1587
                me->SetInCombatWithZone();
1588
                break;
1589
            }
1590
        }
1591
1592
        void UpdateAI(const uint32 diff) override
1593
        {
1594
            if (!UpdateVictim())
1595
                return;
1596
1597
            events.Update(diff);
1598
1599
            if (_shadowStep && me->GetDistance2d(me->GetVictim()) <= 40.0f)
1600
            {
1601
                _shadowStep = false;
1602
                DoCastVictim(80576);//ShadowStep can be143262, wowhead says 80576
1603
            }
1604
1605
            while (uint32 eventId = events.ExecuteEvent())
1606
            {
1607
                switch (eventId)
1608
                {
1609
                case 1:
1610
                    _shadowStep = true;
1611
                    events.ScheduleEvent(1, urand(13000, 15000));
1612
                    break;
1613
                case 10:
1614
                    if (Creature* creature = NearestCreature(me, NPC_TRIGGER_3, 30.0f))
1615
                        me->GetMotionMaster()->MovePoint(22, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), false);
1616
                    break;
1617
                }
1618
            }
1619
            DoMeleeAttackIfReady();
1620
        }
1621
    private:
1622
        bool _shadowStep;
1623
    };
1624
1625
    CreatureAI* GetAI(Creature* creature) const
1626
    {
1627
        return new ragefire_core_npc_korkron_shadowbladeAI(creature);
1628
    }
1629
};
1630
1631
enum korkronDarkShamanSpells
1632
{
1633
    SPELL_ELECTRIFIED_GROUND = 145547,
1634
    SPELL_LAVA_BURST = 142338,
1635
    SPELL_POISON_BOLT_TOTEM = 145549,
1636
};
1637
1638
class ragefire_core_npc_korkron_dark_shaman : public CreatureScript
1639
{
1640
public:
1641
    ragefire_core_npc_korkron_dark_shaman() : CreatureScript("ragefire_core_npc_korkron_dark_shaman") { }
1642
1643
    struct ragefire_core_npc_korkron_dark_shamanAI : public ScriptedAI
1644
    {
1645
        ragefire_core_npc_korkron_dark_shamanAI(Creature* creature) : ScriptedAI(creature)
1646
        {
1647
            instance = me->GetInstanceScript();
1648
        }
1649
1650
        InstanceScript* instance;
1651
1652
        void Reset()
1653
        {
1654
            events.Reset();
1655
        }
1656
1657
        void MovementInform(uint32 /*type*/, uint32 id) override
1658
        {
1659
            if (id == 22)
1660
            {
1661
                me->SetInCombatWithZone();
1662
                me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
1663
            }
1664
        }
1665
1666
        void JustDied(Unit* /*killer*/) override
1667
        {
1668
            if (instance)
1669
            {
1670
                instance->SetData(me->GetEntry(), DONE);
1671
                instance->SetData(me->GetEntry(), SPECIAL);
1672
            }
1673
        }
1674
1675
        void EnterCombat(Unit* /*attacker*/) override
1676
        {
1677
            events.ScheduleEvent(1, urand(10000, 12000));
1678
            events.ScheduleEvent(2, urand(6000, 8000));//reset 8 sec
1679
            events.ScheduleEvent(3, urand(20000, 30000)); //reset 20-30
1680
        }
1681
1682
        void DoAction(const int32 action) override
1683
        {
1684
            switch (action)
1685
            {
1686
            case 1:
1687
                if (Creature* boss = me->FindNearestCreature(70683, 28.0f))
1688
                {
1689
                    me->SetInCombatWithZone();
1690
                }
1691
                break;
1692
            case 10:
1693
                me->SetInCombatWithZone();
1694
                events.ScheduleEvent(10, 1000);
1695
                break;
1696
            }
1697
        }
1698
1699
        void UpdateAI(const uint32 diff) override
1700
        {
1701
            if (!UpdateVictim())
1702
                return;
1703
1704
            if (me->HasUnitState(UNIT_STATE_CASTING))
1705
                return;
1706
1707
            events.Update(diff);
1708
1709
            while (uint32 eventId = events.ExecuteEvent())
1710
            {
1711
                switch (eventId)
1712
                {
1713
                case 1:
1714
                    DoCast(SPELL_ELECTRIFIED_GROUND);
1715
                    events.ScheduleEvent(1, urand(20000, 30000));
1716
                    break;
1717
                case 2:
1718
                    DoCastVictim(SPELL_LAVA_BURST);
1719
                    events.ScheduleEvent(2, 8000);
1720
                    break;
1721
                case 3:
1722
                    DoCast(SPELL_POISON_BOLT_TOTEM);
1723
                    events.ScheduleEvent(3, urand(20000, 30000));
1724
                    break;
1725
                case 10:
1726
                    if (Creature* creature = NearestCreature(me, NPC_TRIGGER_3, 30.0f))
1727
                        me->GetMotionMaster()->MovePoint(22, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), false);
1728
                    break;
1729
                }
1730
            }
1731
            DoMeleeAttackIfReady();
1732
        }
1733
    };
1734
1735
    CreatureAI* GetAI(Creature* creature) const
1736
    {
1737
        return new ragefire_core_npc_korkron_dark_shamanAI(creature);
1738
    }
1739
};
1740
//71097 - npc_ragefire_core_ragefire_peon
1741
class npc_ragefire_core_ragefire_peon : public CreatureScript
1742
{
1743
public:
1744
    npc_ragefire_core_ragefire_peon() : CreatureScript("npc_ragefire_core_ragefire_peon") { }
1745
1746
    struct npc_ragefire_core_ragefire_peonAI : public ScriptedAI
1747
    {
1748
        npc_ragefire_core_ragefire_peonAI(Creature* creature) : ScriptedAI(creature)
1749
        {
1750
            instance = me->GetInstanceScript();
1751
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
1752
            me->SetReactState(REACT_PASSIVE);
1753
        }
1754
1755
        InstanceScript* instance;
1756
1757
        void MovementInform(uint32 /*type*/, uint32 id) override
1758
        {
1759
            if (id == 1)
1760
                me->GetMotionMaster()->MovePoint(2, 1535.967896f, 1028.711792f, 38.705750f);
1761
            if (id == 2)
1762
                me->DespawnOrUnsummon();
1763
        }
1764
    };
1765
1766
    CreatureAI* GetAI(Creature* creature) const
1767
    {
1768
        return new npc_ragefire_core_ragefire_peonAI(creature);
1769
    }
1770
};
1771
1772
//71203 npc_ragefire_core_supply_crates
1773
class npc_ragefire_core_supply_crates : public CreatureScript
1774
{
1775
public:
1776
    npc_ragefire_core_supply_crates() : CreatureScript("npc_ragefire_core_supply_crates") { }
1777
1778
    struct npc_ragefire_core_supply_cratesAI : public ScriptedAI
1779
    {
1780
        npc_ragefire_core_supply_cratesAI(Creature* creature) : ScriptedAI(creature)
1781
        {
1782
            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
1783
            instance = me->GetInstanceScript();
1784
            pGossip = false;
1785
        }
1786
1787
        bool pGossip;
1788
        InstanceScript* instance;
1789
1790
        void sGossipHello(Player* player)
1791
        {
1792
            if (!pGossip)
1793
            {
1794
                pGossip = true;
1795
                if (instance)
1796
                    instance->SetData(me->GetEntry(), DONE);
1797
                if (Creature* c = NearestCreature(me, NPC_VOLT))
1798
                    Say(c, "These supply crates came from Orgrimmar. What is Garrosh planning to do with so many war supplies?");
1799
            }
1800
            player->SEND_GOSSIP_MENU(me->GetEntry(), me->GetGUID());
1801
        }
1802
    };
1803
1804
    CreatureAI* GetAI(Creature* creature) const
1805
    {
1806
        return new npc_ragefire_core_supply_cratesAI(creature);
1807
    }
1808
};
1809
//71208 npc_ragefire_core_protodrake_eggs
1810
class npc_ragefire_core_protodrake_eggs : public CreatureScript
1811
{
1812
public:
1813
    npc_ragefire_core_protodrake_eggs() : CreatureScript("npc_ragefire_core_protodrake_eggs") { }
1814
1815
    struct npc_ragefire_core_protodrake_eggsAI : public ScriptedAI
1816
    {
1817
        npc_ragefire_core_protodrake_eggsAI(Creature* creature) : ScriptedAI(creature)
1818
        {
1819
            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
1820
            instance = me->GetInstanceScript();
1821
            pGossip = false;
1822
        }
1823
1824
        bool pGossip;
1825
        InstanceScript* instance;
1826
1827
        void sGossipHello(Player* player)
1828
        {
1829
            if (!pGossip)
1830
            {
1831
                pGossip = true;
1832
                if (instance)
1833
                    instance->SetData(me->GetEntry(), DONE);
1834
                if (Creature* c = NearestCreature(me, NPC_PATCH))
1835
                    c->MonsterSay("Protodrakes eggs... Is Garrosh working with the Dragonmaw? Orcs on protodrakes sounds bad to me, $n, very bad.", 0, player->GetGUID());
1836
            }
1837
            player->SEND_GOSSIP_MENU(me->GetEntry(), me->GetGUID());
1838
        }
1839
    };
1840
1841
    CreatureAI* GetAI(Creature* creature) const
1842
    {
1843
        return new npc_ragefire_core_protodrake_eggsAI(creature);
1844
    }
1845
};
1846
//71209 npc_ragefire_core_pandaria_artifacts
1847
class npc_ragefire_core_pandaria_artifacts : public CreatureScript
1848
{
1849
public:
1850
    npc_ragefire_core_pandaria_artifacts() : CreatureScript("npc_ragefire_core_pandaria_artifacts") { }
1851
1852
    struct npc_ragefire_core_pandaria_artifactsAI : public ScriptedAI
1853
    {
1854
        npc_ragefire_core_pandaria_artifactsAI(Creature* creature) : ScriptedAI(creature)
1855
        {
1856
            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
1857
            instance = me->GetInstanceScript();
1858
            pGossip = false;
1859
        }
1860
1861
        bool pGossip;
1862
        InstanceScript* instance;
1863
1864
        void sGossipHello(Player* player)
1865
        {
1866
            if (!pGossip)
1867
            {
1868
                pGossip = true;
1869
                if (instance)
1870
                    instance->SetData(me->GetEntry(), DONE);
1871
                if (Creature* c = NearestCreature(me, NPC_NEWT))
1872
                    Say(c, "These are from the dig site in the Vale of Eternal Blossoms. What is Garrosh trying to find there?");
1873
            }
1874
            player->SEND_GOSSIP_MENU(me->GetEntry(), me->GetGUID());
1875
        }
1876
    };
1877
1878
    CreatureAI* GetAI(Creature* creature) const
1879
    {
1880
        return new npc_ragefire_core_pandaria_artifactsAI(creature);
1881
    }
1882
};
1883
1884
class npc_ragefire_stage3 : public CreatureScript
1885
{
1886
public:
1887
    npc_ragefire_stage3() : CreatureScript("npc_ragefire_stage3") { }
1888
1889
    struct npc_ragefire_stage3AI : public ScriptedAI
1890
    {
1891
        npc_ragefire_stage3AI(Creature* creature) : ScriptedAI(creature), startUpdate(false), spawned(false)
1892
        {
1893
            instance = me->GetInstanceScript();
1894
            me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
1895
        }
1896
1897
        InstanceScript* instance;
1898
1899
        void DoAction(const int32 action) override
1900
        {
1901
            if (action == 1)
1902
            {
1903
                startUpdate = true;
1904
                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
1905
            }
1906
        }
1907
1908
        void OnSpellClick(Unit* /*clicker*/) override
1909
        {
1910
            if (spawned)
1911
                return;
1912
1913
            switch (me->GetEntry())
1914
            {
1915
            case NPC_BATTERY:
1916
                SendNotifiactionToMap(me->GetMap(), "|cffFFFF00Embercores wakes from the lava!");
1917
                events.ScheduleEvent(1, 500);
1918
                break;
1919
            case NPC_EGG_YOLK:
1920
                events.ScheduleEvent(2, 500);
1921
                break;
1922
            }
1923
            spawned = true;
1924
        }
1925
1926
        void JustDied(Unit* /*killer*/) override
1927
        {
1928
            events.Reset();
1929
            startUpdate = false;
1930
        }
1931
1932
        void UpdateAI(const uint32 diff) override
1933
        {
1934
            if (!startUpdate)
1935
                return;
1936
1937
            events.Update(diff);
1938
1939
            while (uint32 eventId = events.ExecuteEvent())
1940
            {
1941
                switch (eventId)
1942
                {
1943
                case 1://embercore
1944
                    if (Creature* emberCore = me->SummonCreature(70663, 1383.007935f, 985.9666553f, 31.678915f, 6.0f, TEMPSUMMON_MANUAL_DESPAWN))
1945
                        emberCore->GetAI()->DoAction(1);
1946
                    if (Creature* emberCore = me->SummonCreature(70663, 1386.297974f, 974.14063f, 33.518883f, 1.110001f, TEMPSUMMON_MANUAL_DESPAWN))
1947
                        emberCore->GetAI()->DoAction(1);
1948
                    if (Creature* emberCore = me->SummonCreature(70663, 1388.084229f, 1019.177124f, 31.682781f, 1.110001f, TEMPSUMMON_MANUAL_DESPAWN))
1949
                        emberCore->GetAI()->DoAction(1);
1950
                    break;
1951
                case 2:
1952
1953
                    break;
1954
                }
1955
            }
1956
        }
1957
1958
    private:
1959
        bool startUpdate;
1960
        bool spawned;
1961
    };
1962
1963
    CreatureAI* GetAI(Creature* creature) const
1964
    {
1965
        return new npc_ragefire_stage3AI(creature);
1966
    }
1967
};
1968
1969
class npc_ragefire_embercore : public CreatureScript
1970
{
1971
public:
1972
    npc_ragefire_embercore() : CreatureScript("npc_ragefire_embercore") { }
1973
1974
    struct npc_ragefire_core_embercoreAI : public ScriptedAI
1975
    {
1976
        npc_ragefire_core_embercoreAI(Creature* creature) : ScriptedAI(creature), startTicking(false)
1977
        {
1978
            instance = me->GetInstanceScript();
1979
            DoCast(me, 141186);
1980
1981
            if (Player* player = me->FindNearestPlayer(200.0f))
1982
                me->SetLevel(player->getLevel());
1983
        }
1984
1985
        InstanceScript* instance;
1986
1987
        void JustDied(Unit* /*killer*/) override
1988
        {
1989
            events.Reset();
1990
            startTicking = false;
1991
        }
1992
1993
        void MovementInform(uint32 /*data*/, uint32 id) override
1994
        {
1995
            if (id == 1)
1996
            {
1997
                startTicking = true;
1998
                chooseNewVictim();
1999
                events.ScheduleEvent(1, urand(2000, 5000));
2000
            }
2001
        }
2002
2003
        void DoAction(const int32 action) override
2004
        {
2005
            if (action == 1)
2006
            {
2007
                startTicking = true;
2008
                me->GetMotionMaster()->MovePoint(1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 15.0f, false);
2009
            }
2010
        }
2011
2012
        void chooseNewVictim()
2013
        {
2014
            me->SetInCombatWithZone();
2015
        }
2016
2017
        void UpdateAI(const uint32 diff) override
2018
        {
2019
            if (!startTicking)
2020
                return;
2021
2022
            events.Update(diff);
2023
2024
            while (uint32 eventId = events.ExecuteEvent())
2025
            {
2026
                switch (eventId)
2027
                {
2028
                case 1:
2029
                    if (UpdateVictim())
2030
                        DoCastVictim(142298);//burning embers;
2031
                    else
2032
                        chooseNewVictim();
2033
                    events.ScheduleEvent(1, 8000);
2034
                    break;
2035
                }
2036
            }
2037
        }
2038
2039
    private:
2040
        bool startTicking;
2041
    };
2042
2043
    CreatureAI* GetAI(Creature* creature) const
2044
    {
2045
        return new npc_ragefire_core_embercoreAI(creature);
2046
    }
2047
};
2048
2049
class npc_ragefire_core_mantid_bomb : public CreatureScript
2050
{
2051
public:
2052
    npc_ragefire_core_mantid_bomb() : CreatureScript("npc_ragefire_core_mantid_bomb") { }
2053
2054
    struct npc_ragefire_core_mantid_bombAI : public ScriptedAI
2055
    {
2056
        npc_ragefire_core_mantid_bombAI(Creature* creature) : ScriptedAI(creature), startUpdate(false)
2057
        {
2058
            instance = me->GetInstanceScript();
2059
        }
2060
2061
        InstanceScript* instance;
2062
2063
        void DoAction(const int32 action) override
2064
        {
2065
            if (action == 1)
2066
            {
2067
                startUpdate = true;
2068
                events.ScheduleEvent(1, 1000);
2069
            }
2070
        }
2071
2072
        void JustDied(Unit* /*killer*/) override
2073
        {
2074
            events.Reset();
2075
            startUpdate = false;
2076
        }
2077
2078
        void UpdateAI(const uint32 diff) override
2079
        {
2080
            if (!startUpdate)
2081
                return;
2082
2083
            if (me->HasUnitState(UNIT_STATE_CASTING))
2084
                return;
2085
2086
            events.Update(diff);
2087
            while (uint32 eventId = events.ExecuteEvent())
2088
            {
2089
                switch (eventId)
2090
                {
2091
                case 1:
2092
                    DoCast(SPELL_HUGE_EXPLOSION);
2093
                    me->DespawnOrUnsummon(500);
2094
                    instance->SetData(me->GetEntry(), DONE);
2095
                    break;
2096
                }
2097
            }
2098
        }
2099
2100
    private:
2101
        bool startUpdate;
2102
    };
2103
2104
    CreatureAI* GetAI(Creature* creature) const
2105
    {
2106
        return new npc_ragefire_core_mantid_bombAI(creature);
2107
    }
2108
};
2109
2110
class npc_ragefire_core_kor_kron_dire_soldier : public CreatureScript
2111
{
2112
public:
2113
    npc_ragefire_core_kor_kron_dire_soldier() : CreatureScript("npc_ragefire_core_kor_kron_dire_soldier") { }
2114
2115
    struct npc_ragefire_core_kor_kron_dire_soldierAI : public ScriptedAI
2116
    {
2117
        npc_ragefire_core_kor_kron_dire_soldierAI(Creature* creature) : ScriptedAI(creature), startUpdate(false)
2118
        {
2119
            instance = me->GetInstanceScript();
2120
        }
2121
2122
        InstanceScript* instance;
2123
2124
        void MovementInform(uint32 /*type*/, uint32 id) override
2125
        {
2126
            if (id == 22)
2127
            {
2128
                me->SetInCombatWithZone();
2129
                me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
2130
            }
2131
        }
2132
2133
        void DoAction(const int32 action) override
2134
        {
2135
            if (action == 10)
2136
            {
2137
                me->SetInCombatWithZone();
2138
                startUpdate = true;
2139
                events.ScheduleEvent(1, 1000);
2140
            }
2141
        }
2142
2143
        void JustDied(Unit* /*killer*/) override
2144
        {
2145
            events.Reset();
2146
            startUpdate = false;
2147
            instance->SetData(me->GetEntry(), SPECIAL);
2148
        }
2149
2150
        void UpdateAI(const uint32 diff) override
2151
        {
2152
            if (!UpdateVictim())
2153
                return;
2154
2155
            if (me->HasUnitState(UNIT_STATE_CASTING))
2156
                return;
2157
2158
            events.Update(diff);
2159
            while (uint32 eventId = events.ExecuteEvent())
2160
            {
2161
                switch (eventId)
2162
                {
2163
                case 1:
2164
                    if (Creature* creature = NearestCreature(me, NPC_TRIGGER_3, 30.0f))
2165
                        me->GetMotionMaster()->MovePoint(22, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), false);
2166
                    break;
2167
                }
2168
            }
2169
            DoMeleeAttackIfReady();
2170
        }
2171
2172
    private:
2173
        bool startUpdate;
2174
    };
2175
2176
    CreatureAI* GetAI(Creature* creature) const
2177
    {
2178
        return new npc_ragefire_core_kor_kron_dire_soldierAI(creature);
2179
    }
2180
};
2181
2182
class npc_ragefire_core_flame_hound : public CreatureScript
2183
{
2184
public:
2185
    npc_ragefire_core_flame_hound() : CreatureScript("npc_ragefire_core_flame_hound") { }
2186
2187
    struct npc_ragefire_core_flame_houndAI : public ScriptedAI
2188
    {
2189
        npc_ragefire_core_flame_houndAI(Creature* creature) : ScriptedAI(creature), startUpdate(false)
2190
        {
2191
            instance = me->GetInstanceScript();
2192
        }
2193
2194
        InstanceScript* instance;
2195
2196
        void MovementInform(uint32 /*type*/, uint32 id) override
2197
        {
2198
            if (id == 22)
2199
            {
2200
                me->SetInCombatWithZone();
2201
                me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
2202
            }
2203
        }
2204
2205
        void DoAction(const int32 action) override
2206
        {
2207
            if (action == 10)
2208
            {
2209
                me->SetInCombatWithZone();
2210
                startUpdate = true;
2211
                events.ScheduleEvent(1, 1000);
2212
            }
2213
        }
2214
2215
        void JustDied(Unit* /*killer*/) override
2216
        {
2217
            events.Reset();
2218
            startUpdate = false;
2219
            instance->SetData(me->GetEntry(), SPECIAL);
2220
        }
2221
2222
        void UpdateAI(const uint32 diff) override
2223
        {
2224
            if (!UpdateVictim())
2225
                return;
2226
2227
            if (me->HasUnitState(UNIT_STATE_CASTING))
2228
                return;
2229
2230
            events.Update(diff);
2231
            while (uint32 eventId = events.ExecuteEvent())
2232
            {
2233
                switch (eventId)
2234
                {
2235
                case 1:
2236
                    if (Creature* creature = NearestCreature(me, NPC_TRIGGER_3, 30.0f))
2237
                        me->GetMotionMaster()->MovePoint(22, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), false);
2238
                    break;
2239
                }
2240
            }
2241
            DoMeleeAttackIfReady();
2242
        }
2243
2244
    private:
2245
        bool startUpdate;
2246
    };
2247
2248
    CreatureAI* GetAI(Creature* creature) const
2249
    {
2250
        return new npc_ragefire_core_flame_houndAI(creature);
2251
    }
2252
};
2253
2254
class npc_ragefire_core_kor_kron_emberguard : public CreatureScript
2255
{
2256
public:
2257
    npc_ragefire_core_kor_kron_emberguard() : CreatureScript("npc_ragefire_core_kor_kron_emberguard") { }
2258
2259
    struct npc_ragefire_core_kor_kron_emberguardAI : public ScriptedAI
2260
    {
2261
        npc_ragefire_core_kor_kron_emberguardAI(Creature* creature) : ScriptedAI(creature), startUpdate(false)
2262
        {
2263
            instance = me->GetInstanceScript();
2264
        }
2265
2266
        InstanceScript* instance;
2267
2268
        void MovementInform(uint32 /*type*/, uint32 id) override
2269
        {
2270
            if (id == 22)
2271
            {
2272
                me->SetInCombatWithZone();
2273
                me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
2274
            }
2275
        }
2276
2277
        void DoAction(const int32 action) override
2278
        {
2279
            if (action == 10)
2280
            {
2281
                me->SetInCombatWithZone();
2282
                startUpdate = true;
2283
                events.ScheduleEvent(1, 1000);
2284
            }
2285
        }
2286
2287
        void JustDied(Unit* /*killer*/) override
2288
        {
2289
            events.Reset();
2290
            startUpdate = false;
2291
            instance->SetData(me->GetEntry(), SPECIAL);
2292
        }
2293
2294
        void UpdateAI(const uint32 diff) override
2295
        {
2296
            if (!UpdateVictim())
2297
                return;
2298
2299
            if (me->HasUnitState(UNIT_STATE_CASTING))
2300
                return;
2301
2302
            events.Update(diff);
2303
            while (uint32 eventId = events.ExecuteEvent())
2304
            {
2305
                switch (eventId)
2306
                {
2307
                case 1:
2308
                    if (Creature* creature = NearestCreature(me, NPC_TRIGGER_3, 30.0f))
2309
                        me->GetMotionMaster()->MovePoint(22, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), false);
2310
                    me->SetInCombatWithZone();
2311
                    break;
2312
                }
2313
            }
2314
            DoMeleeAttackIfReady();
2315
        }
2316
2317
    private:
2318
        bool startUpdate;
2319
    };
2320
2321
    CreatureAI* GetAI(Creature* creature) const
2322
    {
2323
        return new npc_ragefire_core_kor_kron_emberguardAI(creature);
2324
    }
2325
};
2326
2327
enum overseerSpells
2328
{
2329
    SPELL_SHATTERING_CHARGE = 142773,
2330
    SPELL_DEMOLISH_ARMOR = 142764,
2331
    SPELL_SHATTERING_STOMP = 142771,
2332
};
2333
2334
class boss_ragefire_overseer_elaglo : public CreatureScript
2335
{
2336
public:
2337
    boss_ragefire_overseer_elaglo() : CreatureScript("boss_ragefire_overseer_elaglo") { }
2338
2339
    CreatureAI* GetAI(Creature* pCreature) const
2340
    {
2341
        return new boss_ragefire_overseer_elagloAI(pCreature);
2342
    }
2343
2344
    struct boss_ragefire_overseer_elagloAI : public BossAI
2345
    {
2346
        boss_ragefire_overseer_elagloAI(Creature* pCreature) : BossAI(pCreature, 0)
2347
        {
2348
            instance = me->GetInstanceScript();
2349
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
2350
            me->SetReactState(REACT_DEFENSIVE);
2351
        }
2352
2353
        InstanceScript* instance;
2354
2355
        void DoAction(const int32 action) override
2356
        {
2357
        }
2358
2359
        void Reset()
2360
        {
2361
            if (instance)
2362
                instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
2363
2364
            _Reset();
2365
        }
2366
2367
        void EnterCombat(Unit* /*attacker*/) override
2368
        {
2369
            _EnterCombat();
2370
            DoCastVictim(SPELL_SHATTERING_CHARGE);
2371
            events.ScheduleEvent(1, urand(3000, 20000));
2372
            events.ScheduleEvent(2, urand(10000, 20000));
2373
        }
2374
2375
        void JustDied(Unit* /*killer*/) override
2376
        {
2377
            if (instance)
2378
                instance->SetData(me->GetEntry(), DONE);
2379
        }
2380
2381
        void UpdateAI(const uint32 diff) override
2382
        {
2383
            if (!UpdateVictim())
2384
                return;
2385
2386
            if (me->HasUnitState(UNIT_STATE_CASTING))
2387
                return;
2388
2389
            events.Update(diff);
2390
2391
            while (uint32 eventId = events.ExecuteEvent())
2392
            {
2393
                switch (eventId)
2394
                {
2395
                case 1:
2396
                    DoCastVictim(SPELL_DEMOLISH_ARMOR);
2397
                    events.ScheduleEvent(1, urand(10000, 20000));
2398
                    break;
2399
                case 2:
2400
                    DoCast(SPELL_SHATTERING_STOMP);
2401
                    events.ScheduleEvent(2, urand(10000, 20000));
2402
                    break;
2403
                }
2404
            }
2405
            DoMeleeAttackIfReady();
2406
        }
2407
    };
2408
};
2409
//stage 3 the sealed gate
2410
2411
//misc spells found in sniffs
2412
/*
2413
Holding Bomb - 141806
2414
Unconscious - 141985
2415
Self Set on Fire - 141964
2416
*/
2417
//misc npcs
2418
//protodrake whelp - 71401
2419
//Holding battery - 141904
2420
//holding cannon ball - 141832
2421
//egg yolk - 141914
2422
//stage 4
2423
//dire rage - 142760 Kor'kron dire soldier uses
2424
2425
//this is custom
2426
class NPC_IRON_BODY_PONSHU_RAGEFIRE : public CreatureScript //CID : 98005
2427
{
2428
public:
2429
    NPC_IRON_BODY_PONSHU_RAGEFIRE() : CreatureScript("NPC_IRON_BODY_PONSHU_RAGEFIRE")
2430
    {
2431
    }
2432
2433
    struct NPC_IRON_BODY_PONSHU_RAGEFIREAI : public ScriptedAI
2434
    {
2435
        InstanceScript* instance;
2436
2437
        void Reset()
2438
        {
2439
            instance = me->GetInstanceScript();
2440
2441
            if (!instance)
2442
                me->DespawnOrUnsummon(1);
2443
2444
            me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
2445
        }
2446
2447
        void DoAction(const int32 action) override
2448
        {
2449
            if (action == 1) // called on spawn
2450
                events.ScheduleEvent(1, 2000);
2451
        }
2452
        
2453
        void UpdateAI(const uint32 diff) override
2454
        {
2455
            events.Update(diff);
2456
2457
            while (uint32 eventId = events.ExecuteEvent())
2458
            {
2459
                switch(eventId)
2460
                {
2461
                case 1:
2462
                    if (Player* player = me->FindNearestPlayer(200.0f))
2463
                        me->MonsterSay("Very nice young $c", 0, player->GetGUID());
2464
                    me->HandleEmoteCommand(Emote::EMOTE_ONESHOT_TALK);
2465
                     events.ScheduleEvent(2, 4000);
2466
                    break;
2467
2468
                case 2:
2469
                    Say(me, "Now for my next task.");
2470
                    break;
2471
                }
2472
            }
2473
        }
2474
    };
2475
};
2476
void AddSC_secrets_of_ragefire()
2477
{
2478
    new instance_ragefire_core();
2479
    new ragefire_core_ticking_bomb();
2480
    new ragefire_core_detonator();
2481
    new ragefire_core_npc_volt();
2482
    new ragefire_core_npc_grit();
2483
    new ragefire_core_npc_newt();
2484
    new ragefire_core_npc_patch();
2485
    new ragefire_core_npc_ticker();
2486
    new boss_ragefire_dark_shaman_xorenth();
2487
    new spell_ruined_earth_71262();
2488
    new npc_glacial_freeze_totem();
2489
    new ragefire_core_npc_korkron_shadowblade();
2490
    new ragefire_core_npc_korkron_dark_shaman();
2491
    new npc_ragefire_core_ragefire_peon();
2492
    new npc_ragefire_core_supply_crates();
2493
    new npc_ragefire_core_protodrake_eggs();
2494
    new npc_ragefire_core_pandaria_artifacts();
2495
    new npc_ragefire_stage3();
2496
    new npc_ragefire_embercore();
2497
    new npc_ragefire_core_mantid_bomb();
2498
    new npc_ragefire_core_kor_kron_dire_soldier();
2499
    new npc_ragefire_core_flame_hound();
2500
    new npc_ragefire_core_kor_kron_emberguard();
2501
    new boss_ragefire_overseer_elaglo();
2502
}