本文整理汇总了C++中EventMap::CancelEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ EventMap::CancelEvent方法的具体用法?C++ EventMap::CancelEvent怎么用?C++ EventMap::CancelEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventMap
的用法示例。
在下文中一共展示了EventMap::CancelEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DamageTaken
void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
{
if (me->HealthBelowPctDamaged(5, uiDamage))
{
if (lifei)
{
lifei->UnSummon();
lifei = NULL;
}
uiDamage = 0;
me->MonsterSay("I can't meditate!", LANG_UNIVERSAL, 0);
me->SetFullHealth();
me->SetReactState(REACT_DEFENSIVE);
std::list<Creature*> unitlist;
GetCreatureListWithEntryInGrid(unitlist, me, 59637, 50.0f);
for (auto creature: unitlist)
me->Kill(creature);
events.ScheduleEvent(EVENT_START, 20000);
events.CancelEvent(EVENT_SPAWN_MOBS);
events.CancelEvent(EVENT_PROGRESS);
events.CancelEvent(EVENT_END);
}
}
示例2: DoAction
void DoAction(const int32 action)
{
switch (action)
{
case ACTION_EYE_DRAIN_LIFE:
events.ScheduleEvent(EVENT_DRAIN_LIFE, 12000);
break;
case ACTION_MAZE_START:
events.CancelEvent(EVENT_LINGERING_GAZE);
events.CancelEvent(EVENT_FORCE_OF_WILL);
break;
case ACTION_MAZE_END:
switch (me->GetEntry())
{
case MIND_EYE:
events.ScheduleEvent(EVENT_FORCE_OF_WILL, 25000);
break;
case APPRAYISYING_EYE:
events.ScheduleEvent(EVENT_LINGERING_GAZE, 19000);
break;
default:
break;
}
break;
default:
break;
}
}
示例3: UpdateAI
void UpdateAI(const uint32 diff)
{
events.Update(diff);
if (!xinTrigger)
if (Creature* trigger = me->FindNearestCreature(NPC_XIN_TRIGGER, 1.0f))
{
me->Relocate(trigger->GetHomePosition());
me->SetFacingTo(0.0f);
xinTrigger = true;
}
while(uint32 eventId = events.ExecuteEvent())
{
switch(eventId)
{
if (instance)
{
case EVENT_INTRO_1:
Talk(SAY_INTRO_1);
me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
events.ScheduleEvent(EVENT_INTRO_2, 12*IN_MILLISECONDS);
events.CancelEvent(EVENT_INTRO_1);
break;
case EVENT_INTRO_2:
Talk(SAY_INTRO_2);
events.ScheduleEvent(EVENT_JUMP_BACK, 12*IN_MILLISECONDS);
events.CancelEvent(EVENT_INTRO_2);
break;
case EVENT_JUMP_BACK:
me->GetMotionMaster()->MoveJump(XinJumpPosition, 10.0f, 10.0f);
events.ScheduleEvent(EVENT_CHOOSE_BOSS, 3*IN_MILLISECONDS);
events.CancelEvent(EVENT_JUMP_BACK);
break;
case EVENT_CHOOSE_BOSS:
if (Creature* boss = /*RAND(*/me->GetCreature(*me, instance->GetData64(DATA_KUAI_THE_BRUTE)))/*,
me->GetCreature(*me, instance->GetData64(DATA_MING_THE_CUNNING)),
me->GetCreature(*me, instance->GetData64(DATA_HAIYAN_THE_UNSTOPPABLE)))*/
boss->AI()->DoAction(ACTION_BOSS_ENTER_COMBAT);
events.CancelEvent(EVENT_CHOOSE_BOSS);
break;
default:
break;
}
}
}
}
示例4: SpellHit
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (!caster || !pInstance)
return;
switch (spell->Id)
{
case SPELL_LAUNCH_CHAIN:
{
uint32 spell = 0;
if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_1) )
spell = SPELL_CHAIN_1;
else if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_2) )
spell = SPELL_CHAIN_2;
else if( caster->GetGUID() == pInstance->GetData64(DATA_HARPOON_FIRE_STATE_3) )
spell = SPELL_CHAIN_3;
else
spell = SPELL_CHAIN_4;
caster->CastSpell(me, spell, true);
}
break;
case SPELL_CHAIN_1:
case SPELL_CHAIN_2:
case SPELL_CHAIN_3:
case SPELL_CHAIN_4:
{
uint8 count = 0;
if( me->HasAura(SPELL_CHAIN_1) )
count++;
if( me->HasAura(SPELL_CHAIN_3) )
count++;
if (RAID_MODE(0,1))
{
if( me->HasAura(SPELL_CHAIN_2) )
count++;
if( me->HasAura(SPELL_CHAIN_4) )
count++;
}
if( count >= REQ_CHAIN_COUNT )
{
if (Creature* commander = ObjectAccessor::GetCreature(*me, CommanderGUID))
commander->AI()->Talk(SAY_COMMANDER_GROUND);
me->InterruptNonMeleeSpells(true);
events.CancelEvent(EVENT_SPELL_FIREBALL);
events.CancelEvent(EVENT_SPELL_DEVOURING_FLAME);
events.CancelEvent(EVENT_SUMMON_MOLE_MACHINES);
me->SetTarget(0);
me->SendMeleeAttackStop(me->GetVictim());
me->GetMotionMaster()->MoveLand(0, CORDS_GROUND, 25.0f);
}
}
break;
}
}
示例5: PassengerBoarded
void PassengerBoarded(Unit* who, int8 seatId, bool apply)
{
if (apply)
events.ScheduleEvent(EVENT_TENTACLE_TOSS, urand(6000, 18000));
else
{
events.ScheduleEvent(EVENT_TENTACLE_TOSS_V, urand(5000, 15000));
events.CancelEvent(EVENT_TENTACLE_TOSS); // If Logout player
events.CancelEvent(EVENT_TENTACLE_TOSS_J); // If Logout player
}
}
示例6: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
{
switch(eventId)
{
case EVENT_SAY_AGGRO_2:
me->MonsterSay(SAY_AGGRO_2, 0, 0);
events.CancelEvent(EVENT_SAY_AGGRO_2);
break;
case EVENT_SAY_AGGRO_3:
me->MonsterSay(SAY_AGGRO_3, 0, 0);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
events.CancelEvent(EVENT_SAY_AGGRO_3);
break;
case EVENT_CALL_BAXTER:
me->MonsterSay(SAY_BAXTER, 0, 0);
if (Creature* Baxter = me->GetCreature(*me, pInstance->GetData64(DATA_BAXTER)))
Baxter->AI()->DoAction(ACTION_START);
events.CancelEvent(EVENT_CALL_BAXTER);
break;
case EVENT_CALL_FRYE:
me->MonsterSay(SAY_FRYE, 0, 0);
if (Creature* Frye = me->GetCreature(*me, pInstance->GetData64(DATA_FRYE)))
Frye->AI()->DoAction(ACTION_START);
events.CancelEvent(EVENT_CALL_FRYE);
break;
case EVENT_PERFUME_SPRAY:
DoCastVictim(SPELL_PERFUME_SPRAY);
events.RescheduleEvent(EVENT_PERFUME_SPRAY, urand(4000, 6000));
break;
case EVENT_CHAIN_REACTION:
DoCast(SPELL_CHAIN_REACTION);
events.RescheduleEvent(EVENT_PERFUME_SPRAY, 6000);
events.RescheduleEvent(EVENT_CHAIN_REACTION, 40000);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
示例7: UpdateAI
void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasAura(SPELL_CONDENSE) && !form_1)
{
events.ScheduleEvent(EVENT_CONDENSING_VAPOR, 2000);
form_1 = true;
} else if (me->HasAura(SPELL_CONDENSE_2) && !form_2)
{
me->SetDisplayId(25654);
events.CancelEvent(EVENT_CONDENSING_VAPOR);
events.ScheduleEvent(EVENT_SWIRLING_VAPOR, 2000);
form_2 = true;
} else if (me->HasAura(SPELL_CONDENSE_3) && !form_3)
{
me->SetDisplayId(36455);
events.CancelEvent(EVENT_SWIRLING_VAPOR);
events.ScheduleEvent(EVENT_FREEZING_VAPOR, 2000);
form_3 = true;
}
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_CONDENSING_VAPOR:
DoCastVictim(SPELL_CONDENSING_VAPOR);
events.ScheduleEvent(EVENT_SWIRLING_VAPOR, 3500);
break;
case EVENT_SWIRLING_VAPOR:
DoCastVictim(SPELL_SWIRLING_VAPOR);
events.ScheduleEvent(EVENT_SWIRLING_VAPOR, 3500);
break;
case EVENT_FREEZING_VAPOR:
DoCastVictim(SPELL_FREEZING_VAPOR);
events.ScheduleEvent(EVENT_COALESCE, 5000);
break;
case EVENT_COALESCE:
DoCastVictim(SPELL_COALESCE);
break;
}
}
DoMeleeAttackIfReady();
}
示例8: DoAction
void DoAction(int32 action)
{
switch(action)
{
case ACTION_GET_IMPALED:
Talk(ANN_IMPALED);
me->RemoveAura(SPELL_CUSTOM_STATE_05);
DoCast(me, SPELL_CUSTOM_STATE_04); // Pinned
// Make head visible and attackable.
if (Unit* head = vehicle->GetPassenger(0))
{
head->SetHealth(me->GetHealth());
head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->CastSpell(head, SPELL_POINT_OF_VULNERABILITY, true);
head->CastSpell(head, SPELL_POINT_OF_VULNERABILITY2, true);
}
events.ScheduleEvent(EVENT_LEAVE_GROUND_PHASE, 33000);
events.ScheduleEvent(EVENT_EJECT_PINCERS, 1000);
events.CancelEvent(EVENT_KILL_TANK);
break;
case ACTION_BREAK_LOOSE:
events.ScheduleEvent(EVENT_BREAK_FREE, 6000);
break;
default:
break;
}
}
示例9: DamageTaken
void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/)
{
if (phase == 0 && !HealthAbovePct(66) && !me->HasUnitState(UNIT_STATE_ROOT))
{
phase = 1;
me->SetReactState(REACT_PASSIVE);
me->SetTarget(0);
me->SendMeleeAttackStop(me->GetVictim());
events.DelayEvents(8000);
me->CastSpell(me, SPELL_THUNDERING_STOMP, false);
events.RescheduleEvent(EVENT_JUMP, 1250);
return;
}
if (phase == 1 && !HealthAbovePct(33) && !me->HasUnitState(UNIT_STATE_ROOT))
{
events.CancelEvent(EVENT_SPELL_CHILLING_WAVE);
phase = 2;
me->SetReactState(REACT_PASSIVE);
me->SetTarget(0);
me->SendMeleeAttackStop(me->GetVictim());
events.DelayEvents(8000);
me->CastSpell(me, SPELL_THUNDERING_STOMP, false);
events.RescheduleEvent(EVENT_JUMP, 1250);
return;
}
}
示例10: DamageTaken
void DamageTaken(Unit* /*pDoneBy*/, uint32& /*uiDamage*/)
{
if (HealthBelowPct(66) && !phase2)
{
phase2 = true;
DoCast(me, SPELL_THUNDERING_STOMP);
// TODO: should go to a forge
DoCast(me, SPELL_FORGE_BLADE);
// TODO: should equip when spell completes
SetEquipmentSlots(false, EQUIP_ID_SWORD, -1, -1);
me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE);
events.ScheduleEvent(EVENT_CHILLINGWAVE, 10000);
}
if (HealthBelowPct(33) && !phase3)
{
phase3 = true;
DoCast(me, SPELL_THUNDERING_STOMP);
// TODO: should go to a forge
DoCast(me, SPELL_FORGE_MACE);
// TODO: should equip when spell completes
SetEquipmentSlots(false, EQUIP_ID_MACE, -1, -1);
me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE);
events.CancelEvent(EVENT_CHILLINGWAVE); // cast only in phase 2.
events.ScheduleEvent(EVENT_DEEPFREEZE, 10000);
}
}
示例11: UpdateAI
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_TWILIGHT_SHIFT:
DoCast(me, SPELL_TWILIGHT_SHIFT);
events.ScheduleEvent(EVENT_TWILIGHT_SHIFT, urand(30000, 35000));
events.ScheduleEvent(EVENT_NEXT_TARGET_ON, 3000);
break;
case EVENT_NEXT_TARGET_ON:
DoResetThreat();
events.ScheduleEvent(EVENT_NEXT_TARGET_ON, 3000);
break;
case EVENT_NEXT_TARGET_OFF:
events.CancelEvent(EVENT_NEXT_TARGET_ON);
break;
}
}
DoMeleeAttackIfReady();
}
示例12: SummonedCreatureDies
void SummonedCreatureDies(Creature* creature, Unit* /*pKiller*/)
{
summons.Despawn(creature);
if (creature->GetEntry() == NPC_VICIOUS_MINDLASHER)
{
uiMindLasherCount++;
if (uiMindLasherCount > 2)
{
Talk(SAY_PHASE_2_2);
events.CancelEvent(EVENT_SUMMON_MURLOC);
events.ScheduleEvent(EVENT_PHASE_2_2, 10000);
events.ScheduleEvent(EVENT_SUMMON_SAPPER, 8000);
events.ScheduleEvent(EVENT_SUMMON_BEAST, 14000);
events.ScheduleEvent(EVENT_BLIGHT_OF_OZUMAT, urand(9000, 11000));
}
else
events.ScheduleEvent(EVENT_SUMMON_MINDLASHER, urand(10000, 15000));
}
else if (creature->GetEntry() == NPC_FACELESS_SAPPER)
{
uiSapperCount++;
if (uiSapperCount > 2)
{
bActive = false;
Talk(SAY_PHASE_3_1);
CompleteEncounter();
}
}
}
示例13: UpdateAI
void UpdateAI(uint32 diff) override
{
m_events.Update(diff);
while (uint32 eventId = m_events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_CHECK_PLAYER:
{
Vehicle* catapult = me->GetVehicleKit();
Unit* unit = catapult->GetPassenger(0);
if (catapult)
if (unit)
{
if (Creature* forsaken = unit->ToCreature())
{
if (forsaken->IsInCombat())
{
forsaken->ExitVehicle();
forsaken->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
m_events.ScheduleEvent(EVENT_MASTER_RESET, 10000);
}
}
}
else
{
if (me->getFaction() != 35)
{
m_events.CancelEvent(EVENT_CAST_BOULDER_PREPARE);
me->setFaction(35);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN);
}
break;
}
m_events.ScheduleEvent(EVENT_CHECK_PLAYER, 1000);
break;
}
case EVENT_CAST_BOULDER_PREPARE:
{
me->CastSpell(me, SPELL_FIERY_BOULDER, true);
m_events.ScheduleEvent(EVENT_CAST_BOULDER_PREPARE, urand(8000,15000));
break;
}
case EVENT_MASTER_RESET:
{
me->DespawnOrUnsummon(1);
break;
}
}
}
if (!UpdateVictim())
return;
else
DoMeleeAttackIfReady();
}
示例14: UpdateAI
void UpdateAI(uint32 diff)
{
events.Update(diff);
while(uint32 eventId = events.ExecuteEvent())
{
switch(eventId)
{
if (instance)
{
case EVENT_AGGRO:
Talk(SAY_OSONG_AGGRO);
events.ScheduleEvent(EVENT_ATTACK_STRIFE, 2*IN_MILLISECONDS);
break;
case EVENT_ATTACK_STRIFE:
if (Creature* strife = me->FindNearestCreature(NPC_STRIFE, 99999.0f))
{
me->AI()->AttackStart(strife);
me->AddThreat(strife, 99999.0f);
}
events.ScheduleEvent(EVENT_ATTACK_PERIL, 8*IN_MILLISECONDS);
events.CancelEvent(EVENT_ATTACK_STRIFE);
break;
case EVENT_ATTACK_PERIL:
if (Creature* peril = me->FindNearestCreature(NPC_PERIL, 99999.0f))
{
me->AI()->AttackStart(peril);
me->AddThreat(peril, 99999.0f);
}
events.ScheduleEvent(EVENT_ATTACK_STRIFE, 8*IN_MILLISECONDS);
events.CancelEvent(EVENT_ATTACK_PERIL);
break;
default:
break;
}
}
}
DoMeleeAttackIfReady();
}
示例15: SetGUID
void SetGUID(uint64 playerGUID, int32 faction)
{
_playerGUID = playerGUID;
_faction = faction;
SetEscortPaused(false);
if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0]))
active->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
events.CancelEvent(EVENT_WAIT_FOR_ASSIST);
}