chore(mods): update default ranked mods
Make AL & SG ranked https://osu.ppy.sh/home/changelog/tachyon/2025.1121.0
This commit is contained in:
@@ -3,7 +3,7 @@ from copy import deepcopy
|
|||||||
from typing import TYPE_CHECKING, ClassVar
|
from typing import TYPE_CHECKING, ClassVar
|
||||||
|
|
||||||
from app.calculator import clamp
|
from app.calculator import clamp
|
||||||
from app.models.mods import APIMod, parse_enum_to_str
|
from app.models.mods import APIMod
|
||||||
from app.models.performance import (
|
from app.models.performance import (
|
||||||
DifficultyAttributes,
|
DifficultyAttributes,
|
||||||
ManiaPerformanceAttributes,
|
ManiaPerformanceAttributes,
|
||||||
@@ -47,6 +47,26 @@ DIFFICULTY_CLASS = {
|
|||||||
GameMode.TAIKO: TaikoDifficultyAttributes,
|
GameMode.TAIKO: TaikoDifficultyAttributes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_enum_to_str = {
|
||||||
|
0: {
|
||||||
|
"MR": {"reflection"},
|
||||||
|
"AC": {"accuracy_judge_mode"},
|
||||||
|
"BR": {"direction"},
|
||||||
|
"AD": {"style"},
|
||||||
|
},
|
||||||
|
1: {"AC": {"accuracy_judge_mode"}},
|
||||||
|
2: {"AC": {"accuracy_judge_mode"}},
|
||||||
|
3: {"AC": {"accuracy_judge_mode"}},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_enum_to_str(ruleset_id: int, mods: list[APIMod]):
|
||||||
|
for mod in mods:
|
||||||
|
if mod["acronym"] in _enum_to_str.get(ruleset_id, {}):
|
||||||
|
for setting in mod.get("settings", {}):
|
||||||
|
if setting in _enum_to_str[ruleset_id][mod["acronym"]]:
|
||||||
|
mod["settings"][setting] = str(mod["settings"][setting]) # pyright: ignore[reportTypedDictNotRequiredAccess]
|
||||||
|
|
||||||
|
|
||||||
class RosuPerformanceCalculator(BasePerformanceCalculator):
|
class RosuPerformanceCalculator(BasePerformanceCalculator):
|
||||||
SUPPORT_MODES: ClassVar[set[GameMode]] = {
|
SUPPORT_MODES: ClassVar[set[GameMode]] = {
|
||||||
@@ -125,7 +145,7 @@ class RosuPerformanceCalculator(BasePerformanceCalculator):
|
|||||||
try:
|
try:
|
||||||
map = rosu.Beatmap(content=beatmap_raw)
|
map = rosu.Beatmap(content=beatmap_raw)
|
||||||
mods = deepcopy(score.mods.copy())
|
mods = deepcopy(score.mods.copy())
|
||||||
parse_enum_to_str(int(score.gamemode), mods)
|
_parse_enum_to_str(int(score.gamemode), mods)
|
||||||
map.convert(self._to_rosu_mode(score.gamemode), mods) # pyright: ignore[reportArgumentType]
|
map.convert(self._to_rosu_mode(score.gamemode), mods) # pyright: ignore[reportArgumentType]
|
||||||
perf = rosu.Performance(
|
perf = rosu.Performance(
|
||||||
mods=mods,
|
mods=mods,
|
||||||
|
|||||||
@@ -147,6 +147,8 @@ DEFAULT_RANKED_MODS = {
|
|||||||
"NS": {"hidden_combo_count": {"check": False, "type": "number"}},
|
"NS": {"hidden_combo_count": {"check": False, "type": "number"}},
|
||||||
"SO": {},
|
"SO": {},
|
||||||
"TC": {},
|
"TC": {},
|
||||||
|
"AL": {},
|
||||||
|
"SG": {},
|
||||||
},
|
},
|
||||||
1: {
|
1: {
|
||||||
"EZ": {},
|
"EZ": {},
|
||||||
@@ -171,6 +173,7 @@ DEFAULT_RANKED_MODS = {
|
|||||||
"mute_combo_count": {"check": False, "type": "number"},
|
"mute_combo_count": {"check": False, "type": "number"},
|
||||||
"affects_hit_sounds": {"check": False, "type": "boolean"},
|
"affects_hit_sounds": {"check": False, "type": "boolean"},
|
||||||
},
|
},
|
||||||
|
"SG": {},
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
"EZ": {"retries": {"type": "number", "eq": 2}},
|
"EZ": {"retries": {"type": "number", "eq": 2}},
|
||||||
@@ -349,27 +352,6 @@ def mods_can_get_pp(ruleset_id: int, mods: list[APIMod]) -> bool:
|
|||||||
return _mods_can_get_pp(ruleset_id, mods, RANKED_MODS)
|
return _mods_can_get_pp(ruleset_id, mods, RANKED_MODS)
|
||||||
|
|
||||||
|
|
||||||
ENUM_TO_STR = {
|
|
||||||
0: {
|
|
||||||
"MR": {"reflection"},
|
|
||||||
"AC": {"accuracy_judge_mode"},
|
|
||||||
"BR": {"direction"},
|
|
||||||
"AD": {"style"},
|
|
||||||
},
|
|
||||||
1: {"AC": {"accuracy_judge_mode"}},
|
|
||||||
2: {"AC": {"accuracy_judge_mode"}},
|
|
||||||
3: {"AC": {"accuracy_judge_mode"}},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def parse_enum_to_str(ruleset_id: int, mods: list[APIMod]):
|
|
||||||
for mod in mods:
|
|
||||||
if mod["acronym"] in ENUM_TO_STR.get(ruleset_id, {}):
|
|
||||||
for setting in mod.get("settings", {}):
|
|
||||||
if setting in ENUM_TO_STR[ruleset_id][mod["acronym"]]:
|
|
||||||
mod["settings"][setting] = str(mod["settings"][setting]) # pyright: ignore[reportTypedDictNotRequiredAccess]
|
|
||||||
|
|
||||||
|
|
||||||
def mod_to_save(mods: list[APIMod]) -> list[str]:
|
def mod_to_save(mods: list[APIMod]) -> list[str]:
|
||||||
s = list({mod["acronym"] for mod in mods})
|
s = list({mod["acronym"] for mod in mods})
|
||||||
s.sort()
|
s.sort()
|
||||||
|
|||||||
Reference in New Issue
Block a user