diff options
| author | Daniel Schadt <kingdread@gmx.de> | 2018-04-23 15:14:35 +0200 | 
|---|---|---|
| committer | Daniel Schadt <kingdread@gmx.de> | 2018-04-23 15:14:35 +0200 | 
| commit | 1a465ee75229d1268f20f2739ba29c4f84f70e7f (patch) | |
| tree | 747cb3d817aa66f150824f799b3987cbea80e877 /src/raw | |
| parent | 6e7431f0ce600502c335b75c8acfe0cf448b68e6 (diff) | |
| download | evtclib-1a465ee75229d1268f20f2739ba29c4f84f70e7f.tar.gz evtclib-1a465ee75229d1268f20f2739ba29c4f84f70e7f.tar.bz2 evtclib-1a465ee75229d1268f20f2739ba29c4f84f70e7f.zip | |
add basic translation to more readable events
This basically implements the "event logic" as described in the README,
though it produces easier-to-digest events.
The test binary show 0 failed events on an example log, but of course,
not all mechanics are used there, and the parsing logic may very well
contain some errors.
Diffstat (limited to 'src/raw')
| -rw-r--r-- | src/raw/types.rs | 25 | 
1 files changed, 24 insertions, 1 deletions
| diff --git a/src/raw/types.rs b/src/raw/types.rs index f94c4c2..f616398 100644 --- a/src/raw/types.rs +++ b/src/raw/types.rs @@ -1,4 +1,4 @@ -use std::fmt; +use std::{self, fmt};  /// The "friend or foe" enum.  #[repr(C)] @@ -234,6 +234,29 @@ pub struct Agent {      pub name: [u8; 64],  } +impl Agent { +    /// Checks whether this agent is a gadget. +    /// +    /// Gadgets are entities spawned by some skills, like the "Binding Roots" +    /// spawned by Entangle. +    pub fn is_gadget(&self) -> bool { +        self.is_elite == std::u32::MAX && (self.prof & 0xffff0000) == 0xffff0000 +    } + +    /// Checks whether this agent is a character. +    /// +    /// Characters are entities like clones, pets, minions, spirits, but also +    /// minis. +    pub fn is_character(&self) -> bool { +        self.is_elite == std::u32::MAX && (self.prof & 0xffff0000) != 0xffff0000 +    } + +    /// Checks whether this agent is a player. +    pub fn is_player(&self) -> bool { +        self.is_elite != std::u32::MAX +    } +} +  impl fmt::Debug for Agent {      fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {          write!( | 
