aboutsummaryrefslogtreecommitdiff
path: root/src/event.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2018-04-23 17:00:14 +0200
committerDaniel Schadt <kingdread@gmx.de>2018-04-23 17:00:14 +0200
commitc6cd5dfef5ca037862c79f7abe460e1b88c8dab4 (patch)
tree5ed70f85bb238184b9f32a9b33b4e721d7dcb1ed /src/event.rs
parent6165bf6e4cfde199c3bc8bd0b862eb7de309aec3 (diff)
downloadevtclib-c6cd5dfef5ca037862c79f7abe460e1b88c8dab4.tar.gz
evtclib-c6cd5dfef5ca037862c79f7abe460e1b88c8dab4.tar.bz2
evtclib-c6cd5dfef5ca037862c79f7abe460e1b88c8dab4.zip
more documentation
Diffstat (limited to 'src/event.rs')
-rw-r--r--src/event.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/event.rs b/src/event.rs
index f9489e6..0b28147 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -104,18 +104,39 @@ pub enum EventKind {
},
}
+/// A higher-level representation of a combat event.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Event {
+ /// The time when the event happened.
+ ///
+ /// This are the milliseconds since Windows has been started (`timeGetTime()`).
pub time: u64,
+ /// The kind of the event.
pub kind: EventKind,
+ /// Whether the agent had more than 90% of its health.
+ ///
+ /// This is the scholar threshold.
pub is_ninety: bool,
+ /// Whether the target health was below 50%.
+ ///
+ /// This is the threshold for many runes and trait damage modifiers (e.g.
+ /// *Bolt to the Heart*).
pub is_fifty: bool,
+ /// Whether the source agent was moving.
pub is_moving: bool,
+ /// Whether the source agent was flanking the target.
pub is_flanking: bool,
+ /// Whether some (or all) damage was mitigated by shields.
pub is_shields: bool,
}
impl Event {
+ /// Transform a raw event to a "high-level" event.
+ ///
+ /// If the event is not known, or some other error occured, `None` is
+ /// returned.
+ ///
+ /// * `raw_event` - the raw event to transform.
pub fn from_raw(raw_event: &raw::CbtEvent) -> Option<Event> {
use raw::CbtStateChange;
let kind = match raw_event.is_statechange {
@@ -211,6 +232,7 @@ fn check_activation(raw_event: &raw::CbtEvent) -> Option<EventKind> {
CbtActivation::CancelFire => Activation::CancelFire(raw_event.value),
CbtActivation::CancelCancel => Activation::CancelCancel(raw_event.value),
CbtActivation::Reset => Activation::Reset,
+ // Already checked and handled above
CbtActivation::None => unreachable!(),
},
}),
@@ -290,7 +312,7 @@ pub enum WeaponSet {
impl WeaponSet {
/// Parse a given integer into the correct enum value.
- pub fn from_u64(value: u64) -> WeaponSet {
+ fn from_u64(value: u64) -> WeaponSet {
match value {
// magic constants from arcdps README
0 => WeaponSet::Water0,