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 JustDied(Unit *pKiller)
        {
            if (!pKiller->ToPlayer())
                return;

            TempSummon *Spawn = NULL;
            switch (urand(0,4))
            {
            case 0:
                Spawn = me->SummonCreature(Gjalerbron_Sleep_Watcher,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,120*IN_MILLISECONDS);
                break;
            case 1:
                Spawn = me->SummonCreature(Gjalerbron_Warrior,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,120*IN_MILLISECONDS);
                break;
            case 2:
                Spawn = me->SummonCreature(Gjalerbron_Rune_Caster,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,120*IN_MILLISECONDS);
                break;
            default:
                me->SummonCreature(Freed_Winterhoof_Longrunner,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,20*IN_MILLISECONDS);
                pKiller->ToPlayer()->KilledMonsterCredit(Freed_Winterhoof_Longrunner, pKiller->ToPlayer()->GetGUID());
                break;
            }
            if (Spawn)
                Spawn->AI()->AttackStart(pKiller);
        }
            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 #4
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]);
        }