diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-11-17 00:01:59 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-11-17 00:01:59 +0100 |
commit | 08e686a5161d3baf1eb25014721147bb4e17a54d (patch) | |
tree | 8131e5213cd5cb98069a073a949f5f531df8413d /src/output/formats.rs | |
parent | 0c634d3c2d279ef75347ac635b69d396d5bf695a (diff) | |
download | raidgrep-08e686a5161d3baf1eb25014721147bb4e17a54d.tar.gz raidgrep-08e686a5161d3baf1eb25014721147bb4e17a54d.tar.bz2 raidgrep-08e686a5161d3baf1eb25014721147bb4e17a54d.zip |
Better output for World vs. World logs
Diffstat (limited to 'src/output/formats.rs')
-rw-r--r-- | src/output/formats.rs | 59 |
1 files changed, 38 insertions, 21 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}", |