当前位置: 首页>>代码示例>>C++>>正文


C++ RemoveEscortState函数代码示例

本文整理汇总了C++中RemoveEscortState函数的典型用法代码示例。如果您正苦于以下问题:C++ RemoveEscortState函数的具体用法?C++ RemoveEscortState怎么用?C++ RemoveEscortState使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RemoveEscortState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetScript

void SmartAI::EndPath(bool fail)
{
    GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mLastWP->id, GetScript()->GetPathId());

    RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
    mWayPoints = NULL;
    mCurrentWPID = 0;
    mWPPauseTimer = 0;
    mLastWP = NULL;
    
    if (mCanRepeatPath)
        StartPath(mRun, GetScript()->GetPathId(), mCanRepeatPath);
    else
        GetScript()->SetPathId(0);


    ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
    if (targets && mEscortQuestID)
    {
        if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
        {
            Player* plr = (*targets->begin())->ToPlayer();
            if(!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
                plr->GroupEventHappens(mEscortQuestID, me);

            if(fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                plr->FailQuest(mEscortQuestID);

            if (Group *pGroup = plr->GetGroup())
            {
                for (GroupReference *gr = pGroup->GetFirstMember(); gr != NULL; gr = gr->next())
                {
                    Player *pGroupGuy = gr->getSource();

                    if(!fail && pGroupGuy->IsAtGroupRewardDistance(me) && !pGroupGuy->GetCorpse())
                        pGroupGuy->AreaExploredOrEventHappens(mEscortQuestID);
                    if(fail && pGroupGuy->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                        pGroupGuy->FailQuest(mEscortQuestID);
                }
            }
        }else
        {
            for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); iter++)
            {
                if (GetScript()->IsPlayer((*iter)))
                {
                    Player* plr = (*iter)->ToPlayer();
                    if(!fail && plr->IsAtGroupRewardDistance(me) && !plr->GetCorpse())
                        plr->AreaExploredOrEventHappens(mEscortQuestID);
                    if(fail && plr->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
                        plr->FailQuest(mEscortQuestID);
                }
            }
        }
    }
    if (mDespawnState == 1)
        StartDespawn();
}
开发者ID:ice74,项目名称:blizzwow,代码行数:58,代码来源:SmartAI.cpp

示例2: AddEscortState

void npc_escortAI::SetEscortPaused(bool bPaused) {
    if (!HasEscortState(STATE_ESCORT_ESCORTING))
        return;

    if (bPaused)
        AddEscortState(STATE_ESCORT_PAUSED);
    else
        RemoveEscortState(STATE_ESCORT_PAUSED);
}
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:9,代码来源:ScriptedEscortAI.cpp

示例3: debug_log

void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
{
    if (uiMoveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING))
    {
        return;
    }

    // Combat start position reached, continue waypoint movement
    if (uiPointId == POINT_LAST_POINT)
    {
        debug_log("SD2: EscortAI has returned to original position before combat");

        m_creature->SetWalk(!m_bIsRunning);
        RemoveEscortState(STATE_ESCORT_RETURNING);
    }
    else if (uiPointId == POINT_HOME)
    {
        debug_log("SD2: EscortAI has returned to original home location and will continue from beginning of waypoint list.");

        CurrentWP = WaypointList.begin();
        m_uiWPWaitTimer = 0;
    }
    else
    {
        // Make sure that we are still on the right waypoint
        if (CurrentWP->uiId != uiPointId)
        {
            script_error_log("EscortAI for Npc %u reached waypoint out of order %u, expected %u.", m_creature->GetEntry(), uiPointId, CurrentWP->uiId);
            return;
        }

        debug_log("SD2: EscortAI waypoint %u reached.", CurrentWP->uiId);

        // In case we were moving while in combat, we should evade back to this position
        m_creature->SetCombatStartPosition(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());

        // Call WP function
        WaypointReached(CurrentWP->uiId);

        m_uiWPWaitTimer = CurrentWP->uiWaitTime;

        ++CurrentWP;
    }

    if (!m_uiWPWaitTimer)
    {
        // Continue WP Movement if Can
        if (HasEscortState(STATE_ESCORT_ESCORTING) && !HasEscortState(STATE_ESCORT_PAUSED | STATE_ESCORT_RETURNING) && !m_creature->getVictim())
        {
            MoveToNextWaypoint();
        }
        else
        {
            m_uiWPWaitTimer = 1;
        }
    }
}
开发者ID:muscnx,项目名称:Mangos021SD2,代码行数:57,代码来源:escort_ai.cpp

示例4: GetScript

void SmartAI::ResumePath()
{
    GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, NULL, mCurrentWPID, GetScript()->GetPathId());
    RemoveEscortState(SMART_ESCORT_PAUSED);
    mForcedPaused = false;
    mWPReached = false;
    mWPPauseTimer = 0;
    SetRun(mRun);

    if (WaypointMovementGenerator<Creature>* move = dynamic_cast<WaypointMovementGenerator<Creature>*>(me->GetMotionMaster()->top()))
        move->GetTrackerTimer().Reset(1);
}
开发者ID:Carbenium,项目名称:TrinityCore,代码行数:12,代码来源:SmartAI.cpp

示例5: StopPath

void SmartAI::UpdatePath(const uint32 diff)
{
    if (!HasEscortState(SMART_ESCORT_ESCORTING))
        return;

    if (mEscortInvokerCheckTimer < diff)
    {
        if (!IsEscortInvokerInRange())
        {
            StopPath(0, mEscortQuestID, true);

            // allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
            GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
            me->DespawnOrUnsummon(1);
            return;
        }
        mEscortInvokerCheckTimer = 1000;
    }
    else
        mEscortInvokerCheckTimer -= diff;

    // handle pause
    if (HasEscortState(SMART_ESCORT_PAUSED))
    {
        if (mWPPauseTimer <= diff)
        {
            if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mForcedPaused))
            {
                ResumePath();
            }
        }
        else
            mWPPauseTimer -= diff;
    }
    else if (m_Ended) // end path
    {
        m_Ended = false;
        StopPath();
        return;
    }

    if (HasEscortState(SMART_ESCORT_RETURNING))
    {
        if (mOOCReached)//reached OOC WP
        {
            mOOCReached = false;
            RemoveEscortState(SMART_ESCORT_RETURNING);
            if (!HasEscortState(SMART_ESCORT_PAUSED))
                ResumePath();
        }
    }
}
开发者ID:Carbenium,项目名称:TrinityCore,代码行数:52,代码来源:SmartAI.cpp

示例6: if

void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
{
    if(moveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING))
        return;

    //Combat start position reached, continue waypoint movement
    if(pointId == POINT_LAST_POINT)
    {
        sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat");

        if(m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
            me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
        else if(!m_bIsRunning && !me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
            me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);

        RemoveEscortState(STATE_ESCORT_RETURNING);

        if(!m_uiWPWaitTimer)
            m_uiWPWaitTimer = 1;
    }
    else if(pointId == POINT_HOME)
    {
        sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");

        CurrentWP = WaypointList.begin();
        m_uiWPWaitTimer = 1;
    }
    else
    {
        if(WaypointList.empty() || CurrentWP == WaypointList.end())
        {
            sLog->outError("TSCR ERROR: EscortAI has no current WP set up for point %u of creature entry %u", pointId, me->GetEntry());
            return;
        }

        //Make sure that we are still on the right waypoint
        if(CurrentWP->id != pointId)
        {
            sLog->outError("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
            return;
        }

        sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI Waypoint %u reached", CurrentWP->id);

        //Call WP function
        WaypointReached(CurrentWP->id);

        m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;

        ++CurrentWP;
    }
}
开发者ID:Desch,项目名称:MythCore,代码行数:52,代码来源:ScriptedEscortAI.cpp

示例7: GetScript

void SmartAI::ResumePath()
{
    GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, nullptr, _currentWaypointNode, GetScript()->GetPathId());

    RemoveEscortState(SMART_ESCORT_PAUSED);

    _waypointPauseForced = false;
    _waypointReached = false;
    _waypointPauseTimer = 0;

    SetRun(mRun);
    me->ResumeMovement();
}
开发者ID:lasyan3,项目名称:TrinityCore,代码行数:13,代码来源:SmartAI.cpp

示例8: debug_log

void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
{
    if (uiMoveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING))
        return;

    //Combat start position reached, continue waypoint movement
    if (uiPointId == POINT_LAST_POINT)
    {
        debug_log("SD0: EscortAI has returned to original position before combat");

        if (m_bIsRunning && m_creature->HasSplineFlag(SPLINEFLAG_WALKMODE))
            m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
        else if (!m_bIsRunning && !m_creature->HasSplineFlag(SPLINEFLAG_WALKMODE))
            m_creature->AddSplineFlag(SPLINEFLAG_WALKMODE);

        RemoveEscortState(STATE_ESCORT_RETURNING);

        if (!m_uiWPWaitTimer)
            m_uiWPWaitTimer = 1;
    }
    else if (uiPointId == POINT_HOME)
    {
        debug_log("SD0: EscortAI has returned to original home location and will continue from beginning of waypoint list.");

        CurrentWP = WaypointList.begin();
        m_uiWPWaitTimer = 1;
    }
    else
    {
        //Make sure that we are still on the right waypoint
        if (CurrentWP->uiId != uiPointId)
        {
            error_log("SD0: EscortAI for Npc %u reached waypoint out of order %u, expected %u.", m_creature->GetEntry(), uiPointId, CurrentWP->uiId);
            return;
        }

        debug_log("SD0: EscortAI waypoint %u reached.", CurrentWP->uiId);

        // In case we were moving while in combat, we should evade back to this position
        m_creature->SetCombatStartPosition(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());

        //Call WP function
        WaypointReached(CurrentWP->uiId);

        m_uiWPWaitTimer = CurrentWP->uiWaitTime + 1;

        ++CurrentWP;
    }
}
开发者ID:DarkSunRise,项目名称:scriptdev0,代码行数:49,代码来源:escort_ai.cpp

示例9: AddEscortState

void npc_escortAI::SetEscortPaused(bool bPaused)
{
    if (!HasEscortState(STATE_ESCORT_ESCORTING))
        return;

    if (bPaused)
    {
        AddEscortState(STATE_ESCORT_PAUSED);
        m_creature->addUnitState(UNIT_STAT_WAYPOINT_PAUSED);
    }
    else
    {
        RemoveEscortState(STATE_ESCORT_PAUSED);
        m_creature->clearUnitState(UNIT_STAT_WAYPOINT_PAUSED);
    }
}
开发者ID:killerwife,项目名称:mangos-classic,代码行数:16,代码来源:escort_ai.cpp

示例10: debug_log

void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
{
    if (uiMoveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING) || me->isInCombat())
        return;

    //Combat start position reached, continue waypoint movement
    if (uiPointId == POINT_LAST_POINT)
    {
        debug_log("TSCR: EscortAI has returned to original position before combat");

        if (IsRunning && me->IsWalking())
            me->SetWalk(false);
        else if (!IsRunning && !me->IsWalking())
            me->SetWalk(true);

        me->GetUnitStateMgr().InitDefaults(false);
        RemoveEscortState(STATE_ESCORT_INCOMBAT);

        if (!WPWaitTimer)
            WPWaitTimer = 1;
    }
    else if (uiPointId == POINT_HOME)
    {
        debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");

        CurrentWP = WaypointList.begin();
        WPWaitTimer = 1;
    }
    else
    {
        //Make sure that we are still on the right waypoint
        if (CurrentWP->id != uiPointId)
        {
            error_log("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u", uiPointId, CurrentWP->id);
            return;
        }

        debug_log("TSCR: EscortAI Waypoint %u reached", CurrentWP->id);

        //Call WP function
        WaypointReached(CurrentWP->id);

        WPWaitTimer = CurrentWP->WaitTimeMs + 1;

        ++CurrentWP;
    }
}
开发者ID:Blumfield,项目名称:ptc2,代码行数:47,代码来源:escort_ai.cpp

示例11: debug_log

void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
{
    if (uiMoveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING))
        return;

    //Combat start position reached, continue waypoint movement
    if (uiPointId == POINT_LAST_POINT)
    {
        debug_log("TSCR: EscortAI has returned to original position before combat");

        if (m_bIsRunning && m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
            m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
        else if (!m_bIsRunning && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
            m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);

        RemoveEscortState(STATE_ESCORT_RETURNING);

        if (!m_uiWPWaitTimer)
            m_uiWPWaitTimer = 1;
    }
    else if (uiPointId == POINT_HOME)
    {
        debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");

        CurrentWP = WaypointList.begin();
        m_uiWPWaitTimer = 1;
    }
    else
    {
        //Make sure that we are still on the right waypoint
        if (CurrentWP->id != uiPointId)
        {
            error_log("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u", uiPointId, CurrentWP->id);
            return;
        }

        debug_log("TSCR: EscortAI Waypoint %u reached", CurrentWP->id);

        //Call WP function
        WaypointReached(CurrentWP->id);

        m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;

        ++CurrentWP;
    }
}
开发者ID:LordVoldemort,项目名称:Shindorei,代码行数:46,代码来源:escort_ai.cpp

示例12: Reset

void SmoothEscortAI::EnterEvadeMode()
{
    if (HasEscortState(ESCORT_STATE_COMBAT))
    {
        Reset();
        RemoveEscortState(ESCORT_STATE_COMBAT);
        me->RemoveAllAuras();
        me->DeleteThreatList();
        me->CombatStop(true);
        me->SetLootRecipient(NULL);
        me->LoadCreaturesAddon();
        me->StopMoving();

        if (HasEscortState(ESCORT_STATE_ESCORTING))
            StartMove();
        else
            me->GetMotionMaster()->MoveTargetedHome();
    }
}
开发者ID:Exodius,项目名称:chuspi,代码行数:19,代码来源:ScriptedSmoothEscortAI.cpp

示例13: TC_LOG_DEBUG

void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
{
    if (moveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING))
        return;

    //Combat start position reached, continue waypoint movement
    if (pointId == POINT_LAST_POINT)
    {
        TC_LOG_DEBUG("scripts", "EscortAI has returned to original position before combat");

        me->SetWalk(!m_bIsRunning);
        RemoveEscortState(STATE_ESCORT_RETURNING);

        if (!m_uiWPWaitTimer)
            m_uiWPWaitTimer = 1;
    }
    else if (pointId == POINT_HOME)
    {
        TC_LOG_DEBUG("scripts", "EscortAI has returned to original home location and will continue from beginning of waypoint list.");

        CurrentWP = WaypointList.begin();
        m_uiWPWaitTimer = 1;
    }
    else
    {
        //Make sure that we are still on the right waypoint
        if (CurrentWP->id != pointId)
        {
            TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
            return;
        }

        TC_LOG_DEBUG("scripts", "EscortAI Waypoint %u reached", CurrentWP->id);

        //Call WP function
        WaypointReached(CurrentWP->id);

        m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;

        ++CurrentWP;
    }
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:42,代码来源:ScriptedEscortAI.cpp

示例14: StopPath

void SmartAI::UpdatePath(const uint32 diff)
{
    if (!HasEscortState(SMART_ESCORT_ESCORTING))
        return;
    if (mEscortInvokerCheckTimer < diff)
    {
        if (!IsEscortInvokerInRange())
        {
            StopPath(mDespawnTime, mEscortQuestID, true);
        }
        mEscortInvokerCheckTimer = 1000;
    } else mEscortInvokerCheckTimer -= diff;
    // handle pause
    if (HasEscortState(SMART_ESCORT_PAUSED))
    {
        if (mWPPauseTimer < diff)
        {
            if (!me->isInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mLastWPIDReached == SMART_ESCORT_LAST_OOC_POINT || mForcedPaused))
            {
                GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, NULL, mLastWP->id, GetScript()->GetPathId());
                RemoveEscortState(SMART_ESCORT_PAUSED);
                if (mForcedPaused)// if paused between 2 wps resend movement
                {
                    ResumePath();
                    mWPReached = false;
                    mForcedPaused = false;
                }
                if (mLastWPIDReached == SMART_ESCORT_LAST_OOC_POINT)
                    mWPReached = true;
            }
            mWPPauseTimer = 0;
        } else {
            mWPPauseTimer -= diff;

        }
    }
    if (HasEscortState(SMART_ESCORT_RETURNING))
    {
        if (mWPReached)//reached OOC WP
        {
            RemoveEscortState(SMART_ESCORT_RETURNING);
            if (!HasEscortState(SMART_ESCORT_PAUSED))
                ResumePath();
            mWPReached = false;
        }
    }
    if (me->isInCombat() || HasEscortState(SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING))
        return;
    // handle next wp
    if (mWPReached)//reached WP
    {
        mWPReached = false;
        if (mCurrentWPID == GetWPCount())
        {
            EndPath();
        } else {
            WayPoint* wp = GetNextWayPoint();
            if (wp)
            {
                SetRun(mRun);
                me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
            }
        }

    }
}
开发者ID:AdrElecTro,项目名称:TrinityCore,代码行数:66,代码来源:SmartAI.cpp

示例15: CreatureStartAttackDoor

 void CreatureStartAttackDoor()
 {
     RemoveEscortState(STATE_ESCORT_ESCORTING | STATE_ESCORT_RETURNING | STATE_ESCORT_PAUSED);
     me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
     me->CastSpell((Unit*)NULL, SPELL_DESTROY_DOOR_SEAL, true);
 }
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:6,代码来源:violet_hold.cpp


注:本文中的RemoveEscortState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。