From 84cba68af3d58573aba22b132ed4c3a1c5ccfaec Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Tue, 28 Apr 2020 12:21:28 +0200 Subject: move boss_id() to encounter_id(), add encounter() --- src/lib.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index b884b05..72b35ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -506,11 +506,20 @@ impl Log { self.boss_agents().into_iter().any(|a| a.addr() == addr) } - /// Returns the boss/encounter id. - pub fn boss_id(&self) -> u16 { + /// Returns the encounter id. + pub fn encounter_id(&self) -> u16 { self.boss_id } + /// Returns the encounter, if present. + /// + /// Some logs don't have an encounter set or have an ID that is unknown to us (for example, if + /// people set up arcdps with custom IDs). Therefore, this method can only return the encounter + /// if we know about it in [`Boss`][Boss]. + pub fn encounter(&self) -> Option { + Boss::from_u16(self.boss_id) + } + /// Return all events present in this log. pub fn events(&self) -> &[Event] { &self.events -- cgit v1.2.3