diff options
author | Daniel Schadt <kingdread@gmx.de> | 2018-04-24 20:44:32 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2018-04-24 20:44:32 +0200 |
commit | 4ea20d5a7d75c77a36bd4baf768226e3089b48ae (patch) | |
tree | 22426e22d9e0a3346ddbaab37a356f14ef7d86c7 /src/main.rs | |
parent | c6cd5dfef5ca037862c79f7abe460e1b88c8dab4 (diff) | |
download | evtclib-4ea20d5a7d75c77a36bd4baf768226e3089b48ae.tar.gz evtclib-4ea20d5a7d75c77a36bd4baf768226e3089b48ae.tar.bz2 evtclib-4ea20d5a7d75c77a36bd4baf768226e3089b48ae.zip |
basic work on statistics calculation
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index 94a8abf..c560143 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,8 +3,8 @@ extern crate evtclib; use byteorder::{ReadBytesExt, BE, LE}; use std::fs::File; -use std::io::BufReader; use std::collections::HashMap; +use std::io::BufReader; // My addr: 5480786193115521456 // My instid: 624 @@ -15,7 +15,7 @@ pub fn main() -> Result<(), evtclib::raw::parser::ParseError> { let mut f = BufReader::new(File::open("material/Samarog.evtc")?); let result = evtclib::raw::parse_file(&mut f)?; -/* + /* for agent in result.agents.iter().filter(|a| a.is_player()) { println!("Agent: {:?}", agent); } @@ -75,16 +75,48 @@ pub fn main() -> Result<(), evtclib::raw::parser::ParseError> { } else { println!("Failed: {:#?}", event); failed += 1; - continue + continue; }; - match &shiny.kind { - &EventKind::Physical { source_agent_addr: src, damage: dmg, .. } if src == 5480786193115521456 => { count += 1; damage += dmg as u64; }, - &EventKind::ConditionTick { source_agent_addr: src, damage: dmg, .. } if src == 5480786193115521456 => { count += 1; damage += dmg as u64; }, + match shiny.kind { + EventKind::Physical { + source_agent_addr: src, + damage: dmg, + .. + } if src == 5480786193115521456 => + { + count += 1; + damage += dmg as u64; + } + EventKind::ConditionTick { + source_agent_addr: src, + damage: dmg, + .. + } if src == 5480786193115521456 => + { + count += 1; + damage += dmg as u64; + } + _ => (), } } println!("Count: {}, Damage: {}", count, damage); println!("Failed events: {}", failed); + let processed = evtclib::process(&result).unwrap(); + //println!("Me: {:#?}", processed.agent_by_addr(5480786193115521456)); + let stats = evtclib::statistics::calculate(&processed).unwrap(); + println!("{:#?}", stats); + let mine = stats.agent_stats.get(&5480786193115521456).unwrap(); + println!("Mine: {:#?}", mine); + println!( + "DPS: {:#?}", + mine.total_damage.total_damage / (mine.combat_time() / 1000) + ); + println!( + "Boss DPS: {:#?}", + mine.boss_damage.total_damage / (mine.combat_time() / 1000) + ); + Ok(()) } |