MaxOhn / rosu-pp-py

osu! difficulty and pp calculation for all modes
MIT License
23 stars 19 forks source link

feat: use rosu-mods #9

Closed MaxOhn closed 3 months ago

MaxOhn commented 3 months ago

Bump rosu-pp to v1.1.0 which utilizes rosu-mods to pass mods as arguments.

Instead of the binding only allowing the int type for mods, now the type must coincide with the alias definitions

GameMods = Union[int, str, GameMod, List[Union[GameMod, str, int]]]
GameMod = dict[str, Union[str, GameModSettings]]
GameModSettings = dict[str, Union[bool, float, str]]

That means, mods can be given either through their (legacy) bitflags, a string for acronyms, a "GameMod" dict, or a sequence whose items are either a "GameMod" dict, a single acronym string, or bitflags for a single mod.

A "GameMod" dict must have the item 'acronym': str and an optional item 'settings': GameModSettings.

This should make it easy to pass along mods as they're given by the osu!api by simple using json.loads(...) to convert the JSON into a python object.