diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-04-28 12:21:28 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-04-28 12:21:28 +0200 |
commit | 84cba68af3d58573aba22b132ed4c3a1c5ccfaec (patch) | |
tree | 10f7772ceff62646ff9a35c9cf5b320318e3f62d /src | |
parent | 134c9eb670095210672ec125c2df755fe7ec341e (diff) | |
download | evtclib-84cba68af3d58573aba22b132ed4c3a1c5ccfaec.tar.gz evtclib-84cba68af3d58573aba22b132ed4c3a1c5ccfaec.tar.bz2 evtclib-84cba68af3d58573aba22b132ed4c3a1c5ccfaec.zip |
move boss_id() to encounter_id(), add encounter()
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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> { + Boss::from_u16(self.boss_id) + } + /// Return all events present in this log. pub fn events(&self) -> &[Event] { &self.events |