TrinityCore
|
#include <EventMap.h>
Public Member Functions | |||||||||||
EventMap () | |||||||||||
Reset | |||||||||||
Removes all scheduled events and resets time and phase. | |||||||||||
void | Reset () | ||||||||||
Update | |||||||||||
Updates the timer of the event map.
| |||||||||||
void | Update (uint32 time) | ||||||||||
void | Update (Milliseconds time) | ||||||||||
GetPhaseMask | |||||||||||
| |||||||||||
uint8 | GetPhaseMask () const | ||||||||||
Empty | |||||||||||
| |||||||||||
bool | Empty () const | ||||||||||
SetPhase | |||||||||||
Sets the phase of the map (absolute).
| |||||||||||
void | SetPhase (uint8 phase) | ||||||||||
AddPhase | |||||||||||
Activates the given phase (bitwise).
| |||||||||||
void | AddPhase (uint8 phase) | ||||||||||
RemovePhase | |||||||||||
Deactivates the given phase (bitwise).
| |||||||||||
void | RemovePhase (uint8 phase) | ||||||||||
ScheduleEvent | |||||||||||
Schedules a new event. An existing event is not canceled.
| |||||||||||
void | ScheduleEvent (uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0) | ||||||||||
void | ScheduleEvent (uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group=0, uint8 phase=0) | ||||||||||
RescheduleEvent | |||||||||||
Cancels the given event and reschedules it.
| |||||||||||
void | RescheduleEvent (uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0) | ||||||||||
void | RescheduleEvent (uint32 eventId, Milliseconds minTime, Milliseconds maxTime, uint32 group=0, uint8 phase=0) | ||||||||||
RepeatEvent | |||||||||||
Repeats the most recently executed event.
| |||||||||||
void | Repeat (Milliseconds time) | ||||||||||
void | Repeat (Milliseconds minTime, Milliseconds maxTime) | ||||||||||
ExecuteEvent | |||||||||||
Returns the next event to be executed and removes it from map.
| |||||||||||
uint32 | ExecuteEvent () | ||||||||||
DelayEvents | |||||||||||
Delay all events of the same group.
| |||||||||||
void | DelayEvents (Milliseconds delay) | ||||||||||
void | DelayEvents (Milliseconds delay, uint32 group) | ||||||||||
CancelEvent | |||||||||||
Cancels all events of the specified id.
| |||||||||||
void | CancelEvent (uint32 eventId) | ||||||||||
CancelEventGroup | |||||||||||
Cancel events belonging to specified group.
| |||||||||||
void | CancelEventGroup (uint32 group) | ||||||||||
IsInPhase | |||||||||||
Returns whether event map is in specified phase or not.
| |||||||||||
bool | IsInPhase (uint8 phase) const | ||||||||||
GetTimeUntilEvent | |||||||||||
Returns time as std::chrono type until next event.
| |||||||||||
Milliseconds | GetTimeUntilEvent (uint32 eventId) const | ||||||||||
ScheduleNextFromSeries | |||||||||||
Schedules specified event with next timer from series
| |||||||||||
void | ScheduleNextFromSeries (uint32 eventData) | ||||||||||
ScheduleEventSeries | |||||||||||
Schedules specified event with first value of the series and then requeues with the next
| |||||||||||
void | ScheduleEventSeries (uint32 eventId, uint8 group, uint8 phase, std::initializer_list< Milliseconds > const &timeSeries) | ||||||||||
void | ScheduleEventSeries (uint32 eventId, std::initializer_list< Milliseconds > const &series) | ||||||||||
Private Types | |
typedef std::multimap< TimePoint, uint32 > | EventStore |
typedef std::map< uint32, std::queue< Milliseconds > > | EventSeriesStore |
Private Attributes | |
_time | |
Internal timer. This does not represent the real date/time value. It's more like a stopwatch: It can run, it can be stopped, it can be resetted and so on. Events occur when this timer has reached their time value. Its value is changed in the Update method. | |
TimePoint | _time |
_phase | |
Phase mask of the event map. Contains the phases the event map is in. Multiple phases from 1 to 8 can be set with SetPhase or AddPhase. RemovePhase deactives a phase. | |
uint8 | _phase |
_eventMap | |
Internal event storage map. Contains the scheduled events. See typedef at the beginning of the class for more details. | |
EventStore | _eventMap |
_lastEvent | |
Stores information on the most recently executed event | |
uint32 | _lastEvent |
_timerSeries | |
Stores information about time series which requeue itself until series is empty | |
EventSeriesStore | _timerSeries |
Definition at line 26 of file EventMap.h.
|
private |
Definition at line 40 of file EventMap.h.
|
private |
Internal storage type. Key: Time as TimePoint when the event should occur. Value: The event data as uint32.
Structure of event data:
Definition at line 39 of file EventMap.h.
|
inline |
Definition at line 43 of file EventMap.h.
|
inline |
Definition at line 101 of file EventMap.h.
void EventMap::CancelEvent | ( | uint32 | eventId | ) |
Definition at line 131 of file EventMap.cpp.
void EventMap::CancelEventGroup | ( | uint32 | group | ) |
Definition at line 153 of file EventMap.cpp.
void EventMap::DelayEvents | ( | Milliseconds | delay | ) |
Definition at line 96 of file EventMap.cpp.
void EventMap::DelayEvents | ( | Milliseconds | delay, |
uint32 | group | ||
) |
|
inline |
uint32 EventMap::ExecuteEvent | ( | ) |
|
inline |
Milliseconds EventMap::GetTimeUntilEvent | ( | uint32 | eventId | ) | const |
|
inline |
|
inline |
Definition at line 112 of file EventMap.h.
void EventMap::Repeat | ( | Milliseconds | minTime, |
Milliseconds | maxTime | ||
) |
void EventMap::Repeat | ( | Milliseconds | time | ) |
Definition at line 63 of file EventMap.cpp.
void EventMap::RescheduleEvent | ( | uint32 | eventId, |
Milliseconds | minTime, | ||
Milliseconds | maxTime, | ||
uint32 | group = 0 , |
||
uint8 | phase = 0 |
||
) |
void EventMap::RescheduleEvent | ( | uint32 | eventId, |
Milliseconds | time, | ||
uint32 | group = 0 , |
||
uint8 | phase = 0 |
||
) |
Definition at line 52 of file EventMap.cpp.
void EventMap::Reset | ( | ) |
Definition at line 21 of file EventMap.cpp.
void EventMap::ScheduleEvent | ( | uint32 | eventId, |
Milliseconds | minTime, | ||
Milliseconds | maxTime, | ||
uint32 | group = 0 , |
||
uint8 | phase = 0 |
||
) |
void EventMap::ScheduleEvent | ( | uint32 | eventId, |
Milliseconds | time, | ||
uint32 | group = 0 , |
||
uint8 | phase = 0 |
||
) |
Definition at line 36 of file EventMap.cpp.
void EventMap::ScheduleEventSeries | ( | uint32 | eventId, |
std::initializer_list< Milliseconds > const & | series | ||
) |
void EventMap::ScheduleEventSeries | ( | uint32 | eventId, |
uint8 | group, | ||
uint8 | phase, | ||
std::initializer_list< Milliseconds > const & | timeSeries | ||
) |
Definition at line 202 of file EventMap.cpp.
void EventMap::ScheduleNextFromSeries | ( | uint32 | eventData | ) |
Definition at line 184 of file EventMap.cpp.
void EventMap::SetPhase | ( | uint8 | phase | ) |
Definition at line 28 of file EventMap.cpp.
|
inline |
Definition at line 66 of file EventMap.h.
|
inline |
|
private |
Definition at line 285 of file EventMap.h.
|
private |
Definition at line 291 of file EventMap.h.
|
private |
Definition at line 276 of file EventMap.h.
|
private |
Definition at line 266 of file EventMap.h.
|
private |
Definition at line 297 of file EventMap.h.