Example #1
0
 static bool HandleGoForwardCommand(ChatHandler* handler, char const* args)
 {
     if (!*args)
         return false;
 
     Player* player = handler->GetSession()->GetPlayer();
 
     uint32 mapId = player->GetMapId();
     float ori = player->GetOrientation();
     char* goDist = strtok((char*)args, " ");
 
     if (!goDist || !player)
         return false;
 
     float dist = (float)atof(goDist);
 
     float x, y;
 
     GetPositionWithDistInOrientation(player, dist, player->GetOrientation(), x, y);
 
     if (!MapManager::IsValidMapCoord(mapId, x, y))
     {
         handler->PSendSysMessage(LANG_INVALID_TARGET_COORD, x, y, mapId);
         handler->SetSentErrorMessage(true);
         return false;
     }
 
     player->TeleportTo(mapId, x, y, player->GetPositionZ(), ori);
     return true;
 }
            void Reset()
            {
                events.Reset();
                whirlwindProgress = 0;

                if (!jumpDone)
                {
                    float x, y;
                    GetPositionWithDistInOrientation(me, 30.0f, 4.23f, x, y);
                    me->GetMotionMaster()->MoveJump(x, y, me->GetMap()->GetHeight(x, y, me->GetPositionZ()), 20, 10, POINT_MINIBOSS_JUMP);
                    jumpDone = true;

                    if (me->GetEntry() == NPC_FLAGRANT_LOTUS)
                    {
                        events.ScheduleEvent(EVENT_BALL_OF_FIRE,    1000);
                        events.ScheduleEvent(EVENT_FLYING_KICK,     1000);
                        events.ScheduleEvent(EVENT_CALL_STAFF,      1000);
                        events.ScheduleEvent(EVENT_RELEASE_STAFF,   1000);
                    }
                    else
                    {
                        events.ScheduleEvent(EVENT_WHIRLING_STEEL_FOCUS,  1000);
                    }
                }
            }
        void Reset()
        {
            me->SetReactState(REACT_PASSIVE);
            orientation = 0.0f;
            checkTimer = 1000;

            switch (me->GetEntry())
            {
                case NPC_EXPLOSION_BUNNY_N_M:
                case NPC_EXPLOSION_BUNNY_N_P:
                    orientation = 0.0f;
                    break;
                case NPC_EXPLOSION_BUNNY_S_M:
                case NPC_EXPLOSION_BUNNY_S_P:
                    orientation = M_PI;
                    break;
                case NPC_EXPLOSION_BUNNY_E_M:
                case NPC_EXPLOSION_BUNNY_E_P:
                    orientation = 4.71f;
                    break;
                case NPC_EXPLOSION_BUNNY_W_M:
                case NPC_EXPLOSION_BUNNY_W_P:
                    orientation = 1.57f;
                    break;
            }

            float x = 0.0f;
            float y = 0.0f;
            GetPositionWithDistInOrientation(me, 40.0f, orientation, x, y);
            me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ());

            me->AddAura(SPELL_MUNITION_EXPLOSION_VISUAL, me);
        }
Example #4
0
        void Reset() override
        {
            me->SetReactState(REACT_PASSIVE);
            orientation = 0.0f;

            switch (me->GetEntry())
            {
                case NPC_EXPLOSION_BUNNY_N_M:
                case NPC_EXPLOSION_BUNNY_N_P:
                    orientation = 0.0f;
                    break;
                case NPC_EXPLOSION_BUNNY_S_M:
                case NPC_EXPLOSION_BUNNY_S_P:
                    orientation = M_PI;
                    break;
                case NPC_EXPLOSION_BUNNY_E_M:
                case NPC_EXPLOSION_BUNNY_E_P:
                    orientation = 4.71f;
                    break;
                case NPC_EXPLOSION_BUNNY_W_M:
                case NPC_EXPLOSION_BUNNY_W_P:
                    orientation = 1.57f;
                    break;
            }

            float x, y = 0.0f;
            GetPositionWithDistInOrientation(me, 40.0f, orientation, x, y);
            me->GetMotionMaster()->MovePoint(1, x, y, me->GetPositionZ());

            me->AddAura(SPELL_EXPLOSIOIN_AURA, me);
        }
            void Reset()
            {
                float x, y;
                GetPositionWithDistInOrientation(me, 100.0f, me->GetOrientation(), x, y);
                me->GetMotionMaster()->MovePoint(0, x, y, me->GetPositionZ());

                me->SetReactState(REACT_PASSIVE);
                me->setFaction(14);

                damageTimer = 500;
            }
 void Reset()
 {
     events.Reset();
     if (!jumpDone)
     {
         float x, y;
         GetPositionWithDistInOrientation(me, 40.0f, 4.0f, x, y);
         me->GetMotionMaster()->MoveJump(x, y, me->GetMap()->GetHeight(x, y, me->GetPositionZ()), 20, 10, POINT_NOVICE_JUMP);
         jumpDone = true;
     }
 }
            void DoAction(const int32 action)
            {
                switch (action)
                {
                    case ACTION_ENCOURAGE:
                    {
                        float x, y;
                        GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation(), x, y);
                        me->GetMotionMaster()->MovePoint(0, x, y, me->GetMap()->GetHeight(0, x, y, me->GetPositionZ()));

                        me->CastSpell(me, 120867, false);
                        events.ScheduleEvent(EVENT_APPLAUSE + urand(0, 1), 500 + urand(500, 1500));
                        break;
                    }
                    case ACTION_RETIRE:
                    {
                        float x, y;
                        GetPositionWithDistInOrientation(me, -5.0f, me->GetOrientation(), x, y);
                        me->GetMotionMaster()->MovePoint(1, x, y, me->GetMap()->GetHeight(0, x, y, me->GetPositionZ()));

                        me->RemoveAura(120867);
                        me->CastSpell(me, 121569, false);
                        events.Reset();
                        break;
                    }
                    case ACTION_ATTACK:
                    {
                        status = STATUS_ATTACK_GRUNTS;

                        float x, y;
                        GetPositionWithDistInOrientation(me, 30.0f, me->GetOrientation(), x, y);
                        me->GetMotionMaster()->MovePoint(0, x, y, me->GetMap()->GetHeight(0, x, y, me->GetPositionZ()));

                        me->RemoveAura(121569);

                        events.Reset();
                        break;
                    }
                }
            }
Example #8
0
        void Reset()
        {
            me->SetReactState(REACT_PASSIVE);
            me->AddAura(SPELL_FIST_BARRIER, me);
            me->AddAura(SPELL_FIST_VISUAL, me);

            float x = 0, y = 0;
            GetPositionWithDistInOrientation(me, 100.0f, me->GetOrientation(), x, y);

            me->GetMotionMaster()->MoveCharge(x, y, me->GetPositionZ(), 24.0f, 1);

            checkNearPlayerTimer = 500;
        }
        void Reset()
        {
            me->SetReactState(REACT_PASSIVE);
            orientation = 0.0f;

            switch (me->GetEntry())
            {
            case NPC_EXPLOSION_BUNNY_N_M:
            case NPC_EXPLOSION_BUNNY_N_P:
                orientation = 0.0f;
                break;
            case NPC_EXPLOSION_BUNNY_S_M:
            case NPC_EXPLOSION_BUNNY_S_P:
                orientation = M_PI;
                break;
            case NPC_EXPLOSION_BUNNY_E_M:
            case NPC_EXPLOSION_BUNNY_E_P:
                orientation = 4.71f;
                break;
            case NPC_EXPLOSION_BUNNY_W_M:
            case NPC_EXPLOSION_BUNNY_W_P:
                orientation = 1.57f;
                break;
            }

            std::list<Creature*> munitionList;
            me->GetCreatureListWithEntryInGrid(munitionList, NPC_STABLE_MUNITION, 2.0f);
            for(auto munition : munitionList)
            {
                if (munition->HasAura(SPELL_MUNITION_STABLE))
                {
                    munition->RemoveAurasDueToSpell(SPELL_MUNITION_STABLE);
                    munition->CastSpell(munition, SPELL_MUNITION_EXPLOSION, true);
                    munition->DespawnOrUnsummon(2 * IN_MILLISECONDS);
                }
            }
            events.ScheduleEvent(EVENT_CHECK, 0.5 * IN_MILLISECONDS);

            float x = 0.0f;
            float y = 0.0f;
            GetPositionWithDistInOrientation(me, 40.0f, orientation, x, y);
            Movement::MoveSplineInit init(me);
            init.MoveTo(x, y, me->GetPositionZ());
            init.SetVelocity(10.0f);
            init.Launch();

            me->DespawnOrUnsummon(me->GetSplineDuration());
            me->CastSpell(me, SPELL_MUNITION_EXPLOSION_AURA, false);
        }
        void UpdateAI(const uint32 diff)
        {
            _events.Update(diff);

            switch (_events.ExecuteEvent())
            {
                case EVENT_CHANGE_PLACE:
                {
                    uint8 newPlace = 0;

                    do
                    {
                        newPlace = urand(0, 3);
                    }
                    while (newPlace == actualPlace);

                    me->GetMotionMaster()->MoveJump(rocksPos[newPlace].GetPositionX(), rocksPos[newPlace].GetPositionY(), rocksPos[newPlace].GetPositionZ(), 10.0f, 10.0f, 1);
                    me->AddAura(SPELL_WATER_SPOUT_WARNING, me); // Just visual
                    actualPlace = newPlace;
                    break;
                }
                case EVENT_SUMMON_WATER_SPOUT:
                {
                    float x = 0.0f, y = 0.0f;
                    GetPositionWithDistInOrientation(me, 5.0f, me->GetOrientation() + frand(-M_PI, M_PI), x, y);
                    waterSpoutGUID = 0;

                    if (Creature* waterSpout = me->SummonCreature(60488, x, y, 92.189629f))
                        waterSpoutGUID = waterSpout->GetGUID();

                    _events.ScheduleEvent(EVENT_WATER_SPOUT_VISUAL, 500);
                    _events.ScheduleEvent(EVENT_WATER_SPOUT_EJECT, 7500);
                    break;
                }
                case EVENT_WATER_SPOUT_VISUAL:
                {
                    if (Creature* waterSpout = getWaterSpout())
                        waterSpout->CastSpell(waterSpout, SPELL_WATER_SPOUT_WARNING, true);
                    break;
                }
                case EVENT_WATER_SPOUT_EJECT:
                {
                    if (Creature* waterSpout = getWaterSpout())
                    {
                        std::list<Player*> playerList;
                        GetPlayerListInGrid(playerList, waterSpout, 1.0f);

                        for (auto player: playerList)
                            player->CastSpell(player, SPELL_WATER_SPOUT_EJECT, true);

                        waterSpout->CastSpell(waterSpout, SPELL_WATER_SPOUT_VISUAL, true);
                    }
                    _events.ScheduleEvent(EVENT_WATER_SPOUT_DESPAWN, 3000);
                    break;
                }
                case EVENT_WATER_SPOUT_DESPAWN:
                {
                    if (Creature* waterSpout = getWaterSpout())
                        waterSpout->DespawnOrUnsummon();

                    waterSpoutGUID = 0;

                    _events.ScheduleEvent(EVENT_CHANGE_PLACE, 2000);
                    break;
                }
            }
        }