本文整理汇总了C++中HasEscortState函数的典型用法代码示例。如果您正苦于以下问题:C++ HasEscortState函数的具体用法?C++ HasEscortState怎么用?C++ HasEscortState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HasEscortState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reset
void Reset() override
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
m_creature->SetStandState(UNIT_STAND_STATE_KNEEL);
}
示例2: UpdateAI
void UpdateAI(const uint32 uiDiff) {
npc_escortAI::UpdateAI(uiDiff);
DoMeleeAttackIfReady();
if (HasEscortState(STATE_ESCORT_ESCORTING))
m_uiChatTimer = 6000;
}
示例3: UpdateEscortAI
void UpdateEscortAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
if (HasEscortState(STATE_ESCORT_PAUSED))
{
if (m_uiGlobalTimer < uiDiff)
{
m_uiGlobalTimer = 5000;
switch (m_uiPhase)
{
case PHASE_INTRO:
{
switch (m_uiPhaseCounter)
{
case 0:
if (Creature* pReethe = GetCreature(NPC_REETHE))
DoScriptText(SAY_OGR_RET_SWEAR, pReethe);
break;
case 1:
DoScriptText(SAY_OGR_REPLY_RET, m_creature);
break;
case 2:
if (Creature* pReethe = GetCreature(NPC_REETHE))
DoScriptText(SAY_OGR_RET_TAKEN, pReethe);
break;
case 3:
DoScriptText(SAY_OGR_TELL_FIRE, m_creature);
if (Creature* pReethe = GetCreature(NPC_REETHE))
DoScriptText(SAY_OGR_RET_NOCLOSER, pReethe);
break;
case 4:
if (Creature* pReethe = GetCreature(NPC_REETHE))
DoScriptText(SAY_OGR_RET_NOFIRE, pReethe);
break;
case 5:
if (Creature* pReethe = GetCreature(NPC_REETHE))
DoScriptText(SAY_OGR_RET_HEAR, pReethe);
m_creature->SummonCreature(NPC_CALDWELL, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 300000);
m_creature->SummonCreature(NPC_HALLAN, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 300000);
m_creature->SummonCreature(NPC_SKIRMISHER, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 300000);
m_creature->SummonCreature(NPC_SKIRMISHER, m_afSpawn[0], m_afSpawn[1], m_afSpawn[2], 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 300000);
m_uiPhase = PHASE_GUESTS;
break;
}
break;
}
case PHASE_GUESTS:
{
switch (m_uiPhaseCounter)
{
case 6:
if (Creature* pCaldwell = GetCreature(NPC_CALDWELL))
DoScriptText(SAY_OGR_CAL_FOUND, pCaldwell);
break;
case 7:
if (Creature* pCaldwell = GetCreature(NPC_CALDWELL))
DoScriptText(SAY_OGR_CAL_MERCY, pCaldwell);
break;
case 8:
if (Creature* pHallan = GetCreature(NPC_HALLAN))
{
DoScriptText(SAY_OGR_HALL_GLAD, pHallan);
if (Creature* pReethe = GetCreature(NPC_REETHE))
pHallan->CastSpell(pReethe, SPELL_FAKE_SHOT, TRIGGERED_NONE);
}
break;
case 9:
if (Creature* pReethe = GetCreature(NPC_REETHE))
{
DoScriptText(EMOTE_OGR_RET_ARROW, pReethe);
DoScriptText(SAY_OGR_RET_ARROW, pReethe);
}
break;
case 10:
if (Creature* pCaldwell = GetCreature(NPC_CALDWELL))
DoScriptText(SAY_OGR_CAL_CLEANUP, pCaldwell);
DoScriptText(SAY_OGR_NODIE, m_creature);
break;
case 11:
DoStartAttackMe();
m_uiPhase = PHASE_FIGHT;
break;
}
break;
}
case PHASE_COMPLETE:
{
switch (m_uiPhaseCounter)
{
case 12:
if (Player* pPlayer = GetPlayerForEscort())
pPlayer->GroupEventHappens(QUEST_QUESTIONING, m_creature);
DoScriptText(SAY_OGR_SURVIVE, m_creature);
//.........这里部分代码省略.........
示例4: JustEngagedWith
void JustEngagedWith(Unit* who) override
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
Talk(SAY_ATTACKED, who);
}
示例5: EnterCombat
void EnterCombat(Unit* /*who*/)
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
DoScriptText(SAY_ELF_AGGRO, me);
}
示例6: TC_LOG_ERROR
/// @todo get rid of this many variables passed in function.
void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */, ObjectGuid playerGUID /* = 0 */, Quest const* quest /* = NULL */, bool instantRespawn /* = false */, bool canLoopPath /* = false */, bool resetWaypoints /* = true */)
{
if (me->GetVictim())
{
TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (!ScriptWP && resetWaypoints) // sd2 never adds wp in script, but tc does
{
if (!WaypointList.empty())
WaypointList.clear();
FillPointMovementListForCreature();
}
if (WaypointList.empty())
{
TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
return;
}
//set variables
m_bIsActiveAttacker = isActiveAttacker;
m_bIsRunning = run;
m_uiPlayerGUID = playerGUID;
m_pQuestForEscort = quest;
m_bCanInstantRespawn = instantRespawn;
m_bCanReturnToStart = canLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
TC_LOG_DEBUG("scripts", "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
TC_LOG_DEBUG("scripts", "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
{
HasImmuneToNPCFlags = true;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
}
TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, %s", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID.ToString().c_str());
CurrentWP = WaypointList.begin();
//Set initial speed
if (m_bIsRunning)
me->SetWalk(false);
else
me->SetWalk(true);
AddEscortState(STATE_ESCORT_ESCORTING);
}
示例7: error_log
//TODO: get rid of this many variables passed in function.
void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath)
{
if (m_creature->getVictim())
{
error_log("ISCR ERROR: EscortAI attempt to Start while in combat.");
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
error_log("ISCR: EscortAI attempt to Start while already escorting.");
return;
}
if (!ScriptWP) // sd2 never adds wp in script, but tc does
{
if (!WaypointList.empty())
WaypointList.clear();
FillPointMovementListForCreature();
}
if (WaypointList.empty())
{
if (pQuest != NULL)
{
error_db_log("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", m_pQuestForEscort->GetQuestId());
return;
}
else
return;
}
//set variables
m_bIsActiveAttacker = bIsActiveAttacker;
m_bIsRunning = bRun;
m_uiPlayerGUID = uiPlayerGUID;
m_pQuestForEscort = pQuest;
m_bCanInstantRespawn = bInstantRespawn;
m_bCanReturnToStart = bCanLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
debug_log("ISCR: 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("ISCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
debug_log("ISCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
//Set initial speed
if (m_bIsRunning)
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
AddEscortState(STATE_ESCORT_ESCORTING);
JustStartedEscort();
}
示例8: 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 (!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_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.");
}
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 = %s", WaypointList.size(), m_bIsRunning, m_playerGuid.GetString().c_str());
CurrentWP = WaypointList.begin();
// Set initial speed
m_creature->SetWalk(!m_bIsRunning);
AddEscortState(STATE_ESCORT_ESCORTING);
JustStartedEscort();
}
示例9: Aggro
void Aggro(Unit*)
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
me->Say(SAY_AGGRO1, LANG_UNIVERSAL, GetPlayerForEscort()->GetGUID());
else me->Say(SAY_AGGRO2, LANG_UNIVERSAL, 0);
}
示例10: UpdateAI
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
if (UpdateVictim())
{
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_FROST_SHOCK:
DoCastVictim(SPELL_FROST_SHOCK);
_events.DelayEvents(1 * IN_MILLISECONDS);
_events.ScheduleEvent(EVENT_FROST_SHOCK, 10s, 15s);
break;
case EVENT_SEARING_TOTEM:
DoCast(me, SPELL_SEARING_TOTEM);
_events.DelayEvents(1 * IN_MILLISECONDS);
_events.ScheduleEvent(EVENT_SEARING_TOTEM, urand(110, 130) * IN_MILLISECONDS);
break;
case EVENT_STRENGTH_OF_EARTH_TOTEM:
DoCast(me, SPELL_STRENGTH_OF_EARTH_TOTEM);
_events.DelayEvents(1 * IN_MILLISECONDS);
_events.ScheduleEvent(EVENT_STRENGTH_OF_EARTH_TOTEM, urand(110, 130) * IN_MILLISECONDS);
break;
case EVENT_HEALING_SURGE:
{
Unit* target = nullptr;
if (me->GetHealthPct() < 85)
target = me;
else if (Player* player = GetPlayerForEscort())
if (player->GetHealthPct() < 85)
target = player;
if (target)
{
DoCast(target, SPELL_HEALING_SURGE);
_events.ScheduleEvent(EVENT_HEALING_SURGE, 10s);
}
else
_events.ScheduleEvent(EVENT_HEALING_SURGE, 2s);
break;
}
default:
break;
}
}
DoMeleeAttackIfReady();
}
if (HasEscortState(STATE_ESCORT_NONE))
return;
EscortAI::UpdateAI(diff);
if (_phase)
{
if (_moveTimer <= diff)
{
switch (_phase)
{
case PHASE_WP_26: //debug skip path to point 26, buggy path calculation
me->GetMotionMaster()->MovePoint(WP_DEBUG_2, -2021.77f, -10648.8f, 129.903f, false);
_moveTimer = 2 * IN_MILLISECONDS;
_phase = PHASE_CONTINUE;
break;
case PHASE_CONTINUE: // continue escort
SetEscortPaused(false);
_moveTimer = 0 * IN_MILLISECONDS;
_phase = PHASE_NONE;
break;
case PHASE_WP_22: //debug skip path to point 22, buggy path calculation
me->GetMotionMaster()->MovePoint(WP_EXPLOSIVES_FIRST_PLANT, -1958.026f, -10660.465f, 111.547f, false);
Talk(SAY_LEGOSO_3);
_moveTimer = 2 * IN_MILLISECONDS;
_phase = PHASE_PLANT_FIRST_KNEEL;
break;
case PHASE_PLANT_FIRST_KNEEL: // plant first explosives stage 1 kneel
me->SetStandState(UNIT_STAND_STATE_KNEEL);
_moveTimer = 10 * IN_MILLISECONDS;
_phase = PHASE_PLANT_FIRST_STAND;
break;
case PHASE_PLANT_FIRST_STAND: // plant first explosives stage 1 stand
me->SetStandState(UNIT_STAND_STATE_STAND);
_moveTimer = 0.5* IN_MILLISECONDS;
_phase = PHASE_PLANT_FIRST_WORK;
break;
case PHASE_PLANT_FIRST_WORK: // plant first explosives stage 2 work
Talk(SAY_LEGOSO_4);
_moveTimer = 17.5 * IN_MILLISECONDS;
_phase = PHASE_PLANT_FIRST_FINISH;
break;
case PHASE_PLANT_FIRST_FINISH: // plant first explosives finish
_explosivesGuids.clear();
for (uint8 i = 0; i != MAX_EXPLOSIVES; ++i)
{
if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_1, ExplosivesPos[0][i], QuaternionData(), 0))
_explosivesGuids.push_back(explosive->GetGUID());
}
me->HandleEmoteCommand(EMOTE_ONESHOT_NONE); // reset anim state
//.........这里部分代码省略.........
示例11: UpdateEscortAI
void UpdateEscortAI(const uint32 uiDiff)
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
return;
if (HasEscortState(STATE_ESCORT_PAUSED))
{
if (m_uiExplodeTimer < uiDiff)
{
if (m_bFirstBarrel)
{
switch(m_uiExplodePhase)
{
case 0:
DoCastSpellIfCan(m_creature, SPELL_DETONATE_EXPLOSIVES_1);
if (Player* pPlayer = GetPlayerForEscort())
DoScriptText(SAY_HELICE_EXPLODE_1, m_creature, pPlayer);
m_uiExplodeTimer = 2500;
++m_uiExplodePhase;
break;
case 1:
if (Player* pPlayer = GetPlayerForEscort())
DoScriptText(SAY_HELICE_MOVE_ON, m_creature, pPlayer);
m_uiExplodeTimer = 2500;
++m_uiExplodePhase;
break;
case 2:
SetEscortPaused(false);
m_uiExplodePhase = 0;
m_uiExplodeTimer = 5000;
m_bFirstBarrel = false;
break;
}
}
else
{
switch(m_uiExplodePhase)
{
case 0:
DoCastSpellIfCan(m_creature, SPELL_DETONATE_EXPLOSIVES_2);
if (Player* pPlayer = GetPlayerForEscort())
DoScriptText(SAY_HELICE_EXPLODE_2, m_creature, pPlayer);
m_uiExplodeTimer = 2500;
++m_uiExplodePhase;
break;
case 1:
SetEscortPaused(false);
m_uiExplodePhase = 0;
m_uiExplodeTimer = 5000;
m_bFirstBarrel = true;
break;
}
}
}
else
m_uiExplodeTimer -= uiDiff;
}
return;
}
DoMeleeAttackIfReady();
}
示例12: UpdateAI
void UpdateAI(uint32 uiDiff)
{
npc_escortAI::UpdateAI(uiDiff);
if (HasEscortState(STATE_ESCORT_PAUSED))
{
if (waveTimer <= uiDiff)
{
switch (wave)
{
case 0:
Talk(SAY_BREAKOUT3);
SummonAcolyte(3);
waveTimer = 20000;
break;
case 1:
Talk(SAY_BREAKOUT4);
SummonAcolyte(3);
waveTimer = 20000;
break;
case 2:
Talk(SAY_BREAKOUT5);
SummonAcolyte(4);
waveTimer = 20000;
break;
case 3:
Talk(SAY_BREAKOUT6);
me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329f, -6045.818f, 127.583f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
waveTimer = 1000;
break;
case 4:
{
Creature* temp = Unit::GetCreature(*me, valrothGUID);
if (!temp || !temp->isAlive())
{
Talk(SAY_BREAKOUT8);
waveTimer = 5000;
}
else
{
waveTimer = 2500;
return;
}
break;
}
case 5:
Talk(SAY_BREAKOUT9);
me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
waveTimer = 2500;
break;
case 6:
Talk(SAY_BREAKOUT10);
SetEscortPaused(false);
break;
}
++wave;
}
else
waveTimer -= uiDiff;
}
}
示例13: EnterCombat
void EnterCombat(Unit* pWho) {
if (HasEscortState(STATE_ESCORT_ESCORTING))
DoScriptText(RAND(SAY_ATTACKED_1, SAY_ATTACKED_2), me, pWho);
}
示例14: JustDied
void JustDied(Unit* /*killer*/) override
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
if (Player* player = GetPlayerForEscort())
player->FailQuest(QUEST_VORSHA);
}
示例15: EnterCombat
void EnterCombat(Unit* /*who*/) override
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
Talk(SAY_ELF_AGGRO);
}