本文整理汇总了C++中AddEscortState函数的典型用法代码示例。如果您正苦于以下问题:C++ AddEscortState函数的具体用法?C++ AddEscortState怎么用?C++ AddEscortState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddEscortState函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: StopPath
void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
{
if (me->isInCombat())// no wp movement in combat
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
if (path)
if (!LoadPath(path))
return;
if (!mWayPoints || mWayPoints->empty())
return;
AddEscortState(SMART_ESCORT_ESCORTING);
mCanRepeatPath = repeat;
SetRun(run);
WayPoint* wp = GetNextWayPoint();
if (wp)
{
me->GetPosition(&mLastOOCPos);
me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, NULL, wp->id, GetScript()->GetPathId());
}
}
开发者ID:Hacker0771,项目名称:al335,代码行数:28,代码来源:SmartAI.cpp
示例2: debug_log
void npc_escortAI::EnterEvadeMode()
{
m_creature->RemoveAllAurasOnEvade();
m_creature->DeleteThreatList();
m_creature->CombatStop(true);
m_creature->SetLootRecipient(NULL);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
// We have left our path
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE)
{
debug_log("SD2: EscortAI has left combat and is now returning to CombatStartPosition.");
AddEscortState(STATE_ESCORT_RETURNING);
float fPosX, fPosY, fPosZ;
m_creature->GetCombatStartPosition(fPosX, fPosY, fPosZ);
m_creature->GetMotionMaster()->MovePoint(POINT_LAST_POINT, fPosX, fPosY, fPosZ);
}
}
else
m_creature->GetMotionMaster()->MoveTargetedHome();
Reset();
}
开发者ID:AtVirus,项目名称:server,代码行数:26,代码来源:escort_ai.cpp
示例3: _EnterEvadeMode
void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
{
if (!me->IsAlive() || me->IsInEvadeMode())
return;
me->RemoveAurasOnEvade();
me->AddUnitState(UNIT_STATE_EVADE);
_EnterEvadeMode();
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db
SetRun(mRun);
if (HasEscortState(SMART_ESCORT_ESCORTING))
{
AddEscortState(SMART_ESCORT_RETURNING);
ReturnToLastOOCPos();
}
else if (mFollowGuid)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
// evade is not cleared in MoveFollow, so we can't keep it
me->ClearUnitState(UNIT_STATE_EVADE);
}
else
me->GetMotionMaster()->MoveTargetedHome();
if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat
SetRun(mRun);
}
开发者ID:DanielBallaSZTE,项目名称:TrinityCorePreWOTLK,代码行数:32,代码来源:SmartAI.cpp
示例4: GetScript
void SmartAI::EnterEvadeMode()
{
if (!me->isAlive())
return;
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon();
me->SetLootRecipient(NULL);
me->ResetPlayerDamageReq();
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db
SetRun(mRun);
if (HasEscortState(SMART_ESCORT_ESCORTING))
{
AddEscortState(SMART_ESCORT_RETURNING);
ReturnToLastOOCPos();
} else if (mFollowGuid) {
if (Unit* target = me->GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
} else {
me->GetMotionMaster()->MoveTargetedHome();
}
Reset();
}
开发者ID:sacel,项目名称:StrawberryEMU,代码行数:28,代码来源:SmartAI.cpp
示例5: AddEscortState
void SmartAI::PausePath(uint32 delay, bool forced)
{
if (!HasEscortState(SMART_ESCORT_ESCORTING))
return;
if (HasEscortState(SMART_ESCORT_PAUSED))
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
return;
}
AddEscortState(SMART_ESCORT_PAUSED);
mWPPauseTimer = delay;
if (forced && !mWPReached)
{
mForcedPaused = forced;
SetRun(mRun);
if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == ESCORT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired();
me->StopMoving();
me->GetMotionMaster()->MoveIdle();//force stop
}
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, NULL, mCurrentWPID, GetScript()->GetPathId());
}
开发者ID:Keader,项目名称:Sunwell,代码行数:25,代码来源:SmartAI.cpp
示例6: error_log
//TODO: get rid of this many variables passed in function.
void npc_escortAI::Start(bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath)
{
if (m_creature->getVictim())
{
error_log("SD2: EscortAI attempt to Start while in combat.");
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
error_log("SD2: EscortAI attempt to Start while already escorting.");
return;
}
/*if (!WaypointList.empty())
WaypointList.clear();*/
FillPointMovementListForCreature();
if (WaypointList.empty())
{
error_db_log("SD2: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint).");
return;
}
//set variables
m_bIsRunning = bRun;
m_uiPlayerGUID = uiPlayerGUID;
m_pQuestForEscort = pQuest;
m_bCanInstantRespawn = bInstantRespawn;
m_bCanReturnToStart = bCanLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
debug_log("SD2: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MoveIdle();
debug_log("SD2: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
debug_log("SD2: EscortAI started with " SIZEFMTD " waypoints. Run = %d, PlayerGUID = " UI64FMTD, WaypointList.size(), m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
//Set initial speed
if (m_bIsRunning)
m_creature->RemoveSplineFlag(SPLINEFLAG_WALKMODE);
AddEscortState(STATE_ESCORT_ESCORTING);
JustStartedEscort();
}
开发者ID:Danstahr,项目名称:ScriptDev2,代码行数:60,代码来源:escort_ai.cpp
示例7: 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
示例8: GetScript
void SmartAI::EnterEvadeMode()
{
// xinef: fixes strange jumps when charming SmartAI npc
if (!me->IsAlive() || me->IsInEvadeMode())
return;
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
{
me->AttackStop();
return;
}
me->RemoveEvadeAuras();
me->AddUnitState(UNIT_STATE_EVADE);
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(NULL);
me->ResetPlayerDamageReq();
me->SetLastDamagedTime(0);
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db
SetRun(mRun);
if (HasEscortState(SMART_ESCORT_ESCORTING))
{
AddEscortState(SMART_ESCORT_RETURNING);
ReturnToLastOOCPos();
}
else if (mFollowGuid)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
me->ClearUnitState(UNIT_STATE_EVADE);
// xinef: do not forget to reset scripts as we wont call reached home
GetScript()->OnReset();
}
else
{
me->GetMotionMaster()->MoveTargetedHome();
// xinef: do not forget to reset scripts as we wont call reached home
if (!me->HasUnitState(UNIT_STATE_EVADE))
GetScript()->OnReset();
}
}
开发者ID:Matt-One,项目名称:azerothcore-wotlk,代码行数:48,代码来源:SmartAI.cpp
示例9: script_error_log
// TODO: get rid of this many variables passed in function.
void npc_escortAI::Start(bool bRun, const Player* pPlayer, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath)
{
if (m_creature->getVictim())
{
script_error_log("EscortAI attempt to Start while in combat.");
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
script_error_log("EscortAI attempt to Start while already escorting.");
return;
}
if (!pSystemMgr.GetPathInfo(m_creature->GetEntry(), 1))
{
script_error_log("EscortAI attempt to start escorting for %s, but has no waypoints loaded", m_creature->GetGuidStr().c_str());
return;
}
// set variables
m_bIsRunning = bRun;
m_playerGuid = pPlayer ? pPlayer->GetObjectGuid() : ObjectGuid();
m_pQuestForEscort = pQuest;
m_bCanInstantRespawn = bInstantRespawn;
m_bCanReturnToStart = bCanLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
debug_log("SD2: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
// disable npcflags
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
AddEscortState(STATE_ESCORT_ESCORTING);
// Set initial speed
m_creature->SetWalk(!m_bIsRunning);
m_creature->StopMoving();
// Start moving along the path with 2500ms delay
m_creature->GetMotionMaster()->Clear(false, true);
m_creature->GetMotionMaster()->MoveWaypoint(1, 3, 2500);
JustStartedEscort();
}
开发者ID:killerwife,项目名称:mangos-classic,代码行数:49,代码来源:escort_ai.cpp
示例10: 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
示例11: AddEscortState
void npc_escortAI::AttackStart(Unit* pWho)
{
if (!pWho)
return;
if (me->Attack(pWho, true))
{
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE && !HasEscortState(STATE_ESCORT_INCOMBAT))
AddEscortState(STATE_ESCORT_INCOMBAT);
if (IsCombatMovement())
{
me->StopMoving();
me->GetMotionMaster()->MoveChase(pWho);
}
}
}
开发者ID:Blumfield,项目名称:ptc2,代码行数:17,代码来源:escort_ai.cpp
示例12: GetScript
void SmartAI::EnterEvadeMode(EvadeReason /*why*/)
{
if (mEvadeDisabled)
{
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);
return;
}
if (!IsAIControlled())
{
me->AttackStop();
return;
}
if (!_EnterEvadeMode())
return;
me->AddUnitState(UNIT_STATE_EVADE);
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE); // must be after _EnterEvadeMode (spells, auras, ...)
SetRun(mRun);
if (Unit* owner = me->GetCharmerOrOwner())
{
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
me->ClearUnitState(UNIT_STATE_EVADE);
}
else if (HasEscortState(SMART_ESCORT_ESCORTING))
{
AddEscortState(SMART_ESCORT_RETURNING);
ReturnToLastOOCPos();
}
else if (Unit* target = mFollowGuid ? ObjectAccessor::GetUnit(*me, mFollowGuid) : nullptr)
{
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
// evade is not cleared in MoveFollow, so we can't keep it
me->ClearUnitState(UNIT_STATE_EVADE);
}
else
me->GetMotionMaster()->MoveTargetedHome();
if (!me->HasUnitState(UNIT_STATE_EVADE))
GetScript()->OnReset();
}
开发者ID:lasyan3,项目名称:TrinityCore,代码行数:45,代码来源:SmartAI.cpp
示例13: AddEscortState
void npc_escortAI::EnterEvadeMode()
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop(true);
m_creature->SetLootRecipient(NULL);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
debug_log("TSCR: EscortAI has left combat and is now returning to last point");
}
else
{
m_creature->GetMotionMaster()->MoveTargetedHome();
Reset();
}
}
开发者ID:LordVoldemort,项目名称:Shindorei,代码行数:19,代码来源:escort_ai.cpp
示例14: AddEscortState
void SmoothEscortAI::AttackStart(Unit* who)
{
if (!who)
return;
if (me->Attack(who, true))
{
if (!HasEscortState(ESCORT_STATE_COMBAT))
{
AddEscortState(ESCORT_STATE_COMBAT);
me->StopMoving();
Position pos;
me->GetPosition(&pos);
me->SetHomePosition(pos);
}
if (IsCombatMovementAllowed())
me->GetMotionMaster()->MoveChase(who);
}
}
开发者ID:Exodius,项目名称:chuspi,代码行数:20,代码来源:ScriptedSmoothEscortAI.cpp
示例15: AddEscortState
void SmartAI::PausePath(uint32 delay, bool forced)
{
if (!HasEscortState(SMART_ESCORT_ESCORTING))
return;
if (HasEscortState(SMART_ESCORT_PAUSED))
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
return;
}
mForcedPaused = forced;
me->GetPosition(&mLastOOCPos);
AddEscortState(SMART_ESCORT_PAUSED);
mWPPauseTimer = delay;
if (forced)
{
SetRun(mRun);
me->StopMoving();//force stop
me->GetMotionMaster()->MoveIdle();//force stop
}
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, NULL, mLastWP->id, GetScript()->GetPathId());
}
开发者ID:AdrElecTro,项目名称:TrinityCore,代码行数:21,代码来源:SmartAI.cpp
示例16: AddEscortState
void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->SetLootRecipient(NULL);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
TC_LOG_DEBUG("scripts", "EscortAI has left combat and is now returning to last point");
}
else
{
me->GetMotionMaster()->MoveTargetedHome();
if (HasImmuneToNPCFlags)
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
Reset();
}
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:21,代码来源:ScriptedEscortAI.cpp
示例17: TC_LOG_ERROR
void SmartAI::PausePath(uint32 delay, bool forced)
{
if (!HasEscortState(SMART_ESCORT_ESCORTING))
return;
if (HasEscortState(SMART_ESCORT_PAUSED))
{
TC_LOG_ERROR("misc", "SmartAI::PausePath: Creature entry %u wanted to pause waypoint (current waypoint: %u) movement while already paused, ignoring.", me->GetEntry(), mCurrentWPID);
return;
}
AddEscortState(SMART_ESCORT_PAUSED);
mWPPauseTimer = delay;
if (forced && !mWPReached)
{
mForcedPaused = forced;
SetRun(mRun);
me->StopMoving();
}
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, nullptr, mCurrentWPID, GetScript()->GetPathId());
}
开发者ID:Carbenium,项目名称:TrinityCore,代码行数:21,代码来源:SmartAI.cpp
示例18: EnterEvadeMode
void EnterEvadeMode()
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->SetHomePosition(1845.577759f+rand_norm()*5-2.5f, 800.681152f+rand_norm()*5-2.5f, 44.104248f, M_PI);
}
me->DeleteThreatList();
me->CombatStop(true);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
}
else
{
me->GetMotionMaster()->MoveTargetedHome();
Reset();
}
me->ClearUnitState(UNIT_STATE_EVADE);
}
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:22,代码来源:violet_hold.cpp
示例19: StopPath
void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
{
if (me->IsInCombat())// no wp movement in combat
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
StopPath();
if (path)
{
if (!LoadPath(path))
return;
}
if (!mWayPoints || mWayPoints->empty())
return;
if (WayPoint* wp = GetNextWayPoint())
{
AddEscortState(SMART_ESCORT_ESCORTING);
mCanRepeatPath = repeat;
SetRun(run);
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
{
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
}
Movement::PointsArray pathPoints;
GenerateWayPointArray(&pathPoints);
me->GetMotionMaster()->MoveSplinePath(&pathPoints);
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, NULL, wp->id, GetScript()->GetPathId());
}
}
开发者ID:Matt-One,项目名称:azerothcore-wotlk,代码行数:39,代码来源:SmartAI.cpp
示例20: RemoveAuras
void SmartAI::EnterEvadeMode()
{
if (!me->isAlive() || me->IsInEvadeMode())
return;
RemoveAuras();
me->AddUnitState(UNIT_STATE_EVADE);
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon();
me->SetLootRecipient(NULL);
me->ResetPlayerDamageReq();
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db
SetRun(mRun);
if (HasEscortState(SMART_ESCORT_ESCORTING))
{
AddEscortState(SMART_ESCORT_RETURNING);
ReturnToLastOOCPos();
}
else if (mFollowGuid)
{
if (Unit* target = me->GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
}
else
{
mCanCombatMove = true;
me->GetMotionMaster()->MoveTargetedHome();
}
//sLog->OutSpecialLog("SmartAI::EnterEvadeMode Entry %u" , me->GetEntry());
if (!HasEscortState(SMART_ESCORT_ESCORTING)) // Don't mess up escort movement after combat.
SetRun(mRun);
}
开发者ID:Expery,项目名称:Core,代码行数:38,代码来源:SmartAI.cpp
注:本文中的AddEscortState函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论