mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 16:58:55 +00:00
Use more accurate accuracy from 100s and 50s
This commit is contained in:
parent
ce4ed285f9
commit
3a89c009da
4 changed files with 26 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
use super::BeatmapWithMode;
|
||||
use crate::{
|
||||
discord::oppai_cache::{BeatmapContent, BeatmapInfo},
|
||||
discord::oppai_cache::{BeatmapContent, BeatmapInfo, OppaiAccuracy},
|
||||
models::{Beatmap, Mode, Mods, Rank, Score, User},
|
||||
};
|
||||
use chrono::Utc;
|
||||
|
@ -224,7 +224,7 @@ impl<'a> ScoreEmbedBuilder<'a> {
|
|||
content
|
||||
.get_pp_from(
|
||||
oppai_rs::Combo::non_fc(s.max_combo as u32, s.count_miss as u32),
|
||||
accuracy as f32,
|
||||
OppaiAccuracy::from_hits(s.count_100 as u32, s.count_50 as u32),
|
||||
Some(op),
|
||||
s.mods,
|
||||
)
|
||||
|
@ -236,7 +236,12 @@ impl<'a> ScoreEmbedBuilder<'a> {
|
|||
mode.to_oppai_mode()
|
||||
.and_then(|op| {
|
||||
content
|
||||
.get_pp_from(oppai_rs::Combo::FC(0), accuracy as f32, Some(op), s.mods)
|
||||
.get_pp_from(
|
||||
oppai_rs::Combo::FC(0),
|
||||
OppaiAccuracy::from_hits(s.count_100 as u32, s.count_50 as u32),
|
||||
Some(op),
|
||||
s.mods,
|
||||
)
|
||||
.ok()
|
||||
})
|
||||
.filter(|&v| {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
discord::beatmap_cache::BeatmapMetaCache,
|
||||
discord::oppai_cache::BeatmapCache,
|
||||
discord::oppai_cache::{BeatmapCache, OppaiAccuracy},
|
||||
models::{Beatmap, Mode, Mods, Score, User},
|
||||
request::UserID,
|
||||
Client as OsuHttpClient,
|
||||
|
@ -384,7 +384,10 @@ async fn list_plays<'a>(
|
|||
max_combo: p.max_combo as u32,
|
||||
misses: p.count_miss as u32,
|
||||
},
|
||||
p.accuracy(mode) as f32,
|
||||
OppaiAccuracy::from_hits(
|
||||
p.count_100 as u32,
|
||||
p.count_50 as u32,
|
||||
),
|
||||
Some(op),
|
||||
p.mods,
|
||||
)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use std::{ffi::CString, sync::Arc};
|
||||
use youmubot_prelude::*;
|
||||
|
||||
pub use oppai_rs::Accuracy as OppaiAccuracy;
|
||||
|
||||
/// the information collected from a download/Oppai request.
|
||||
#[derive(Debug)]
|
||||
pub struct BeatmapContent {
|
||||
|
@ -20,7 +22,7 @@ impl BeatmapContent {
|
|||
pub fn get_pp_from(
|
||||
&self,
|
||||
combo: oppai_rs::Combo,
|
||||
accuracy: f32,
|
||||
accuracy: impl Into<OppaiAccuracy>,
|
||||
mode: Option<oppai_rs::Mode>,
|
||||
mods: impl Into<oppai_rs::Mods>,
|
||||
) -> Result<f32> {
|
||||
|
|
|
@ -4,7 +4,10 @@ use super::{
|
|||
ModeArg, OsuClient,
|
||||
};
|
||||
use crate::{
|
||||
discord::{oppai_cache::BeatmapCache, BeatmapWithMode},
|
||||
discord::{
|
||||
oppai_cache::{BeatmapCache, OppaiAccuracy},
|
||||
BeatmapWithMode,
|
||||
},
|
||||
models::{Mode, Mods, Score},
|
||||
request::UserID,
|
||||
};
|
||||
|
@ -275,12 +278,12 @@ async fn show_leaderboard(
|
|||
let mode = bm.1;
|
||||
let oppai = data.get::<BeatmapCache>().unwrap();
|
||||
let oppai_map = oppai.get_beatmap(bm.0.beatmap_id).await?;
|
||||
let get_oppai_pp = move |combo: u64, misses: u64, acc: f64, mods: Mods| {
|
||||
let get_oppai_pp = move |combo: u64, misses: u64, acc: OppaiAccuracy, mods: Mods| {
|
||||
mode.to_oppai_mode().and_then(|mode| {
|
||||
oppai_map
|
||||
.get_pp_from(
|
||||
oppai_rs::Combo::non_fc(combo as u32, misses as u32),
|
||||
acc as f32,
|
||||
acc,
|
||||
Some(mode),
|
||||
mods,
|
||||
)
|
||||
|
@ -354,7 +357,10 @@ async fn show_leaderboard(
|
|||
get_oppai_pp(
|
||||
score.max_combo,
|
||||
score.count_miss,
|
||||
score.accuracy(mode),
|
||||
OppaiAccuracy::from_hits(
|
||||
score.count_100 as u32,
|
||||
score.count_50 as u32,
|
||||
),
|
||||
score.mods,
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue