[][src]Struct evtclib::Agent

#[repr(C)]pub struct Agent<Kind = ()> { /* fields omitted */ }

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

impl<Kind> Agent<Kind>[src]

pub fn kind(&self) -> &AgentKind[src]

The kind of this agent.

impl<Kind> Agent<Kind>[src]

pub fn addr(&self) -> u64[src]

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.

pub fn toughness(&self) -> i16[src]

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.

pub fn concentration(&self) -> i16[src]

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.

pub fn healing(&self) -> i16[src]

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.

pub fn condition(&self) -> i16[src]

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.

pub fn instance_id(&self) -> u16[src]

The instance ID of this agent.

pub fn first_aware(&self) -> u64[src]

The timestamp of the first event entry with this agent.

pub fn last_aware(&self) -> u64[src]

The timestamp of the last event entry with this agent.

pub fn master_agent(&self) -> Option<u64>[src]

The master agent's address.

impl<Kind> Agent<Kind>[src]

pub fn erase(&self) -> &Agent[src]

Erase any extra information about the contained agent kind.

pub fn as_player(&self) -> Option<&Agent<Player>>[src]

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

pub fn as_gadget(&self) -> Option<&Agent<Gadget>>[src]

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

pub fn as_character(&self) -> Option<&Agent<Character>>[src]

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

impl Agent<Player>[src]

pub fn player(&self) -> &Player[src]

Directly access the underlying player data.

pub fn account_name(&self) -> &str[src]

Shorthand to get the player's account name.

pub fn character_name(&self) -> &str[src]

Shorthand to get the player's character name.

pub fn elite(&self) -> Option<EliteSpec>[src]

Shorthand to get the player's elite specialization.

pub fn profession(&self) -> Profession[src]

Shorthand to get the player's profession.

pub fn subgroup(&self) -> u8[src]

Shorthand to get the player's subgroup.

impl Agent<Gadget>[src]

pub fn gadget(&self) -> &Gadget[src]

Directly access the underlying gadget data.

pub fn id(&self) -> u16[src]

Shorthand to get the gadget's id.

pub fn name(&self) -> &str[src]

Shorthand to get the gadget's name.

impl Agent<Character>[src]

pub fn character(&self) -> &Character[src]

Directly access the underlying character data.

pub fn id(&self) -> u16[src]

Shorthand to get the character's id.

pub fn name(&self) -> &str[src]

Shorthand to get the character's name.

Trait Implementations

impl<Kind: Clone> Clone for Agent<Kind>[src]

impl<Kind: Debug> Debug for Agent<Kind>[src]

impl<Kind: Eq> Eq for Agent<Kind>[src]

impl<Kind: Hash> Hash for Agent<Kind>[src]

impl<Kind: PartialEq> PartialEq<Agent<Kind>> for Agent<Kind>[src]

impl<Kind> StructuralEq for Agent<Kind>[src]

impl<Kind> StructuralPartialEq for Agent<Kind>[src]

impl<'_> TryFrom<&'_ Agent> for Agent[src]

type Error = EvtcError

The type returned in the event of a conversion error.

fn try_from(raw_agent: &Agent) -> Result<Self, Self::Error>[src]

Parse a raw agent.

impl TryFrom<Agent> for Agent[src]

type Error = EvtcError

The type returned in the event of a conversion error.

fn try_from(raw_agent: Agent) -> Result<Self, Self::Error>[src]

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.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.