本文整理汇总了C++中HasFollowState函数的典型用法代码示例。如果您正苦于以下问题:C++ HasFollowState函数的具体用法?C++ HasFollowState怎么用?C++ HasFollowState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HasFollowState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveInLineOfSight
void MoveInLineOfSight(Unit* who) override
{
FollowerAI::MoveInLineOfSight(who);
if (!me->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && who->GetEntry() == NPC_LILADRIS)
{
if (me->IsWithinDistInMap(who, INTERACTION_DISTANCE*5))
{
if (Player* player = GetLeaderForFollower())
{
if (player->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE)
player->GroupEventHappens(QUEST_SLEEPER_AWAKENED, me);
Talk(SAY_KER_END);
}
SetFollowComplete();
}
}
}
示例2: AddFollowState
void FollowerAI::SetFollowComplete(bool bWithEndEvent)
{
if (me->HasUnitState(UNIT_STAT_FOLLOW))
{
me->ClearUnitState(UNIT_STAT_FOLLOW);
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
}
if (bWithEndEvent)
AddFollowState(STATE_FOLLOW_POSTEVENT);
else
{
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
RemoveFollowState(STATE_FOLLOW_POSTEVENT);
}
AddFollowState(STATE_FOLLOW_COMPLETE);
}
示例3: UpdateFollowerAI
void UpdateFollowerAI(const uint32 uiDiff)
{
if (!UpdateVictim())
{
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
{
if (m_uiPostEventTimer <= uiDiff)
{
m_uiPostEventTimer = 3000;
Unit *pArynia = Unit::GetUnit(*me, AryniaGUID);
if (!pArynia || !pArynia->isAlive())
{
SetFollowComplete();
return;
}
switch(m_uiPhasePostEvent)
{
case 0:
DoScriptText(SAY_AT_HOME, pArynia);
break;
case 1:
DoScriptText(EMOTE_AT_HOME, me, 0, true);
me->GetMotionMaster()->MovePoint(POINT_ID_TO_FOREST, m_afToForestLoc[0], m_afToForestLoc[1], m_afToForestLoc[2]);
break;
}
++m_uiPhasePostEvent;
}
else
m_uiPostEventTimer -= uiDiff;
}
return;
}
DoMeleeAttackIfReady();
}
示例4: StartFollow
void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Quest* quest)
{
if (me->getVictim())
{
sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
sLog->outError(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while already following.");
return;
}
//set variables
m_uiLeaderGUID = player->GetGUID();
if (factionForFollower)
me->setFaction(factionForFollower);
m_pQuestForFollow = quest;
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
me->SetUInt32Value(UNIT_NPC_FLAGS + 1, UNIT_NPC_FLAG2_NONE);
AddFollowState(STATE_FOLLOW_INPROGRESS);
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName(), m_uiLeaderGUID);
}
示例5: StartFollow
void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const Quest* pQuest, float followDist)
{
if (m_creature->getVictim())
{
sLog.outDebug("FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
sLog.outError("FollowerAI attempt to StartFollow while already following.");
return;
}
//set variables
m_uiLeaderGUID = pLeader->GetGUID();
m_uiFollowDistance = followDist;
if (uiFactionForFollower)
m_creature->setFaction(uiFactionForFollower);
m_pQuestForFollow = pQuest;
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
sLog.outDebug("FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
AddFollowState(STATE_FOLLOW_INPROGRESS);
m_creature->GetMotionMaster()->MoveFollow(pLeader, followDist, PET_FOLLOW_ANGLE);
sLog.outDebug("FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID);
}
示例6: JustDied
void FollowerAI::JustDied(Unit*)
{
if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || !m_leaderGuid || !m_pQuestForFollow)
return;
//TODO: need a better check for quests with time limit.
if (Player* pPlayer = GetLeaderForFollower())
{
if (Group* pGroup = pPlayer->GetGroup())
{
for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next())
{
if (Player* pMember = pRef->getSource())
{
if (pMember->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
pMember->FailQuest(m_pQuestForFollow->GetQuestId());
}
}
}
else if (pPlayer->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE)
pPlayer->FailQuest(m_pQuestForFollow->GetQuestId());
}
}
示例7: debug_log
void FollowerAI::StartFollow(Player* leader, uint32 factionForFollower, const Quest* quest)
{
if (m_creature->getVictim())
{
debug_log("SD2: FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
script_error_log("FollowerAI attempt to StartFollow while already following.");
return;
}
// set variables
m_leaderGuid = leader->GetObjectGuid();
if (factionForFollower)
m_creature->SetFactionTemporary(factionForFollower, TEMPFACTION_RESTORE_RESPAWN);
m_questForFollow = quest;
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
debug_log("SD2: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
AddFollowState(STATE_FOLLOW_INPROGRESS);
m_creature->GetMotionMaster()->MoveFollow(leader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
debug_log("SD2: FollowerAI start follow %s (Guid %s)", leader->GetName(), m_leaderGuid.GetString().c_str());
}
示例8: TC_LOG_DEBUG
void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Quest* quest)
{
if (me->GetVictim())
{
TC_LOG_DEBUG("scripts", "FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
TC_LOG_ERROR("scripts", "FollowerAI attempt to StartFollow while already following.");
return;
}
//set variables
m_uiLeaderGUID = player->GetGUID();
if (factionForFollower)
me->setFaction(factionForFollower);
m_pQuestForFollow = quest;
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
TC_LOG_DEBUG("scripts", "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
AddFollowState(STATE_FOLLOW_INPROGRESS);
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (%s)", player->GetName().c_str(), m_uiLeaderGUID.ToString().c_str());
}
示例9: EnterEvadeMode
void FollowerAI::EnterEvadeMode()
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->SetLootRecipient(NULL);
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
{
float fPosX, fPosY, fPosZ;
me->GetPosition(fPosX, fPosY, fPosZ);
me->GetMotionMaster()->MovePoint(POINT_COMBAT_START, fPosX, fPosY, fPosZ);
}
}
else
{
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
me->GetMotionMaster()->MoveTargetedHome();
}
Reset();
}
示例10: UpdateFollowerAI
void UpdateFollowerAI(const uint32 uiDiff)
{
if (!UpdateVictim())
{
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
{
if (m_uiEndEventTimer <= uiDiff)
{
Unit* pKernobee = Unit::GetUnit(*me, KernobeeGUID);
if (!pKernobee || !pKernobee->IsAlive())
{
SetFollowComplete();
return;
}
switch (m_uiEndEventProgress)
{
case 1:
DoScriptText(SAY_KERNOBEE_END, me);
m_uiEndEventTimer = 3000;
break;
case 2:
SetFollowComplete();
break;
}
++m_uiEndEventProgress;
}
else
m_uiEndEventTimer -= uiDiff;
}
return;
}
DoMeleeAttackIfReady();
}
示例11: debug_log
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))
{
debug_log("SD2: FollowerAI is set completed, despawns.");
m_creature->ForcedDespawn();
return;
}
bool bIsMaxRangeExceeded = true;
if (Player* pPlayer = GetLeaderForFollower())
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
debug_log("SD2: FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
return;
}
if (Group* pGroup = pPlayer->GetGroup())
{
for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; 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;
}
}
if (bIsMaxRangeExceeded)
{
debug_log("SD2: FollowerAI failed because player/group was to far away or not found");
m_creature->ForcedDespawn();
return;
}
m_uiUpdateFollowTimer = 1000;
}
else
m_uiUpdateFollowTimer -= uiDiff;
}
UpdateFollowerAI(uiDiff);
}
示例12: UpdateFollowerAI
void UpdateFollowerAI(uint32 Diff) override
{
if (!UpdateVictim())
{
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
{
if (EndEventTimer <= Diff)
{
Creature* spraggle = ObjectAccessor::GetCreature(*me, SpraggleGUID);
if (!spraggle || !spraggle->IsAlive())
{
SetFollowComplete();
return;
}
switch (EndEventProgress)
{
case 1:
Talk(SAY_RIN_END_1);
EndEventTimer = 3000;
break;
case 2:
spraggle->AI()->Talk(SAY_SPR_END_2);
EndEventTimer = 5000;
break;
case 3:
Talk(SAY_RIN_END_3);
EndEventTimer = 1000;
break;
case 4:
Talk(EMOTE_RIN_END_4);
SetFaint();
EndEventTimer = 9000;
break;
case 5:
Talk(EMOTE_RIN_END_5);
ClearFaint();
EndEventTimer = 1000;
break;
case 6:
Talk(SAY_RIN_END_6);
EndEventTimer = 3000;
break;
case 7:
spraggle->AI()->Talk(SAY_SPR_END_7);
EndEventTimer = 10000;
break;
case 8:
Talk(EMOTE_RIN_END_8);
EndEventTimer = 5000;
break;
case 9:
SetFollowComplete();
break;
}
++EndEventProgress;
}
else
EndEventTimer -= Diff;
}
else if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !HasFollowState(STATE_FOLLOW_PAUSED))
{
if (FaintTimer <= Diff)
{
SetFaint();
FaintTimer = urand(60000, 120000);
}
else
FaintTimer -= Diff;
}
return;
}
DoMeleeAttackIfReady();
}
示例13: MoveInLineOfSight
void MoveInLineOfSight(Unit* pWho) override
{
// should not have npcflag by default, so set when expected
if (!m_creature->getVictim() && !m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && HasFollowState(STATE_FOLLOW_INPROGRESS) && pWho->GetEntry() == NPC_WINNA)
{
if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE))
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
}
示例14: SpellHit
void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN)
ClearSleeping();
}
示例15: UpdateFollowerAI
void UpdateFollowerAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
//we are doing the post-event, or...
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
{
if (m_uiPostEventTimer < uiDiff)
{
m_uiPostEventTimer = 5000;
if (!pTorta || !pTorta->isAlive())
{
//something happened, so just complete
SetFollowComplete();
return;
}
switch(m_uiPhasePostEvent)
{
case 1:
DoScriptText(SAY_TOOG_POST_1, m_creature);
break;
case 2:
DoScriptText(SAY_TORT_POST_2, pTorta);
break;
case 3:
DoScriptText(SAY_TOOG_POST_3, m_creature);
break;
case 4:
DoScriptText(SAY_TORT_POST_4, pTorta);
break;
case 5:
DoScriptText(SAY_TOOG_POST_5, m_creature);
break;
case 6:
DoScriptText(SAY_TORT_POST_6, pTorta);
m_creature->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]);
break;
}
++m_uiPhasePostEvent;
}
else
m_uiPostEventTimer -= uiDiff;
}
//...we are doing regular speech check
else if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
if (m_uiCheckSpeechTimer < uiDiff)
{
m_uiCheckSpeechTimer = 5000;
switch(urand(0, 50))
{
case 10:
DoScriptText(SAY_TOOG_THIRST, m_creature);
break;
case 25:
DoScriptText(SAY_TOOG_WORRIED, m_creature);
break;
}
}
else
m_uiCheckSpeechTimer -= uiDiff;
}
return;
}
DoMeleeAttackIfReady();
}