feat(score): add simple suspicious score check
TODO: use another lib to check the beatmap is whether suspicious or not
This commit is contained in:
@@ -3,6 +3,8 @@ from __future__ import annotations
|
||||
import math
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from app.config import settings
|
||||
from app.log import logger
|
||||
from app.models.beatmap import BeatmapAttributes
|
||||
from app.models.mods import APIMod
|
||||
from app.models.score import GameMode
|
||||
@@ -75,7 +77,18 @@ def calculate_pp(
|
||||
misses=score.nmiss,
|
||||
)
|
||||
attrs = perf.calculate(map)
|
||||
return attrs.pp
|
||||
pp = attrs.pp
|
||||
# mrekk bp1: 2048pp; ppy-sb top1 rxbp1: 2198pp
|
||||
if settings.suspicious_score_check and (
|
||||
(attrs.difficulty.stars > 25 and score.accuracy < 0.8) or pp > 2300
|
||||
):
|
||||
logger.warning(
|
||||
f"User {score.user_id} played {score.beatmap_id} with {pp=} "
|
||||
f"acc={score.accuracy}. The score is suspicious and return 0pp"
|
||||
f"({score.id=})"
|
||||
)
|
||||
return 0
|
||||
return pp
|
||||
|
||||
|
||||
# https://osu.ppy.sh/wiki/Gameplay/Score/Total_score
|
||||
|
||||
@@ -94,6 +94,7 @@ class Settings(BaseSettings):
|
||||
enable_supporter_for_all_users: bool = False
|
||||
enable_all_beatmap_leaderboard: bool = False
|
||||
enable_all_beatmap_pp: bool = False
|
||||
suspicious_score_check: bool = True
|
||||
seasonal_backgrounds: list[str] = []
|
||||
|
||||
# 存储设置
|
||||
|
||||
Reference in New Issue
Block a user