本文整理汇总了C++中EventMap::ScheduleEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ EventMap::ScheduleEvent方法的具体用法?C++ EventMap::ScheduleEvent怎么用?C++ EventMap::ScheduleEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventMap
的用法示例。
在下文中一共展示了EventMap::ScheduleEvent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
return;
if ((!me->HasAura(SPELL_DECIMATION_BLADE_10) && !me->HasAura(SPELL_DECIMATION_BLADE_25))
&& !me->HasAura(SPELL_INFERNO_BLADE)) //set normal 2 blade equip
SetEquipmentSlots(false, EQUIPMENT_ID_SWORD_1H, EQUIPMENT_ID_SWORD_1H, 0);
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK);
break;
case EVENT_BLAZE_OF_GLORY:
DoCast(me->GetVictim(), SPELL_BLAZE_OF_GLORY);
DoCast(me, SPELL_INCENDIARY_SOUL);
events.ScheduleEvent(EVENT_BLAZE_OF_GLORY, 20000);
break;
case EVENT_SHARDS_OF_TORMENT:
Talk(SAY_CRY_ANN);
DoCast(me, SPELL_SHARDS_OF_TORMENT);
events.ScheduleEvent(EVENT_SUMMON_SHARDS, 1000);
break;
case EVENT_DECIMATION_BLADE:
Talk(SAY_DECIMATION);
Talk(SAY_DECI_ANN);
DoCast(me, (Is25ManRaid() ? SPELL_DECIMATION_BLADE_25 : SPELL_DECIMATION_BLADE_10));
SetEquipmentSlots(false, EQUIPMENT_ID_SWORD_2H, 0, 0); //set one blade equip
events.ScheduleEvent(EVENT_INFERNO_BLADE, 30000);
break;
case EVENT_INFERNO_BLADE:
Talk(SAY_INFERNO);
Talk(SAY_INFE_ANN);
DoCast(me, SPELL_INFERNO_BLADE);
SetEquipmentSlots(false, EQUIPMENT_ID_SWORD_2H, 0, 0); //set one blade equip
events.ScheduleEvent(EVENT_DECIMATION_BLADE, 30000);
break;
case EVENT_COUNTDOWN:
Talk(SAY_COUNTDOWN);
CastCountDown();
events.ScheduleEvent(EVENT_COUNTDOWN, 40000);
break;
case EVENT_SUMMON_SHARDS:
std::list<Unit*> players;
SelectTargetList(players, Is25ManRaid() ? 2 : 1, SELECT_TARGET_RANDOM, 500.0f, true);
if (!players.empty())
for (std::list<Unit*>::iterator itr = players.begin(); itr != players.end(); ++itr)
DoCast(*itr, SPELL_SHARDS_OF_TORMENT_SUMMON);
events.ScheduleEvent(EVENT_SHARDS_OF_TORMENT, 35000);
break;
}
}
DoMeleeAttackIfReady();
}
示例2: Reset
void Reset()
{
events.Reset();
events.ScheduleEvent(EVENT_DESPAWN, 5*MINUTE*IN_MILLISECONDS);
}
示例3: UpdateAI
void UpdateAI(uint32 diff) override
{
m_events.Update(diff);
if (CheckPlayerIsInvalid())
{
Reset();
return;
}
while (uint32 eventId = m_events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_CHECK_ARRIVEL_PLAYER:
{
if (!m_videoStarted)
if (Player* player = me->FindNearestPlayer(10.0f))
if (player->GetQuestStatus(QUEST_LAST_STAND) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_LAST_CHANCE_AT_HUMANITY) == QUEST_STATUS_NONE)
{
player->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN);
m_playerGUID = player->GetGUID();
m_videoStarted = true;
if (!m_kingGUID)
if (Creature* king = me->FindNearestCreature(NPC_KING_GREYMANE, 25.0f))
m_kingGUID = king->GetGUID();
if (!m_godfreyGUID)
if (Creature* lord = me->FindNearestCreature(NPC_LORD_GODFREY, 25.0f))
m_godfreyGUID = lord->GetGUID();
m_events.ScheduleEvent(EVENT_TALK_0, 4000);
return;
}
m_events.ScheduleEvent(EVENT_CHECK_ARRIVEL_PLAYER, 1000);
break;
}
case EVENT_TALK_0:
{
m_events.ScheduleEvent(EVENT_TALK_1, 14000);
Talk(0);
break;
}
case EVENT_TALK_1:
{
if (Player* player = sObjectAccessor->GetPlayer(*me, m_playerGUID))
player->CastSpell(player, SPELL_CATACLYSM_1);
if (Creature* lord = sObjectAccessor->GetCreature(*me, m_godfreyGUID))
lord->AI()->Talk(0);
m_events.ScheduleEvent(EVENT_TALK_2, 8000);
break;
}
case EVENT_TALK_2:
{
if (Player* player = sObjectAccessor->GetPlayer(*me, m_playerGUID))
player->CastSpell(player, SPELL_CATACLYSM_2);
if (Creature* king = sObjectAccessor->GetCreature(*me, m_kingGUID))
king->AI()->Talk(0);
m_events.ScheduleEvent(EVENT_TALK_3, 9000);
break;
}
case EVENT_TALK_3:
{
if (Player* player = sObjectAccessor->GetPlayer(*me, m_playerGUID))
player->CastSpell(player, SPELL_CATACLYSM_3);
if (Creature* king = sObjectAccessor->GetCreature(*me, m_kingGUID))
king->AI()->Talk(1);
m_events.ScheduleEvent(EVENT_TALK_4, 8000);
break;
}
case EVENT_TALK_4:
{
if (Player* player = sObjectAccessor->GetPlayer(*me, m_playerGUID))
player->CastSpell(player, SPELL_LAST_STAND_COMPLETE_2);
m_events.ScheduleEvent(EVENT_RESTART, 30000);
break;
}
case EVENT_RESTART:
{
Reset();
break;
}
}
}
if (!UpdateVictim())
return;
else
DoMeleeAttackIfReady();
}
示例4: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!pInstance || !UpdateVictim())
return;
if (IsHeroic() && me->HealthBelowPct(30) && !bShadowBreath)
{
bShadowBreath = true;
if (Creature* pNefarius = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS_HEROIC, 200.0f))
pNefarius->AI()->DoAction(ACTION_SHADOW_BREATH);
}
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
/*case EVENT_HEAD_START:
SetGrounded(true, 0);
if (Creature* pMagmawhead = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MAGMAW_HEAD)))
pMagmawhead->AI()->DoAction(ACTION_HEAD_START);
events.ScheduleEvent(EVENT_HEAD_END, 20000);
break;
case EVENT_HEAD_END:
if (Creature* pMagmawhead = ObjectAccessor::GetCreature(*me, pInstance->GetData64(DATA_MAGMAW_HEAD)))
pMagmawhead->AI()->DoAction(ACTION_HEAD_END);
SetGrounded(false, 0);
events.ScheduleEvent(EVENT_MELEE_CHECK, 6000);
events.ScheduleEvent(EVENT_LAVA_SPEW, urand(3000, 7000));
events.ScheduleEvent(EVENT_PILLAR_OF_FLAME, urand(10000, 15000));
events.ScheduleEvent(EVENT_MAGMA_SPLIT, urand(15000, 20000));
break;*/
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK);
break;
case EVENT_MELEE_CHECK:
if (!me->IsWithinMeleeRange(me->getVictim()))
DoCast(me, SPELL_MAGMA_SPLIT_2);
events.ScheduleEvent(EVENT_MELEE_CHECK, 1000);
break;
case EVENT_MAGMA_SPLIT:
me->CastCustomSpell(SPELL_MAGMA_SPLIT_1, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 8, 3, 8), 0, false);
events.ScheduleEvent(EVENT_MAGMA_SPLIT, urand(15000, 20000));
break;
case EVENT_LAVA_SPEW:
DoCast (me, SPELL_LAVA_SPEW);
events.ScheduleEvent(EVENT_LAVA_SPEW, 22000);
break;
case EVENT_PILLAR_OF_FLAME:
Unit* target;
target = SelectTarget(SELECT_TARGET_RANDOM, 1, -20.0f, true);
if (!target)
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
if (!target)
break;
me->SummonCreature(NPC_PILLAR_OF_FLAME,
target->GetPositionX(),
target->GetPositionY(),
target->GetPositionZ(),
0.0f, TEMPSUMMON_TIMED_DESPAWN, 8000);
events.ScheduleEvent(EVENT_PILLAR_OF_FLAME, urand(35000, 45000));
break;
case EVENT_MANGLE:
DoCast(me->getVictim(), SPELL_MANGLE);
//events.CancelEvent(EVENT_MELEE_CHECK);
//events.CancelEvent(EVENT_LAVA_SPEW);
//events.CancelEvent(EVENT_PILLAR_OF_FLAME);
//events.CancelEvent(EVENT_MAGMA_SPLIT);
events.ScheduleEvent(EVENT_MANGLE, 95000);
//events.ScheduleEvent(EVENT_HEAD_START, 12000);
break;
}
}
if (me->getVictim())
if (!me->getVictim()->HasAura(SPELL_MANGLE) && !bGrounded)
DoMeleeAttackIfReady();
}
示例5: Reset
void Reset()
{
BossAI::Reset();
events2.Reset();
events2.ScheduleEvent(EVENT_PHANTOM, 21000);
}
示例6: EnterCombat
void EnterCombat(Unit* /*who*/)
{
events.ScheduleEvent(EVENT_SHADOW_GAZE, 1000);
}
示例7: EnterCombat
void EnterCombat(Unit* /*who*/)
{
events.ScheduleEvent(EVENT_SKULL_CRACK, 3000);
}
示例8: UpdateAI
void UpdateAI(uint32 diff)
{
events.Update(diff);
if (Creature* warlord = me->FindNearestCreature(NPC_WARLORD, 1000.0f, true))
{
if (warlord->FindNearestCreature(me->GetEntry(), 2.0f, true) && !boss)
{
boss = true;
uint32 stack = me->GetAura(AURA_DIFFUSION)->GetStackAmount();
if (stack >= 1)
warlord->CastSpell(warlord, AURA_DIFFUSION, true);
if (stack >= 2 && warlord->HasAura(AURA_DIFFUSION))
warlord->GetAura(AURA_DIFFUSION)->SetStackAmount(stack);
me->DespawnOrUnsummon(1000);
}
}
if (Creature* cmaw = me->FindNearestCreature(55544, 100.0f, true))
{
if (cmaw->GetDistance(me) >= 40.0f && !maw)
{
maw = true;
DoCast(SPELL_BLACK_BLOOD_ERUPTION);
me->NearTeleportTo(-1762.994f, -1951.96f, -226.269f, 0.0f, true);
}
}
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case SPHERE_START:
me->SetSpeed(MOVE_RUN, 0.6f);
me->GetMotionMaster()->MoveRandom(20.0f);
events.ScheduleEvent(SPHERE_TARGET, urand(5000, 15000));
break;
case SPHERE_TARGET:
player = true;
break;
case SPHERE_UPDATE:
if (player)
{
Unit* victim = SelectTarget(SELECT_TARGET_RANDOM);
me->GetMotionMaster()->MovePoint(0, victim->GetPositionX(), victim->GetPositionY(), victim->GetPositionZ());
me->SetSpeed(MOVE_RUN, 5.0f);
if (victim->FindNearestCreature(me->GetEntry(), 10.0f, true))
{
DoCast(SPELL_SPREYED_SPHERE);
events.ScheduleEvent(SPHERE_START, 2000);
player = false;
}
}
events.ScheduleEvent(SPHERE_UPDATE, 2000);
break;
}
}
}
示例9: UpdateAI
void UpdateAI(uint32 diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
return;
if (ShouldSummonAdds)
{
// Despawns the Stalker
DespawnCreatures(NPC_SHADOW_GALE_STALKER);
RemoveShadowGaleDebuffFromPlayers();
me->SetReactState(REACT_AGGRESSIVE);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveChase(me->getVictim());
if ((rand()%2))
me->MonsterYell(SAY_SUMMON, LANG_UNIVERSAL, NULL);
//Adds a visual portal effect to the Stalker
FacelessPortalStalker->GetAI()->DoCast(FacelessPortalStalker, SPELL_TWILIGHT_PORTAL_VISUAL, true);
events.ScheduleEvent(EVENT_REMOVE_TWILIGHT_PORTAL, 7000);
//Summons Faceless over the Spell
FacelessPortalStalker->GetAI()->DoCast(FacelessPortalStalker, SPELL_SPAWN_FACELESS, true);
ShouldSummonAdds = false;
// DBM says that the Spell has 40s CD
events.ScheduleEvent(EVENT_SHADOW_GALE, urand(40000, 44000));
}
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_ENFEEBLING_BLOW:
DoCastVictim(SPELL_ENFEEBLING_BLOW);
events.ScheduleEvent(EVENT_ENFEEBLING_BLOW, urand(19000, 24000));
break;
case EVENT_SHADOW_GALE:
ShadowGaleTrigger = me->SummonCreature(NPC_SHADOW_GALE_STALKER, -739.665f/*+(urand(0, 20)-10)*/, -827.024f/*+(urand(0, 20)-10)*/, 232.412f, 3.1f, TEMPSUMMON_CORPSE_DESPAWN);
me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->MovePoint(POINT_ERUDAX_IS_AT_STALKER, ShadowGaleTrigger->GetPositionX(), ShadowGaleTrigger->GetPositionY(), ShadowGaleTrigger->GetPositionZ());
// Talk(SAY_GALE);
break;
case EVENT_REMOVE_TWILIGHT_PORTAL:
//Removes Portal effect from Stalker
FacelessPortalStalker->RemoveAllAuras();
break;
case EVENT_BINDING_SHADOWS:
if (Unit* tempTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 500.0f, true))
DoCast(tempTarget, SPELL_BINDING_SHADOWS);
events.ScheduleEvent(EVENT_BINDING_SHADOWS, urand(12000, 17000));
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
示例10: EnterCombat
void EnterCombat(Unit* /*attacker*/)
{
events.Reset();
events.ScheduleEvent(EVENT_CAST_CLEAVE, urand(3000, 5000));
events.ScheduleEvent(EVENT_CAST_STARFALL, urand(8000, 10000));
}
示例11: StartGame
/*
Resets all variables and also find the ids of the four closests color clusters, since every simon
node have diferent ids for clusters this is absolutely NECESSARY.
*/
void StartGame()
{
listening = false;
gameLevel = 0;
fails = 0;
gameTicks = 0;
zCoordCorrection = large ? 8.0f : 2.75f;
searchDistance = large ? 13.0f : 5.0f;
colorSequence.clear();
playableSequence.clear();
playerSequence.clear();
me->SetObjectScale(large ? 2.0f : 1.0f);
std::list<WorldObject*> ClusterList;
Trinity::AllWorldObjectsInRange objects(me, searchDistance);
Trinity::WorldObjectListSearcher<Trinity::AllWorldObjectsInRange> searcher(me, ClusterList, objects);
me->VisitNearbyObject(searchDistance, searcher);
for (std::list<WorldObject*>::const_iterator i = ClusterList.begin(); i != ClusterList.end(); ++i)
{
if (GameObject* go = (*i)->ToGameObject())
{
// We are checking for displayid because all simon nodes have 4 clusters with different entries
if (large)
{
switch (go->GetGOInfo()->displayId)
{
case GO_BLUE_CLUSTER_DISPLAY_LARGE:
clusterIds[SIMON_BLUE] = go->GetEntry();
break;
case GO_RED_CLUSTER_DISPLAY_LARGE:
clusterIds[SIMON_RED] = go->GetEntry();
break;
case GO_GREEN_CLUSTER_DISPLAY_LARGE:
clusterIds[SIMON_GREEN] = go->GetEntry();
break;
case GO_YELLOW_CLUSTER_DISPLAY_LARGE:
clusterIds[SIMON_YELLOW] = go->GetEntry();
break;
}
}
else
{
switch (go->GetGOInfo()->displayId)
{
case GO_BLUE_CLUSTER_DISPLAY:
clusterIds[SIMON_BLUE] = go->GetEntry();
break;
case GO_RED_CLUSTER_DISPLAY:
clusterIds[SIMON_RED] = go->GetEntry();
break;
case GO_GREEN_CLUSTER_DISPLAY:
clusterIds[SIMON_GREEN] = go->GetEntry();
break;
case GO_YELLOW_CLUSTER_DISPLAY:
clusterIds[SIMON_YELLOW] = go->GetEntry();
break;
}
}
}
}
_events.Reset();
_events.ScheduleEvent(EVENT_SIMON_ROUND_FINISHED, 1000);
_events.ScheduleEvent(EVENT_SIMON_PERIODIC_PLAYER_CHECK, 2000);
if (GameObject* relic = me->FindNearestGameObject(large ? GO_APEXIS_MONUMENT : GO_APEXIS_RELIC, searchDistance))
relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
示例12: UpdateAI
void UpdateAI(const uint32 diff)
{
switch (phase)
{
case PHASE_CHAINED:
if (!anchorGUID)
{
if (Creature* anchor = me->FindNearestCreature(29521, 30))
{
anchor->AI()->SetGUID(me->GetGUID());
anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
anchorGUID = anchor->GetGUID();
}
else
sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!");
float dist = 99.0f;
GameObject* prison = NULL;
for (uint8 i = 0; i < 12; ++i)
{
if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i], 30))
{
if (me->IsWithinDist(temp_prison, dist, false))
{
dist = me->GetDistance2d(temp_prison);
prison = temp_prison;
}
}
}
if (prison)
prison->ResetDoorOrButton();
else
sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!");
}
break;
case PHASE_TO_EQUIP:
if (wait_timer)
{
if (wait_timer > diff)
wait_timer -= diff;
else
{
me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ());
//sLog->outDebug(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ());
phase = PHASE_EQUIPING;
wait_timer = 0;
}
}
break;
case PHASE_TO_ATTACK:
if (wait_timer)
{
if (wait_timer > diff)
wait_timer -= diff;
else
{
me->setFaction(14);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
phase = PHASE_ATTACKING;
if (Player* target = Unit::GetPlayer(*me, playerGUID))
me->AI()->AttackStart(target);
wait_timer = 0;
}
}
break;
case PHASE_ATTACKING:
if (!UpdateVictim())
return;
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_ICY_TOUCH:
DoCast(me->getVictim(), SPELL_ICY_TOUCH);
events.DelayEvents(1000, GCD_CAST);
events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST);
break;
case EVENT_PLAGUE_STRIKE:
DoCast(me->getVictim(), SPELL_PLAGUE_STRIKE);
events.DelayEvents(1000, GCD_CAST);
events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST);
break;
case EVENT_BLOOD_STRIKE:
DoCast(me->getVictim(), SPELL_BLOOD_STRIKE);
events.DelayEvents(1000, GCD_CAST);
events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST);
break;
case EVENT_DEATH_COIL:
DoCast(me->getVictim(), SPELL_DEATH_COIL);
events.DelayEvents(1000, GCD_CAST);
events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST);
break;
}
}
//.........这里部分代码省略.........