void Update(uint32 diff)
        {
            if (auiEncounter[0] == SPECIAL)
                if (uiEngageTimer <= diff)
                {
                    Creature *pGashra = instance->GetCreature(uiWatcherGashra);
                    Creature *pSilthik = instance->GetCreature(uiWatcherSilthik);
                    Creature *pNarjil = instance->GetCreature(uiWatcherNarjil);
                    Creature *pKrikthir = instance->GetCreature(uiKrikthir);

                    if (pGashra && pSilthik && pNarjil && pKrikthir)
                    {
                        if (pGashra->isAlive() && !pGashra->isInCombat())
                            pGashra->SetInCombatWithZone();
                        else if (pSilthik->isAlive() && !pSilthik->isInCombat())
                            pSilthik->SetInCombatWithZone();
                        else if (pNarjil->isAlive() && !pNarjil->isInCombat())
                            pNarjil->SetInCombatWithZone();
                        else if (pKrikthir->isAlive() && !pKrikthir->isInCombat())
                            pKrikthir->SetInCombatWithZone();

                        uiEngageTimer = 45*IN_MILLISECONDS;
                    }
                } else uiEngageTimer -= diff;

            if (bDoorSwitch)
            {
                if (uiDoorTimer <= diff)
                {
                    bDoorSwitch = false;
                    for (uint8 i = 0; i < 3; ++i)
                        HandleGameObject(uiAnubarakDoor[i], false);
                } else uiDoorTimer -= diff;
            }
        }
Example #2
0
void WorldSession::HandleSpellClick(WorldPacket& recv_data)
{
    ObjectGuid guid;
    recv_data >> guid;

    // client prevent click and set different icon at combat state; however combat state is allowed for dungeons
    if (_player->isInCombat() && !_player->GetMap()->IsDungeon())
        return;

    Creature* unit = _player->GetMap()->GetAnyTypeCreature(guid);
    if (!unit || unit->isInCombat())                        // client prevent click and set different icon at combat state
        return;

    SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry());
    for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
    {
        if (itr->second.IsFitToRequirements(_player, unit))
        {
            if (sScriptDevAIMgr.OnNpcSpellClick(_player, unit, itr->second.spellId))
                return;

            Unit* caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit;
            Unit* target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit;

            if (itr->second.spellId)
                caster->CastSpell(target, itr->second.spellId, TRIGGERED_OLD_TRIGGERED);
            else
                sLog.outError("WorldSession::HandleSpellClick: npc_spell_click with entry %u has 0 in spell_id. Not handled custom case?", unit->GetEntry());
        }
    }
}
void instance_stratholme::OnCreatureDeath(Creature* pCreature)
{
    switch (pCreature->GetEntry())
    {
        case NPC_BARONESS_ANASTARI: SetData(TYPE_BARONESS, DONE); break;
        case NPC_MALEKI_THE_PALLID: SetData(TYPE_PALLID, DONE);   break;
        case NPC_NERUBENKAN:        SetData(TYPE_NERUB, DONE);    break;
        case NPC_RAMSTEIN:          SetData(TYPE_RAMSTEIN, DONE); break;
        case NPC_BARON:             SetData(TYPE_BARON, DONE);    break;

        case NPC_THUZADIN_ACOLYTE:
            ThazudinAcolyteJustDied(pCreature);
            break;

        case NPC_ABOM_BILE:
        case NPC_ABOM_VENOM:
            // Start Slaughterhouse Event
            SetData(TYPE_RAMSTEIN, SPECIAL);
            break;

        case NPC_MINDLESS_UNDEAD:
            m_luiUndeadGUIDs.remove(pCreature->GetObjectGuid());
            if (m_luiUndeadGUIDs.empty())
            {
                // Let the black Guards move out of the citadel
                for (GuidList::const_iterator itr = m_luiGuardGUIDs.begin(); itr != m_luiGuardGUIDs.end(); ++itr)
                {
                    Creature* pGuard = instance->GetCreature(*itr);
                    if (pGuard && pGuard->isAlive() && !pGuard->isInCombat())
                    {
                        float fX, fY, fZ;
                        pGuard->GetRandomPoint(aStratholmeLocation[5].m_fX, aStratholmeLocation[5].m_fY, aStratholmeLocation[5].m_fZ, 10.0f, fX, fY, fZ);
                        pGuard->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
                    }
                }
            }
            break;
        case NPC_BLACK_GUARD:
            m_luiGuardGUIDs.remove(pCreature->GetObjectGuid());
            if (m_luiGuardGUIDs.empty())
                SetData(TYPE_BLACK_GUARDS, DONE);

            break;

        // Timmy spawn support
        case NPC_CRIMSON_INITIATE:
        case NPC_CRIMSON_GALLANT:
        case NPC_CRIMSON_GUARDSMAN:
        case NPC_CRIMSON_CONJURER:
            if (m_suiCrimsonLowGuids.find(pCreature->GetGUIDLow()) != m_suiCrimsonLowGuids.end())
            {
                m_suiCrimsonLowGuids.erase(pCreature->GetGUIDLow());

                // If all courtyard mobs are dead then summon Timmy
                if (m_suiCrimsonLowGuids.empty())
                    pCreature->SummonCreature(NPC_TIMMY_THE_CRUEL, aTimmyLocation[0].m_fX, aTimmyLocation[0].m_fY, aTimmyLocation[0].m_fZ, aTimmyLocation[0].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0);
            }
            break;
    }
}
Example #4
0
    void UpdateAI(const uint32 diff)
    {
        if(DelayTimer > diff)
        {
            DelayTimer -= diff;
            return;
        }
        else if(DelayTimer)
        {
            DelayTimer = 0;
        }

        UpdateTarget(diff);

        if(CheckTeronTimer < diff)
        {
            Creature *pTeron = pInstance->GetCreature(pInstance->GetData64(DATA_TERONGOREFIEND));
            if(!pTeron || !pTeron->isInCombat())
                 m_creature->Kill(m_creature, false);

            CheckTeronTimer = 2000;
        }
        else
            CheckTeronTimer -= diff;

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (Check_Timer <= diff)
        {
            Creature* Shaffar = me->FindNearestCreature(ENTRY_SHAFFAR, 100);
            if (!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat())
            {
                KillSelf();
                return;
            }
            Check_Timer = 1000;
        } else Check_Timer -= diff;

        if (ArcaneBolt_Timer <= diff)
        {
            DoCast(me->getVictim(),SPELL_ARCANE_BOLT);
            ArcaneBolt_Timer = 2000 + rand()%2500;
        } else ArcaneBolt_Timer -= diff;

        if (Apprentice_Timer <= diff)
        {
            if (me->IsNonMeleeSpellCasted(false))
                me->InterruptNonMeleeSpells(true);

            me->CastSpell(me,SPELL_ETHEREAL_APPRENTICE,true);
            if (me->isPet())
                ((Pet*)me)->SetDuration(0);
            KillSelf();
            return;
        } else Apprentice_Timer -= diff;
    }
        void UpdateAI(const uint32 diff)
        {
            if(CheckTeronTimer < diff)
            {
                if(TeronGUID)
                {
                    DoZoneInCombat();

                    Creature* Teron = Unit::GetCreature((*me), TeronGUID);
                    if((Teron) && (!Teron->isAlive() || !Teron->isInCombat()))
                    {
                        Despawn();
                        return;
                    }
                }
                else
                {
                    Despawn();
                    return;
                }

                CheckTeronTimer = 5000;
            }else CheckTeronTimer -= diff;

            if(ShadowBoltTimer < diff)
            {
                Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                if(ptarget)
                    DoCast(ptarget , SPELL_SHADOWBOLT);
                ShadowBoltTimer = 2000;
            }else ShadowBoltTimer -= diff;

        }
        void UpdateAI(uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (Check_Timer <= diff)
            {
                Creature* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100);
                if (!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat())
                {
                    KillSelf();
                    return;
                }
                Check_Timer = 1000;
            } else Check_Timer -= diff;

            if (ArcaneBolt_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCANE_BOLT);
                ArcaneBolt_Timer = urand(2000, 4500);
            } else ArcaneBolt_Timer -= diff;

            if (Apprentice_Timer <= diff)
            {
                if (me->IsNonMeleeSpellCasted(false))
                    me->InterruptNonMeleeSpells(true);

                DoCast(me, SPELL_ETHEREAL_APPRENTICE, true);
                me->DespawnOrUnsummon();
                return;
            } else Apprentice_Timer -= diff;
        }
Example #8
0
// Flesh tentacle functions
void flesh_tentacleAI::UpdateAI(const uint32 uiDiff)
{
    // Check if we have a target
    if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        return;

    if (m_cThunGuid)
    {
        if (m_uiCheckTimer < uiDiff)
        {
            Creature* pParent = m_creature->GetMap()->GetCreature(m_cThunGuid);

            if (!pParent || !pParent->isAlive() || !pParent->isInCombat())
            {
                m_cThunGuid.Clear();
                m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, NULL, false);
                return;
            }

            m_uiCheckTimer = 1000;
        }
        else
            m_uiCheckTimer -= uiDiff;
    }

    DoMeleeAttackIfReady();
}
Example #9
0
void WorldSession::HandleSpellClick( WorldPacket & recv_data )
{
    CHECK_PACKET_SIZE(recv_data, 8);

    uint64 guid;
    recv_data >> guid;

    if (_player->isInCombat())                              // client prevent click and set different icon at combat state
        return;

    Creature *unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
    if (!unit || unit->isInCombat())                        // client prevent click and set different icon at combat state
        return;

    SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(unit->GetEntry());
    for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
    {
        if (itr->second.IsFitToRequirements(_player))
        {
            Unit *caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit;
            Unit *target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit;

            caster->CastSpell(target, itr->second.spellId, true);
        }
    }
}
Example #10
0
            void EnterCombat(Unit* who)
            {
                me->SetReactState(REACT_AGGRESSIVE);

                Creature* kologarn = me->GetVehicleCreatureBase();
                if (kologarn && !kologarn->isInCombat())
                    kologarn->AI()->AttackStart(who);
            }
void TargetedMovementGenerator<Creature>::Initialize(Creature &owner)
{
    if (owner.isInCombat())
        owner.RemoveMonsterMoveFlag(MONSTER_MOVE_WALK);

    if (((Creature*)&owner)->canFly())
        owner.AddMonsterMoveFlag(MONSTER_MOVE_FLY);

    _setTargetLocation(owner);
}
		void EnterCombat(Unit* /*who*/)
		{
			if(!Feludius->isInCombat())
				Feludius->CombatStart(me->getVictim(), 1.0f);

			events.ScheduleEvent(EVENT_BUNRING_BLOOD, urand(31000,33000));
			events.ScheduleEvent(EVENT_FLAME_TORRENT, urand(10000,12000));
			events.ScheduleEvent(EVENT_AEGIS_OF_FLAME, urand(54000,57000));
			events.ScheduleEvent(EVENT_INFERNO_LEAP, urand(25000,27000));
		}
		void EnterCombat(Unit* /*who*/)
		{
			if(!Ignacious->isInCombat())
				Ignacious->CombatStart(me->getVictim(), 1.0f);

			events.ScheduleEvent(EVENT_HYDROLANCE, urand(10000,12000));
			events.ScheduleEvent(EVENT_WATER_BOMB, urand(16000,19000));
			events.ScheduleEvent(EVENT_HEART_OF_ICE, urand(10000,12000));
			events.ScheduleEvent(EVENT_GLACIATE, urand(32000,34000));		
		}
    void UpdateAI(const uint32 diff)
    {
        if (!pInstance)
            return;

        if (!VashjGUID)
            return;

        Creature *Vashj = Unit::GetCreature(*me, VashjGUID);

        if (move <= diff)
        {
            me->SetUnitMovementFlags(MOVEFLAG_WALK_MODE);
            if (phase == 1)
                me->GetMotionMaster()->MovePoint(0, x, y, z);
            if (phase == 1 && me->GetDistance(x,y,z) < 0.1f)
                phase = 2;
            if (phase == 2)
            {
                me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z);
                phase = 3;
            }
            if (phase == 3)
            {
                me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z);
                if (me->GetDistance(MIDDLE_X, MIDDLE_Y, MIDDLE_Z) < 3)
                {
                    SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_SURGE);
                    if (spell)
                    {
                        for (uint8 i = 0; i < 3; ++i)
                        {
                            if (!spell->Effect[i])
                                continue;

                            if (Vashj)
                                Vashj->AddAura(new VashjSurgeAura(spell, i, NULL, Vashj, Vashj));
                        }
                    }
                    me->Kill(me);
                }
            }
            if (Vashj)
            {
                if (!Vashj->isInCombat() || CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead())
                {
                    //call Unsummon()
                    me->Kill(me);
                }
            }
            move = 1000;
        } else move -= diff;
    }
 void EnterCombat(Unit* who)
 {
     // Send Shaffar to fight
     Creature* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100);
     if (!Shaffar || Shaffar->isDead())
     {
         KillSelf();
         return;
     }
     if (!Shaffar->isInCombat())
         Shaffar->AI()->AttackStart(who);
 }
 void ChannelerEngaged(Unit* who)
 {
     if (who && !addYell)
     {
         addYell = true;
         DoScriptText(RAND(SAY_ADD_AGGRO_1,SAY_ADD_AGGRO_2,SAY_ADD_AGGRO_3), me);
     }
     for (uint8 i=0; i<5; ++i)
     {
         Creature *channeler = Unit::GetCreature(*me, Channelers[i]);
         if (who && channeler && !channeler->isInCombat())
             channeler->AI()->AttackStart(who);
     }
 }
        void UpdateAI(uint32 const diff)
        {
            if (!VorpilGUID)
            {
                me->Kill(me);
                return;
            }

            if (move <= diff)
            {
                Creature* Vorpil = Unit::GetCreature(*me, VorpilGUID);
                if (!Vorpil)
                {
                    VorpilGUID = 0;
                    return;
                }

                if (sacrificed)
                {
                    if (Vorpil->isAlive())
                    {
                        me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS, H_SPELL_EMPOWERING_SHADOWS), Vorpil);
                        Vorpil->ModifyHealth(int32(Vorpil->CountPctFromMaxHealth(4)));
                    }
                    DoCast(me, SPELL_SHADOW_NOVA, true);
                    me->Kill(me);
                    return;
                }

                me->GetMotionMaster()->MoveFollow(Vorpil, 0, 0);

                if (me->IsWithinDist(Vorpil, 3))
                {
                    DoCast(me, SPELL_SACRIFICE, false);
                    sacrificed = true;
                    move = 500;
                    return;
                }

                if (!Vorpil->isInCombat() || Vorpil->isDead())
                {
                    me->Kill(me);
                    return;
                }
                move = 1000;
            }
            else
                move -= diff;
        }
	void EnterCombat(Unit * who) {
		DoZoneInCombat();
		Creature *pOtherBoss = GetOtherBoss();
		if (pOtherBoss) {
			// TODO: we should activate the other boss location so he can start attackning even if nobody
			// is near I dont know how to do that
			ScriptedAI *otherAI = CAST_AI(ScriptedAI, pOtherBoss->AI());
			if (!pOtherBoss->isInCombat()) {
				DoPlaySoundToSet(me,
						IAmVeklor() ? SOUND_VL_AGGRO : SOUND_VN_AGGRO);
				otherAI->AttackStart(who);
				otherAI->DoZoneInCombat();
			}
		}
	}
 void WaypointReached(uint32 waypointId)
 {
     switch (waypointId)
     {
         case 0:
             Talk(EMOTE_WOLF_LIFT_HEAD);
             break;
         case 2:
             Talk(EMOTE_WOLF_HOWL);
             break;
         case 50:
             if (pRyga && pRyga->isAlive() && !pRyga->isInCombat())
                 pRyga->AI()->Talk(SAY_WOLF_WELCOME);
             break;
     }
 }
Example #20
0
    void Aggro(Unit* pWho)
    {

        DoScriptText(SAY_AGGRO, m_creature);
        if (m_pInstance)
        {
            m_pInstance->SetData(TYPE_FAERLINA, IN_PROGRESS);

            for (std::list<uint64>::iterator itr = m_pInstance->lFaelinasAdds.begin(); itr != m_pInstance->lFaelinasAdds.end(); ++itr)
            {
                Creature* pAdd = (Creature*)Unit::GetUnit(*m_creature, *itr);
                if (pAdd && !pAdd->isInCombat() && pAdd->AI())
                    pAdd->AI()->AttackStart(pWho);
            }
        }
    }
 void CallBuddiesToAttack(Unit* who)
 {
     for (int i=0; i<3; ++i)
     {
         Creature* c = Unit::GetCreature(*me, NearbyGUID[i]);
         if (c)
         {
             if (!c->isInCombat())
             {
                 c->SetNoCallAssistance(true);
                 if (c->AI())
                     c->AI()->AttackStart(who);
             }
         }
     }
 }
    void Aggro(Unit* pWho)
    {
        m_creature->SetInCombatWithZone();

        Creature *pOtherBoss = GetOtherBoss();
        if (pOtherBoss)
        {
            // TODO: we should activate the other boss location so he can start attackning even if nobody
            // is near I dont know how to do that
            if (!pOtherBoss->isInCombat())
            {
                DoPlaySoundToSet(m_creature, IAmVeklor() ? SOUND_VL_AGGRO : SOUND_VN_AGGRO);
                pOtherBoss->AI()->AttackStart(pWho);
            }
        }
    }
Example #23
0
    void Aggro(Unit* pWho)
    {
        Creature *pOtherBoss = GetOtherBoss();
        if (pOtherBoss)
        {
            // TODO: we should activate the other boss location so he can start attackning even if nobody
            // is near I dont know how to do that
            if (!pOtherBoss->isInCombat())
            {
                DoPlaySoundToSet(m_creature, IAmVeklor() ? SOUND_VL_AGGRO : SOUND_VN_AGGRO);
                pOtherBoss->AI()->AttackStart(pWho);
            }
        }

        if (m_pInstance)
            m_pInstance->SetData(TYPE_TWINS, IN_PROGRESS);
    }
void instance_ruins_of_ahnqiraj::CheckRajaxxWipe()
{
    m_uiWipeCheckTimer = 10000;
    bool stillAlive = false;

    Creature* pAndorov = GetSingleCreatureFromStorage(NPC_GENERAL_ANDOROV);

    if (pAndorov && pAndorov->isAlive())
        stillAlive = true;
    else
    {
        Map::PlayerList const &PlayerList = instance->GetPlayers();
        for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
        {
            if (Player* pPlayer = itr->getSource())
            {
                if (pPlayer && pPlayer->isAlive() && pPlayer->isTargetableForAttack())
                {
                    stillAlive = true;
                    break;
                }
            }
        }
    }

    if (!stillAlive)
    {
        SetData(TYPE_RAJAXX, FAIL);
        ResetRajaxx();
        return;
    }

    for (uint8 i = 0; i < m_uiCurrentArmyWave; ++i)
    {
        for (ObjectGuidSet::const_iterator itr = m_sArmyWavesGuids[i].begin(); itr != m_sArmyWavesGuids[i].end(); ++itr)
        {
            if (Creature* pTemp = instance->GetCreature(*itr))
            {
                if (pAndorov && pAndorov->isAlive() && !pAndorov->isInCombat())
                    pAndorov->AI()->AttackStart(pTemp);
                if (!pTemp->isInCombat())
                    pTemp->SetInCombatWithZone();
            }
        }
    }
}
Example #25
0
 void WaypointReached(uint32 uiPointId) override
 {
     switch (uiPointId)
     {
         case 0:
             DoScriptText(EMOTE_WOLF_LIFT_HEAD, m_creature);
             break;
         case 2:
             DoScriptText(EMOTE_WOLF_HOWL, m_creature);
             break;
         case 50:
             Creature* pRyga = GetClosestCreatureWithEntry(m_creature, NPC_RYGA, 30.0f);
             if (pRyga && pRyga->isAlive() && !pRyga->isInCombat())
                 DoScriptText(SAY_WOLF_WELCOME, pRyga);
             break;
     }
 }
Example #26
0
    void UpdateAI(const uint32 diff)
    {
        if(CheckTeronTimer < diff)
        {
            Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID));
            if(Teron && Teron->isInCombat())
            {
                DoZoneInCombat();

                Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID));
                if((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode()))
                    Despawn();

                float newX, newY, newZ;
                m_creature->GetRandomPoint(m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ(), 3.0, newX, newY, newZ);

                newZ = (newZ < 200.0) ? (newZ + 1.0) : newZ;
                m_creature->GetMotionMaster()->MovePoint(1, newX, newY, newZ);
                m_creature->SetSpeed(MOVE_RUN, 0.1);
            }
            else
                Despawn();

            CheckTeronTimer = 5000;
        }
        else
            CheckTeronTimer -= diff;

        if(ShadowBoltTimer < diff)
        {
            Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID));
            if(!Teron)
                return;

            if(Unit *target = ((ScriptedAI*)Teron->AI())->SelectUnit(SELECT_TARGET_RANDOM, 0, 200, true))
                DoCast(target, SPELL_SHADOWBOLT);

            ShadowBoltTimer = 1500+rand()%1000;
        }
        else
            ShadowBoltTimer -= diff;

        return;
    }
Example #27
0
    void EnterEvadeMode()
    {
        if (!me->isInCombat() || me->IsInEvadeMode())
            return;

        CreatureAI::EnterEvadeMode();

        // evade rest
        std::for_each(avVandarNpcIds, avVandarNpcIds + AV_VANDAR_NPC_COUNT,
                  [this] (uint32 a)->void
                  {
                        if (a == me->GetEntry())
                            return;

                        Creature * c = me->GetMap()->GetCreatureById(a);
                        if (c && c->isInCombat() && c->IsAIEnabled && c->AI())
                            c->AI()->EnterEvadeMode();
                  });
    }
 void ChannelerEngaged(Unit* who)
 {
     if (who && !addYell)
     {
         addYell = true;
         switch(rand()%3)
         {
             case 0: DoScriptText(SAY_ADD_AGGRO_1, me); break;
             case 1: DoScriptText(SAY_ADD_AGGRO_2, me); break;
             default: DoScriptText(SAY_ADD_AGGRO_3, me); break;
         }
     }
     for (int i=0; i<5; ++i)
     {
         Creature* channeler = Unit::GetCreature(*me, Channelers[i]);
         if (who && channeler && !channeler->isInCombat())
             channeler->AI()->AttackStart(who);
     }
 }
void instance_stratholme::DoMoveBackDefenders(uint8 uiStep, Creature* pCreature)
{
    uint8 uiIndex;
    uint8 uiTreshold = 0;
    uint8 uiFoundGuards = 0;

    switch (uiStep)
    {
        case BARRICADE:
            uiIndex = FIRST_BARRICADES;
            break;
        case STAIRS:
            uiIndex = BARRICADE;
            uiTreshold = 3;
            break;
        default:
            return;     // avoid indexing the following table with a wrong index. Should never happen.
    }

    // Check that there are still defenders to move to the stairs/last barricade
    if (m_suiCrimsonDefendersLowGuids[uiIndex].empty())
        return;
    if (pCreature)
        DoScriptText(ScarletEventYells[uiStep], pCreature);

    for (GuidList::const_iterator itr = m_suiCrimsonDefendersLowGuids[uiIndex].begin(); itr != m_suiCrimsonDefendersLowGuids[uiIndex].end(); ++itr)
    {
        Creature* pGuard = instance->GetCreature(*itr);
        if (pGuard && pGuard->isAlive() && !pGuard->isInCombat())
        {
            pGuard->GetMotionMaster()->MoveIdle();
            pGuard->SetWalk(false);
            pGuard->GetMotionMaster()->MovePoint(0, aScarletLastStand[uiTreshold + uiFoundGuards].m_fX, aScarletLastStand[uiTreshold + uiFoundGuards].m_fY, aScarletLastStand[uiTreshold + uiFoundGuards].m_fZ);
            uiFoundGuards++;
        }

        if (uiFoundGuards == 3)
            return;
    }

    return;
}
Example #30
0
    bool OnGossipHello (Player* player, GameObject* go)
    {
        InstanceScript* _instance = go->GetInstanceScript();
        if (!_instance)
            return true;

        Creature* Magtheridon = Unit::GetCreature(*go, _instance->GetData64(DATA_MAGTHERIDON));
        if (!Magtheridon || !Magtheridon->isAlive() || !Magtheridon->isInCombat())
            return true;

        // if exhausted or already channeling return
        if (player->HasAura(SPELL_MIND_EXHAUSTION) || player->FindCurrentSpellBySpellId(SPELL_SHADOW_GRASP_VISUAL))
            return true;

        player->InterruptNonMeleeSpells(false);
        player->AddAura(SPELL_SHADOW_GRASP, player);
        player->CastSpell(player, SPELL_SHADOW_GRASP_VISUAL, false);
        CAST_AI(boss_magtheridon::boss_magtheridonAI, Magtheridon->AI())->SetClicker(go->GetGUID(), player->GetGUID());
        return true;
    }