use evtclib::{AgentName, Log}; use super::{LogResult, Opt}; /// Do filtering based on the character or account name. pub fn filter_name(log: &Log, opt: &Opt) -> bool { for player in log.players() { match player.name() { AgentName::Player { account_name, character_name, .. } => { if (opt.field.search_account() && opt.expression.is_match(account_name)) || (opt.field.search_character() && opt.expression.is_match(character_name)) { return true; } } _ => unreachable!(), } } return false; } /// Do filtering based on the fight outcome. pub fn filter_outcome(result: &LogResult, opt: &Opt) -> bool { match opt.outcome { Some(o) if o == result.outcome => true, None => true, _ => false, } }