aboutsummaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorDaniel <kingdread@gmx.de>2021-11-19 22:04:50 +0100
committerDaniel <kingdread@gmx.de>2021-11-19 22:04:50 +0100
commit53123d5ab01f2b6ee0282ff067ba39e10b28528e (patch)
tree11c616ea7a20be3f7e9f8688c2d5d3134359731d /src/output
parent0c634d3c2d279ef75347ac635b69d396d5bf695a (diff)
parenta7682465132e4758bd50777f17a7c4b2048b4c8c (diff)
downloadraidgrep-53123d5ab01f2b6ee0282ff067ba39e10b28528e.tar.gz
raidgrep-53123d5ab01f2b6ee0282ff067ba39e10b28528e.tar.bz2
raidgrep-53123d5ab01f2b6ee0282ff067ba39e10b28528e.zip
Merge branch 'gamemode-filters'
Diffstat (limited to 'src/output')
-rw-r--r--src/output/formats.rs59
-rw-r--r--src/output/sorting.rs7
2 files changed, 44 insertions, 22 deletions
diff --git a/src/output/formats.rs b/src/output/formats.rs
index d22ab19..47da57e 100644
--- a/src/output/formats.rs
+++ b/src/output/formats.rs
@@ -5,6 +5,7 @@ use super::super::guilds;
use super::{FightOutcome, LogResult};
use chrono::Local;
+use evtclib::GameMode;
/// An output format
pub trait Format: Sync + Send {
@@ -30,27 +31,43 @@ impl Format for HumanReadable {
item.log_file.to_string_lossy()
)
.expect("writing to String failed");
- let outcome = match item.outcome {
- FightOutcome::Success => "SUCCESS".green(),
- FightOutcome::Wipe => "WIPE".red(),
- };
- writeln!(
- result,
- "{}: {} - {}: {}{} {} after {}",
- "Date".green(),
- item.time
- .with_timezone(&Local)
- .format("%Y-%m-%d %H:%M:%S %a"),
- "Boss".green(),
- item.encounter
- .map(|x| x.to_string())
- .unwrap_or_else(|| "unknown".into()),
- if item.is_cm { " CM" } else { "" },
- outcome,
- humantime::Duration::from(item.duration.to_std().unwrap()),
- )
- .expect("writing to String failed");
- for player in &item.players {
+
+ if item.game_mode != Some(GameMode::WvW) {
+ let outcome = match item.outcome {
+ FightOutcome::Success => "SUCCESS".green(),
+ FightOutcome::Wipe => "WIPE".red(),
+ };
+ writeln!(
+ result,
+ "{}: {} - {}: {}{} {} after {}",
+ "Date".green(),
+ item.time
+ .with_timezone(&Local)
+ .format("%Y-%m-%d %H:%M:%S %a"),
+ "Boss".green(),
+ item.encounter
+ .map(|x| x.to_string())
+ .unwrap_or_else(|| "unknown".into()),
+ if item.is_cm { " CM" } else { "" },
+ outcome,
+ humantime::Duration::from(item.duration.to_std().unwrap()),
+ )
+ .expect("writing to String failed");
+ } else {
+ writeln!(
+ result,
+ "{}: {} - {} ended after {}",
+ "Date".green(),
+ item.time
+ .with_timezone(&Local)
+ .format("%Y-%m-%d %H:%M:%S %a"),
+ "World vs. World".green(),
+ humantime::Duration::from(item.duration.to_std().unwrap()),
+ )
+ .expect("writing to String failed");
+ }
+
+ for player in item.players.iter().filter(|p| !p.account_name.is_empty()) {
write!(
result,
" {:2} {:20} {:19} {:12}",
diff --git a/src/output/sorting.rs b/src/output/sorting.rs
index 234d804..27ea1e1 100644
--- a/src/output/sorting.rs
+++ b/src/output/sorting.rs
@@ -135,7 +135,7 @@ mod tests {
use super::*;
use chrono::prelude::*;
- use evtclib::Encounter as E;
+ use evtclib::{Encounter as E, GameMode};
#[test]
fn test_parse_component() {
@@ -179,6 +179,7 @@ mod tests {
players: vec![],
outcome: FightOutcome::Success,
is_cm: false,
+ game_mode: Some(GameMode::Raid),
},
&LogResult {
log_file: "".into(),
@@ -188,6 +189,7 @@ mod tests {
players: vec![],
outcome: FightOutcome::Success,
is_cm: false,
+ game_mode: Some(GameMode::Raid),
},
&LogResult {
log_file: "".into(),
@@ -197,6 +199,7 @@ mod tests {
players: vec![],
outcome: FightOutcome::Success,
is_cm: false,
+ game_mode: Some(GameMode::Raid),
},
&LogResult {
log_file: "".into(),
@@ -206,6 +209,7 @@ mod tests {
players: vec![],
outcome: FightOutcome::Success,
is_cm: false,
+ game_mode: Some(GameMode::Raid),
},
&LogResult {
log_file: "".into(),
@@ -215,6 +219,7 @@ mod tests {
players: vec![],
outcome: FightOutcome::Success,
is_cm: false,
+ game_mode: Some(GameMode::Raid),
},
];