以下示例是关于cpp中包含EVENT用法的示例代码,想了解EVENT的具体用法?EVENT怎么用?EVENT使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。
212 GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
213 event->setEventType(event->getButtonMask() ? GUIEventAdapter::DRAG : GUIEventAdapter::MOVE);
214 event->setTime(time);
338 case(GUIEventAdapter::KEY_Shift_R): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_SHIFT | _accumulateEventState->getModKeyMask()); break;
339 case(GUIEventAdapter::KEY_Control_L): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_CTRL | _accumulateEventState->getModKeyMask()); break;
340 case(GUIEventAdapter::KEY_Control_R): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_CTRL | _accumulateEventState->getModKeyMask()); break;
341 case(GUIEventAdapter::KEY_Meta_L): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_LEFT_META | _accumulateEventState->getModKeyMask()); break;
342 case(GUIEventAdapter::KEY_Meta_R): _accumulateEventState->setModKeyMask(GUIEventAdapter::MODKEY_RIGHT_META | _accumulateEventState->getModKeyMask()); break;
416
417 GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
418 event->setEventType(GUIEventAdapter::PUSH);
499{
500 GUIEventAdapter* event = new GUIEventAdapter(*_accumulateEventState);
501 event->setEventType(GUIEventAdapter::USER);
132{
133 if (mGameEvent[event_id].state == GAMEEVENT_NORMAL || mGameEvent[event_id].state == GAMEEVENT_INTERNAL)
134 {
171{
172 bool serverwide_evt = mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL;
173
180 if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
181 mGameEvent[event_id].end = mGameEvent[event_id].start + mGameEvent[event_id].length;
182 }
348
349 if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
350 {
1563 if (mGameEvent[event_id].nextstart)
1564 trans->PAppend("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u', '%u', "UI64FMTD")", event_id, mGameEvent[event_id].state, (uint64) (mGameEvent[event_id].nextstart));
1565 else
299 {
300 sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
301 return false;
315 {
316 sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
317 return false;
639 {
640 sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
641 return false;
649 }
650 else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX)
651 {
667 {
668 if (e.action.randomPhase.phase1 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase2 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase3 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase4 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
669 {
166 QueryResult result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
167 "event_param1, event_param2, event_param3, event_param4, "
168 "action1_type, action1_param1, action1_param2, action1_param3, "
337 sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
338 sLog->outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
339 continue;
398 default:
399 sLog->outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
400 break;
516 if (temp.event_param3 < spell->RecoveryTime)
517 sLog->outDebug("CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1, action.cast.spellId, spell->RecoveryTime, temp.event_param3);
518 }
601 if (!sSpellStore.LookupEntry(action.cast_event_all.spellId))
602 sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j + 1, action.cast_event_all.spellId);
603 break;
47 {
48 sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
49 Enabled = false;
66 // Need make copy for filter unneeded steps and safe in case table reload
67 CreatureEventAI_Event_Map::const_iterator CreatureEvents = sEventAIMgr->GetCreatureEventAIMap().find(me->GetEntry());
68 if (CreatureEvents != sEventAIMgr->GetCreatureEventAIMap().end())
326 default:
327 sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
328 break;
1070 {
1071 //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
1072 if (m_EventUpdateTime <= diff)
1383
1384bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event)
1385{
122
123 for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
124 {
218
219 for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
220 {
254 QueryResult* result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
255 "event_param1, event_param2, event_param3, event_param4, "
256 "action1_type, action1_param1, action1_param2, action1_param3, "
491 default:
492 sLog.outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
493 break;
839 bool ainame = strcmp(cInfo->AIName, "EventAI") == 0;
840 bool hasevent = m_CreatureEventAI_Event_Map.find(i) != m_CreatureEventAI_Event_Map.end();
841 if (ainame && !hasevent)
41 {
42 sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
43 Enabled = false;
66 // Need make copy for filter unneeded steps and safe in case table reload
67 CreatureEventAI_Event_Map::const_iterator creatureEventsItr = sEventAIMgr.GetCreatureEventAIMap().find(m_creature->GetEntry());
68 if (creatureEventsItr != sEventAIMgr.GetCreatureEventAIMap().end())
366 default:
367 sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
368 break;
1036 {
1037 CreatureEventAI_Event const& event = (*i).Event;
1038 switch (event.event_type)
1447
1448bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event)
1449{
338 {
339 sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
340 return false;
534 GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
535 if (e.event.gameEvent.gameEventId >= events.size() || !events[e.event.gameEvent.gameEventId].isValid())
536 return false;
542 {
543 sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
544 return false;
710 }
711 else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX)
712 {
910 default:
911 sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
912 return false;
132{
133 if (mGameEvent[event_id].state == GAMEEVENT_NORMAL || mGameEvent[event_id].state == GAMEEVENT_INTERNAL)
134 {
171{
172 bool serverwide_evt = mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL;
173
180 if (mGameEvent[event_id].end <= mGameEvent[event_id].start)
181 mGameEvent[event_id].end = mGameEvent[event_id].start + mGameEvent[event_id].length;
182 }
348
349 if (mGameEvent[event_id].state != GAMEEVENT_NORMAL && mGameEvent[event_id].state != GAMEEVENT_INTERNAL)
350 {
1563 if (mGameEvent[event_id].nextstart)
1564 trans->PAppend("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u', '%u', "UI64FMTD")", event_id, mGameEvent[event_id].state, (uint64) (mGameEvent[event_id].nextstart));
1565 else
299 {
300 sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
301 return false;
315 {
316 sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
317 return false;
639 {
640 sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
641 return false;
649 }
650 else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX)
651 {
667 {
668 if (e.action.randomPhase.phase1 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase2 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase3 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase4 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
669 {
本文地址:https://www.itbaoku.cn/snippets/415948.html