diff options
author | Daniel Schadt <kingdread@gmx.de> | 2018-06-14 09:20:50 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2018-06-14 09:20:50 +0200 |
commit | 93efc6051269348a955f79d34ae151560fbcb0d3 (patch) | |
tree | cd70f4c3507960d3f702235b99d8d0deb4b7a312 /src/statistics/mod.rs | |
parent | 1857d5b73fdf137a23b8266b923047f8cc07bd49 (diff) | |
download | evtclib-93efc6051269348a955f79d34ae151560fbcb0d3.tar.gz evtclib-93efc6051269348a955f79d34ae151560fbcb0d3.tar.bz2 evtclib-93efc6051269348a955f79d34ae151560fbcb0d3.zip |
rework boon tracking
Diffstat (limited to 'src/statistics/mod.rs')
-rw-r--r-- | src/statistics/mod.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/statistics/mod.rs b/src/statistics/mod.rs index 5f2f288..0254135 100644 --- a/src/statistics/mod.rs +++ b/src/statistics/mod.rs @@ -9,6 +9,7 @@ pub mod gamedata; pub mod math; pub mod trackers; +use self::boon::BoonLog; use self::damage::DamageLog; use self::trackers::{RunnableTracker, Tracker}; @@ -53,7 +54,7 @@ pub struct AgentStats { /// /// For duration-based boons, the average amount of stacks is the same as /// the uptime. - pub boon_averages: HashMap<u16, f64>, + pub boon_log: BoonLog, /// Time when the agent has entered combat (millseconds since log start). pub enter_combat: u64, /// Time when the agent has left combat (millseconds since log start). @@ -87,6 +88,7 @@ pub fn calculate(log: &Log) -> StatResult<Statistics> { let mut damage_tracker = trackers::DamageTracker::new(log); let mut log_start_tracker = trackers::LogStartTracker::new(); let mut combat_time_tracker = trackers::CombatTimeTracker::new(); + let mut boon_tracker = trackers::BoonTracker::new(); run_trackers( log, @@ -94,6 +96,7 @@ pub fn calculate(log: &Log) -> StatResult<Statistics> { &mut damage_tracker, &mut log_start_tracker, &mut combat_time_tracker, + &mut boon_tracker, ], )?; @@ -104,14 +107,27 @@ pub fn calculate(log: &Log) -> StatResult<Statistics> { let agent = agent_stats .entry(*agent_addr) .or_insert_with(Default::default); + // XXX: This used to be enter_time - log_start_time, as it makes more + // sense to have the time relative to the log start instead of the + // Windows boot time. However, this also means that we need to modify + // all event times before we do any tracking, as many trackers rely on + // event.time to track information related to time. if enter_time != 0 { - agent.enter_combat = enter_time - log_start_time; + agent.enter_combat = enter_time; } if exit_time != 0 { - agent.exit_combat = exit_time - log_start_time; + agent.exit_combat = exit_time; } } + let boon_logs = try_tracker!(boon_tracker.finalize()); + for (agent_addr, boon_log) in boon_logs { + let agent = agent_stats + .entry(agent_addr) + .or_insert_with(Default::default); + agent.boon_log = boon_log; + } + let damage_log = try_tracker!(damage_tracker.finalize()); Ok(Statistics { |