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.iidx.stubs import (
|
|
|
|
IIDX1stStyle,
|
|
|
|
IIDX2ndStyle,
|
|
|
|
IIDX3rdStyle,
|
|
|
|
IIDX4thStyle,
|
|
|
|
IIDX5thStyle,
|
|
|
|
IIDX6thStyle,
|
|
|
|
IIDX7thStyle,
|
|
|
|
IIDX8thStyle,
|
|
|
|
IIDX9thStyle,
|
|
|
|
IIDX10thStyle,
|
|
|
|
IIDXRed,
|
|
|
|
IIDXHappySky,
|
|
|
|
IIDXDistorted,
|
|
|
|
IIDXGold,
|
|
|
|
IIDXDJTroopers,
|
|
|
|
IIDXEmpress,
|
|
|
|
IIDXSirius,
|
|
|
|
IIDXResortAnthem,
|
|
|
|
IIDXLincle,
|
|
|
|
)
|
|
|
|
from bemani.backend.iidx.tricoro import IIDXTricoro
|
|
|
|
from bemani.backend.iidx.spada import IIDXSpada
|
|
|
|
from bemani.backend.iidx.pendual import IIDXPendual
|
|
|
|
from bemani.backend.iidx.copula import IIDXCopula
|
|
|
|
from bemani.backend.iidx.sinobuz import IIDXSinobuz
|
|
|
|
from bemani.backend.iidx.cannonballers import IIDXCannonBallers
|
2021-05-17 23:51:26 +02:00
|
|
|
from bemani.backend.iidx.rootage import IIDXRootage
|
|
|
|
from bemani.backend.iidx.heroicverse import IIDXHeroicVerse
|
|
|
|
from bemani.backend.iidx.bistrover import IIDXBistrover
|
2021-05-18 03:10:18 +02:00
|
|
|
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 IIDXFactory(Factory):
|
|
|
|
|
2021-09-07 19:56:15 +02:00
|
|
|
MANAGED_CLASSES: List[Type[Base]] = [
|
2019-12-08 22:43:49 +01:00
|
|
|
IIDX1stStyle,
|
|
|
|
IIDX2ndStyle,
|
|
|
|
IIDX3rdStyle,
|
|
|
|
IIDX4thStyle,
|
|
|
|
IIDX5thStyle,
|
|
|
|
IIDX6thStyle,
|
|
|
|
IIDX7thStyle,
|
|
|
|
IIDX8thStyle,
|
|
|
|
IIDX9thStyle,
|
|
|
|
IIDX10thStyle,
|
|
|
|
IIDXRed,
|
|
|
|
IIDXHappySky,
|
|
|
|
IIDXDistorted,
|
|
|
|
IIDXGold,
|
|
|
|
IIDXDJTroopers,
|
|
|
|
IIDXEmpress,
|
|
|
|
IIDXSirius,
|
|
|
|
IIDXResortAnthem,
|
|
|
|
IIDXLincle,
|
|
|
|
IIDXTricoro,
|
|
|
|
IIDXSpada,
|
|
|
|
IIDXPendual,
|
|
|
|
IIDXCopula,
|
|
|
|
IIDXSinobuz,
|
|
|
|
IIDXCannonBallers,
|
2021-05-17 23:51:26 +02:00
|
|
|
IIDXRootage,
|
|
|
|
IIDXHeroicVerse,
|
|
|
|
IIDXBistrover,
|
2019-12-08 22:43:49 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def register_all(cls) -> None:
|
2021-08-19 21:20:31 +02:00
|
|
|
for gamecode in ['JDJ', 'JDZ', 'KDZ', 'LDJ']:
|
|
|
|
Base.register(gamecode, IIDXFactory)
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
@classmethod
|
2021-08-20 06:43:59 +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 < 2013100200:
|
|
|
|
return VersionConstants.IIDX_TRICORO
|
|
|
|
if date >= 2013100200 and date < 2014091700:
|
|
|
|
return VersionConstants.IIDX_SPADA
|
|
|
|
if date >= 2014091700 and date < 2015111100:
|
|
|
|
return VersionConstants.IIDX_PENDUAL
|
|
|
|
if date >= 2015111100 and date < 2016102600:
|
|
|
|
return VersionConstants.IIDX_COPULA
|
|
|
|
if date >= 2016102600 and date < 2017122100:
|
|
|
|
return VersionConstants.IIDX_SINOBUZ
|
2021-05-17 23:51:26 +02:00
|
|
|
if date >= 2017122100 and date < 2018110700:
|
2019-12-08 22:43:49 +01:00
|
|
|
return VersionConstants.IIDX_CANNON_BALLERS
|
2021-05-17 23:51:26 +02:00
|
|
|
if date >= 2018110700 and date < 2019101600:
|
|
|
|
return VersionConstants.IIDX_ROOTAGE
|
|
|
|
if date >= 2019101600 and date < 2020102800:
|
|
|
|
return VersionConstants.IIDX_HEROIC_VERSE
|
|
|
|
if date >= 2020102800:
|
|
|
|
return VersionConstants.IIDX_BISTROVER
|
2019-12-08 22:43:49 +01:00
|
|
|
return None
|
|
|
|
|
2021-08-19 21:20:31 +02:00
|
|
|
if model.gamecode == 'JDJ':
|
2019-12-08 22:43:49 +01:00
|
|
|
return IIDXSirius(data, config, model)
|
2021-08-19 21:20:31 +02:00
|
|
|
if model.gamecode == 'JDZ':
|
2019-12-08 22:43:49 +01:00
|
|
|
return IIDXResortAnthem(data, config, model)
|
2021-08-19 21:20:31 +02:00
|
|
|
if model.gamecode == 'KDZ':
|
2019-12-08 22:43:49 +01:00
|
|
|
return IIDXLincle(data, config, model)
|
2021-08-19 21:20:31 +02:00
|
|
|
if model.gamecode == 'LDJ':
|
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.
|
2021-08-19 21:20:31 +02:00
|
|
|
if parentmodel.gamecode not in ['JDJ', 'JDZ', 'KDZ', 'LDJ']:
|
2019-12-08 22:43:49 +01:00
|
|
|
return None
|
|
|
|
parentversion = version_from_date(parentmodel.version)
|
|
|
|
if parentversion == VersionConstants.IIDX_SPADA:
|
|
|
|
return IIDXTricoro(data, config, model)
|
|
|
|
if parentversion == VersionConstants.IIDX_PENDUAL:
|
|
|
|
return IIDXSpada(data, config, model)
|
|
|
|
if parentversion == VersionConstants.IIDX_COPULA:
|
|
|
|
return IIDXPendual(data, config, model)
|
|
|
|
if parentversion == VersionConstants.IIDX_SINOBUZ:
|
|
|
|
return IIDXCopula(data, config, model)
|
|
|
|
if parentversion == VersionConstants.IIDX_CANNON_BALLERS:
|
|
|
|
return IIDXSinobuz(data, config, model)
|
2021-05-17 23:51:26 +02:00
|
|
|
if parentversion == VersionConstants.IIDX_ROOTAGE:
|
|
|
|
return IIDXCannonBallers(data, config, model)
|
|
|
|
if parentversion == VersionConstants.IIDX_HEROIC_VERSE:
|
|
|
|
return IIDXRootage(data, config, model)
|
|
|
|
if parentversion == VersionConstants.IIDX_BISTROVER:
|
|
|
|
return IIDXHeroicVerse(data, config, model)
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Unknown older version
|
|
|
|
return None
|
|
|
|
|
|
|
|
version = version_from_date(model.version)
|
|
|
|
if version == VersionConstants.IIDX_TRICORO:
|
|
|
|
return IIDXTricoro(data, config, model)
|
|
|
|
if version == VersionConstants.IIDX_SPADA:
|
|
|
|
return IIDXSpada(data, config, model)
|
|
|
|
if version == VersionConstants.IIDX_PENDUAL:
|
|
|
|
return IIDXPendual(data, config, model)
|
|
|
|
if version == VersionConstants.IIDX_COPULA:
|
|
|
|
return IIDXCopula(data, config, model)
|
|
|
|
if version == VersionConstants.IIDX_SINOBUZ:
|
|
|
|
return IIDXSinobuz(data, config, model)
|
|
|
|
if version == VersionConstants.IIDX_CANNON_BALLERS:
|
|
|
|
return IIDXCannonBallers(data, config, model)
|
2021-05-17 23:51:26 +02:00
|
|
|
if version == VersionConstants.IIDX_ROOTAGE:
|
|
|
|
return IIDXRootage(data, config, model)
|
|
|
|
if version == VersionConstants.IIDX_HEROIC_VERSE:
|
|
|
|
return IIDXHeroicVerse(data, config, model)
|
|
|
|
if version == VersionConstants.IIDX_BISTROVER:
|
|
|
|
return IIDXBistrover(data, config, model)
|
2019-12-08 22:43:49 +01:00
|
|
|
|
|
|
|
# Unknown game version
|
|
|
|
return None
|