Skip to content

Commit 9bab620

Browse files
committed
Update Beatmap.DifficultyAttributes
In reaction to the latest pp update More info: ppy/osu-web#11990
1 parent bc550a3 commit 9bab620

File tree

3 files changed

+29
-31
lines changed

3 files changed

+29
-31
lines changed

lib/Beatmap.ts

+17-16
Original file line numberDiff line numberDiff line change
@@ -164,33 +164,32 @@ export namespace Beatmap {
164164
/** @obtainableFrom {@link API.getBeatmapDifficultyAttributesOsu} */
165165
export interface Osu extends DifficultyAttributes {
166166
aim_difficulty: number
167+
aim_difficult_slider_count: number
167168
speed_difficulty: number
168169
speed_note_count: number
169-
flashlight_difficulty: number
170170
slider_factor: number
171-
approach_rate: number
172-
overall_difficulty: number
171+
aim_difficult_strain_count: number
172+
speed_difficult_strain_count: number
173173
}
174174

175175
/** @obtainableFrom {@link API.getBeatmapDifficultyAttributesTaiko} */
176176
export interface Taiko extends DifficultyAttributes {
177-
stamina_difficulty: number
178-
rhythm_difficulty: number
179-
colour_difficulty: number
180-
peak_difficulty: number
181-
great_hit_window: number
177+
mono_stamina_factor: number
182178
}
183179

184-
/** @obtainableFrom {@link API.getBeatmapDifficultyAttributesFruits} */
185-
export interface Fruits extends DifficultyAttributes {
186-
approach_rate: number
187-
}
180+
/**
181+
* @obtainableFrom {@link API.getBeatmapDifficultyAttributesFruits}
182+
* @remarks Since the pp update of 2025-03-06, no property exclusive to this Ruleset exists
183+
*/
184+
export interface Fruits extends DifficultyAttributes {}
188185

189-
/** @obtainableFrom {@link API.getBeatmapDifficultyAttributesMania} */
186+
/**
187+
* @obtainableFrom {@link API.getBeatmapDifficultyAttributesMania}
188+
* @remarks Since the pp update of 2025-03-06, no property exclusive to this Ruleset exists
189+
*/
190190
export interface Mania extends DifficultyAttributes {
191-
great_hit_window: number
192-
/** @remarks API documentation says it exists, my thorough testing says it doesn't, so... */
193-
score_multiplier?: number
191+
/** @remarks This seems to be about the max_combo with **Classic mod or Stable (non-lazer) client** */
192+
max_combo: number
194193
}
195194

196195
export type Any = Osu | Taiko | Fruits | Mania
@@ -229,6 +228,7 @@ export namespace Beatmap {
229228
* Get various data about the difficulty of a ctb beatmap!
230229
* @param beatmap The Beatmap in question
231230
* @param mods Can be a bitset of mods, an array of mod acronyms, or an array of Mods (ignores mod settings) (defaults to **No Mod**)
231+
* @remarks Since the pp update of 2025-03-06, no property exclusive to this Ruleset exists
232232
*/
233233
export async function getFruits(this: API, beatmap: Beatmap["id"] | Beatmap, mods?: Mod[] | string[] | number): Promise<DifficultyAttributes.Fruits> {
234234
return await this.getBeatmapDifficultyAttributes(beatmap, mods, Ruleset.fruits) as DifficultyAttributes.Fruits
@@ -237,6 +237,7 @@ export namespace Beatmap {
237237
* Get various data about the difficulty of a mania beatmap!
238238
* @param beatmap The Beatmap in question
239239
* @param mods Can be a bitset of mods, an array of mod acronyms, or an array of Mods (ignores mod settings) (defaults to **No Mod**)
240+
* @remarks Since the pp update of 2025-03-06, no property exclusive to this Ruleset exists
240241
*/
241242
export async function getMania(this: API, beatmap: Beatmap["id"] | Beatmap, mods?: Mod[] | string[] | number): Promise<DifficultyAttributes.Mania> {
242243
return await this.getBeatmapDifficultyAttributes(beatmap, mods, Ruleset.mania) as DifficultyAttributes.Mania

lib/tests/exports.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,23 @@ export type Test = (api: API) => Promise<true>;
88

99
const generator = tsj.createGenerator({path: "lib/index.ts", additionalProperties: true})
1010

11-
export function validate(object: unknown, schemaName: string): boolean {
11+
export function validate(obj: unknown, schemaName: string): boolean {
1212
try {
1313
const schema = fixDate(generator.createSchema(schemaName))
1414
const ajv_const = new ajv.default({strict: false})
1515
ajv_const.addFormat("date-time", true)
1616
const validator = ajv_const.compile(schema)
1717

18-
if (Array.isArray(object)) {
19-
for (let i = 0; i < object.length; i++) {
20-
const result = validator(object[i])
21-
if (validator.errors) console.error("❌ from validator:\n", validator.errors, "\n...for the following object:\n",
22-
util.inspect(object[i], {colors: true, compact: true, depth: 100}), "\n\n")
18+
if (Array.isArray(obj)) {
19+
for (let i = 0; i < obj.length; i++) {
20+
const result = validator(obj[i])
21+
if (validator.errors) console.error(obj[i], util.inspect(validator.errors, {colors: true, depth: 5}))
2322
if (!result) return false
2423
}
2524
return true
2625
} else {
27-
const result = validator(object)
28-
if (validator.errors) console.error("❌ from validator:\n", validator.errors, "\n...for the following object:\n",
29-
util.inspect(object, {colors: true, compact: true, depth: 100}), "\n\n")
26+
const result = validator(obj)
27+
if (validator.errors) console.error(obj, util.inspect(validator.errors, {colors: true, depth: 5}))
3028
return result
3129
}
3230
} catch(err) {

lib/tests/guest/beatmap.test.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,28 @@ const getBeatmaps: Test = async(api) => {
2828

2929
const getBeatmapDifficultyAttributesOsu: Test = async(api) => {
3030
const attributes = await api.getBeatmapDifficultyAttributesOsu(125660, ["DT"])
31-
console.log(attributes)
32-
expect(attributes.approach_rate.toFixed(2)).to.equal("9.67")
31+
expect(attributes.max_combo).to.equal(1193)
3332
expect(validate(attributes, "Beatmap.DifficultyAttributes.Osu"))
3433
return true
3534
}
3635

3736
const getBeatmapDifficultyAttributesTaiko: Test = async(api) => {
3837
const attributes = await api.getBeatmapDifficultyAttributesTaiko(388463, ["DT"])
39-
expect(attributes.great_hit_window).to.be.lessThan(35)
38+
expect(attributes.max_combo).to.equal(876)
4039
expect(validate(attributes, "Beatmap.DifficultyAttributes.Taiko"))
4140
return true
4241
}
4342

4443
const getBeatmapDifficultyAttributesFruits: Test = async(api) => {
4544
const attributes = await api.getBeatmapDifficultyAttributesFruits(705339, ["DT"])
46-
expect(attributes.approach_rate.toFixed(2)).to.equal("10.33")
45+
expect(attributes.max_combo).to.equal(1029)
4746
expect(validate(attributes, "Beatmap.DifficultyAttributes.Fruits"))
4847
return true
4948
}
5049

5150
const getBeatmapDifficultyAttributesMania: Test = async(api) => {
52-
const attributes = await api.getBeatmapDifficultyAttributesMania(3980252, ["DT"])
53-
expect(attributes.great_hit_window).to.equal(40)
51+
const attributes = await api.getBeatmapDifficultyAttributesMania(473228, ["DT"])
52+
expect(attributes.max_combo).to.equal(5614)
5453
expect(validate(attributes, "Beatmap.DifficultyAttributes.Mania"))
5554
return true
5655
}

0 commit comments

Comments
 (0)