2021-09-07 19:56:15 +02:00
|
|
|
from typing import List, Optional, Type
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
from bemani.backend.base import Base, Factory
|
|
|
|
from bemani.backend.sdvx.booth import SoundVoltexBooth
|
|
|
|
from bemani.backend.sdvx.infiniteinfection import SoundVoltexInfiniteInfection
|
|
|
|
from bemani.backend.sdvx.gravitywars import SoundVoltexGravityWars
|
|
|
|
from bemani.backend.sdvx.gravitywars_s1 import SoundVoltexGravityWarsSeason1
|
|
|
|
from bemani.backend.sdvx.gravitywars_s2 import SoundVoltexGravityWarsSeason2
|
|
|
|
from bemani.backend.sdvx.heavenlyhaven import SoundVoltexHeavenlyHaven
|
|
|
|
from bemani.common import Model, VersionConstants
|
2021-08-20 06:43:59 +02:00
|
|
|
from bemani.data import Config, Data
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
class SoundVoltexFactory(Factory):
|
2021-09-07 19:56:15 +02:00
|
|
|
MANAGED_CLASSES: List[Type[Base]] = [
|
2019-12-08 22:43:49 +01:00
|
|
|
SoundVoltexBooth,
|
|
|
|
SoundVoltexInfiniteInfection,
|
|
|
|
SoundVoltexGravityWars,
|
|
|
|
SoundVoltexHeavenlyHaven,
|
|
|
|
]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def register_all(cls) -> None:
|
2022-10-15 20:56:30 +02:00
|
|
|
for gamecode in ["KFC"]:
|
2021-08-19 21:20:31 +02:00
|
|
|
Base.register(gamecode, SoundVoltexFactory)
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
@classmethod
|
2022-10-15 20:56:30 +02:00
|
|
|
def create(
|
|
|
|
cls,
|
|
|
|
data: Data,
|
|
|
|
config: Config,
|
|
|
|
model: Model,
|
|
|
|
parentmodel: Optional[Model] = None,
|
|
|
|
) -> Optional[Base]:
|
2019-12-08 22:43:49 +01:00
|
|
|
def version_from_date(date: int) -> Optional[int]:
|
|
|
|
if date < 2013060500:
|
|
|
|
return VersionConstants.SDVX_BOOTH
|
|
|
|
elif date >= 2013060500 and date < 2014112000:
|
|
|
|
return VersionConstants.SDVX_INFINITE_INFECTION
|
|
|
|
elif date >= 2014112000 and date < 2016122100:
|
|
|
|
return VersionConstants.SDVX_GRAVITY_WARS
|
|
|
|
elif date >= 2016122100:
|
|
|
|
return VersionConstants.SDVX_HEAVENLY_HAVEN
|
|
|
|
return None
|
|
|
|
|
2022-10-15 20:56:30 +02:00
|
|
|
if model.gamecode == "KFC":
|
2019-12-08 22:43:49 +01:00
|
|
|
if model.version is None:
|
|
|
|
if parentmodel is None:
|
|
|
|
return None
|
|
|
|
|
|
|
|
# We have no way to tell apart newer versions. However, we can make
|
|
|
|
# an educated guess if we happen to be summoned for old profile lookup.
|
2022-10-15 20:56:30 +02:00
|
|
|
if parentmodel.gamecode != "KFC":
|
2019-12-08 22:43:49 +01:00
|
|
|
return None
|
|
|
|
|
|
|
|
parentversion = version_from_date(parentmodel.version)
|
|
|
|
if parentversion == VersionConstants.SDVX_INFINITE_INFECTION:
|
|
|
|
return SoundVoltexBooth(data, config, model)
|
|
|
|
if parentversion == VersionConstants.SDVX_GRAVITY_WARS:
|
|
|
|
return SoundVoltexInfiniteInfection(data, config, model)
|
|
|
|
if parentversion == VersionConstants.SDVX_HEAVENLY_HAVEN:
|
|
|
|
# We return the generic here because this is usually for profile
|
|
|
|
# checks, which means we only care about existence.
|
|
|
|
return SoundVoltexGravityWars(data, config, model)
|
|
|
|
|
|
|
|
# Unknown older version
|
|
|
|
return None
|
|
|
|
|
|
|
|
version = version_from_date(model.version)
|
|
|
|
if version == VersionConstants.SDVX_BOOTH:
|
|
|
|
return SoundVoltexBooth(data, config, model)
|
|
|
|
if version == VersionConstants.SDVX_INFINITE_INFECTION:
|
|
|
|
return SoundVoltexInfiniteInfection(data, config, model)
|
|
|
|
if version == VersionConstants.SDVX_GRAVITY_WARS:
|
|
|
|
# Determine which season
|
|
|
|
if model.version < 2015120400:
|
|
|
|
return SoundVoltexGravityWarsSeason1(data, config, model)
|
|
|
|
else:
|
|
|
|
return SoundVoltexGravityWarsSeason2(data, config, model)
|
|
|
|
if version == VersionConstants.SDVX_HEAVENLY_HAVEN:
|
|
|
|
return SoundVoltexHeavenlyHaven(data, config, model)
|
|
|
|
|
|
|
|
# Unknown game
|
|
|
|
return None
|