From c731b470fc162e56f6d81c475bacb41230a5e2d3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 31 May 2019 02:51:16 +0200 Subject: add option to filter based on boss --- src/filters.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/filters.rs') 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) -- cgit v1.2.3