aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/lib.rs12
-rw-r--r--tests/logs/wvw-20211112.zevtcbin0 -> 10372 bytes
-rw-r--r--tests/parsing.rs1
-rw-r--r--tests/wvw.rs11
5 files changed, 25 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b916e0..5701aa7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
### Added
- Boss and encounter definitions for the training golems (`StandardKittyGolem`,
`MediumKittyGolem`, `LargeKittyGolem`)
+- `Log::is_generic` to check whether a log is generic (WvW)
### Fixed
- `evtclib` will no longer choke on WvW logs where player names might not contain the expected
diff --git a/src/lib.rs b/src/lib.rs
index 293be64..60f4903 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -257,6 +257,18 @@ impl Log {
let last = self.events().last().map(Event::time).unwrap_or(0);
last - first
}
+
+ /// Check whether this log represents a "generic" log.
+ ///
+ /// A generic log is a log that is not tied to a specific boss ID, but rather is triggered by
+ /// squad members entering and leaving combat. This is for example the case in WvW logs, which
+ /// can be identified using this function.
+ ///
+ /// Note that many of the analyzing functions (such as [`Log::was_rewarded`]) do not have
+ /// sensible results for generic functions.
+ pub fn is_generic(&self) -> bool {
+ self.boss_id == 1
+ }
}
/// Convenience data accessing funtions for [`Log`][Log]s.
diff --git a/tests/logs/wvw-20211112.zevtc b/tests/logs/wvw-20211112.zevtc
new file mode 100644
index 0000000..a5e135d
--- /dev/null
+++ b/tests/logs/wvw-20211112.zevtc
Binary files differ
diff --git a/tests/parsing.rs b/tests/parsing.rs
index 3eb3a4b..49e6fe9 100644
--- a/tests/parsing.rs
+++ b/tests/parsing.rs
@@ -13,6 +13,7 @@ macro_rules! test {
let log = evtclib::raw::parse_zip(&mut file).expect("parsing zip failed");
let log = evtclib::process(&log).expect("processing log failed");
assert_eq!(log.encounter(), Some($boss));
+ assert!(!log.is_generic());
let players = $players;
diff --git a/tests/wvw.rs b/tests/wvw.rs
new file mode 100644
index 0000000..5af15c7
--- /dev/null
+++ b/tests/wvw.rs
@@ -0,0 +1,11 @@
+//! Tests for WvW log parsing.
+//!
+//! WvW logs are a bit special in some regards (no proper boss ID, players with autogenerated
+//! names), so it is good to have some basic testing for those.
+
+#[test]
+fn test_smoke() {
+ let log = "./tests/logs/wvw-20211112.zevtc";
+ let log = evtclib::process_file(log, evtclib::Compression::Zip).unwrap();
+ assert!(log.is_generic());
+}