updated rosu-pp

This commit is contained in:
MaxOhn
2022-08-02 20:36:40 +02:00
parent 2e448e3f29
commit 7997284913
5 changed files with 48 additions and 9 deletions
Generated
+3 -3
View File
@@ -159,13 +159,13 @@ dependencies = [
[[package]]
name = "rosu-pp"
version = "0.7.1"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c807e3e09e6877ebe8f518d27dfe68235f7b3fc34a800d66310aebb743c96c43"
checksum = "238725936123d4c42c3a4492397d02614798de0881008e7377d78d5db7e0e042"
[[package]]
name = "rosu-pp-py"
version = "0.7.1"
version = "0.8.0"
dependencies = [
"pyo3",
"rosu-pp",
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "rosu-pp-py"
version = "0.7.2"
version = "0.8.0"
description = "osu! difficulty and pp calculation for all modes"
authors = ["Max Ohn <ohn.m@hotmail.de>"]
license = "MIT"
@@ -12,7 +12,7 @@ crate-type = ["cdylib"]
[dependencies]
pyo3 = { version = "0.16", features = ["macros", "extension-module"] }
rosu-pp = { version = "0.7" }
rosu-pp = { version = "0.8" }
[profile.release]
lto = "fat"
+4
View File
@@ -133,6 +133,10 @@ bpm: float
Beats per minute of the map. (O/T/C/M)
clockRate: float
Clock rate used in calculation i.e. 1.5 for DT, 0.75 for HT, 1.0 for NM or one that was specified (O/T/C/M)
timePreempt: Optional[float]
The time in milliseconds in which the circles is visible before being clicked. (O)
greatHitWindow: Optional[float]
The time in milliseconds in which a 300 ("great") is achievable. (O/T/M)
nCircles: Optional[int]
The amount of circles in the map. (O/T/M)
nSliders: Optional[int]
+5 -1
View File
@@ -132,6 +132,10 @@ class CalculateResult:
Beats per minute of the map. (O/T/C/M)
`clockRate`: float
Clock rate used in calculation i.e. 1.5 for DT, 0.75 for HT, 1.0 for NM or one that was specified (O/T/C/M)
`timePreempt`: Optional[float]
The time in milliseconds in which the circles is visible before being clicked. (O)
`greatHitWindow`: Optional[float]
The time in milliseconds in which a 300 ("great") is achievable. (O/T/M)
`nCircles`: Optional[int]
The amount of circles in the map. (O/T/M)
`nSliders`: Optional[int]
@@ -241,4 +245,4 @@ class Calculator:
currTime = i * strains.sectionLength
print(f'Aim strain at {currTime}ms: {strain}')
```
"""
"""
+34 -3
View File
@@ -322,6 +322,10 @@ struct CalculateResult {
#[pyo3(get, set)]
clockRate: f64,
#[pyo3(get, set)]
timePreempt: Option<f64>,
#[pyo3(get, set)]
greatHitWindow: Option<f64>,
#[pyo3(get, set)]
nCircles: Option<usize>,
#[pyo3(get, set)]
nSliders: Option<usize>,
@@ -338,15 +342,30 @@ impl CalculateResult {
mods: u32,
clock_rate: Option<f64>,
) -> Self {
let mut attr_builder = map.attributes();
if let Some(clock_rate) = clock_rate {
attr_builder.clock_rate(clock_rate);
}
let mode = match &attrs {
PerformanceAttributes::Catch(_) => GameMode::Catch,
PerformanceAttributes::Mania(_) => GameMode::Mania,
PerformanceAttributes::Osu(_) => GameMode::Osu,
PerformanceAttributes::Taiko(_) => GameMode::Taiko,
};
attr_builder.converted(map.mode == GameMode::Osu && mode != GameMode::Osu);
let BeatmapAttributes {
ar,
cs,
hp,
od,
clock_rate: clock_rate_,
} = map.attributes().mods(mods);
clock_rate,
hit_windows,
} = attr_builder.mods(mods).mode(mode).build();
let clock_rate = clock_rate.unwrap_or(clock_rate_);
let bpm = map.bpm() * clock_rate;
match attrs {
@@ -386,6 +405,7 @@ impl CalculateResult {
od,
bpm,
clockRate: clock_rate,
greatHitWindow: Some(hit_windows.od),
..Default::default()
},
PerformanceAttributes::Osu(OsuPerformanceAttributes {
@@ -417,6 +437,8 @@ impl CalculateResult {
od,
bpm,
clockRate: clock_rate,
timePreempt: Some(hit_windows.ar),
greatHitWindow: Some(hit_windows.od),
..Default::default()
},
PerformanceAttributes::Taiko(TaikoPerformanceAttributes {
@@ -440,6 +462,7 @@ impl CalculateResult {
od,
bpm,
clockRate: clock_rate,
greatHitWindow: Some(hit_windows.od),
..Default::default()
},
}
@@ -748,6 +771,14 @@ impl Display for CalculateResult {
.field("bpm", &self.bpm)
.field("clockRate", &self.clockRate);
if let Some(ref time_preempt) = self.timePreempt {
s.field("timePreempt", time_preempt);
}
if let Some(ref great_hit_window) = self.greatHitWindow {
s.field("greatHitWindow", great_hit_window);
}
if let Some(ref n_circles) = self.nCircles {
s.field("nCircles", n_circles);
}