Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ aim-accuracy-fix = { package = "akatsuki-pp", git = "https://github.com/osuAkats
improved-miss-penalty-and-acc-rework = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "c5cb35b62309c2159a466a6d26addde7acf0c231" }
everything-at-once = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "6d22dcdcafb70399a5c0380fcad96e3bdd5c4009" }
kippy-attempt = { package = "akatsuki-pp", git = "https://github.com/kippysevenstars/akatsuki-pp-rs", rev = "001cc6eb920c4945e14b66ca682bfbf8ecedce4b" }
flygon-rebalance = { package = "akatsuki-pp", git = "https://github.com/miaxaly/akatsuki-pp-rs", rev = "65f7d98bb3031142ffc6cbb2d81ddafea11bc667" }
md5 = "0.7.0"
26 changes: 26 additions & 0 deletions src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,31 @@ async fn calculate_kippy_attempt_pp(
Ok(pp)
}

async fn calculate_flygon_rebalance_pp(
score: &RippleScore,
context: Arc<Context>,
) -> anyhow::Result<f32> {
let beatmap_bytes =
usecases::beatmaps::fetch_beatmap_osu_file(score.beatmap_id, context).await?;
let beatmap = flygon_rebalance::Beatmap::from_bytes(&beatmap_bytes)?;

let result = flygon_rebalance::osu_2019::OsuPP::from_map(&beatmap)
.mods(score.mods as u32)
.combo(score.max_combo as u32)
.n300(score.count_300 as u32)
.n100(score.count_100 as u32)
.n50(score.count_50 as u32)
.misses(score.count_misses as u32)
.calculate();

let mut pp = round(result.pp as f32, 2);
if pp.is_infinite() || pp.is_nan() {
pp = 0.0;
}

Ok(pp)
}

async fn process_scores(
rework: &Rework,
scores: Vec<RippleScore>,
Expand All @@ -301,6 +326,7 @@ async fn process_scores(
27 => calculate_improved_miss_penalty_and_acc_rework_pp(score, context.clone()).await?,
28 => calculate_everything_at_once_pp(score, context.clone()).await?,
29 => calculate_kippy_attempt_pp(score, context.clone()).await?,
30 => calculate_flygon_rebalance_pp(score, context.clone()).await?,
_ => unreachable!(),
};

Expand Down