diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-04-28 16:36:46 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-04-28 16:36:46 +0200 |
commit | 12049c7e393799dc456bb312d14a3b98aecebd28 (patch) | |
tree | 11ebedc28f5e8515bc7072f8e6dbdfa3ad9468a3 /src | |
parent | e474d65a2b16520216081730339665c2bf02108b (diff) | |
download | evtclib-12049c7e393799dc456bb312d14a3b98aecebd28.tar.gz evtclib-12049c7e393799dc456bb312d14a3b98aecebd28.tar.bz2 evtclib-12049c7e393799dc456bb312d14a3b98aecebd28.zip |
add more shorthands to Agent<Player|...>
Diffstat (limited to 'src')
-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. |