aboutsummaryrefslogtreecommitdiff
path: root/src/raw/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/raw/types.rs')
-rw-r--r--src/raw/types.rs25
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!(