aboutsummaryrefslogtreecommitdiff
path: root/src/filters.rs
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2019-05-31 02:51:16 +0200
committerDaniel <kingdread@gmx.de>2019-05-31 02:51:16 +0200
commitc731b470fc162e56f6d81c475bacb41230a5e2d3 (patch)
tree926a46c99d465b4da362c6583364b11bb6109771 /src/filters.rs
parent9243e9c6cc6cdefe1565291a2933cc58556ebe9b (diff)
downloadraidgrep-c731b470fc162e56f6d81c475bacb41230a5e2d3.tar.gz
raidgrep-c731b470fc162e56f6d81c475bacb41230a5e2d3.tar.bz2
raidgrep-c731b470fc162e56f6d81c475bacb41230a5e2d3.zip
add option to filter based on boss
Diffstat (limited to 'src/filters.rs')
-rw-r--r--src/filters.rs11
1 files changed, 11 insertions, 0 deletions
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)