diff options
author | Daniel <kingdread@gmx.de> | 2020-10-04 11:48:26 +0200 |
---|---|---|
committer | Daniel <kingdread@gmx.de> | 2020-10-04 11:48:26 +0200 |
commit | 5ae375078d981e9efb3ac6ea68572f941fc883cf (patch) | |
tree | 6718d823ec6c08a67b665a31fb0ee8396aa651f6 /src | |
parent | 16a3472627e421488ec461447301a39fcca1d4ef (diff) | |
download | raidgrep-5ae375078d981e9efb3ac6ea68572f941fc883cf.tar.gz raidgrep-5ae375078d981e9efb3ac6ea68572f941fc883cf.tar.bz2 raidgrep-5ae375078d981e9efb3ac6ea68572f941fc883cf.zip |
update to newest evtclib
There's a good chance that this will be evtclib 0.5, so we want to adapt
our API usage (mainly replacing evtclib::Boss with evtclib::Encounter).
The naming is a bit all over the place now, as we sometimes refer to
bosses and sometimes to encounters, but I hope to make a sensible
decision at *some point* about what we're actually doing here.
Diffstat (limited to 'src')
-rw-r--r-- | src/fexpr/grammar.lalrpop | 6 | ||||
-rw-r--r-- | src/filters/log.rs | 10 | ||||
-rw-r--r-- | src/main.rs | 12 | ||||
-rw-r--r-- | src/output/formats.rs | 2 | ||||
-rw-r--r-- | src/output/sorting.rs | 2 |
5 files changed, 16 insertions, 16 deletions
diff --git a/src/fexpr/grammar.lalrpop b/src/fexpr/grammar.lalrpop index 092407e..6333783 100644 --- a/src/fexpr/grammar.lalrpop +++ b/src/fexpr/grammar.lalrpop @@ -9,7 +9,7 @@ use super::{ DurationProducer, CountProducer, }; -use evtclib::Boss; +use evtclib::Encounter; use std::collections::HashSet; use lalrpop_util::ParseError; @@ -61,7 +61,7 @@ LogPredicate: Box<dyn filters::log::LogFilter> = { "-log-before" <Date> => filters::log::log_before(<>), "-log-after" <Date> => filters::log::log_after(<>), - "-boss" <Comma<Boss>> => filters::log::boss(<>), + "-boss" <Comma<Encounter>> => filters::log::encounter(<>), "-cm" => filters::log::challenge_mote(), "-include" => filters::constant(true), @@ -138,7 +138,7 @@ Weekday: Weekday = { }), } -Boss: Boss = { +Encounter: Encounter = { <l:@L> <w:word> =>? w.parse().map_err(|_| ParseError::User { error: FError { location: l, diff --git a/src/filters/log.rs b/src/filters/log.rs index 10258a0..bd02b21 100644 --- a/src/filters/log.rs +++ b/src/filters/log.rs @@ -9,7 +9,7 @@ use super::{ use std::collections::HashSet; -use evtclib::Boss; +use evtclib::Encounter; use chrono::{DateTime, Datelike, Utc, Weekday}; use num_traits::FromPrimitive as _; @@ -18,22 +18,22 @@ use num_traits::FromPrimitive as _; pub trait LogFilter = Filter<EarlyLogResult, LogResult>; #[derive(Debug, Clone)] -struct BossFilter(HashSet<Boss>); +struct BossFilter(HashSet<Encounter>); impl Filter<EarlyLogResult, LogResult> for BossFilter { fn filter_early(&self, early_log: &EarlyLogResult) -> Inclusion { - let boss = Boss::from_u16(early_log.evtc.header.combat_id); + let boss = Encounter::from_u16(early_log.evtc.header.combat_id); boss.map(|b| self.0.contains(&b).into()) .unwrap_or(Inclusion::Exclude) } fn filter(&self, log: &LogResult) -> bool { - log.boss.map(|b| self.0.contains(&b)).unwrap_or(false) + log.encounter.map(|b| self.0.contains(&b)).unwrap_or(false) } } /// A `LogFilter` that only accepts logs with one of the given bosses. -pub fn boss(bosses: HashSet<Boss>) -> Box<dyn LogFilter> { +pub fn encounter(bosses: HashSet<Encounter>) -> Box<dyn LogFilter> { Box::new(BossFilter(bosses)) } diff --git a/src/main.rs b/src/main.rs index 0ff9e44..9149b17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ use structopt::StructOpt; use walkdir::{DirEntry, WalkDir}; use evtclib::raw::parser::PartialEvtc; -use evtclib::{Boss, EventKind, Log, Outcome}; +use evtclib::{Encounter, EventKind, Log, Outcome}; mod fexpr; mod filters; @@ -172,8 +172,8 @@ pub struct LogResult { time: DateTime<Utc>, /// The duration of the fight. duration: Duration, - /// The boss. - boss: Option<Boss>, + /// The encounter. + encounter: Option<Encounter>, /// A vector of all participating players. players: Vec<Player>, /// The outcome of the fight. @@ -552,8 +552,8 @@ fn search_file(path: &Path, is_zip: bool, filter: &dyn LogFilter) -> Result<Opti /// Extract human-readable information from the given log file. fn extract_info(path: &Path, log: &Log) -> LogResult { - let boss = log.encounter(); - if boss.is_none() { + let encounter = log.encounter(); + if encounter.is_none() { debug!( "log file has unknown boss: {:?} (id: {:#x})", path, @@ -579,7 +579,7 @@ fn extract_info(path: &Path, log: &Log) -> LogResult { log_file: path.to_path_buf(), time: Utc.timestamp(i64::from(log.local_end_timestamp().unwrap_or(0)), 0), duration: get_fight_duration(log), - boss, + encounter, players, outcome: get_fight_outcome(log), is_cm: log.is_cm(), diff --git a/src/output/formats.rs b/src/output/formats.rs index 560963b..7225da2 100644 --- a/src/output/formats.rs +++ b/src/output/formats.rs @@ -42,7 +42,7 @@ impl Format for HumanReadable { .with_timezone(&Local) .format("%Y-%m-%d %H:%M:%S %a"), "Boss".green(), - item.boss + item.encounter .map(|x| x.to_string()) .unwrap_or_else(|| "unknown".into()), if item.is_cm { " CM" } else { "" }, diff --git a/src/output/sorting.rs b/src/output/sorting.rs index 2a0821c..628a1a8 100644 --- a/src/output/sorting.rs +++ b/src/output/sorting.rs @@ -68,7 +68,7 @@ impl Display for Component { } fn boss_id(log: &LogResult) -> u32 { - log.boss.map(|x| x as u32).unwrap_or(0) + log.encounter.map(|x| x as u32).unwrap_or(0) } impl Component { |