Exemplo n.º 1
0
    void SetFaint()
    {
        if (!HasFollowState(STATE_FOLLOW_POSTEVENT))
        {
            SetFollowPaused(true);

            switch(urand(0, 3))
            {
            case 0:
                DoScriptText(SAY_FAINT_1, m_creature);
                break;
            case 1:
                DoScriptText(SAY_FAINT_2, m_creature);
                break;
            case 2:
                DoScriptText(SAY_FAINT_3, m_creature);
                break;
            case 3:
                DoScriptText(SAY_FAINT_4, m_creature);
                break;
            }
        }

        //what does actually happen here? Emote? Aura?
        m_creature->SetStandState(UNIT_STAND_STATE_SLEEP);
    }
Exemplo n.º 2
0
    void ClearFaint()
    {
        m_creature->SetStandState(UNIT_STAND_STATE_STAND);

        if (HasFollowState(STATE_FOLLOW_POSTEVENT))
            return;

        switch(urand(0, 3))
        {
        case 0:
            DoScriptText(SAY_WAKE_1, m_creature);
            break;
        case 1:
            DoScriptText(SAY_WAKE_2, m_creature);
            break;
        case 2:
            DoScriptText(SAY_WAKE_3, m_creature);
            break;
        case 3:
            DoScriptText(SAY_WAKE_4, m_creature);
            break;
        }

        SetFollowPaused(false);
    }
Exemplo n.º 3
0
void FollowerAI::MovementInform(uint32 uiMotionType, uint32 uiPointId)
{
    if (uiMotionType != POINT_MOTION_TYPE || !HasFollowState(STATE_FOLLOW_INPROGRESS))
        return;

    if (uiPointId == POINT_COMBAT_START)
    {
        if (GetLeaderForFollower())
        {
            if (!HasFollowState(STATE_FOLLOW_PAUSED))
                AddFollowState(STATE_FOLLOW_RETURNING);
        }
        else
        {
            // Ustaag <Nostalrius> : vilain fix des mobs qui voulaient pas respawn à leur point de spawn
            SetFollowPaused(false);
            float x = 0.0f;
            float y = 0.0f;
            float z = 0.0f;
            float o = 0.0f;
            m_creature->GetHomePosition(x, y, z, o);
            m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
            m_creature->NearTeleportTo(x, y, z, o);
            m_creature->ForcedDespawn();
        }
    }
}
Exemplo n.º 4
0
    void UpdateFollowerAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            if (m_uiWanderTimer)
            {
                if (m_uiWanderTimer <= uiDiff)
                {
                    // set follow paused and wander in a random point
                    SetFollowPaused(true);
                    DoScriptText(EMOTE_WANDER, m_creature);
                    m_uiWanderTimer = 0;

                    switch (urand(0, 3))
                    {
                        case 0: DoScriptText(SAY_WANDER_1, m_creature); break;
                        case 1: DoScriptText(SAY_WANDER_2, m_creature); break;
                        case 2: DoScriptText(SAY_WANDER_3, m_creature); break;
                        case 3: DoScriptText(SAY_WANDER_4, m_creature); break;
                    }

                    float fX, fY, fZ;
                    m_creature->GetNearPoint(m_creature, fX, fY, fZ, 0, frand(25.0f, 40.0f), frand(0, 2 * M_PI_F));
                    m_creature->GetMotionMaster()->MoveRandomAroundPoint(fX, fY, fZ, 20.0f);
                }
                else
                    m_uiWanderTimer -= uiDiff;
            }

            return;
        }

        DoMeleeAttackIfReady();
    }
Exemplo n.º 5
0
		void ClearSleeping() {
			me->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL);
			me->SetStandState(UNIT_STAND_STATE_STAND);

			DoScriptText(EMOTE_KER_AWAKEN, me);

			SetFollowPaused(false);
		}
Exemplo n.º 6
0
        void ClearFaint()
        {
            me->SetStandState(UNIT_STAND_STATE_STAND);

            if (HasFollowState(STATE_FOLLOW_POSTEVENT))
                return;

            DoScriptText(RAND(SAY_WAKE_1, SAY_WAKE_2, SAY_WAKE_3, SAY_WAKE_4), me);

            SetFollowPaused(false);
        }
Exemplo n.º 7
0
        void SetSleeping()
        {
            SetFollowPaused(true);

            DoScriptText(RAND(EMOTE_KER_SLEEP_1, EMOTE_KER_SLEEP_2, EMOTE_KER_SLEEP_3), me);

            DoScriptText(RAND(SAY_KER_SLEEP_1, SAY_KER_SLEEP_2, SAY_KER_SLEEP_3, SAY_KER_SLEEP_4), me);

            me->SetStandState(UNIT_STAND_STATE_SLEEP);
            DoCast(me, SPELL_SLEEP_VISUAL, false);
        }
Exemplo n.º 8
0
        void SetSleeping()
        {
            SetFollowPaused(true);

            Talk(EMOTE_KER_SLEEP);

            Talk(SAY_KER_SLEEP);

            me->SetStandState(UNIT_STAND_STATE_SLEEP);
            DoCast(me, SPELL_SLEEP_VISUAL, false);
        }
Exemplo n.º 9
0
        void ClearFaint()
        {
            me->SetStandState(UNIT_STAND_STATE_STAND);

            if (HasFollowState(STATE_FOLLOW_POSTEVENT))
                return;

            Talk(SAY_WAKE);

            SetFollowPaused(false);
        }
Exemplo n.º 10
0
        void SetFaint()
        {
            if (!HasFollowState(STATE_FOLLOW_POSTEVENT))
            {
                SetFollowPaused(true);

                DoScriptText(RAND(SAY_FAINT_1, SAY_FAINT_2, SAY_FAINT_3, SAY_FAINT_4), me);
            }

            //what does actually happen here? Emote? Aura?
            me->SetStandState(UNIT_STAND_STATE_SLEEP);
        }
Exemplo n.º 11
0
        void SetFaint()
        {
            if (!HasFollowState(STATE_FOLLOW_POSTEVENT))
            {
                SetFollowPaused(true);

                Talk(SAY_FAINT);
            }

            //what does actually happen here? Emote? Aura?
            me->SetStandState(UNIT_STAND_STATE_SLEEP);
        }
Exemplo n.º 12
0
 void ReceiveAIEvent(AIEventType eventType, Creature* /*pSender*/, Unit* pInvoker, uint32 uiMiscValue) override
 {
     // start following
     if (eventType == AI_EVENT_START_EVENT && pInvoker->GetTypeId() == TYPEID_PLAYER)
     {
         StartFollow((Player*)pInvoker, 0, GetQuestTemplateStore(uiMiscValue));
         m_uiWanderTimer = 30000;
     }
     else if (eventType == AI_EVENT_CUSTOM_A)
     {
         // resume following
         m_bIsRecalled = true;
         SetFollowPaused(false);
     }
 }
Exemplo n.º 13
0
    npc_kittenAI(Creature* pCreature) : FollowerAI(pCreature)
    {
        if (pCreature->GetOwner() && pCreature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
        {
            StartFollow((Player*)pCreature->GetOwner());
            SetFollowPaused(true);
            DoScriptText(EMOTE_SAB_JUMP, m_creature);

            pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

            // find a decent way to move to center of moonwell
        }

        m_uiMoonwellCooldown = 7500;
        Reset();
    }
Exemplo n.º 14
0
    void UpdateFollowerAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            if (HasFollowState(STATE_FOLLOW_PAUSED))
            {
                if (m_uiMoonwellCooldown < uiDiff)
                {
                    m_creature->CastSpell(m_creature, SPELL_CORRUPT_SABER_VISUAL, false);
                    SetFollowPaused(false);
                }
                else
                    m_uiMoonwellCooldown -= uiDiff;
            }

            return;
        }

        DoMeleeAttackIfReady();
    }
Exemplo n.º 15
0
    void SetSleeping()
    {
        SetFollowPaused(true);

        switch (urand(0, 2))
        {
            case 0: DoScriptText(EMOTE_KER_SLEEP_1, m_creature); break;
            case 1: DoScriptText(EMOTE_KER_SLEEP_2, m_creature); break;
            case 2: DoScriptText(EMOTE_KER_SLEEP_3, m_creature); break;
        }

        switch (urand(0, 3))
        {
            case 0: DoScriptText(SAY_KER_SLEEP_1, m_creature); break;
            case 1: DoScriptText(SAY_KER_SLEEP_2, m_creature); break;
            case 2: DoScriptText(SAY_KER_SLEEP_3, m_creature); break;
            case 3: DoScriptText(SAY_KER_SLEEP_4, m_creature); break;
        }

        m_creature->SetStandState(UNIT_STAND_STATE_SLEEP);
        m_creature->CastSpell(m_creature, SPELL_SLEEP_VISUAL, false);
    }
Exemplo n.º 16
0
void FollowerAI::UpdateAI(const uint32 uiDiff)
{
    if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !m_creature->getVictim())
    {
        if (m_uiUpdateFollowTimer < uiDiff)
        {
            if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
            {
                sLog.outDebug("FollowerAI is set completed, despawns.");
                m_creature->DisappearAndDie();
                return;
            }

            bool bIsMaxRangeExceeded = true;

            if (Player* pPlayer = GetLeaderForFollower())
            {
                if (HasFollowState(STATE_FOLLOW_RETURNING))
                {
                    sLog.outDebug("FollowerAI is returning to leader.");

                    RemoveFollowState(STATE_FOLLOW_RETURNING);
                    m_creature->GetMotionMaster()->MoveFollow(pPlayer, m_uiFollowDistance, PET_FOLLOW_ANGLE);
                    return;
                }

                if (Group* pGroup = pPlayer->GetGroup())
                {
                    for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != nullptr; pRef = pRef->next())
                    {
                        Player* pMember = pRef->getSource();

                        if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
                        {
                            bIsMaxRangeExceeded = false;
                            break;
                        }
                    }
                }
                else
                {
                    if (m_creature->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE))
                        bIsMaxRangeExceeded = false;
                }

                // allow postEvent to happen even if quest credit is already handled
                /*if (HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT))
                    bIsMaxRangeExceeded = false;*/
            }

            if (bIsMaxRangeExceeded)
            {
                sLog.outDebug("FollowerAI failed because player/group was to far away or not found");
                SetFollowPaused(false);
                m_creature->DisappearAndDie();
                return;
            }

            m_uiUpdateFollowTimer = 300;
        }
        else
            m_uiUpdateFollowTimer -= uiDiff;
    }

    UpdateFollowerAI(uiDiff);
}