Exemplo n.º 1
0
void SmartAI::UpdateAI(uint32 diff)
{
    GetScript()->OnUpdate(diff);
    UpdatePath(diff);
    UpdateDespawn(diff);

    /// @todo move to void
    if (mFollowGuid)
    {
        if (mFollowArrivedTimer < diff)
        {
            if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true))
            {
                StopFollow();
                return;
            }

            mFollowArrivedTimer = 1000;
        }
        else
            mFollowArrivedTimer -= diff;
    }

    if (!UpdateVictim())
        return;

    if (mCanAutoAttack)
        DoMeleeAttackIfReady();
}
Exemplo n.º 2
0
void SmartAI::UpdateAI(const uint32 diff)
{
    GetScript()->OnUpdate(diff);
    UpdatePath(diff);
    UpdateDespawn(diff);

    //TODO move to void
    if (mFollowGuid)
    {
        if (mFollowArrivedTimer < diff)
        {
            if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true))
            {
                if (Player* player = me->GetPlayer(*me, mFollowGuid))
                {
                    if (!mFollowCreditType)
                        player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
                    else
                        player->GroupEventHappens(mFollowCredit, me);
                }
                mFollowGuid = 0;
                mFollowDist = 0;
                mFollowAngle = 0;
                mFollowCredit = 0;
                mFollowArrivedTimer = 1000;
                mFollowArrivedEntry = 0;
                mFollowCreditType = 0;
                SetDespawnTime(5000);
                me->StopMoving();
                me->GetMotionMaster()->MoveIdle();
                StartDespawn();
                GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED);
                return;
            }
            mFollowArrivedTimer = 1000;
        }
        else
            mFollowArrivedTimer -= diff;
    }

    if (!UpdateVictim())
        return;

    if (mCanAutoAttack)
        DoMeleeAttackIfReady();
}
Exemplo n.º 3
0
void SmartAI::UpdateAI(uint32 diff)
{
    CheckConditions(diff);

    GetScript()->OnUpdate(diff);

    UpdatePath(diff);
    UpdateFollow(diff);
    UpdateDespawn(diff);

    if (!IsAIControlled())
        return;

    if (!UpdateVictim())
        return;

    if (mCanAutoAttack)
        DoMeleeAttackIfReady();
}