#[repr(C)]pub struct Agent<Kind = ()> { /* private fields */ }
Expand description
An agent.
Agents in arcdps are very versatile, as a lot of things end up being an “agent”. This includes:
- Players
- Bosses
- Any additional mobs that spawn
- Mesmer illusions
- Ranger spirits, pets
- Guardian spirit weapons
- …
Generally, you can divide them into three kinds (AgentKind
):
Player
: All players themselves.Character
: Non-player mobs, including most bosses, “adds” and player-generated characters.Gadget
: Some additional gadgets, such as ley rifts, continuum split, …
All of these agents share some common fields, which are the ones accessible in Agent<Kind>
.
The kind can be retrieved using .kind()
, which can be matched on.
Obtaining an agent
The normal way to obtain the agents is to use the .agents()
method on a
Log
, or one of the other accessor methods (like
.players()
or .agent_by_addr()
).
In the cases where you already have a raw::Agent
available, you can also
convert it to an Agent
by using the standard
TryFrom
/TryInto
traits:
use std::convert::TryInto;
let raw_agent: raw::Agent = panic!();
let agent: Agent = raw_agent.try_into().unwrap();
Note that you can convert references as well, so if you plan on re-using the raw agent
afterwards, you should opt for Agent::try_from(&raw_agent)
instead.
The Kind
parameter
The type parameter is not actually used and only exists at the type level. It can be used to
tag Agent
s containing a known kind. For example, Agent<Player>
implements
.player()
, which returns a &Player
directly (instead of a
Option<&Player>
). This works because such tagged Agent
s can only be constructed (safely)
using .as_player()
, .as_gadget()
or
.as_character()
. This is useful since functions like
Log::players
, which already filter only players, don’t require the
consumer to do another check/pattern match for the right agent kind.
The unit type ()
is used to tag Agent
s which contain an undetermined type, and it is the
default if you write Agent
without any parameters.
The downside is that methods which work on Agent
s theoretically should be generic over
Kind
. An escape hatch is the method .erase()
, which erases the kind
information and produces the default Agent<()>
. Functions/methods that only take Agent<()>
can therefore be used by any other agent as well.
Implementations
sourceimpl<Kind> Agent<Kind>
impl<Kind> Agent<Kind>
sourcepub fn addr(&self) -> u64
pub fn addr(&self) -> u64
The address of this agent.
This is not actually the address of the in-memory Rust object, but rather a serialization detail of arcdps. You should consider this as an opaque number and only compare it to other agent addresses.
sourcepub fn toughness(&self) -> i16
pub fn toughness(&self) -> i16
The toughness of this agent.
This is not an absolute number, but a relative indicator that indicates this agent’s toughness relative to the other people in the squad.
0 means lowest toughness, 10 means highest toughness.
sourcepub fn concentration(&self) -> i16
pub fn concentration(&self) -> i16
The concentration of this agent.
This is not an absolute number, but a relative indicator that indicates this agent’s concentration relative to the other people in the squad.
0 means lowest concentration, 10 means highest concentration.
sourcepub fn healing(&self) -> i16
pub fn healing(&self) -> i16
The healing power of this agent.
This is not an absolute number, but a relative indicator that indicates this agent’s healing power relative to the other people in the squad.
0 means lowest healing power, 10 means highest healing power.
sourcepub fn condition(&self) -> i16
pub fn condition(&self) -> i16
The condition damage of this agent.
This is not an absolute number, but a relative indicator that indicates this agent’s condition damage relative to the other people in the squad.
0 means lowest condition damage, 10 means highest condition damage.
sourcepub fn instance_id(&self) -> u16
pub fn instance_id(&self) -> u16
The instance ID of this agent.
sourcepub fn first_aware(&self) -> u64
pub fn first_aware(&self) -> u64
The timestamp of the first event entry with this agent.
sourcepub fn last_aware(&self) -> u64
pub fn last_aware(&self) -> u64
The timestamp of the last event entry with this agent.
sourcepub fn master_agent(&self) -> Option<u64>
pub fn master_agent(&self) -> Option<u64>
The master agent’s address.
sourceimpl<Kind> Agent<Kind>
impl<Kind> Agent<Kind>
sourcepub fn as_player(&self) -> Option<&Agent<Player>>
pub fn as_player(&self) -> Option<&Agent<Player>>
Try to convert this Agent
to an Agent
representing a Player
.
sourcepub fn as_gadget(&self) -> Option<&Agent<Gadget>>
pub fn as_gadget(&self) -> Option<&Agent<Gadget>>
Try to convert this Agent
to an Agent
representing a Gadget
.
sourcepub fn as_character(&self) -> Option<&Agent<Character>>
pub fn as_character(&self) -> Option<&Agent<Character>>
Try to convert this Agent
to an Agent
representing a Character
.
sourceimpl Agent<Player>
impl Agent<Player>
sourcepub fn account_name(&self) -> &str
pub fn account_name(&self) -> &str
Shorthand to get the player’s account name.
sourcepub fn character_name(&self) -> &str
pub fn character_name(&self) -> &str
Shorthand to get the player’s character name.
sourcepub fn profession(&self) -> Profession
pub fn profession(&self) -> Profession
Shorthand to get the player’s profession.
Trait Implementations
sourceimpl TryFrom<Agent> for Agent
impl TryFrom<Agent> for Agent
impl<Kind: Eq> Eq for Agent<Kind>
impl<Kind> StructuralEq for Agent<Kind>
impl<Kind> StructuralPartialEq for Agent<Kind>
Auto Trait Implementations
impl<Kind> RefUnwindSafe for Agent<Kind> where
Kind: RefUnwindSafe,
impl<Kind> Send for Agent<Kind> where
Kind: Send,
impl<Kind> Sync for Agent<Kind> where
Kind: Sync,
impl<Kind> Unpin for Agent<Kind> where
Kind: Unpin,
impl<Kind> UnwindSafe for Agent<Kind> where
Kind: UnwindSafe,
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