aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock3
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs5
-rw-r--r--src/output/formats.rs59
4 files changed, 44 insertions, 25 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a837792..63dd30b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -350,8 +350,7 @@ dependencies = [
[[package]]
name = "evtclib"
version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "538da1756f463fb78c5dab1cd641ac44f9de74bbf30b770c8d58b8b364dcf080"
+source = "git+https://gitlab.com/dunj3/evtclib.git#b962896e0d31667162b0a844e3f2186707b641ad"
dependencies = [
"byteorder",
"getset",
diff --git a/Cargo.toml b/Cargo.toml
index 43f7606..5f456b8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ repository = "https://gitlab.com/dunj3/raidgrep"
lto = true
[dependencies]
-evtclib = "0.5.0"
+evtclib = { git = "https://gitlab.com/dunj3/evtclib.git" }
regex = "1.5.4"
structopt = "0.3.25"
walkdir = "2.3.2"
diff --git a/src/main.rs b/src/main.rs
index b35f769..8bde143 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -17,7 +17,7 @@ use structopt::StructOpt;
use walkdir::{DirEntry, WalkDir};
use evtclib::raw::parser::PartialEvtc;
-use evtclib::{Encounter, EventKind, Log, Outcome};
+use evtclib::{Encounter, EventKind, GameMode, Log, Outcome};
mod fexpr;
mod filters;
@@ -180,6 +180,8 @@ pub struct LogResult {
outcome: FightOutcome,
/// Whether the fight had the Challenge Mote turned on.
is_cm: bool,
+ /// The game mode of the fight.
+ game_mode: Option<GameMode>,
}
/// A player.
@@ -578,6 +580,7 @@ fn extract_info(path: &Path, log: &Log) -> LogResult {
players,
outcome: get_fight_outcome(log),
is_cm: log.is_cm(),
+ game_mode: log.game_mode(),
}
}
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}",