Skip to content

Commit

Permalink
remove deleted reworks (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunyoku authored Jul 13, 2024
1 parent 74a04b2 commit 8256413
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 257 deletions.
54 changes: 0 additions & 54 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,11 @@ akatsuki-pp-rs = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuk
"async_tokio",
] }
reqwest = "0.11"
conceptual-rework = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", branch = "conceptual-rework", features = [
"async_tokio",
] }
async-trait = "0.1.62"
skill-rebalance = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", branch = "skill-rebalance", features = [
"async_tokio",
] }
structured-logger = "1.0.3"
cursordance = { package = "akatsuki-pp", git = "https://github.com/CursorDance/akatsuki-pp-rs", rev = "56a71011e13274e63f6548611f3d5c822377c0d3", features = [
"async_tokio",
] }
no-accuracy = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "d3ab5af7a63f17a2a40bbce573b06ea451375638", features = [
"async_tokio",
] }
simplify-relax = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "ce896ca661de4aa4c0c6739a703c4a162426878b", features = [
"async_tokio",
] }
improved-miss-penalty = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "bb1c8ee99a6788f4706fbadee47894590c4fded6", features = [
"async_tokio",
] }
accuracy-fun = { package = "akatsuki-pp", git = "https://github.com/osuAkatsuki/akatsuki-pp-rs", rev = "879fd8caa2cb082a5b9c0761fc2ddca3b283b226", features = [
"async_tokio",
] }
md5 = "0.7.0"

[profile.release]
Expand Down
185 changes: 0 additions & 185 deletions src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,166 +19,13 @@ use crate::{
usecases,
};

use accuracy_fun::Beatmap as AccuracyFunBeatmap;
use conceptual_rework::{
Beatmap as ConceptualBeatmap, BeatmapExt as ConceptualBeatmapExt,
GameMode as ConceptualGameMode,
};
use cursordance::Beatmap as CdBeatmap;
use improved_miss_penalty::Beatmap as ImprovedMissPenaltyBeatmap;
use no_accuracy::Beatmap as NoAccuracyBeatmap;
use simplify_relax::Beatmap as SimplifyRelaxBeatmap;
use skill_rebalance::{
Beatmap as SkillRebalanceBeatmap, BeatmapExt as SkillRebalanceBeatmapExt,
GameMode as SkillRebalanceGameMode,
};

fn round(x: f32, decimals: u32) -> f32 {
let y = 10i32.pow(decimals) as f32;
(x * y).round() / y
}

async fn calculate_conceptual_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 = ConceptualBeatmap::from_bytes(&beatmap_bytes).await?;

let result = beatmap
.pp()
.mode(match score.play_mode {
0 => ConceptualGameMode::Osu,
1 => ConceptualGameMode::Taiko,
2 => ConceptualGameMode::Catch,
3 => ConceptualGameMode::Mania,
_ => unreachable!(),
})
.mods(score.mods as u32)
.combo(score.max_combo as usize)
.n300(score.count_300 as usize)
.n100(score.count_100 as usize)
.n50(score.count_50 as usize)
.n_misses(score.count_misses as usize)
.calculate();

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

Ok(pp)
}

async fn calculate_skill_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 = SkillRebalanceBeatmap::from_bytes(&beatmap_bytes).await?;

let result = beatmap
.pp()
.mode(match score.play_mode {
0 => SkillRebalanceGameMode::Osu,
1 => SkillRebalanceGameMode::Taiko,
2 => SkillRebalanceGameMode::Catch,
3 => SkillRebalanceGameMode::Mania,
_ => unreachable!(),
})
.mods(score.mods as u32)
.combo(score.max_combo as usize)
.n300(score.count_300 as usize)
.n100(score.count_100 as usize)
.n50(score.count_50 as usize)
.n_misses(score.count_misses as usize)
.calculate();

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

Ok(pp)
}

async fn calculate_cursordance_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 = CdBeatmap::from_bytes(&beatmap_bytes).await?;

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

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

Ok(pp)
}

async fn calculate_no_accuracy_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 = NoAccuracyBeatmap::from_bytes(&beatmap_bytes).await?;

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

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

Ok(pp)
}

async fn calculate_simplfy_relax_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 = SimplifyRelaxBeatmap::from_bytes(&beatmap_bytes).await?;

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

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

Ok(pp)
}

async fn calculate_improved_miss_penalty_pp(
score: &RippleScore,
context: Arc<Context>,
Expand All @@ -204,31 +51,6 @@ async fn calculate_improved_miss_penalty_pp(
Ok(pp)
}

async fn calculate_accuracy_fun_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 = AccuracyFunBeatmap::from_bytes(&beatmap_bytes).await?;

let result = accuracy_fun::osu_2019::OsuPP::new(&beatmap)
.mods(score.mods as u32)
.combo(score.max_combo as usize)
.n300(score.count_300 as usize)
.n100(score.count_100 as usize)
.n50(score.count_50 as usize)
.misses(score.count_misses as usize)
.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 @@ -238,14 +60,7 @@ async fn process_scores(

for score in &scores {
let new_pp = match rework.rework_id {
10 => calculate_conceptual_pp(score, context.clone()).await?,
12 => calculate_conceptual_pp(score, context.clone()).await?,
13 => calculate_skill_rebalance_pp(score, context.clone()).await?,
16 => calculate_cursordance_pp(score, context.clone()).await?,
17 => calculate_no_accuracy_pp(score, context.clone()).await?,
18 => calculate_simplfy_relax_pp(score, context.clone()).await?,
19 => calculate_improved_miss_penalty_pp(score, context.clone()).await?,
20 => calculate_accuracy_fun_pp(score, context.clone()).await?,
_ => unreachable!(),
};

Expand Down

0 comments on commit 8256413

Please sign in to comment.