Merge remote-tracking branch 'origin/develop' into idac

This commit is contained in:
Dniel97 2024-04-13 23:09:51 +02:00
commit 2b014178c8
Signed by: Dniel97
GPG Key ID: 6180B3C768FB2E08
8 changed files with 85 additions and 15 deletions

View File

@ -1,6 +1,15 @@
# Changelog
Documenting updates to ARTEMiS, to be updated every time the master branch is pushed to.
## 20240408
### System
+ Modified the game specific documentation
## 20240407
### Maimai
+ Support maimai DX International [#118](https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/118) (Thanks beerpsi!)
+ Fixed the maimai DX reboot time from config [#120](https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/120) (Thanks topty!)
## 20240318
### CXB
+ Fixing handle_data_shop_list_detail_request for Sunrise S1

View File

@ -241,6 +241,10 @@ class Data:
self.logger.info("Message is required for create-revision")
return
for _, mod in Utils.get_all_titles().items():
if hasattr(mod, "database"):
mod.database(self.config)
self.__alembic_cmd(
"revision",
"--autogenerate",

View File

@ -9,7 +9,15 @@ using the megaime database. Clean installations always create the latest databas
To upgrade the core database and the database for every game, execute:
```shell
python dbutils.py autoupgrade
python dbutils.py upgrade
```
If you are using the old master branch that was not setup with alembic, make sure to do the following steps in order:
- Pull down latest master/develop
- Update core.yaml
- Back up your existing database
```shell
python dbutils.py migrate
```
# Table of content
@ -22,7 +30,7 @@ python dbutils.py autoupgrade
- [Card Maker](#card-maker)
- [WACCA](#wacca)
- [Sword Art Online Arcade](#sao)
- [Initial D THE ARCADE](#initial-d-the-arcade)
- [Initial D THE ARCADE](#initial-d-the-arcade)
# Supported Games
@ -95,7 +103,7 @@ crypto:
Always make sure your database (tables) are up-to-date:
```shell
python dbutils.py --game SDBT upgrade
python dbutils.py upgrade
```
### Online Battle
@ -218,7 +226,7 @@ The importer for maimai Pre-DX will import Events and Music. Not all games will
Always make sure your database (tables) are up-to-date:
```shell
python dbutils.py --game SDEZ upgrade
python dbutils.py upgrade
```
Pre-Dx uses the same database as DX, so only upgrade using the SDEZ game code!
@ -262,7 +270,7 @@ In order to use custom PV Lists, simply drop in your .dat files inside of /title
Always make sure your database (tables) are up-to-date:
```shell
python dbutils.py --game SBZV upgrade
python dbutils.py upgrade
```
## O.N.G.E.K.I.
@ -318,7 +326,7 @@ crypto:
Always make sure your database (tables) are up-to-date:
```shell
python dbutils.py --game SDDT upgrade
python dbutils.py upgrade
```
### Controlling Events (Ranking Event, Technical Challenge Event, Mission Event)
@ -546,7 +554,7 @@ Config file is located in `config/wacca.yaml`.
Always make sure your database (tables) are up-to-date:
```shell
python dbutils.py --game SDFE upgrade
python dbutils.py upgrade
```
### VIP Rewards
@ -619,7 +627,7 @@ Config file is located in `config/sao.yaml`.
Always make sure your database (tables) are up-to-date:
```shell
python dbutils.py --game SDEW upgrade
python dbutils.py upgrade
```
### Notes
@ -684,7 +692,7 @@ Config file is located in `config/idac.yaml`.
Always make sure your database (tables) are up-to-date:
```shell
python dbutils.py --game SDGT upgrade
python dbutils.py upgrade
```
### Notes

View File

@ -15,4 +15,5 @@ game_codes = [
Mai2Constants.GAME_CODE_ORANGE,
Mai2Constants.GAME_CODE_GREEN,
Mai2Constants.GAME_CODE,
Mai2Constants.GAME_CODE_DX_INT,
]

View File

@ -28,6 +28,7 @@ class Mai2Constants:
GAME_CODE_MILK = "SDDZ"
GAME_CODE_FINALE = "SDEY"
GAME_CODE_DX = "SDEZ"
GAME_CODE_DX_INT = "SDGA"
CONFIG_NAME = "mai2.yaml"

View File

@ -16,12 +16,36 @@ class Mai2DX(Mai2Base):
self.version = Mai2Constants.VER_MAIMAI_DX
async def handle_get_game_setting_api_request(self, data: Dict):
# if reboot start/end time is not defined use the default behavior of being a few hours ago
if self.core_config.title.reboot_start_time == "" or self.core_config.title.reboot_end_time == "":
reboot_start = datetime.strftime(
datetime.utcnow() + timedelta(hours=6), self.date_time_format
)
reboot_end = datetime.strftime(
datetime.utcnow() + timedelta(hours=7), self.date_time_format
)
else:
# get current datetime in JST
current_jst = datetime.now(pytz.timezone('Asia/Tokyo')).date()
# parse config start/end times into datetime
reboot_start_time = datetime.strptime(self.core_config.title.reboot_start_time, "%H:%M")
reboot_end_time = datetime.strptime(self.core_config.title.reboot_end_time, "%H:%M")
# offset datetimes with current date/time
reboot_start_time = reboot_start_time.replace(year=current_jst.year, month=current_jst.month, day=current_jst.day, tzinfo=pytz.timezone('Asia/Tokyo'))
reboot_end_time = reboot_end_time.replace(year=current_jst.year, month=current_jst.month, day=current_jst.day, tzinfo=pytz.timezone('Asia/Tokyo'))
# create strings for use in gameSetting
reboot_start = reboot_start_time.strftime(self.date_time_format)
reboot_end = reboot_end_time.strftime(self.date_time_format)
return {
"gameSetting": {
"isMaintenance": False,
"requestInterval": 1800,
"rebootStartTime": "2020-01-01 07:00:00.0",
"rebootEndTime": "2020-01-01 07:59:59.0",
"rebootStartTime": reboot_start,
"rebootEndTime": reboot_end,
"movieUploadLimit": 100,
"movieStatus": 1,
"movieServerUri": self.old_server + "movie/",

View File

@ -113,18 +113,23 @@ class Mai2Servlet(BaseServlet):
Route("/{version:int}/MaimaiServlet/usbdl/{endpoint:str}", self.handle_usbdl),
Route("/{version:int}/MaimaiServlet/deliver/{endpoint:str}", self.handle_deliver),
Route("/{version:int}/MaimaiServlet/{endpoint:str}", self.handle_mai, methods=['POST']),
Route("/{version:int}/Maimai2Servlet/{endpoint:str}", self.handle_mai2, methods=['POST']),
Route("/{game:str}/{version:int}/Maimai2Servlet/{endpoint:str}", self.handle_mai2, methods=['POST']),
]
def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]:
def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]:
if game_code in {Mai2Constants.GAME_CODE_DX, Mai2Constants.GAME_CODE_DX_INT}:
path = f"{game_code}/{game_ver}"
else:
path = game_ver
if not self.core_cfg.server.is_using_proxy and Utils.get_title_port(self.core_cfg) != 80:
return (
f"http://{self.core_cfg.server.hostname}:{Utils.get_title_port(self.core_cfg)}/{game_ver}/",
f"http://{self.core_cfg.server.hostname}:{Utils.get_title_port(self.core_cfg)}/{path}/",
f"{self.core_cfg.server.hostname}",
)
return (
f"http://{self.core_cfg.server.hostname}/{game_ver}/",
f"http://{self.core_cfg.server.hostname}/{path}/",
f"{self.core_cfg.server.hostname}",
)
@ -239,6 +244,8 @@ class Mai2Servlet(BaseServlet):
async def handle_mai2(self, request: Request) -> bytes:
endpoint: str = request.path_params.get('endpoint')
version: int = request.path_params.get('version')
game_code = request.path_params.get('game')
if endpoint.lower() == "ping":
return Response(zlib.compress(b'{"returnCode": "1"}'))
@ -292,6 +299,11 @@ class Mai2Servlet(BaseServlet):
self.logger.info(f"v{version} {endpoint} request from {client_ip}")
self.logger.debug(req_data)
endpoint = (
endpoint.replace("MaimaiExp", "")
if game_code == Mai2Constants.GAME_CODE_DX_INT
else endpoint
)
func_to_find = "handle_" + inflection.underscore(endpoint) + "_request"
handler_cls = self.versions[internal_ver](self.core_cfg, self.game_cfg)

View File

@ -13,6 +13,7 @@ import traceback
import sys
from core import CoreConfig, Utils
from core.data import Data
from core.title import BaseServlet
from .config import WaccaConfig
from .config import WaccaConfig
@ -33,6 +34,7 @@ class WaccaServlet(BaseServlet):
self.game_cfg.update(
yaml.safe_load(open(f"{cfg_dir}/{WaccaConstants.CONFIG_NAME}"))
)
self.data = Data(core_cfg)
self.versions = [
WaccaBase(core_cfg, self.game_cfg),
@ -136,6 +138,15 @@ class WaccaServlet(BaseServlet):
resp.status = 1
resp.message = "不正なリクエスト エラーです"
return end(resp.make())
if not self.core_cfg.server.allow_unregistered_serials:
mech = await self.data.arcade.get_machine(req.chipId)
if not mech:
self.logger.error(f"Blocked request from unregistered serial {req.chipId} to {url_path}")
resp = BaseResponse()
resp.status = 1
resp.message = "機械エラーです"
return end(resp.make())
ver_search = int(version_full)