#[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 Agents 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 Agents 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 Agents 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 Agents 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§
Source§impl<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.
Source§impl<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.
Source§impl 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.