pub struct Event { /* private fields */ }
Expand description
A higher-level representation of a combat event.
Events can be many things, from damage events to general status messages (e.g. there’s
EventKind::MapId
to give information about the current map). The main way
to use events is to match on the EventKind
stored in .kind
and
then decide how to proceed. Note that all Event
s have certain fields that are always
present, but they might not always be useful or contain sensible information. This is just an
artifact of how arcdps saves the events.
The main way to deal with events is to iterate/use the .events()
provided by a parsed Log
. However, if you end up working with raw events
(CbtEvent
), then you can convert them to a “high-level” event using the
standard TryFrom
/TryInto
mechanisms:
use std::convert::TryInto;
let raw_event: raw::CbtEvent = panic!();
let event: Event = raw_event.try_into().unwrap();
Note that if you plan on re-using the raw event afterwards, you should use the implementation
that works on a reference instead: Event::try_from(&raw_event)
.
Implementations
sourceimpl Event
impl Event
sourcepub fn time(&self) -> u64
pub fn time(&self) -> u64
The time when the event happened.
This are the milliseconds since Windows has been started (timeGetTime()
).
sourcepub fn is_ninety(&self) -> bool
pub fn is_ninety(&self) -> bool
Whether the agent had more than 90% of its health.
This is the scholar threshold.
sourcepub fn is_fifty(&self) -> bool
pub fn is_fifty(&self) -> 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).
sourcepub fn is_flanking(&self) -> bool
pub fn is_flanking(&self) -> bool
Whether the source agent was flanking the target.
sourcepub fn is_shields(&self) -> bool
pub fn is_shields(&self) -> bool
Whether some (or all) damage was mitigated by shields.
Trait Implementations
sourceimpl TryFrom<&'_ CbtEvent> for Event
impl TryFrom<&'_ CbtEvent> for Event
sourcefn try_from(raw_event: &CbtEvent) -> Result<Self, Self::Error>
fn try_from(raw_event: &CbtEvent) -> Result<Self, Self::Error>
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.
type Error = FromRawEventError
type Error = FromRawEventError
The type returned in the event of a conversion error.
sourceimpl TryFrom<CbtEvent> for Event
impl TryFrom<CbtEvent> for Event
sourcefn try_from(raw_event: CbtEvent) -> Result<Self, Self::Error>
fn try_from(raw_event: CbtEvent) -> Result<Self, Self::Error>
Convenience method to avoid manual borrowing.
Note that this conversion will consume the event, so if you plan on re-using it, use the
TryFrom<&raw::CbtEvent>
implementation that works with a reference.
type Error = FromRawEventError
type Error = FromRawEventError
The type returned in the event of a conversion error.
impl StructuralPartialEq for Event
Auto Trait Implementations
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more