From ca0bbd45d2e3b4bddb3b545215a22e6d8345621d Mon Sep 17 00:00:00 2001 From: Zynh0722 Date: Fri, 2 Feb 2024 14:06:44 -0800 Subject: [PATCH] more info! --- src/main.rs | 60 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 554808f..4a4b9c0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ mod compile_data; mod raw_data; -use crate::compile_data::{JobStats, Role}; +use crate::compile_data::{DpsRole, JobStats, Role}; use crate::raw_data::RawJobStats; use std::fs::File; @@ -14,11 +14,13 @@ fn get_job_stats(lodestone_id: usize) -> anyhow::Result> { } fn main() -> anyhow::Result<()> { - let id = 29932586; + let id = 29932586; // Binglesworth let stats = get_job_stats(id)?; display_stats(id, &stats); - let id = 44540671; + println!(); + + let id = 44540671; // Dialus let stats = get_job_stats(id)?; display_stats(id, &stats); @@ -26,11 +28,61 @@ fn main() -> anyhow::Result<()> { } fn display_stats(id: usize, stats: &[JobStats]) { + println!("{id}\t\tLevels Earned"); + println!("-------------------------------------"); + let total_dowm_earned_levels = stats .iter() .filter(|j| matches!(j.role, Role::Tank | Role::Healer | Role::Dps(_))) .filter(|j| j.name != "Scholar") .fold(0usize, |acc, j| acc + j.level - j.starting_level); - println!("{total_dowm_earned_levels} levels for {id}"); + println!("DoW/DoM\t\t\t{total_dowm_earned_levels}"); + + let healer_stats = stats.iter().filter(|j| matches!(j.role, Role::Healer)); + let healer_stats_no_scholar = healer_stats.clone().filter(|j| j.name != "Scholar"); + let total_healer_earned = healer_stats.fold(0usize, |acc, j| acc + j.level - j.starting_level); + let total_healer_earned_no_scholar = + healer_stats_no_scholar.fold(0usize, |acc, j| acc + j.level - j.starting_level); + + println!("Healers (w/o SCH)\t{total_healer_earned} ({total_healer_earned_no_scholar})"); + + let total_tank_earned = stats + .iter() + .filter(|j| matches!(j.role, Role::Tank)) + .fold(0usize, |acc, j| acc + j.level - j.starting_level); + + println!("Tanks\t\t\t{total_tank_earned}"); + + let total_dps_earned = stats + .iter() + .filter(|j| matches!(j.role, Role::Dps(_))) + .fold(0usize, |acc, j| acc + j.level - j.starting_level); + + println!("Dps\t\t\t{total_dps_earned}"); + + let total_melee_dps_earned = stats + .iter() + .filter(|j| matches!(j.role, Role::Dps(DpsRole::Melee))) + .fold(0usize, |acc, j| acc + j.level - j.starting_level); + + println!("Dps - Melee\t\t{total_melee_dps_earned}"); + + let total_ranged_dps_earned = stats + .iter() + .filter(|j| matches!(j.role, Role::Dps(DpsRole::Ranged))) + .fold(0usize, |acc, j| acc + j.level - j.starting_level); + + println!("Dps - Ranged\t\t{total_ranged_dps_earned}"); + + let magic_stats = stats + .iter() + .filter(|j| matches!(j.role, Role::Dps(DpsRole::Magic))); + let magic_stats_no_blue = magic_stats.clone().filter(|j| !j.is_blue_mage); + + let magic_earned = magic_stats.fold(0usize, |acc, j| acc + j.level - j.starting_level); + let magic_earned_no_blue = + magic_stats_no_blue.fold(0usize, |acc, j| acc + j.level - j.starting_level); + + println!("Dps - Magic (w/o BLU)\t{magic_earned} ({magic_earned_no_blue})"); }