add finale handler, pre-dx game codes

This commit is contained in:
Hay1tsme 2023-04-30 22:19:31 -04:00
parent 6ad5194bb8
commit deeac1d8db
7 changed files with 103 additions and 8 deletions

View File

@ -6,5 +6,14 @@ from titles.mai2.read import Mai2Reader
index = Mai2Servlet
database = Mai2Data
reader = Mai2Reader
game_codes = [Mai2Constants.GAME_CODE]
game_codes = [
Mai2Constants.GAME_CODE_DX,
Mai2Constants.GAME_CODE_FINALE,
Mai2Constants.GAME_CODE_MILK,
Mai2Constants.GAME_CODE_MURASAKI,
Mai2Constants.GAME_CODE_PINK,
Mai2Constants.GAME_CODE_ORANGE,
Mai2Constants.GAME_CODE_GREEN,
Mai2Constants.GAME_CODE,
]
current_schema_version = 4

View File

@ -12,8 +12,7 @@ class Mai2Base:
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
self.core_config = cfg
self.game_config = game_cfg
self.game = Mai2Constants.GAME_CODE
self.version = Mai2Constants.VER_MAIMAI_DX
self.version = Mai2Constants.VER_MAIMAI
self.data = Mai2Data(cfg)
self.logger = logging.getLogger("mai2")

View File

@ -20,10 +20,31 @@ class Mai2Constants:
DATE_TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
GAME_CODE = "SDEZ"
GAME_CODE = "SBXL"
GAME_CODE_GREEN = "SBZF"
GAME_CODE_ORANGE = "SDBM"
GAME_CODE_PINK = "SDCQ"
GAME_CODE_MURASAKI = "SDDK"
GAME_CODE_MILK = "SDDZ"
GAME_CODE_FINALE = "SDEY"
GAME_CODE_DX = "SDEZ"
CONFIG_NAME = "mai2.yaml"
VER_MAIMAI = 1000
VER_MAIMAI_PLUS = 1001
VER_MAIMAI_GREEN = 1002
VER_MAIMAI_GREEN_PLUS = 1003
VER_MAIMAI_ORANGE = 1004
VER_MAIMAI_ORANGE_PLUS = 1005
VER_MAIMAI_PINK = 1006
VER_MAIMAI_PINK_PLUS = 1007
VER_MAIMAI_MURASAKI = 1008
VER_MAIMAI_MURASAKI_PLUS = 1009
VER_MAIMAI_MILK = 1010
VER_MAIMAI_MILK_PLUS = 1011
VER_MAIMAI_FINALE = 1012
VER_MAIMAI_DX = 0
VER_MAIMAI_DX_PLUS = 1
VER_MAIMAI_DX_SPLASH = 2
@ -42,6 +63,24 @@ class Mai2Constants:
"maimai DX Festival",
)
VERSION_STRING_OLD = (
"maimai",
"maimai PLUS",
"maimai GreeN",
"maimai GreeN PLUS",
"maimai ORANGE",
"maimai ORANGE PLUS",
"maimai PiNK",
"maimai PiNK PLUS",
"maimai MURASAKi",
"maimai MURASAKi PLUS",
"maimai MiLK",
"maimai MiLK PLUS",
"maimai FiNALE",
)
@classmethod
def game_ver_to_string(cls, ver: int):
if ver >= 1000:
return cls.VERSION_STRING_OLD[ver / 1000]
return cls.VERSION_STRING[ver]

15
titles/mai2/dx.py Normal file
View File

@ -0,0 +1,15 @@
from typing import Any, List, Dict
from datetime import datetime, timedelta
import pytz
import json
from core.config import CoreConfig
from titles.mai2.base import Mai2Base
from titles.mai2.config import Mai2Config
from titles.mai2.const import Mai2Constants
class Mai2DX(Mai2Base):
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
super().__init__(cfg, game_cfg)
self.version = Mai2Constants.VER_MAIMAI_DX

View File

@ -9,7 +9,7 @@ from titles.mai2.config import Mai2Config
from titles.mai2.const import Mai2Constants
class Mai2Plus(Mai2Base):
class Mai2DXPlus(Mai2Base):
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
super().__init__(cfg, game_cfg)
self.version = Mai2Constants.VER_MAIMAI_DX_PLUS

15
titles/mai2/finale.py Normal file
View File

@ -0,0 +1,15 @@
from typing import Any, List, Dict
from datetime import datetime, timedelta
import pytz
import json
from core.config import CoreConfig
from titles.mai2.base import Mai2Base
from titles.mai2.config import Mai2Config
from titles.mai2.const import Mai2Constants
class Mai2Finale(Mai2Base):
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
super().__init__(cfg, game_cfg)
self.version = Mai2Constants.VER_MAIMAI_FINALE

View File

@ -14,7 +14,9 @@ from core.utils import Utils
from titles.mai2.config import Mai2Config
from titles.mai2.const import Mai2Constants
from titles.mai2.base import Mai2Base
from titles.mai2.plus import Mai2Plus
from titles.mai2.finale import Mai2Finale
from titles.mai2.dx import Mai2DX
from titles.mai2.dxplus import Mai2DXPlus
from titles.mai2.splash import Mai2Splash
from titles.mai2.splashplus import Mai2SplashPlus
from titles.mai2.universe import Mai2Universe
@ -32,8 +34,8 @@ class Mai2Servlet:
)
self.versions = [
Mai2Base,
Mai2Plus,
Mai2DX,
Mai2DXPlus,
Mai2Splash,
Mai2SplashPlus,
Mai2Universe,
@ -41,6 +43,22 @@ class Mai2Servlet:
Mai2Festival,
]
self.versions_old = [
Mai2Base,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
Mai2Finale,
]
self.logger = logging.getLogger("mai2")
log_fmt_str = "[%(asctime)s] Mai2 | %(levelname)s | %(message)s"
log_fmt = logging.Formatter(log_fmt_str)