#[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

The kind of this agent.

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.

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.

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.

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.

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.

The instance ID of this agent.

The timestamp of the first event entry with this agent.

The timestamp of the last event entry with this agent.

The master agent’s address.

Erase any extra information about the contained agent kind.

Try to convert this Agent to an Agent representing a Player.

Try to convert this Agent to an Agent representing a Gadget.

Try to convert this Agent to an Agent representing a Character.

Directly access the underlying player data.

Shorthand to get the player’s account name.

Shorthand to get the player’s character name.

Shorthand to get the player’s elite specialization.

Shorthand to get the player’s profession.

Shorthand to get the player’s subgroup.

Directly access the underlying gadget data.

Shorthand to get the gadget’s id.

Shorthand to get the gadget’s name.

Directly access the underlying character data.

Shorthand to get the character’s id.

Shorthand to get the character’s name.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Parse a raw agent.

The type returned in the event of a conversion error.

Convenience method to avoid manual borrowing.

Note that this conversion will consume the agent, so if you plan on re-using it, use the TryFrom<&raw::Agent> implementation that works with a reference.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.