diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -442,6 +442,31 @@ impl Agent<Player> { pub fn player(&self) -> &Player { self.kind.as_player().expect("Agent<Player> had no player!") } + + /// Shorthand to get the player's account name. + pub fn account_name(&self) -> &str { + self.player().account_name() + } + + /// Shorthand to get the player's character name. + pub fn character_name(&self) -> &str { + self.player().character_name() + } + + /// Shorthand to get the player's elite specialization. + pub fn elite(&self) -> Option<EliteSpec> { + self.player().elite() + } + + /// Shorthand to get the player's profession. + pub fn profession(&self) -> Profession { + self.player().profession() + } + + /// Shorthand to get the player's subgroup. + pub fn subgroup(&self) -> u8 { + self.player().subgroup() + } } impl Agent<Gadget> { @@ -449,6 +474,16 @@ impl Agent<Gadget> { pub fn gadget(&self) -> &Gadget { self.kind.as_gadget().expect("Agent<Gadget> had no gadget!") } + + /// Shorthand to get the gadget's id. + pub fn id(&self) -> u16 { + self.gadget().id() + } + + /// Shorthand to get the gadget's name. + pub fn name(&self) -> &str { + self.gadget().name() + } } impl Agent<Character> { @@ -458,6 +493,16 @@ impl Agent<Character> { .as_character() .expect("Agent<Character> had no character!") } + + /// Shorthand to get the character's id. + pub fn id(&self) -> u16 { + self.character().id() + } + + /// Shorthand to get the character's name. + pub fn name(&self) -> &str { + self.character().name() + } } /// A fully processed log file. |