mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-07-01 04:06:27 +00:00
Compare commits
3 Commits
v0.2.0
...
62c85e9e82
Author | SHA1 | Date | |
---|---|---|---|
62c85e9e82
|
|||
c7de60ee03
|
|||
7c000d01cb
|
@ -1,6 +1,6 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from sqlalchemy import TEXT, case, func, inspect, select
|
from sqlalchemy import TEXT, case, func, inspect, select, text
|
||||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||||
from sqlalchemy_utils import create_view
|
from sqlalchemy_utils import create_view
|
||||||
|
|
||||||
@ -78,10 +78,16 @@ class ScoreCalculated(ScoresViewBase):
|
|||||||
Score.score,
|
Score.score,
|
||||||
Score.pure,
|
Score.pure,
|
||||||
(
|
(
|
||||||
Score.score
|
case(
|
||||||
- func.floor(
|
(
|
||||||
(Score.pure * 10000000.0 / ChartInfo.notes)
|
(ChartInfo.notes.isnot(None) & ChartInfo.notes != 0),
|
||||||
+ (Score.far * 0.5 * 10000000.0 / ChartInfo.notes)
|
Score.score
|
||||||
|
- func.floor(
|
||||||
|
(Score.pure * 10000000.0 / ChartInfo.notes)
|
||||||
|
+ (Score.far * 0.5 * 10000000.0 / ChartInfo.notes)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
else_=text("NULL"),
|
||||||
)
|
)
|
||||||
).label("shiny_pure"),
|
).label("shiny_pure"),
|
||||||
Score.far,
|
Score.far,
|
||||||
|
15
src/arcaea_offline/utils/partner.py
Normal file
15
src/arcaea_offline/utils/partner.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
from enum import IntEnum
|
||||||
|
|
||||||
|
|
||||||
|
class KanaeDayNight(IntEnum):
|
||||||
|
Day = 0
|
||||||
|
Night = 1
|
||||||
|
|
||||||
|
|
||||||
|
def kanae_day_night(timestamp: int) -> KanaeDayNight:
|
||||||
|
"""
|
||||||
|
:param timestamp: POSIX timestamp, which is passed to `datetime.fromtimestamp(timestamp)`.
|
||||||
|
"""
|
||||||
|
dt = datetime.fromtimestamp(timestamp)
|
||||||
|
return KanaeDayNight.Day if 6 <= dt.hour <= 19 else KanaeDayNight.Night
|
@ -2,6 +2,15 @@ from typing import Any, Sequence
|
|||||||
|
|
||||||
SCORE_GRADE_FLOOR = [9900000, 9800000, 9500000, 9200000, 8900000, 8600000, 0]
|
SCORE_GRADE_FLOOR = [9900000, 9800000, 9500000, 9200000, 8900000, 8600000, 0]
|
||||||
SCORE_GRADE_TEXTS = ["EX+", "EX", "AA", "A", "B", "C", "D"]
|
SCORE_GRADE_TEXTS = ["EX+", "EX", "AA", "A", "B", "C", "D"]
|
||||||
|
MODIFIER_TEXTS = ["NORMAL", "EASY", "HARD"]
|
||||||
|
CLEAR_TYPE_TEXTS = [
|
||||||
|
"TRACK LOST",
|
||||||
|
"NORMAL CLEAR",
|
||||||
|
"FULL RECALL",
|
||||||
|
"PURE MEMORY",
|
||||||
|
"EASY CLEAR",
|
||||||
|
"HARD CLEAR",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def zip_score_grade(score: int, __seq: Sequence, default: Any = "__PRESERVE__"):
|
def zip_score_grade(score: int, __seq: Sequence, default: Any = "__PRESERVE__"):
|
||||||
@ -27,3 +36,11 @@ def zip_score_grade(score: int, __seq: Sequence, default: Any = "__PRESERVE__"):
|
|||||||
|
|
||||||
def score_to_grade_text(score: int) -> str:
|
def score_to_grade_text(score: int) -> str:
|
||||||
return zip_score_grade(score, SCORE_GRADE_TEXTS)
|
return zip_score_grade(score, SCORE_GRADE_TEXTS)
|
||||||
|
|
||||||
|
|
||||||
|
def modifier_to_text(modifier: int) -> str:
|
||||||
|
return MODIFIER_TEXTS[modifier]
|
||||||
|
|
||||||
|
|
||||||
|
def clear_type_to_text(clear_type: int) -> str:
|
||||||
|
return CLEAR_TYPE_TEXTS[clear_type]
|
||||||
|
Reference in New Issue
Block a user