aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/csl.rs17
-rw-r--r--src/filters.rs11
-rw-r--r--src/main.rs13
3 files changed, 39 insertions, 2 deletions
diff --git a/src/csl.rs b/src/csl.rs
index fb11841..df10451 100644
--- a/src/csl.rs
+++ b/src/csl.rs
@@ -5,6 +5,7 @@ use std::fmt;
use super::{SearchField, FightOutcome};
use chrono::Weekday;
+use evtclib::statistics::gamedata::Boss;
pub trait Variants: Copy {
type Output: Iterator<Item=Self>;
@@ -29,12 +30,26 @@ macro_rules! variants {
].iter().cloned()
}
}
- }
+ };
+ ($target:ident => $($var:ident,)+) => {
+ variants!($target => $($var),+);
+ };
}
variants! { SearchField => Account, Character }
variants! { FightOutcome => Success, Wipe }
variants! { Weekday => Mon, Tue, Wed, Thu, Fri, Sat, Sun }
+variants! { Boss =>
+ ValeGuardian, Gorseval, Sabetha,
+ Slothasor, Matthias,
+ KeepConstruct, Xera,
+ Cairn, MursaatOverseer, Samarog, Deimos,
+ SoullessHorror, Dhuum,
+ ConjuredAmalgamate, LargosTwins, Qadim,
+
+ Skorvald, Artsariiv, Arkk,
+ MAMA, Siax, Ensolyss,
+}
/// The character that delimits items from each other.
const DELIMITER: char = ',';
diff --git a/src/filters.rs b/src/filters.rs
index 8433690..02334bc 100644
--- a/src/filters.rs
+++ b/src/filters.rs
@@ -1,5 +1,8 @@
use evtclib::{Agent, AgentName};
use evtclib::raw::parser::PartialEvtc;
+use evtclib::statistics::gamedata::Boss;
+
+use num_traits::FromPrimitive;
use super::{SearchField, LogResult, Opt};
@@ -30,6 +33,14 @@ pub fn filter_name(evtc: &PartialEvtc, opt: &Opt) -> bool {
false
}
+/// Do filtering based on the boss ID.
+pub fn filter_boss(evtc: &PartialEvtc, opt: &Opt) -> bool {
+ let boss = Boss::from_u16(evtc.header.combat_id);
+ boss
+ .map(|b| opt.bosses.contains(&b))
+ .unwrap_or(true)
+}
+
/// Do filtering based on the fight outcome.
pub fn filter_outcome(result: &LogResult, opt: &Opt) -> bool {
opt.outcome.contains(&result.outcome)
diff --git a/src/main.rs b/src/main.rs
index 87ebbb0..89dab09 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -123,6 +123,14 @@ pub struct Opt {
)]
weekdays: CommaSeparatedList<Weekday>,
+ /// Only show logs from the given encounters.
+ #[structopt(
+ short = "e",
+ long = "bosses",
+ default_value = "*",
+ )]
+ bosses: CommaSeparatedList<evtclib::statistics::gamedata::Boss>,
+
/// Print more debugging information to stderr.
#[structopt(long = "debug")]
debug: bool,
@@ -317,7 +325,10 @@ fn search_log(entry: &DirEntry, opt: &Opt) -> Result<Option<LogResult>, RuntimeE
let mut stream = wrapper.get_stream();
let partial = evtclib::raw::parser::parse_partial_file(&mut stream)?;
- if filters::filter_name(&partial, opt) == opt.invert {
+ let early_ok = filters::filter_name(&partial, opt) != opt.invert
+ && filters::filter_boss(&partial, opt);
+
+ if !early_ok {
return Ok(None)
}