Example #1
0
 void DoFinalSpawnForCreature(Creature* creature)
 {
     switch (creature->GetEntry())
     {
     case ENTRY_BNAAR_C_CONSOLE:
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2946.52f, 4201.42f, 163.47f, 3.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2927.49f, 4192.81f, 163.00f);
         break;
     case ENTRY_CORUU_C_CONSOLE:
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2453.88f, 2737.85f, 133.27f, 2.59f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2433.96f, 2751.53f, 133.85f);
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2441.62f, 2735.32f, 134.49f, 1.97f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2433.96f, 2751.53f, 133.85f);
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2450.73f, 2754.50f, 134.49f, 3.29f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2433.96f, 2751.53f, 133.85f);
         break;
     case ENTRY_DURO_C_CONSOLE:
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2956.18f, 2202.85f, 165.32f, 5.45f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2972.27f, 2193.22f, 164.48f);
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2975.30f, 2211.50f, 165.32f, 4.55f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2972.27f, 2193.22f, 164.48f);
         add = me->SummonCreature(ENTRY_SUNFURY_PROT, 2965.02f, 2217.45f, 164.16f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2972.27f, 2193.22f, 164.48f);
         break;
     case ENTRY_ARA_C_CONSOLE:
         add = me->SummonCreature(ENTRY_ARA_ENGI, 3994.51f, 4020.46f, 192.18f, 0.91f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 4008.35f, 4035.04f, 192.70f);
         add = me->SummonCreature(ENTRY_ARA_GORKLONN, 4021.56f, 4059.35f, 193.59f, 4.44f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 4016.62f, 4039.89f, 193.46f);
         break;
     }
 }
void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
{
    CHECK_PACKET_SIZE(recv_data,8);

    uint64 guid;
    recv_data >> guid;

    sLog.outDebug ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));

    Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
    if (!pCreature)
    {
        sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.",
                       GUID_LOPART(guid));
        return;
    }

    // remove fake death
    if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
        GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);

    // Stop the npc if moving
    pCreature->SendMonsterStop();
    pCreature->StopMoving();
    pCreature->m_movementInfo.RemoveMovementFlag(MOVEFLAG_MOVING);
    pCreature->GetMotionMaster()->MoveDistract(20000);

    if (sScriptMgr.OnGossipHello(_player, pCreature))
        return;

    pCreature->prepareGossipMenu(_player);
    pCreature->sendPreparedGossip(_player);
}
bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
{
    if (!i_path || i_path->empty())
        return false;
    if (Stopped())
        return true;

    if (m_isArrivalDone)
    {
        if ((i_currentNode == i_path->size() - 1) && !repeating) // If that's our last waypoint
        {
            creature.SetHomePosition(i_path->at(i_currentNode)->x, i_path->at(i_currentNode)->y, i_path->at(i_currentNode)->z, creature.GetOrientation());
            creature.GetMotionMaster()->Initialize();
            return false;
        }

        i_currentNode = (i_currentNode+1) % i_path->size();
    }

    WaypointData const* node = i_path->at(i_currentNode);

    m_isArrivalDone = false;

    creature.AddUnitState(UNIT_STATE_ROAMING_MOVE);

    Movement::MoveSplineInit init(creature);
    init.MoveTo(node->x, node->y, node->z);

    //! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table
    if (node->orientation && node->delay)
        init.SetFacing(node->orientation);

    init.SetWalk(!node->run);
    init.Launch();

    //Call for creature group update
    if (creature.GetFormation() && creature.GetFormation()->getLeader() == &creature)
        creature.GetFormation()->LeaderMoveTo(node->x, node->y, node->z);

    return true;
}
Example #4
0
 void JustDied(Unit* /*killer*/)
 {
     if (ScriptedInstance* instance = me->GetInstanceScript())
     {
         Creature* Selin = (Unit::GetCreature(*me, instance->GetData64(DATA_SELIN)));
         if (Selin && Selin->isAlive())
         {
             if (CAST_AI(boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID())
             {
                 // Set this to false if we are the Creature that Selin is draining so his AI flows properly
                 CAST_AI(boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false;
                 CAST_AI(boss_selin_fireheartAI, Selin->AI())->IsDraining = false;
                 CAST_AI(boss_selin_fireheartAI, Selin->AI())->EmpowerTimer = 10000;
                 if (Selin->getVictim())
                 {
                     Selin->AI()->AttackStart(Selin->getVictim());
                     Selin->GetMotionMaster()->MoveChase(Selin->getVictim());
                 }
             }
         }
     } else sLog->outError(ERROR_INST_DATA);
 }
        void UpdateAI(uint32 const Diff)
        {
            if (!UpdateVictim())
                return;

            // Transformation on 66% and 33% of health
            if ((me->GetHealthPct() < 66.0f && !TransformationCounter && me->GetHealthPct() > 33.0f) || (me->GetHealthPct() < 33.0f && TransformationCounter))
            {
                TransformationCounter = !TransformationCounter;

                std::list<Creature*> shadowsList;
                GetCreatureListWithEntryInGrid(shadowsList, me, NPC_SHADOW_OF_OBSIDIUS, 60.0f);
                if (shadowsList.empty())
                    return;

                std::list<Creature*>::iterator current = shadowsList.begin();
                std::advance(current, urand(0, shadowsList.size() - 1));
                Creature * toTransform = *current;

                Position Pos;
                toTransform->GetPosition(&Pos);

                toTransform->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                me->NearTeleportTo(Pos.GetPositionX(), Pos.GetPositionY(), Pos.GetPositionZ(), Pos.GetOrientation());

                // Needed to prevent continual visual movement on the stun
                toTransform->GetMotionMaster()->MoveIdle();
                me->GetMotionMaster()->MoveIdle();

                me->CastSpell(toTransform, SPELL_TRANSFORMATION_1, true);
                me->CastSpell(toTransform, SPELL_TRANSFORMATION_3, true);
                me->CastSpell(toTransform, SPELL_TRANSFORMATION_2, true);

                // Return to chase movement
                me->GetMotionMaster()->MoveChase(me->GetVictim());
                toTransform->GetMotionMaster()->MoveChase(me->GetVictim());

                Talk(SAY_TRANSFORM);
            }

            if (StoneBlowTimer <= Diff)
            {
                if (me->IsNonMeleeSpellCasted(false))
                    return;

                DoCastVictim(SPELL_STONE_BLOW);

                StoneBlowTimer = urand(20000, 25000);
            }
            else
                StoneBlowTimer -= Diff;

            if (TwilightCorruptionTimer <= Diff)
            {
                if (me->IsNonMeleeSpellCasted(false))
                    return;

                if (Unit * pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true))
                    me->CastSpell(pTarget, SPELL_TWILIGHT_CORRUPTION, false);

                TwilightCorruptionTimer = urand(20000, 25000);
            }
            else
                TwilightCorruptionTimer -= Diff;

            if (IsHeroic())
            {
                if (ThunderclapTimer <= Diff)
                {
                    if (me->IsNonMeleeSpellCasted(false))
                        return;

                    me->CastSpell(me, SPELL_THUNDERCLAP, false);

                    ThunderclapTimer = urand(20000, 25000);
                }
                else
                    ThunderclapTimer -= Diff;
            }

            DoMeleeAttackIfReady();
        }
Example #6
0
        void UpdateAI(const uint32 diff)
        {
            if (_phase != PHASE_OUTRO)
                return;

            _events.Update(diff);

            while (uint32 eventId = _events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_OUTRO_1:
                {
                    if (Creature* temp = me->GetCreature(*me, _instanceScript->GetData64(DATA_JAINA_SYLVANAS_1)))
                        temp->DespawnOrUnsummon();

                    Creature* jainaOrSylvanas = NULL;
                    if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
                        jainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1, outroPos[2], TEMPSUMMON_MANUAL_DESPAWN);
                    else
                        jainaOrSylvanas = me->SummonCreature(NPC_SYLVANAS_PART1, outroPos[2], TEMPSUMMON_MANUAL_DESPAWN);

                    if (jainaOrSylvanas)
                    {
                        jainaOrSylvanas->GetMotionMaster()->MovePoint(0, outroPos[3]);
                        _outroNpcGUID = jainaOrSylvanas->GetGUID();
                    }
                    _events.ScheduleEvent(EVENT_OUTRO_2, 6000);
                    break;
                }
                case EVENT_OUTRO_2:
                    if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _outroNpcGUID))
                    {
                        jainaOrSylvanas->SetFacingToObject(me);
                        me->SetFacingToObject(jainaOrSylvanas);
                        if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
                            jainaOrSylvanas->AI()->Talk(SAY_JAYNA_OUTRO_2);
                        else
                            jainaOrSylvanas->AI()->Talk(SAY_SYLVANAS_OUTRO_2);
                    }
                    _events.ScheduleEvent(EVENT_OUTRO_3, 5000);
                    break;
                case EVENT_OUTRO_3:
                    Talk(SAY_KRICK_OUTRO_3);
                    _events.ScheduleEvent(EVENT_OUTRO_4, 18000);
                    break;
                case EVENT_OUTRO_4:
                    if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _outroNpcGUID))
                    {
                        if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
                            jainaOrSylvanas->AI()->Talk(SAY_JAYNA_OUTRO_4);
                        else
                            jainaOrSylvanas->AI()->Talk(SAY_SYLVANAS_OUTRO_4);
                    }
                    _events.ScheduleEvent(EVENT_OUTRO_5, 5000);
                    break;
                case EVENT_OUTRO_5:
                    Talk(SAY_KRICK_OUTRO_5);
                    _events.ScheduleEvent(EVENT_OUTRO_6, 1000);
                    break;
                case EVENT_OUTRO_6:
                    if (Creature* tyrannus = me->GetCreature(*me, _instanceScript->GetData64(DATA_TYRANNUS_EVENT)))
                    {
                        tyrannus->SetSpeed(MOVE_FLIGHT, 3.5f, true);
                        tyrannus->GetMotionMaster()->MovePoint(1, outroPos[4]);
                        _tyrannusGUID = tyrannus->GetGUID();
                    }
                    _events.ScheduleEvent(EVENT_OUTRO_7, 5000);
                    break;
                case EVENT_OUTRO_7:
                    if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
                        tyrannus->AI()->Talk(SAY_TYRANNUS_OUTRO_7);
                    _events.ScheduleEvent(EVENT_OUTRO_8, 5000);
                    break;
                case EVENT_OUTRO_8:
                    //! HACK: Creature's can't have MOVEMENTFLAG_FLYING
                    me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
                    me->GetMotionMaster()->MovePoint(0, outroPos[5]);
                    DoCast(me, SPELL_STRANGULATING);
                    _events.ScheduleEvent(EVENT_OUTRO_9, 2000);
                    break;
                case EVENT_OUTRO_9:
                    Talk(SAY_KRICK_OUTRO_8);
                    // TODO: Tyrannus starts killing Krick.
                    // there shall be some visual spell effect
                    if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
                        tyrannus->CastSpell(me, SPELL_NECROMANTIC_POWER, true);  //not sure if it's the right spell :/
                    _events.ScheduleEvent(EVENT_OUTRO_10, 1000);
                    break;
                case EVENT_OUTRO_10:
                    //! HACK: Creature's can't have MOVEMENTFLAG_FLYING
                    me->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING);
                    me->AddUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR);
                    me->GetMotionMaster()->MovePoint(0, outroPos[6]);
                    _events.ScheduleEvent(EVENT_OUTRO_11, 2000);
                    break;
                case EVENT_OUTRO_11:
                    DoCast(me, SPELL_KRICK_KILL_CREDIT); // don't really know if we need it
                    me->SetStandState(UNIT_STAND_STATE_DEAD);
                    me->SetHealth(0);
                    _events.ScheduleEvent(EVENT_OUTRO_12, 3000);
                    break;
                case EVENT_OUTRO_12:
                    if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
                        tyrannus->AI()->Talk(SAY_TYRANNUS_OUTRO_9);
                    _events.ScheduleEvent(EVENT_OUTRO_13, 2000);
                    break;
                case EVENT_OUTRO_13:
                    if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _outroNpcGUID))
                    {
                        if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
                            jainaOrSylvanas->AI()->Talk(SAY_JAYNA_OUTRO_10);
                        else
                            jainaOrSylvanas->AI()->Talk(SAY_SYLVANAS_OUTRO_10);
                    }
                    // End of OUTRO. for now...
                    _events.ScheduleEvent(EVENT_OUTRO_END, 3000);
                    if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
                        tyrannus->GetMotionMaster()->MovePoint(0, outroPos[7]);
                    break;
                case EVENT_OUTRO_END:
                    if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
                        tyrannus->DespawnOrUnsummon();

                    me->DisappearAndDie();
                    break;
                default:
                    break;
                }
            }
        }
Example #7
0
 void DoWaveSpawnForCreature(Creature* creature)
 {
     switch (creature->GetEntry())
     {
     case ENTRY_BNAAR_C_CONSOLE:
         if (rand()%2)
         {
             add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2933.68f, 4162.55f, 164.00f, 1.60f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 2927.36f, 4212.97f, 164.00f);
         }
         else
         {
             add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2927.36f, 4212.97f, 164.00f, 4.94f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 2933.68f, 4162.55f, 164.00f);
         }
         Wave_Timer = 30000;
         break;
     case ENTRY_CORUU_C_CONSOLE:
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2445.21f, 2765.26f, 134.49f, 3.93f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2424.21f, 2740.15f, 133.81f);
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2429.86f, 2731.85f, 134.53f, 1.31f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2435.37f, 2766.04f, 133.81f);
         Wave_Timer = 20000;
         break;
     case ENTRY_DURO_C_CONSOLE:
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2986.80f, 2205.36f, 165.37f, 3.74f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2985.15f, 2197.32f, 164.79f);
         add = me->SummonCreature(ENTRY_SUNFURY_TECH, 2952.91f, 2191.20f, 165.32f, 0.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
         if (add) add->GetMotionMaster()->MovePoint(0, 2060.01f, 2185.27f, 164.67f);
         Wave_Timer = 15000;
         break;
     case ENTRY_ARA_C_CONSOLE:
         if (rand()%2)
         {
             add = me->SummonCreature(ENTRY_ARA_TECH, 4035.11f, 4038.97f, 194.27f, 2.57f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 4003.42f, 4040.19f, 193.49f);
             add = me->SummonCreature(ENTRY_ARA_TECH, 4033.66f, 4036.79f, 194.28f, 2.57f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 4003.42f, 4040.19f, 193.49f);
             add = me->SummonCreature(ENTRY_ARA_TECH, 4037.13f, 4037.30f, 194.23f, 2.57f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 4003.42f, 4040.19f, 193.49f);
         }
         else
         {
             add = me->SummonCreature(ENTRY_ARA_TECH, 3099.59f, 4049.30f, 194.22f, 0.05f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 4028.01f, 4035.17f, 193.59f);
             add = me->SummonCreature(ENTRY_ARA_TECH, 3999.72f, 4046.75f, 194.22f, 0.05f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 4028.01f, 4035.17f, 193.59f);
             add = me->SummonCreature(ENTRY_ARA_TECH, 3996.81f, 4048.26f, 194.22f, 0.05f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
             if (add) add->GetMotionMaster()->MovePoint(0, 4028.01f, 4035.17f, 193.59f);
         }
         Wave_Timer = 15000;
         break;
     }
 }