aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-09-28 13:28:29 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-09-28 13:28:29 +0200
commitba10db6e8120fe9315bf0dec99e9dee188b8332c (patch)
tree9d3a2d831aa0b9ecc20cc21010f2d782fba55d2e /src/lib.rs
parent3b79ad8fa9b4a8c9c535b417129e3f70769074e0 (diff)
parent132bc6e276bf996b8a67990ad32042b8023d8786 (diff)
downloadevtclib-ba10db6e8120fe9315bf0dec99e9dee188b8332c.tar.gz
evtclib-ba10db6e8120fe9315bf0dec99e9dee188b8332c.tar.bz2
evtclib-ba10db6e8120fe9315bf0dec99e9dee188b8332c.zip
Merge branch 'boss-encounter-split' into master
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0c934ec..ecdc876 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -104,7 +104,8 @@ mod processing;
pub use processing::{process, process_file, process_stream, Compression};
pub mod gamedata;
-pub use gamedata::{Boss, EliteSpec, Profession};
+use gamedata::Boss;
+pub use gamedata::{EliteSpec, Encounter, Profession};
pub mod analyzers;
pub use analyzers::{Analyzer, Outcome};
@@ -758,20 +759,12 @@ impl Log {
/// This correctly returns multiple agents on encounters where multiple
/// agents are needed.
pub fn boss_agents(&self) -> Vec<&Agent> {
- let boss_ids = if self.boss_id == Boss::Xera as u16 {
- vec![self.boss_id, gamedata::XERA_PHASE2_ID]
- } else if self.boss_id == Boss::LargosTwins as u16 {
- vec![gamedata::NIKARE_ID, gamedata::KENUT_ID]
- } else if self.encounter() == Some(Boss::VoiceOfTheFallen) {
- vec![
- gamedata::VOICE_OF_THE_FALLEN_ID,
- gamedata::CLAW_OF_THE_FALLEN_ID,
- ]
- } else {
- vec![self.boss_id]
- };
+ let bosses = self
+ .encounter()
+ .map(Encounter::bosses)
+ .unwrap_or(&[] as &[_]);
self.npcs()
- .filter(|c| boss_ids.contains(&c.character().id))
+ .filter(|c| bosses.iter().any(|boss| *boss as u16 == c.character().id))
.map(Agent::erase)
.collect()
}
@@ -791,16 +784,10 @@ impl Log {
///
/// 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].
+ /// if we know about it in [`Encounter`].
#[inline]
- pub fn encounter(&self) -> Option<Boss> {
- // Sometimes, encounters of the strike mission "Voice of the Fallen and Claw of the Fallen"
- // are saved with the ID of the Claw and sometimes with the Voice. Therefore, we need to
- // unify those cases.
- if self.boss_id == gamedata::CLAW_OF_THE_FALLEN_ID {
- return Some(Boss::VoiceOfTheFallen);
- }
- Boss::from_u16(self.boss_id)
+ pub fn encounter(&self) -> Option<Encounter> {
+ Boss::from_u16(self.boss_id).map(Boss::encounter)
}
/// Return an analyzer suitable to analyze the given log.