Example #1
0
        void SummonNPC(GameObject* go, Player* player, uint32 npc, uint32 spell)
        {
            go->CastSpell(player, spell);
            TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000);
            summons->CastSpell(summons, SPELL_SPAWN_IN, false);
            switch (summons->GetEntry())
            {
                case NPC_TEMPLAR_FIRE:
                case NPC_TEMPLAR_WATER:
                case NPC_TEMPLAR_AIR:
                case NPC_TEMPLAR_EARTH:
                    summons->AI()->Talk(SAY_TEMPLAR_AGGRO);
                    break;

                case NPC_DUKE_FIRE:
                case NPC_DUKE_WATER:
                case NPC_DUKE_EARTH:
                case NPC_DUKE_AIR:
                    summons->AI()->Talk(SAY_DUKE_AGGRO);
                    break;
                case NPC_ROYAL_FIRE:
                case NPC_ROYAL_AIR:
                case NPC_ROYAL_EARTH:
                case NPC_ROYAL_WATER:
                    summons->AI()->Talk(YELL_ROYAL_AGGRO);
                    break;
            }
            summons->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            summons->SendMeleeAttackStart(player);
            summons->CombatStart(player);
        }
            void OnPlayerEnter(Player* player)
            {
                if (!TeamInInstance)
                    TeamInInstance = player->GetTeam();

                if (_summonAlgalon)
                {
                    _summonAlgalon = false;
                    TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
                    if (_algalonTimer && _algalonTimer <= 60)
                        algalon->AI()->DoAction(ACTION_INIT_ALGALON);
                    else
                        algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
                }
            }
Example #3
0
        void OnPlayerEnter(Player* player)
        {
            if (!TeamInInstance)
                TeamInInstance = player->GetTeam();

            if (_summonAlgalon)
            {
                _summonAlgalon = false;
                TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
                if (_algalonTimer && _algalonTimer <= 60)
                    algalon->AI()->DoAction(ACTION_INIT_ALGALON);
                else
                    algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
            }

            // Keepers at Observation Ring
            if (GetBossState(BOSS_FREYA) == DONE && _summonObservationRingKeeper[0] && !KeeperGUIDs[0])
            {
                _summonObservationRingKeeper[0] = false;
                instance->SummonCreature(NPC_FREYA_OBSERVATION_RING, ObservationRingKeepersPos[0]);
            }
            if (GetBossState(BOSS_HODIR) == DONE && _summonObservationRingKeeper[1] && !KeeperGUIDs[1])
            {
                _summonObservationRingKeeper[1] = false;
                instance->SummonCreature(NPC_HODIR_OBSERVATION_RING, ObservationRingKeepersPos[1]);
            }
            if (GetBossState(BOSS_THORIM) == DONE && _summonObservationRingKeeper[2] && !KeeperGUIDs[2])
            {
                _summonObservationRingKeeper[2] = false;
                instance->SummonCreature(NPC_THORIM_OBSERVATION_RING, ObservationRingKeepersPos[2]);
            }
            if (GetBossState(BOSS_MIMIRON) == DONE && _summonObservationRingKeeper[3] && !KeeperGUIDs[3])
            {
                _summonObservationRingKeeper[3] = false;
                instance->SummonCreature(NPC_MIMIRON_OBSERVATION_RING, ObservationRingKeepersPos[3]);
            }

            // Keepers in Yogg-Saron's room
            if (_summonYSKeeper[0])
                instance->SummonCreature(NPC_FREYA_YS, YSKeepersPos[0]);
            if (_summonYSKeeper[1])
                instance->SummonCreature(NPC_HODIR_YS, YSKeepersPos[1]);
            if (_summonYSKeeper[2])
                instance->SummonCreature(NPC_THORIM_YS, YSKeepersPos[2]);
            if (_summonYSKeeper[3])
                instance->SummonCreature(NPC_MIMIRON_YS, YSKeepersPos[3]);
        }
            void UpdateAI(const uint32 diff)
            {
                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_TALK_LOREWALKER_DESPAWN:
                            me->ForcedDespawn();
                            break;
                        // This is the first speech when Lorewalker stonestep sees you for the first time.
                        case EVENT_INTRO_0:
                            Talk(EVENT_TALK_INTRO_0); //419621722
                            events.ScheduleEvent(EVENT_INTRO_1, 8019);
                            break;
                        case EVENT_INTRO_1:
                            Talk(EVENT_TALK_INTRO_1); //419629741
                            events.ScheduleEvent(EVENT_INTRO_2, 16162);
                            break;
                        case EVENT_INTRO_2:
                            Talk(EVENT_TALK_INTRO_2); //419645903
                            events.ScheduleEvent(EVENT_INTRO_3, 9578);
                            break;
                        case EVENT_INTRO_3:
                            Talk(EVENT_TALK_INTRO_3); //419655481
                            break;
                        // End of the first speech.

                        // TRIAL: Speech when the scroll is destroyed.
                        case EVENT_SUN_0:
                            me->RemoveAura(SPELL_ROOT_SELF);
                            Talk(EVENT_TALK_ZAO_APPEARS_0); //419667540
                            events.ScheduleEvent(EVENT_SUN_1, 9641);
                            break;
                        case EVENT_SUN_1:
                            Talk(EVENT_TALK_ZAO_APPEARS_1); //419677181
                            me->GetMotionMaster()->MovePoint(0, 838.033f, -2480.518f, 176.744f);
                            events.ScheduleEvent(EVENT_SUN_2, 811);
                            break;
                        case EVENT_SUN_2:
                            Talk(EVENT_TALK_ZAO_APPEARS_2); //419677992
                            me->GetMotionMaster()->MovePoint(0, 834.643f, -2490.361f, 179.897f);
                            events.ScheduleEvent(EVENT_SUN_3, 2792);
                            break;
                        case EVENT_SUN_3:
                            Talk(EVENT_TALK_ZAO_APPEARS_3); //419680784
                            me->SetFacingTo(1.239f);
                            instance->SetData(TYPE_SET_SUNS_SELECTABLE, 0);
                            events.ScheduleEvent(EVENT_SUN_4, 4214);
                            break;
                        case EVENT_SUN_4:
                            me->CastSpell(me, SPELL_MEDITATION, false);
                            Talk(EVENT_TALK_ZAO_APPEARS_4); //419722998
                            break;
                        // TRIAL: End of speech for destroyed scroll.

                        // ZAO: Speech when the scroll is destroyed.
                        case EVENT_STRIFE_0:
                            me->RemoveAura(SPELL_ROOT_SELF);
                            Talk(EVENT_TALK_STRIFE_0); //419667540
                            events.ScheduleEvent(EVENT_STRIFE_1, 9641);
                            break;
                        case EVENT_STRIFE_1:
                            Talk(EVENT_TALK_STRIFE_1); //419677181
                            me->GetMotionMaster()->MovePoint(0, 838.033f, -2480.518f, 176.744f);
                            events.ScheduleEvent(EVENT_STRIFE_2, 8011);
                            break;
                        case EVENT_STRIFE_2:
                            Talk(EVENT_TALK_STRIFE_2); //419677992
                            me->GetMotionMaster()->MovePoint(0, 834.643f, -2490.361f, 179.897f);
                            events.ScheduleEvent(EVENT_STRIFE_3, 5092);
                            break;
                        case EVENT_STRIFE_3:
                            {
                                Talk(EVENT_TALK_STRIFE_3); //419680784
                                me->SetFacingTo(1.239f);
                                events.ScheduleEvent(EVENT_STRIFE_4, 6014);
                                TempSummon* temp = me->SummonCreature(CREATURE_OSONG, 842.752f, -2468.911f, 174.959f);
                                if (!temp)
                                    break;
                                temp->setFaction(14);
                                temp->Attack(SelectTarget(SELECT_TARGET_RANDOM), true);
                                temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                temp->SetFacingTo(1.239f);
                                sCreatureTextMgr->SendChat(temp, 0, 0);
                            }
                            break;
                        case EVENT_STRIFE_4:
                            me->CastSpell(me, SPELL_MEDITATION, false);
                            Talk(EVENT_TALK_STRIFE_4); //419722998
                            events.ScheduleEvent(EVENT_TALK_LOREWALKER_DESPAWN, 3000);
                            break;
                        // ZAO: End of speech for destroyed scroll.
                    }
                }

            }