Files
Dniel97_artemis/titles/idac/const.py
T
Dniel97andpuniru 3ac8762868 Initial D THE ARCADE Season 3 support (#1)
## Changes:

- [x] Added database upgrade script for season 3 tables
- [x] Completly implement season 3
- [x] Teams are fully functional as intended
- [x] Time Release is properly updated for season 3 (v2.10.00)
- [x] New accounts can be created and saved in db
- [x] Old 2eason 2 accounts can be transfered to season 3
- [x] Season independed config has been added inclusive version specific configs

Co-authored-by: puniru <puniru@posteo.jp>
Reviewed-on: https://gitea.tendokyu.moe/Dniel97/artemis-IDAC/pulls/1
Co-authored-by: Dniel97 <Dniel97@noreply.gitea.tendokyu.moe>
Co-committed-by: Dniel97 <Dniel97@noreply.gitea.tendokyu.moe>
2026-04-01 18:18:09 +00:00

321 lines
7.8 KiB
Python

from enum import IntEnum
from typing import Dict, List, Optional
from pydantic import BaseModel
class RewardCategoryEnum(IntEnum):
NONE = 0
D_COIN = 1
CAR_DRESSUP_TOKEN = 3
AVATAR_TOKEN = 5
TACHOMETER = 6
AURA = 7
AURA_COLOR = 8
AVATAR_FACE = 9
AVATAR_EYE = 10
AVATAR_MOUTH = 11
AVATAR_HAIR = 12
AVATAR_GLASSES = 13
AVATAR_ACCESSORIES = 14
AVATAR_BODY = 15
AVATAR_BACKGROUNDS = 18
CHATSTAMP = 21
KEYCHAIN = 22
TITLE = 24
FULLTUNE_TICKET = 25
PAPER_CUP = 26
BGM = 27
ONOMATOPE = 28
MAIN_MENU_BG = 31
CAR_PAINT = 32
AURA_LEVEL = 33
FT_TOKEN_PIECES = 34
UNDERNEONS = 35
class LayoutEnum(IntEnum):
TECHNICAL = 0
HIGHSPEED = 1
class StyleEnum(IntEnum):
DH = 0
HC = 1
AR = 2
class CarMakerEnum(IntEnum):
TOYOTA = 0
NISSAN = 1
HONDA = 2
MAZDA = 3
SUBARU = 4
MITSUBISHI = 5
SUZUKI = 6
INITIALD = 7
COMPLETE = 8
PORSCHE = 9
class StoryTypeEnum(IntEnum):
NONE = 0
STORY = 1
MFG = 2
BUNTA = 3
TOUHOU_1ST = 4
MIKU = 5
HOT_VERSION = 6
class CollaboEnum(IntEnum):
NONE = 0
WMN = 1
TOHO = 2
LIFEGUARD = 3
MFG = 4
ANNIVERSARY_20TH = 5
TOHO_2 = 6
MIKU = 7
HOT_VERSION = 8
TOUHOU_3 = 9
class StoryPlayStatusEnum(IntEnum):
NEW = 0
PLAYED = 1
CLEARED = 2
MAX = 3 # not used?
class NameChangeCategoryEnum(IntEnum):
PAYMET = 0
CREDIT_RETRY = 1
INHERIT = 2
DENIED = 3
class BattleGiftStatusEnum(IntEnum):
NONE = 0
AQUIRED = 1
NEW = 2
class LeagueRankEnum(IntEnum):
OPEN = 0
BASIC = 1
BRONZE = 2
SILVER = 3
GOLD = 4
PLATINUM = 5
MASTER = 6
class VSInfoBattleModeEnum(IntEnum):
ONLINE = 0
INSTORE = 1
class PointRule(BaseModel):
upper_points: int
lower_points: int
destination_league_rank_id: LeagueRankEnum
destination_point: int
class RankRule(BaseModel):
destination_league_rank_id: LeagueRankEnum
destination_rank: int
demote_rank: Optional[int] = None
class PointRankingRule(BaseModel):
points_upper_rank: int
upper_points: int
point_rules: List[PointRule]
class OpenRankingRule(BaseModel):
default_rank_id: LeagueRankEnum
default_rank: int
rules: List[RankRule]
class NormalRankingRule(BaseModel):
default_rank_id: LeagueRankEnum
default_rank: int
rules: Dict[LeagueRankEnum, RankRule]
class TeamPointsRankingRules(BaseModel):
"""
TeamPointsRankingRules is a dictionary of PointRankingRule objects, where the key is the version (season)
"""
RootModel: Dict[int, PointRankingRule]
def __getitem__(self, version: int) -> "PointRankingRule":
return self.RootModel[version]
class TeamRankingRulesOpenRound(BaseModel):
"""
TeamRankingRulesOpenRound is a dictionary of RankingRule objects, where the key is the version (season)
"""
RootModel: Dict[int, OpenRankingRule]
def __getitem__(self, version: int) -> "OpenRankingRule":
return self.RootModel[version]
class TeamRankingRulesNormalRound(BaseModel):
"""
TeamRankingRulesNormalRound is a dictionary of RankingRule objects, where the key is the version (season)
"""
RootModel: Dict[int, NormalRankingRule]
def __getitem__(self, version: int) -> "NormalRankingRule":
return self.RootModel[version]
class IDACConstants:
GAME_CODE = "SDGT"
CONFIG_NAME = "idac.yaml"
VER_IDAC_SEASON_1 = 0
VER_IDAC_SEASON_2 = 1
VER_IDAC_SEASON_3 = 2
BATTLE_MODE_ONLINE = 0
BATTLE_MODE_OFFLINE = 1
VERSION_STRING = (
"Initial D THE ARCADE Season 1",
"Initial D THE ARCADE Season 2",
"Initial D THE ARCADE Season 3",
)
MAX_GRADE = {
0: 54,
1: 72,
2: 72,
3: 81,
}
CAR_LAYOUT_MAPPING_FULL = {
0: LayoutEnum.TECHNICAL,
1: LayoutEnum.TECHNICAL,
2: LayoutEnum.TECHNICAL,
3: LayoutEnum.TECHNICAL,
4: LayoutEnum.TECHNICAL,
5: LayoutEnum.TECHNICAL,
9: LayoutEnum.TECHNICAL,
10: LayoutEnum.TECHNICAL,
13: LayoutEnum.TECHNICAL,
14: LayoutEnum.TECHNICAL,
258: LayoutEnum.TECHNICAL,
259: LayoutEnum.TECHNICAL,
261: LayoutEnum.TECHNICAL,
512: LayoutEnum.TECHNICAL,
513: LayoutEnum.TECHNICAL,
514: LayoutEnum.TECHNICAL,
515: LayoutEnum.TECHNICAL,
770: LayoutEnum.TECHNICAL,
771: LayoutEnum.TECHNICAL,
772: LayoutEnum.TECHNICAL,
1280: LayoutEnum.TECHNICAL,
1281: LayoutEnum.TECHNICAL,
1283: LayoutEnum.TECHNICAL,
1285: LayoutEnum.TECHNICAL,
1286: LayoutEnum.TECHNICAL,
1536: LayoutEnum.TECHNICAL,
1537: LayoutEnum.TECHNICAL,
1792: LayoutEnum.TECHNICAL,
}
TEAM_POINTS_RANKING_RULES = TeamPointsRankingRules(
RootModel={
VER_IDAC_SEASON_3: PointRankingRule(
points_upper_rank=2,
upper_points=5000,
point_rules=[
PointRule(
lower_points=0,
upper_points=1000,
destination_league_rank_id=LeagueRankEnum.BASIC,
destination_point=1000,
),
PointRule(
lower_points=1000,
upper_points=5000,
destination_league_rank_id=LeagueRankEnum.BRONZE,
destination_point=5000,
),
],
),
}
)
TEAM_RANKING_RULES_OPEN_ROUND = TeamRankingRulesOpenRound(
RootModel={
VER_IDAC_SEASON_3: OpenRankingRule(
default_rank_id=LeagueRankEnum.SILVER,
default_rank=2200,
rules=[
RankRule(
destination_league_rank_id=LeagueRankEnum.GOLD,
destination_rank=2200,
demote_rank=None,
),
RankRule(
destination_league_rank_id=LeagueRankEnum.PLATINUM,
destination_rank=700,
demote_rank=None,
),
RankRule(
destination_league_rank_id=LeagueRankEnum.MASTER,
destination_rank=200,
demote_rank=None,
),
],
)
}
)
TEAM_RANKING_RULES_NORMAL_ROUND = TeamRankingRulesNormalRound(
RootModel={
VER_IDAC_SEASON_3: NormalRankingRule(
default_rank_id=LeagueRankEnum.SILVER,
default_rank=500,
rules={
LeagueRankEnum.SILVER: RankRule(
destination_league_rank_id=LeagueRankEnum.GOLD,
destination_rank=500,
demote_rank=None,
),
LeagueRankEnum.GOLD: RankRule(
destination_league_rank_id=LeagueRankEnum.PLATINUM,
destination_rank=200,
demote_rank=1001,
),
LeagueRankEnum.PLATINUM: RankRule(
destination_league_rank_id=LeagueRankEnum.MASTER,
destination_rank=50,
demote_rank=301,
),
LeagueRankEnum.MASTER: RankRule(
destination_league_rank_id=LeagueRankEnum.MASTER,
destination_rank=50,
demote_rank=151,
),
},
)
}
)
@classmethod
def game_ver_to_string(cls, ver: int):
return cls.VERSION_STRING[ver]