From 532cd3d9b9d758a042ef51949d7ec8447213f978 Mon Sep 17 00:00:00 2001
From: drmext <71258889+drmext@users.noreply.github.com>
Date: Tue, 15 Nov 2022 14:03:37 +0000
Subject: [PATCH] Black formatting
---
.gitignore | 6 +-
README.md | 19 +-
config.py | 5 +-
core_common.py | 61 +-
core_database.py | 2 +-
modules/__init__.py | 14 +-
modules/core/cardmng.py | 46 +-
modules/core/eacoin.py | 6 +-
modules/core/facility.py | 36 +-
modules/core/message.py | 16 +-
modules/core/package.py | 2 +-
modules/core/pcbevent.py | 2 +-
modules/core/pcbtracker.py | 2 +-
modules/ddr/eventlog.py | 4 +-
modules/ddr/eventlog_2.py | 4 +-
modules/ddr/playerdata.py | 755 +++++++++++--------
modules/ddr/playerdata_2.py | 752 ++++++++++---------
modules/ddr/system.py | 4 +-
modules/ddr/system_2.py | 4 +-
modules/ddr/tax.py | 2 +-
modules/iidx/iidx29gamesystem.py | 102 +--
modules/iidx/iidx29grade.py | 144 ++--
modules/iidx/iidx29lobby.py | 41 +-
modules/iidx/iidx29music.py | 554 +++++++-------
modules/iidx/iidx29pc.py | 1160 ++++++++++++++---------------
modules/iidx/iidx29ranking.py | 6 +-
modules/iidx/iidx29shop.py | 19 +-
modules/iidx/iidx30gamesystem.py | 102 +--
modules/iidx/iidx30grade.py | 144 ++--
modules/iidx/iidx30lobby.py | 41 +-
modules/iidx/iidx30music.py | 556 +++++++-------
modules/iidx/iidx30pc.py | 1180 +++++++++++++++---------------
modules/iidx/iidx30ranking.py | 6 +-
modules/iidx/iidx30shop.py | 19 +-
modules/iidx/music.py | 381 +++++-----
modules/iidx/pc.py | 872 +++++++++++-----------
modules/iidx/ranking.py | 6 +-
modules/iidx/shop.py | 19 +-
modules/sdvx/eventlog.py | 4 +-
modules/sdvx/game.py | 720 +++++++++---------
pyeamu.py | 46 +-
requirements.txt | 34 +-
utils/arc4.py | 5 +-
utils/card.py | 12 +-
utils/lz77.py | 4 +-
45 files changed, 4133 insertions(+), 3786 deletions(-)
diff --git a/.gitignore b/.gitignore
index 67a7a82..2651921 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
*.pyc
-db.json
-*.db
+/db*.json
+/*.db
+.venv/
+webui/
diff --git a/README.md b/README.md
index 81d1d3e..fc2b24c 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,21 @@
# MonkeyBusiness
-e-amusement server using FastAPI and TinyDB
-for experimental testing and playing
+e-amusement server using [FastAPI](https://github.com/tiangolo/fastapi) and [TinyDB](https://github.com/msiemens/tinydb)
+for experimental local testing and playing
-## Instructions:
-`pip install -U -r requirements.txt`
+**don't host it publicly as-is**
-`python pyeamu.py`
+## Instructions
-Edit services url and enable url_slash
+1. Install [python](https://www.python.org/ftp/python/3.10.8/python-3.10.8-amd64.exe) with "Add python.exe to PATH" checked
+1. Run `start.bat`
+
+1. Edit prop/ea3-config.xml
+
+## Playable Games
-## Playable Games:
- DDR A20 PLUS
- DDR A3
- IIDX 18 Resort Anthem
@@ -20,4 +23,4 @@ Edit services url and enable url_slash
- IIDX 20 tricoro
- IIDX 29 CastHour
- IIDX 30 RESIDENT
-- SDVX 6 Exceed Gear
+- SDVX 6 EXCEED GEAR
diff --git a/config.py b/config.py
index dbf5064..007525e 100644
--- a/config.py
+++ b/config.py
@@ -5,14 +5,15 @@ def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(0)
try:
- s.connect(('10.254.254.254', 1))
+ s.connect(("10.254.254.254", 1))
IP = s.getsockname()[0]
except Exception:
- IP = '127.0.0.1'
+ IP = "127.0.0.1"
finally:
s.close()
return IP
+
ip = get_ip()
port = 8000
services_prefix = "/core"
diff --git a/core_common.py b/core_common.py
index 552aa75..66cd587 100644
--- a/core_common.py
+++ b/core_common.py
@@ -30,7 +30,7 @@ def _add_list_as_str(elm, vals):
if elm is not None:
elm.text = new_val
- elm.attrib['__count'] = str(len(vals))
+ elm.attrib["__count"] = str(len(vals))
else:
return new_val
@@ -50,43 +50,43 @@ async def core_get_game_version_from_software_version(software_version):
_, model, dest, spec, rev, ext = software_version
ext = int(ext)
- if model == 'LDJ' and ext >= 2022101700:
+ if model == "LDJ" and ext >= 2022101700:
return 30
- elif model == 'LDJ' and ext in range(2021101300, 2022101500):
+ elif model == "LDJ" and ext in range(2021101300, 2022101500):
return 29
- elif model == 'JDZ' and ext == 2011071200:
+ elif model == "JDZ" and ext == 2011071200:
return 18
- elif model == 'KDZ' and ext == 2012090300:
+ elif model == "KDZ" and ext == 2012090300:
return 19
- elif model == 'LDJ' and ext == 2013090900:
+ elif model == "LDJ" and ext == 2013090900:
return 20
- elif model == 'MDX' and ext >= 2019022600:
+ elif model == "MDX" and ext >= 2019022600:
return 19
- elif model == 'KFC' and ext >= 2020090402:
+ elif model == "KFC" and ext >= 2020090402:
return 6
else:
return 0
async def core_process_request(request):
- cl = request.headers.get('Content-Length')
+ cl = request.headers.get("Content-Length")
data = await request.body()
if not cl or not data:
return {}
- if 'X-Compress' in request.headers:
- request.compress = request.headers.get('X-Compress')
+ if "X-Compress" in request.headers:
+ request.compress = request.headers.get("X-Compress")
else:
request.compress = None
- if 'X-Eamuse-Info' in request.headers:
- xeamuseinfo = request.headers.get('X-Eamuse-Info')
+ if "X-Eamuse-Info" in request.headers:
+ xeamuseinfo = request.headers.get("X-Eamuse-Info")
key = bytes.fromhex(xeamuseinfo[2:].replace("-", ""))
- xml_dec = EamuseARC4(key).decrypt(data[:int(cl)])
+ xml_dec = EamuseARC4(key).decrypt(data[: int(cl)])
request.is_encrypted = True
else:
- xml_dec = data[:int(cl)]
+ xml_dec = data[: int(cl)]
request.is_encrypted = False
if request.compress == "lz77":
@@ -101,25 +101,24 @@ async def core_process_request(request):
print("Request:")
print(xml_text)
- model_parts = (root.attrib['model'], *root.attrib['model'].split(':'))
+ model_parts = (root.attrib["model"], *root.attrib["model"].split(":"))
module = root[0].tag
- method = root[0].attrib['method'] if 'method' in root[0].attrib else None
- command = root[0].attrib['command'] if 'command' in root[0].attrib else None
+ method = root[0].attrib["method"] if "method" in root[0].attrib else None
+ command = root[0].attrib["command"] if "command" in root[0].attrib else None
game_version = await core_get_game_version_from_software_version(model_parts)
return {
- 'root': root,
- 'text': xml_text,
- 'module': module,
- 'method': method,
- 'command': command,
-
- 'model': model_parts[1],
- 'dest': model_parts[2],
- 'spec': model_parts[3],
- 'rev': model_parts[4],
- 'ext': model_parts[5],
- 'game_version': game_version,
+ "root": root,
+ "text": xml_text,
+ "module": module,
+ "method": method,
+ "command": command,
+ "model": model_parts[1],
+ "dest": model_parts[2],
+ "spec": model_parts[3],
+ "rev": model_parts[4],
+ "ext": model_parts[5],
+ "game_version": game_version,
}
@@ -138,7 +137,7 @@ async def core_prepare_response(request, xml):
response_headers = {"User-Agent": "EAMUSE.Httpac/1.0"}
if request.is_encrypted:
- xeamuseinfo = "1-%08x-%04x" % (int(time.time()), random.randint(0x0000, 0xffff))
+ xeamuseinfo = "1-%08x-%04x" % (int(time.time()), random.randint(0x0000, 0xFFFF))
response_headers["X-Eamuse-Info"] = xeamuseinfo
key = bytes.fromhex(xeamuseinfo[2:].replace("-", ""))
response = EamuseARC4(key).encrypt(xml_binary)
diff --git a/core_database.py b/core_database.py
index 835b8ec..02d671a 100644
--- a/core_database.py
+++ b/core_database.py
@@ -1,6 +1,6 @@
from tinydb import TinyDB
-db = TinyDB('db.json', indent=4)
+db = TinyDB("db.json", indent=4)
def get_db():
diff --git a/modules/__init__.py b/modules/__init__.py
index 455a9a2..0553b9e 100644
--- a/modules/__init__.py
+++ b/modules/__init__.py
@@ -3,15 +3,15 @@ from os import path
from glob import glob
routers = []
-for module_path in [f for f in glob(path.join(path.dirname(__file__), '**/*.py'), recursive=True)
- if path.basename(f) != "__init__.py"]:
- spec = util.spec_from_file_location('', module_path)
+for module_path in [
+ f
+ for f in glob(path.join(path.dirname(__file__), "**/*.py"), recursive=True)
+ if path.basename(f) != "__init__.py"
+]:
+ spec = util.spec_from_file_location("", module_path)
module = util.module_from_spec(spec)
spec.loader.exec_module(module)
- router = getattr(module, 'router', None)
+ router = getattr(module, "router", None)
if router is not None:
routers.append(router)
-
-
-
diff --git a/modules/core/cardmng.py b/modules/core/cardmng.py
index 835d985..0b0dfce 100644
--- a/modules/core/cardmng.py
+++ b/modules/core/cardmng.py
@@ -21,12 +21,12 @@ def get_target_table(game_id):
def get_profile(game_id, cid):
target_table = get_target_table(game_id)
- profile = get_db().table(target_table).get(where('card') == cid)
+ profile = get_db().table(target_table).get(where("card") == cid)
if profile is None:
profile = {
- 'card': cid,
- 'version': {},
+ "card": cid,
+ "version": {},
}
return profile
@@ -35,43 +35,41 @@ def get_profile(game_id, cid):
def get_game_profile(game_id, game_version, cid):
profile = get_profile(game_id, cid)
- if str(game_version) not in profile['version']:
- profile['version'][str(game_version)] = {}
+ if str(game_version) not in profile["version"]:
+ profile["version"][str(game_version)] = {}
- return profile['version'][str(game_version)]
+ return profile["version"][str(game_version)]
def create_profile(game_id, game_version, cid, pin):
target_table = get_target_table(game_id)
profile = get_profile(game_id, cid)
- profile['pin'] = pin
+ profile["pin"] = pin
- get_db().table(target_table).upsert(profile, where('card') == cid)
+ get_db().table(target_table).upsert(profile, where("card") == cid)
-@router.post('/{gameinfo}/cardmng/authpass')
+@router.post("/{gameinfo}/cardmng/authpass")
async def cardmng_authpass(request: Request):
request_info = await core_process_request(request)
- cid = request_info['root'][0].attrib['refid']
- passwd = request_info['root'][0].attrib['pass']
+ cid = request_info["root"][0].attrib["refid"]
+ passwd = request_info["root"][0].attrib["pass"]
- profile = get_profile(request_info['model'], cid)
- if profile is None or passwd != profile.get('pin', None):
+ profile = get_profile(request_info["model"], cid)
+ if profile is None or passwd != profile.get("pin", None):
status = 116
else:
status = 0
- response = E.response(
- E.authpass(status=status)
- )
+ response = E.response(E.authpass(status=status))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/cardmng/bindmodel')
+@router.post("/{gameinfo}/cardmng/bindmodel")
async def cardmng_bindmodel(request: Request):
request_info = await core_process_request(request)
@@ -85,14 +83,14 @@ async def cardmng_bindmodel(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/cardmng/getrefid')
+@router.post("/{gameinfo}/cardmng/getrefid")
async def cardmng_getrefid(request: Request):
request_info = await core_process_request(request)
- cid = request_info['root'][0].attrib['cardid']
- passwd = request_info['root'][0].attrib['passwd']
+ cid = request_info["root"][0].attrib["cardid"]
+ passwd = request_info["root"][0].attrib["passwd"]
- create_profile(request_info['model'], request_info['game_version'], cid, passwd)
+ create_profile(request_info["model"], request_info["game_version"], cid, passwd)
response = E.response(
E.getrefid(
@@ -105,13 +103,13 @@ async def cardmng_getrefid(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/cardmng/inquire')
+@router.post("/{gameinfo}/cardmng/inquire")
async def cardmng_inquire(request: Request):
request_info = await core_process_request(request)
- cid = request_info['root'][0].attrib['cardid']
+ cid = request_info["root"][0].attrib["cardid"]
- profile = get_game_profile(request_info['model'], request_info['game_version'], cid)
+ profile = get_game_profile(request_info["model"], request_info["game_version"], cid)
if profile:
binded = 1
newflag = 0
diff --git a/modules/core/eacoin.py b/modules/core/eacoin.py
index 75a9f07..260cfdc 100644
--- a/modules/core/eacoin.py
+++ b/modules/core/eacoin.py
@@ -7,7 +7,7 @@ from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/core", tags=["eacoin"])
-@router.post('/{gameinfo}/eacoin/checkin')
+@router.post("/{gameinfo}/eacoin/checkin")
async def eacoin_checkin(request: Request):
request_info = await core_process_request(request)
@@ -27,7 +27,7 @@ async def eacoin_checkin(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/eacoin/consume')
+@router.post("/{gameinfo}/eacoin/consume")
async def eacoin_consume(request: Request):
request_info = await core_process_request(request)
@@ -43,7 +43,7 @@ async def eacoin_consume(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/eacoin/getbalance')
+@router.post("/{gameinfo}/eacoin/getbalance")
async def eacoin_getbalance(request: Request):
request_info = await core_process_request(request)
diff --git a/modules/core/facility.py b/modules/core/facility.py
index 55f65f0..63a6ada 100644
--- a/modules/core/facility.py
+++ b/modules/core/facility.py
@@ -7,33 +7,33 @@ from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/core", tags=["facility"])
-@router.post('/{gameinfo}/facility/get')
+@router.post("/{gameinfo}/facility/get")
async def facility_get(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.facility(
E.location(
- E('id', 'EA000001', __type="str"),
- E.country('JP', __type="str"),
- E.region('JP-13', __type="str"),
- E.customercode('X000000001', __type="str"),
- E.companycode('X000000001', __type="str"),
+ E("id", "EA000001", __type="str"),
+ E.country("JP", __type="str"),
+ E.region("JP-13", __type="str"),
+ E.customercode("X000000001", __type="str"),
+ E.companycode("X000000001", __type="str"),
E.latitude(0, __type="s32"),
E.longitude(0, __type="s32"),
E.accuracy(0, __type="u8"),
- E.countryname('Japan', __type="str"),
- E.regionname('Tokyo', __type="str"),
- E.countryjname('日本国', __type="str"),
- E.regionjname('東京都', __type="str"),
+ E.countryname("Japan", __type="str"),
+ E.regionname("Tokyo", __type="str"),
+ E.countryjname("日本国", __type="str"),
+ E.regionjname("東京都", __type="str"),
E.name(config.arcade, __type="str"),
- E('type', 255, __type="u8"),
+ E("type", 255, __type="u8"),
),
E.line(
- E('class', 8, __type="u8"),
+ E("class", 8, __type="u8"),
E.rtt(500, __type="u16"),
E.upclass(8, __type="u8"),
- E('id', 3, __type="str"),
+ E("id", 3, __type="str"),
),
E.portfw(
E.globalip(config.ip, __type="ip4"),
@@ -56,11 +56,11 @@ async def facility_get(request: Request):
E.valid(365, __type="u16"),
),
E.url(
- E.eapass('www.ea-pass.konami.net', __type="str"),
- E.arcadefan('www.konami.jp/am', __type="str"),
- E.konaminetdx('http://am.573.jp', __type="str"),
- E.konamiid('https://id.konami.net', __type="str"),
- E.eagate('http://eagate.573.jp', __type="str"),
+ E.eapass("www.ea-pass.konami.net", __type="str"),
+ E.arcadefan("www.konami.jp/am", __type="str"),
+ E.konaminetdx("http://am.573.jp", __type="str"),
+ E.konamiid("https://id.konami.net", __type="str"),
+ E.eagate("http://eagate.573.jp", __type="str"),
),
),
expire=10800,
diff --git a/modules/core/message.py b/modules/core/message.py
index 6c10a5e..b3b70a6 100644
--- a/modules/core/message.py
+++ b/modules/core/message.py
@@ -7,18 +7,22 @@ from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/core", tags=["message"])
-@router.post('/{gameinfo}/message/get')
+@router.post("/{gameinfo}/message/get")
async def message_get(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.message(
expire=300,
- *[E.item(
- name=s,
- start=0,
- end=604800,
- ) for s in ('sys.mainte', 'sys.eacoin.mainte') if config.maintenance_mode]
+ *[
+ E.item(
+ name=s,
+ start=0,
+ end=604800,
+ )
+ for s in ("sys.mainte", "sys.eacoin.mainte")
+ if config.maintenance_mode
+ ]
)
)
diff --git a/modules/core/package.py b/modules/core/package.py
index 8647367..6801d9b 100644
--- a/modules/core/package.py
+++ b/modules/core/package.py
@@ -5,7 +5,7 @@ from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/core", tags=["package"])
-@router.post('/{gameinfo}/package/list')
+@router.post("/{gameinfo}/package/list")
async def package_list(request: Request):
request_info = await core_process_request(request)
diff --git a/modules/core/pcbevent.py b/modules/core/pcbevent.py
index 02b21b0..029bfd7 100644
--- a/modules/core/pcbevent.py
+++ b/modules/core/pcbevent.py
@@ -5,7 +5,7 @@ from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/core", tags=["pcbevent"])
-@router.post('/{gameinfo}/pcbevent/put')
+@router.post("/{gameinfo}/pcbevent/put")
async def pcbevent_put(request: Request):
request_info = await core_process_request(request)
diff --git a/modules/core/pcbtracker.py b/modules/core/pcbtracker.py
index 92ff45e..478037d 100644
--- a/modules/core/pcbtracker.py
+++ b/modules/core/pcbtracker.py
@@ -7,7 +7,7 @@ from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/core", tags=["pcbtracker"])
-@router.post('/{gameinfo}/pcbtracker/alive')
+@router.post("/{gameinfo}/pcbtracker/alive")
async def pcbtracker_alive(request: Request):
request_info = await core_process_request(request)
diff --git a/modules/ddr/eventlog.py b/modules/ddr/eventlog.py
index 126bdc3..417d920 100644
--- a/modules/ddr/eventlog.py
+++ b/modules/ddr/eventlog.py
@@ -8,8 +8,8 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["MDX"]
-@router.post('/{gameinfo}/eventlog/write')
-async def eventlog_write(request: Request):
+@router.post("/{gameinfo}/eventlog/write")
+async def ddr_eventlog_write(request: Request):
request_info = await core_process_request(request)
response = E.response(
diff --git a/modules/ddr/eventlog_2.py b/modules/ddr/eventlog_2.py
index 1d026f4..d0adc7e 100644
--- a/modules/ddr/eventlog_2.py
+++ b/modules/ddr/eventlog_2.py
@@ -8,8 +8,8 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["MDX"]
-@router.post('/{gameinfo}/eventlog_2/write')
-async def eventlog_2_write(request: Request):
+@router.post("/{gameinfo}/eventlog_2/write")
+async def ddr_eventlog_2_write(request: Request):
request_info = await core_process_request(request)
response = E.response(
diff --git a/modules/ddr/playerdata.py b/modules/ddr/playerdata.py
index a8a01ff..502dae3 100644
--- a/modules/ddr/playerdata.py
+++ b/modules/ddr/playerdata.py
@@ -17,92 +17,98 @@ router.model_whitelist = ["MDX"]
def get_profile(cid):
- return get_db().table('ddr_profile').get(
- where('card') == cid
- )
+ return get_db().table("ddr_profile").get(where("card") == cid)
def get_game_profile(cid, game_version):
profile = get_profile(cid)
- return profile['version'].get(str(game_version), None)
+ return profile["version"].get(str(game_version), None)
+
def get_common(ddr_id, game_version, idx):
- profile = get_db().table('ddr_profile').get(
- where('ddr_id') == int(ddr_id)
- )
+ profile = get_db().table("ddr_profile").get(where("ddr_id") == int(ddr_id))
if profile is not None:
- return profile['version'].get(str(game_version), None)['common'].split(',')[idx]
+ return profile["version"].get(str(game_version), None)["common"].split(",")[idx]
else:
return 0
-@router.post('/{gameinfo}/playerdata/usergamedata_advanced')
+
+@router.post("/{gameinfo}/playerdata/usergamedata_advanced")
async def usergamedata_advanced(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
- is_omni = True if request_info['rev'] == 'O' else False
+ game_version = request_info["game_version"]
+ is_omni = True if request_info["rev"] == "O" else False
response = None
- data = request_info['root'][0].find('data')
- mode = data.find('mode').text
- gamesession = data.find('gamesession').text
- refid = data.find('refid').text
-
- default = 'X0000000000000000000000000000000'[:-len(gamesession)]+gamesession
+ data = request_info["root"][0].find("data")
+ mode = data.find("mode").text
+ gamesession = data.find("gamesession").text
+ refid = data.find("refid").text
+
+ default = "X0000000000000000000000000000000"[: -len(gamesession)] + gamesession
db = get_db()
- all_profiles_for_card = db.table('ddr_profile').get(Query().card == refid)
+ all_profiles_for_card = db.table("ddr_profile").get(Query().card == refid)
- if mode == 'usernew':
- shoparea = data.find('shoparea').text
+ if mode == "usernew":
+ shoparea = data.find("shoparea").text
- if 'ddr_id' not in all_profiles_for_card:
+ if "ddr_id" not in all_profiles_for_card:
ddr_id = random.randint(10000000, 99999999)
- all_profiles_for_card['ddr_id'] = ddr_id
+ all_profiles_for_card["ddr_id"] = ddr_id
- all_profiles_for_card['version'][str(game_version)] = {
- 'game_version': game_version,
- 'calories_disp': "Off",
- 'character': "All Character Random",
- 'arrow_skin': "Normal",
- 'filter': "Darkest",
- 'guideline': "Center",
- 'priority': "Judgment",
- 'timing_disp': "On",
- 'rival_1_ddr_id': 0,
- 'rival_2_ddr_id': 0,
- 'rival_3_ddr_id': 0,
- 'single_grade': 0,
- 'double_grade': 0,
+ all_profiles_for_card["version"][str(game_version)] = {
+ "game_version": game_version,
+ "calories_disp": "Off",
+ "character": "All Character Random",
+ "arrow_skin": "Normal",
+ "filter": "Darkest",
+ "guideline": "Center",
+ "priority": "Judgment",
+ "timing_disp": "On",
+ "rival_1_ddr_id": 0,
+ "rival_2_ddr_id": 0,
+ "rival_3_ddr_id": 0,
+ "single_grade": 0,
+ "double_grade": 0,
}
- db.table('ddr_profile').upsert(all_profiles_for_card, where('card') == refid)
+ db.table("ddr_profile").upsert(all_profiles_for_card, where("card") == refid)
response = E.response(
E.playerdata(
E.result(0, __type="s32"),
- E.seq('-'.join([str(ddr_id)[:4], str(ddr_id)[4:]]), __type="str"),
+ E.seq("-".join([str(ddr_id)[:4], str(ddr_id)[4:]]), __type="str"),
E.code(ddr_id, __type="s32"),
- E.shoparea(shoparea, __type="str")
+ E.shoparea(shoparea, __type="str"),
)
)
- elif mode == 'userload' and refid != default:
+ elif mode == "userload" and refid != default:
all_scores = {}
if all_profiles_for_card is not None:
- ddr_id = all_profiles_for_card['ddr_id']
+ ddr_id = all_profiles_for_card["ddr_id"]
profile = get_game_profile(refid, game_version)
- single_grade = profile.get('single_grade', 0)
- double_grade = profile.get('double_grade', 0)
+ single_grade = profile.get("single_grade", 0)
+ double_grade = profile.get("double_grade", 0)
- for record in db.table('ddr_scores_best').search((where('game_version') == game_version)& (where('ddr_id') == ddr_id)):
- mcode = record['mcode']
- difficulty = record['difficulty']
+ for record in db.table("ddr_scores_best").search(
+ (where("game_version") == game_version) & (where("ddr_id") == ddr_id)
+ ):
+ mcode = record["mcode"]
+ difficulty = record["difficulty"]
if mcode not in all_scores:
all_scores[mcode] = [[0, 0, 0, 0, 0] for x in range(10)]
- all_scores[mcode][difficulty] = ([1, record['rank'], record['lamp'], record['score'], record['ghostid']])
+ all_scores[mcode][difficulty] = [
+ 1,
+ record["rank"],
+ record["lamp"],
+ record["score"],
+ record["ghostid"],
+ ]
response = E.response(
E.playerdata(
@@ -110,25 +116,36 @@ async def usergamedata_advanced(request: Request):
E.is_new(1 if all_profiles_for_card is None else 0, __type="bool"),
E.is_refid_locked(0, __type="bool"),
E.eventdata_count_all(1, __type="s16"),
- *[E.music(
- E.mcode(int(mcode), __type="u32"),
- *[E.note(
- E.count(s[0], __type="u16"),
- E.rank(s[1], __type="u8"),
- E.clearkind(s[2], __type="u8"),
- E.score(s[3], __type="s32"),
- E.ghostid(s[4], __type="s32"),
- ) for s in [score for score in all_scores.get(mcode)]],
- ) for mcode in all_scores.keys()],
- *[E.eventdata(
- E.eventid(event, __type="u32"),
- E.eventtype(9999, __type="s32"),
- E.eventno(0, __type="u32"),
- E.condition(0, __type="s64"),
- E.reward(0, __type="u32"),
- E.comptime(1, __type="s32"),
- E.savedata(0, __type="s64"),
- ) for event in [e for e in range(1, 100) if e not in [4, 6, 7, 8, 14, 47]]],
+ *[
+ E.music(
+ E.mcode(int(mcode), __type="u32"),
+ *[
+ E.note(
+ E.count(s[0], __type="u16"),
+ E.rank(s[1], __type="u8"),
+ E.clearkind(s[2], __type="u8"),
+ E.score(s[3], __type="s32"),
+ E.ghostid(s[4], __type="s32"),
+ )
+ for s in [score for score in all_scores.get(mcode)]
+ ],
+ )
+ for mcode in all_scores.keys()
+ ],
+ *[
+ E.eventdata(
+ E.eventid(event, __type="u32"),
+ E.eventtype(9999, __type="s32"),
+ E.eventno(0, __type="u32"),
+ E.condition(0, __type="s64"),
+ E.reward(0, __type="u32"),
+ E.comptime(1, __type="s32"),
+ E.savedata(0, __type="s64"),
+ )
+ for event in [
+ e for e in range(1, 100) if e not in [4, 6, 7, 8, 14, 47]
+ ]
+ ],
E.grade(
E.single_grade(single_grade, __type="u32"),
E.double_grade(double_grade, __type="u32"),
@@ -165,187 +182,194 @@ async def usergamedata_advanced(request: Request):
E.mcode(0, __type="u32"),
E.notetype(0, __type="s8"),
E.playstyle(0, __type="s32"),
- )
+ ),
),
E.preplayable(),
)
)
- elif mode == 'ghostload':
- ghostid = int(data.find('ghostid').text)
- record = db.table('ddr_scores').get(doc_id=ghostid)
+ elif mode == "ghostload":
+ ghostid = int(data.find("ghostid").text)
+ record = db.table("ddr_scores").get(doc_id=ghostid)
response = E.response(
E.playerdata(
E.result(0, __type="s32"),
E.ghostdata(
- E.code(record['ddr_id'], __type="s32"),
- E.mcode(record['mcode'], __type="u32"),
- E.notetype(record['difficulty'], __type="u8"),
- E.ghostsize(record['ghostsize'], __type="s32"),
- E.ghost(record['ghost'], __type="string"),
- )
+ E.code(record["ddr_id"], __type="s32"),
+ E.mcode(record["mcode"], __type="u32"),
+ E.notetype(record["difficulty"], __type="u8"),
+ E.ghostsize(record["ghostsize"], __type="s32"),
+ E.ghost(record["ghost"], __type="string"),
+ ),
)
)
- elif mode == 'usersave' and refid != default:
+ elif mode == "usersave" and refid != default:
timestamp = time.time()
-
- ddr_id = int(data.find('ddrcode').text)
- playstyle = int(data.find('playstyle').text)
- pcbid = data.find('pcbid').text
- shoparea = data.find('shoparea').text
- note = data.findall('note')
+ ddr_id = int(data.find("ddrcode").text)
+ playstyle = int(data.find("playstyle").text)
+ pcbid = data.find("pcbid").text
+ shoparea = data.find("shoparea").text
- if int(data.find('isgameover').text) == 0:
+ note = data.findall("note")
+
+ if int(data.find("isgameover").text) == 0:
for n in note:
- if int(n.find('stagenum').text) != 0:
- mcode = int(n.find('mcode').text)
- difficulty = int(n.find('notetype').text)
- rank = int(n.find('rank').text)
- lamp = int(n.find('clearkind').text)
- score = int(n.find('score').text)
- exscore = int(n.find('exscore').text)
- maxcombo = int(n.find('maxcombo').text)
- life = int(n.find('life').text)
- fastcount = int(n.find('fastcount').text)
- slowcount = int(n.find('slowcount').text)
- judge_marvelous = int(n.find('judge_marvelous').text)
- judge_perfect = int(n.find('judge_perfect').text)
- judge_great = int(n.find('judge_great').text)
- judge_good = int(n.find('judge_good').text)
- judge_boo = int(n.find('judge_boo').text)
- judge_miss = int(n.find('judge_miss').text)
- judge_ok = int(n.find('judge_ok').text)
- judge_ng = int(n.find('judge_ng').text)
- calorie = int(n.find('calorie').text)
- ghostsize = int(n.find('ghostsize').text)
- ghost = n.find('ghost').text
- opt_speed = int(n.find('opt_speed').text)
- opt_boost = int(n.find('opt_boost').text)
- opt_appearance = int(n.find('opt_appearance').text)
- opt_turn = int(n.find('opt_turn').text)
- opt_dark = int(n.find('opt_dark').text)
- opt_scroll = int(n.find('opt_scroll').text)
- opt_arrowcolor = int(n.find('opt_arrowcolor').text)
- opt_cut = int(n.find('opt_cut').text)
- opt_freeze = int(n.find('opt_freeze').text)
- opt_jump = int(n.find('opt_jump').text)
- opt_arrowshape = int(n.find('opt_arrowshape').text)
- opt_filter = int(n.find('opt_filter').text)
- opt_guideline = int(n.find('opt_guideline').text)
- opt_gauge = int(n.find('opt_gauge').text)
- opt_judgepriority = int(n.find('opt_judgepriority').text)
- opt_timing = int(n.find('opt_timing').text)
+ if int(n.find("stagenum").text) != 0:
+ mcode = int(n.find("mcode").text)
+ difficulty = int(n.find("notetype").text)
+ rank = int(n.find("rank").text)
+ lamp = int(n.find("clearkind").text)
+ score = int(n.find("score").text)
+ exscore = int(n.find("exscore").text)
+ maxcombo = int(n.find("maxcombo").text)
+ life = int(n.find("life").text)
+ fastcount = int(n.find("fastcount").text)
+ slowcount = int(n.find("slowcount").text)
+ judge_marvelous = int(n.find("judge_marvelous").text)
+ judge_perfect = int(n.find("judge_perfect").text)
+ judge_great = int(n.find("judge_great").text)
+ judge_good = int(n.find("judge_good").text)
+ judge_boo = int(n.find("judge_boo").text)
+ judge_miss = int(n.find("judge_miss").text)
+ judge_ok = int(n.find("judge_ok").text)
+ judge_ng = int(n.find("judge_ng").text)
+ calorie = int(n.find("calorie").text)
+ ghostsize = int(n.find("ghostsize").text)
+ ghost = n.find("ghost").text
+ opt_speed = int(n.find("opt_speed").text)
+ opt_boost = int(n.find("opt_boost").text)
+ opt_appearance = int(n.find("opt_appearance").text)
+ opt_turn = int(n.find("opt_turn").text)
+ opt_dark = int(n.find("opt_dark").text)
+ opt_scroll = int(n.find("opt_scroll").text)
+ opt_arrowcolor = int(n.find("opt_arrowcolor").text)
+ opt_cut = int(n.find("opt_cut").text)
+ opt_freeze = int(n.find("opt_freeze").text)
+ opt_jump = int(n.find("opt_jump").text)
+ opt_arrowshape = int(n.find("opt_arrowshape").text)
+ opt_filter = int(n.find("opt_filter").text)
+ opt_guideline = int(n.find("opt_guideline").text)
+ opt_gauge = int(n.find("opt_gauge").text)
+ opt_judgepriority = int(n.find("opt_judgepriority").text)
+ opt_timing = int(n.find("opt_timing").text)
- db.table('ddr_scores').insert(
+ db.table("ddr_scores").insert(
{
- 'timestamp': timestamp,
- 'pcbid': pcbid,
- 'shoparea': shoparea,
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': rank,
- 'lamp': lamp,
- 'score': score,
- 'exscore': exscore,
- 'maxcombo': maxcombo,
- 'life': life,
- 'fastcount': fastcount,
- 'slowcount': slowcount,
- 'judge_marvelous': judge_marvelous,
- 'judge_perfect': judge_perfect,
- 'judge_great': judge_great,
- 'judge_good': judge_good,
- 'judge_boo': judge_boo,
- 'judge_miss': judge_miss,
- 'judge_ok': judge_ok,
- 'judge_ng': judge_ng,
- 'calorie': calorie,
- 'ghostsize': ghostsize,
- 'ghost': ghost,
- 'opt_speed': opt_speed,
- 'opt_boost': opt_boost,
- 'opt_appearance': opt_appearance,
- 'opt_turn': opt_turn,
- 'opt_dark': opt_dark,
- 'opt_scroll': opt_scroll,
- 'opt_arrowcolor': opt_arrowcolor,
- 'opt_cut': opt_cut,
- 'opt_freeze': opt_freeze,
- 'opt_jump': opt_jump,
- 'opt_arrowshape': opt_arrowshape,
- 'opt_filter': opt_filter,
- 'opt_guideline': opt_guideline,
- 'opt_gauge': opt_gauge,
- 'opt_judgepriority': opt_judgepriority,
- 'opt_timing': opt_timing,
+ "timestamp": timestamp,
+ "pcbid": pcbid,
+ "shoparea": shoparea,
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": rank,
+ "lamp": lamp,
+ "score": score,
+ "exscore": exscore,
+ "maxcombo": maxcombo,
+ "life": life,
+ "fastcount": fastcount,
+ "slowcount": slowcount,
+ "judge_marvelous": judge_marvelous,
+ "judge_perfect": judge_perfect,
+ "judge_great": judge_great,
+ "judge_good": judge_good,
+ "judge_boo": judge_boo,
+ "judge_miss": judge_miss,
+ "judge_ok": judge_ok,
+ "judge_ng": judge_ng,
+ "calorie": calorie,
+ "ghostsize": ghostsize,
+ "ghost": ghost,
+ "opt_speed": opt_speed,
+ "opt_boost": opt_boost,
+ "opt_appearance": opt_appearance,
+ "opt_turn": opt_turn,
+ "opt_dark": opt_dark,
+ "opt_scroll": opt_scroll,
+ "opt_arrowcolor": opt_arrowcolor,
+ "opt_cut": opt_cut,
+ "opt_freeze": opt_freeze,
+ "opt_jump": opt_jump,
+ "opt_arrowshape": opt_arrowshape,
+ "opt_filter": opt_filter,
+ "opt_guideline": opt_guideline,
+ "opt_gauge": opt_gauge,
+ "opt_judgepriority": opt_judgepriority,
+ "opt_timing": opt_timing,
},
)
- best = db.table('ddr_scores_best').get(
- (where('ddr_id') == ddr_id)
- & (where('game_version') == game_version)
- & (where('mcode') == mcode)
- & (where('difficulty') == difficulty)
+ best = db.table("ddr_scores_best").get(
+ (where("ddr_id") == ddr_id)
+ & (where("game_version") == game_version)
+ & (where("mcode") == mcode)
+ & (where("difficulty") == difficulty)
)
best = {} if best is None else best
best_score_data = {
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': min(rank, best.get('rank', rank)),
- 'lamp': max(lamp, best.get('lamp', lamp)),
- 'score': max(score, best.get('score', score)),
- 'exscore': max(exscore, best.get('exscore', exscore)),
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": min(rank, best.get("rank", rank)),
+ "lamp": max(lamp, best.get("lamp", lamp)),
+ "score": max(score, best.get("score", score)),
+ "exscore": max(exscore, best.get("exscore", exscore)),
}
- ghostid = db.table('ddr_scores').get(
- (where('ddr_id') == ddr_id)
- & (where('game_version') == game_version)
- & (where('mcode') == mcode)
- & (where('difficulty') == difficulty)
- & (where('score') == max(score, best.get('score', score)))
+ ghostid = db.table("ddr_scores").get(
+ (where("ddr_id") == ddr_id)
+ & (where("game_version") == game_version)
+ & (where("mcode") == mcode)
+ & (where("difficulty") == difficulty)
+ & (where("score") == max(score, best.get("score", score)))
)
- best_score_data['ghostid'] = ghostid.doc_id
+ best_score_data["ghostid"] = ghostid.doc_id
- db.table('ddr_scores_best').upsert(
+ db.table("ddr_scores_best").upsert(
best_score_data,
- (where('ddr_id') == ddr_id)
- & (where('game_version') == game_version)
- & (where('mcode') == mcode)
- & (where('difficulty') == difficulty)
+ (where("ddr_id") == ddr_id)
+ & (where("game_version") == game_version)
+ & (where("mcode") == mcode)
+ & (where("difficulty") == difficulty),
)
- elif int(data.find('isgameover').text) == 1:
- single_grade = int(data.find('grade/single_grade').text)
- double_grade = int(data.find('grade/double_grade').text)
+ elif int(data.find("isgameover").text) == 1:
+ single_grade = int(data.find("grade/single_grade").text)
+ double_grade = int(data.find("grade/double_grade").text)
profile = get_profile(refid)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
# workaround to save the correct dan grade by using the course mcode
- # because omnimix force unlocks all dan courses with 1 in coursedb.xml
+ # because omnimix force unlocks all dan courses with 1 in coursedb.xml
if is_omni:
n = note[0]
- mcode = int(n.find('mcode').text)
- if int(n.find('clearkind').text) != 1:
+ mcode = int(n.find("mcode").text)
+ if int(n.find("clearkind").text) != 1:
for grade, course_id in enumerate(range(1000, 1011), start=1):
if playstyle == 0 and mcode in (course_id, course_id + 11):
single_grade = grade
- elif playstyle == 1 and mcode in (course_id + 1000, course_id + 1000 + 11):
+ elif playstyle == 1 and mcode in (
+ course_id + 1000,
+ course_id + 1000 + 11,
+ ):
double_grade = grade
- game_profile['single_grade'] = max(single_grade, game_profile.get('single_grade', single_grade))
- game_profile['double_grade'] = max(double_grade, game_profile.get('double_grade', double_grade))
+ game_profile["single_grade"] = max(
+ single_grade, game_profile.get("single_grade", single_grade)
+ )
+ game_profile["double_grade"] = max(
+ double_grade, game_profile.get("double_grade", double_grade)
+ )
- profile['version'][str(game_version)] = game_profile
- db.table('ddr_profile').upsert(profile, where('card') == refid)
+ profile["version"][str(game_version)] = game_profile
+ db.table("ddr_profile").upsert(profile, where("card") == refid)
response = E.response(
E.playerdata(
@@ -353,95 +377,121 @@ async def usergamedata_advanced(request: Request):
)
)
- elif mode == 'rivalload':
- loadflag = int(data.find('loadflag').text)
- ddrcode = int(data.find('ddrcode').text)
- pcbid = data.find('pcbid').text
- shoparea = data.find('shoparea').text
+ elif mode == "rivalload":
+ loadflag = int(data.find("loadflag").text)
+ ddrcode = int(data.find("ddrcode").text)
+ pcbid = data.find("pcbid").text
+ shoparea = data.find("shoparea").text
if loadflag == 1:
all_scores = {}
- for record in db.table('ddr_scores').search(
- (where('game_version') == game_version)
- & (where('pcbid') == pcbid)
- & (where('ddr_id') != 0)
+ for record in db.table("ddr_scores").search(
+ (where("game_version") == game_version)
+ & (where("pcbid") == pcbid)
+ & (where("ddr_id") != 0)
):
- ddr_id = record['ddr_id']
- playstyle = record['playstyle']
- mcode = record['mcode']
- difficulty = record['difficulty']
- score = record['score']
+ ddr_id = record["ddr_id"]
+ playstyle = record["playstyle"]
+ mcode = record["mcode"]
+ difficulty = record["difficulty"]
+ score = record["score"]
- if (playstyle, mcode, difficulty) not in all_scores or score > all_scores[(playstyle, mcode, difficulty)].get("score"):
+ if (
+ playstyle,
+ mcode,
+ difficulty,
+ ) not in all_scores or score > all_scores[
+ (playstyle, mcode, difficulty)
+ ].get(
+ "score"
+ ):
all_scores[playstyle, mcode, difficulty] = {
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': record['rank'],
- 'lamp': record['lamp'],
- 'score': score,
- 'exscore': record['exscore'],
- 'ghostid': record.doc_id
- }
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": record["rank"],
+ "lamp": record["lamp"],
+ "score": score,
+ "exscore": record["exscore"],
+ "ghostid": record.doc_id,
+ }
scores = list(all_scores.values())
elif loadflag == 2:
all_scores = {}
- for record in db.table('ddr_scores').search(
- (where('game_version') == game_version)
- & (where('shoparea') == shoparea)
- & (where('ddr_id') != 0)
+ for record in db.table("ddr_scores").search(
+ (where("game_version") == game_version)
+ & (where("shoparea") == shoparea)
+ & (where("ddr_id") != 0)
):
- ddr_id = record['ddr_id']
- playstyle = record['playstyle']
- mcode = record['mcode']
- difficulty = record['difficulty']
- score = record['score']
+ ddr_id = record["ddr_id"]
+ playstyle = record["playstyle"]
+ mcode = record["mcode"]
+ difficulty = record["difficulty"]
+ score = record["score"]
- if (playstyle, mcode, difficulty) not in all_scores or score > all_scores[(playstyle, mcode, difficulty)].get("score"):
+ if (
+ playstyle,
+ mcode,
+ difficulty,
+ ) not in all_scores or score > all_scores[
+ (playstyle, mcode, difficulty)
+ ].get(
+ "score"
+ ):
all_scores[playstyle, mcode, difficulty] = {
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': record['rank'],
- 'lamp': record['lamp'],
- 'score': score,
- 'exscore': record['exscore'],
- 'ghostid': record.doc_id
- }
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": record["rank"],
+ "lamp": record["lamp"],
+ "score": score,
+ "exscore": record["exscore"],
+ "ghostid": record.doc_id,
+ }
scores = list(all_scores.values())
elif loadflag == 4:
all_scores = {}
- for record in db.table('ddr_scores').search((where('game_version') == game_version) & (where('ddr_id') != 0)):
- ddr_id = record['ddr_id']
- playstyle = record['playstyle']
- mcode = record['mcode']
- difficulty = record['difficulty']
- score = record['score']
+ for record in db.table("ddr_scores").search(
+ (where("game_version") == game_version) & (where("ddr_id") != 0)
+ ):
+ ddr_id = record["ddr_id"]
+ playstyle = record["playstyle"]
+ mcode = record["mcode"]
+ difficulty = record["difficulty"]
+ score = record["score"]
- if (playstyle, mcode, difficulty) not in all_scores or score > all_scores[(playstyle, mcode, difficulty)].get("score"):
+ if (
+ playstyle,
+ mcode,
+ difficulty,
+ ) not in all_scores or score > all_scores[
+ (playstyle, mcode, difficulty)
+ ].get(
+ "score"
+ ):
all_scores[playstyle, mcode, difficulty] = {
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': record['rank'],
- 'lamp': record['lamp'],
- 'score': score,
- 'exscore': record['exscore'],
- 'ghostid': record.doc_id
- }
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": record["rank"],
+ "lamp": record["lamp"],
+ "score": score,
+ "exscore": record["exscore"],
+ "ghostid": record.doc_id,
+ }
scores = list(all_scores.values())
elif loadflag in (8, 16, 32):
scores = []
- for s in db.table('ddr_scores_best').search(where('ddr_id') == ddrcode):
+ for s in db.table("ddr_scores_best").search(where("ddr_id") == ddrcode):
scores.append(s)
response = E.response(
@@ -449,23 +499,31 @@ async def usergamedata_advanced(request: Request):
E.result(0, __type="s32"),
E.data(
E.recordtype(loadflag, __type="s32"),
- *[E.record(
- E.mcode(s['mcode'], __type="u32"),
- E.notetype(s['difficulty'], __type="u8"),
- E.rank(s['rank'], __type="u8"),
- E.clearkind(s['lamp'], __type="u8"),
- E.flagdata(0, __type="u8"),
- E.name(get_common(s['ddr_id'], game_version, 27), __type="str"),
- E.area(int(get_common(s['ddr_id'], game_version, 3), 16), __type="s32"),
- E.code(s['ddr_id'], __type="s32"),
- E.score(s['score'], __type="s32"),
- E.ghostid(s['ghostid'], __type="s32"),
- )for s in scores]
- )
+ *[
+ E.record(
+ E.mcode(s["mcode"], __type="u32"),
+ E.notetype(s["difficulty"], __type="u8"),
+ E.rank(s["rank"], __type="u8"),
+ E.clearkind(s["lamp"], __type="u8"),
+ E.flagdata(0, __type="u8"),
+ E.name(
+ get_common(s["ddr_id"], game_version, 27), __type="str"
+ ),
+ E.area(
+ int(get_common(s["ddr_id"], game_version, 3), 16),
+ __type="s32",
+ ),
+ E.code(s["ddr_id"], __type="s32"),
+ E.score(s["score"], __type="s32"),
+ E.ghostid(s["ghostid"], __type="s32"),
+ )
+ for s in scores
+ ],
+ ),
)
)
- elif mode == 'inheritance':
+ elif mode == "inheritance":
response = E.response(
E.playerdata(
E.result(0, __type="s32"),
@@ -484,50 +542,87 @@ async def usergamedata_advanced(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/playerdata/usergamedata_recv')
+@router.post("/{gameinfo}/playerdata/usergamedata_recv")
async def usergamedata_recv(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- data = request_info['root'][0].find('data')
- cid = data.find('refid').text
+ data = request_info["root"][0].find("data")
+ cid = data.find("refid").text
profile = get_game_profile(cid, game_version)
- db = get_db().table('ddr_profile')
+ db = get_db().table("ddr_profile")
all_profiles_for_card = db.get(Query().card == cid)
if all_profiles_for_card is None:
load = [
- b64encode(str.encode('1,d,1111111,1,0,0,0,0,0,ffffffffffffffff,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,1010-1010,,,,,,').decode()),
- b64encode(str.encode('0,3,0,0,0,0,0,3,0,0,0,0,1,2,0,0,0,10.000000,10.000000,10.000000,10.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,').decode()),
- b64encode(str.encode('1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,').decode()),
- b64encode(str.encode('0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,').decode()),
+ b64encode(
+ str.encode(
+ "1,d,1111111,1,0,0,0,0,0,ffffffffffffffff,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,1010-1010,,,,,,"
+ ).decode()
+ ),
+ b64encode(
+ str.encode(
+ "0,3,0,0,0,0,0,3,0,0,0,0,1,2,0,0,0,10.000000,10.000000,10.000000,10.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,"
+ ).decode()
+ ),
+ b64encode(
+ str.encode(
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,"
+ ).decode()
+ ),
+ b64encode(
+ str.encode(
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,"
+ ).decode()
+ ),
]
else:
calories_disp = ["Off", "On"]
- character = ["All Character Random", "Man Random", "Female Random", "Yuni", "Rage", "Afro", "Jenny", "Emi", "Baby-Lon", "Gus", "Ruby", "Alice", "Julio", "Bonnie", "Zero", "Rinon"]
+ character = [
+ "All Character Random",
+ "Man Random",
+ "Female Random",
+ "Yuni",
+ "Rage",
+ "Afro",
+ "Jenny",
+ "Emi",
+ "Baby-Lon",
+ "Gus",
+ "Ruby",
+ "Alice",
+ "Julio",
+ "Bonnie",
+ "Zero",
+ "Rinon",
+ ]
arrow_skin = ["Normal", "X", "Classic", "Cyber", "Medium", "Small", "Dot"]
screen_filter = ["Off", "Dark", "Darker", "Darkest"]
guideline = ["Off", "Border", "Center"]
priority = ["Judgment", "Arrow"]
timing_disp = ["Off", "On"]
- common = profile['common'].split(',')
- common[5] = calories_disp.index(profile['calories_disp'])
- common[6] = character.index(profile['character'])
- common[9] = 1 # Mobile link
+ common = profile["common"].split(",")
+ common[5] = calories_disp.index(profile["calories_disp"])
+ common[6] = character.index(profile["character"])
+ common[9] = 1 # Mobile link
common_load = ",".join([str(i) for i in common])
- option = profile['option'].split(',')
- option[13] = arrow_skin.index(profile['arrow_skin'])
- option[14] = screen_filter.index(profile['filter'])
- option[15] = guideline.index(profile['guideline'])
- option[17] = priority.index(profile['priority'])
- option[18] = timing_disp.index(profile['timing_disp'])
+ option = profile["option"].split(",")
+ option[13] = arrow_skin.index(profile["arrow_skin"])
+ option[14] = screen_filter.index(profile["filter"])
+ option[15] = guideline.index(profile["guideline"])
+ option[17] = priority.index(profile["priority"])
+ option[18] = timing_disp.index(profile["timing_disp"])
option_load = ",".join([str(i) for i in option])
- rival = profile['rival'].split(',')
- rival_ids = [profile.get('rival_1_ddr_id', 0), profile.get('rival_2_ddr_id', 0), profile.get('rival_3_ddr_id', 0)]
+ rival = profile["rival"].split(",")
+ rival_ids = [
+ profile.get("rival_1_ddr_id", 0),
+ profile.get("rival_2_ddr_id", 0),
+ profile.get("rival_3_ddr_id", 0),
+ ]
for idx, r in enumerate(rival_ids, start=3):
if r != 0:
rival[idx] = idx - 2
@@ -535,10 +630,10 @@ async def usergamedata_recv(request: Request):
rival_load = ",".join([str(i) for i in rival])
load = [
- b64encode(str.encode(common_load.split('ffffffff,COMMON,')[1])).decode(),
- b64encode(str.encode(option_load.split('ffffffff,OPTION,')[1])).decode(),
- b64encode(str.encode(profile['last'].split('ffffffff,LAST,')[1])).decode(),
- b64encode(str.encode(rival_load.split('ffffffff,RIVAL,')[1])).decode()
+ b64encode(str.encode(common_load.split("ffffffff,COMMON,")[1])).decode(),
+ b64encode(str.encode(option_load.split("ffffffff,OPTION,")[1])).decode(),
+ b64encode(str.encode(profile["last"].split("ffffffff,LAST,")[1])).decode(),
+ b64encode(str.encode(rival_load.split("ffffffff,RIVAL,")[1])).decode(),
]
response = E.response(
@@ -546,7 +641,7 @@ async def usergamedata_recv(request: Request):
E.result(0, __type="s32"),
E.player(
E.record(
- *[E.d(p, __type="str")for p in load],
+ *[E.d(p, __type="str") for p in load],
),
E.record_num(4, __type="u32"),
),
@@ -557,33 +652,43 @@ async def usergamedata_recv(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/playerdata/usergamedata_send')
+@router.post("/{gameinfo}/playerdata/usergamedata_send")
async def usergamedata_send(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- data = request_info['root'][0].find('data')
- cid = data.find('refid').text
- num = int(data.find('datanum').text)
+ data = request_info["root"][0].find("data")
+ cid = data.find("refid").text
+ num = int(data.find("datanum").text)
profile = get_profile(cid)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
if num == 1:
- game_profile['common'] = b64decode(data.find('record')[0].text.split('1 in coursedb.xml
+ # because omnimix force unlocks all dan courses with 1 in coursedb.xml
if is_omni:
n = note[0]
- mcode = int(n.find('mcode').text)
- if int(n.find('clearkind').text) != 1:
+ mcode = int(n.find("mcode").text)
+ if int(n.find("clearkind").text) != 1:
for grade, course_id in enumerate(range(1000, 1011), start=1):
if playstyle == 0 and mcode in (course_id, course_id + 11):
single_grade = grade
- elif playstyle == 1 and mcode in (course_id + 1000, course_id + 1000 + 11):
+ elif playstyle == 1 and mcode in (
+ course_id + 1000,
+ course_id + 1000 + 11,
+ ):
double_grade = grade
- game_profile['single_grade'] = max(single_grade, game_profile.get('single_grade', single_grade))
- game_profile['double_grade'] = max(double_grade, game_profile.get('double_grade', double_grade))
+ game_profile["single_grade"] = max(
+ single_grade, game_profile.get("single_grade", single_grade)
+ )
+ game_profile["double_grade"] = max(
+ double_grade, game_profile.get("double_grade", double_grade)
+ )
- profile['version'][str(game_version)] = game_profile
- db.table('ddr_profile').upsert(profile, where('card') == refid)
+ profile["version"][str(game_version)] = game_profile
+ db.table("ddr_profile").upsert(profile, where("card") == refid)
response = E.response(
E.playerdata_2(
@@ -353,124 +377,153 @@ async def usergamedata_advanced(request: Request):
)
)
- elif mode == 'rivalload':
- loadflag = int(data.find('loadflag').text)
- ddrcode = int(data.find('ddrcode').text)
- pcbid = data.find('pcbid').text
- shoparea = data.find('shoparea').text
+ elif mode == "rivalload":
+ loadflag = int(data.find("loadflag").text)
+ ddrcode = int(data.find("ddrcode").text)
+ pcbid = data.find("pcbid").text
+ shoparea = data.find("shoparea").text
if loadflag == 1:
all_scores = {}
- for record in db.table('ddr_scores').search(
- (where('game_version') == game_version)
- & (where('pcbid') == pcbid)
- & (where('ddr_id') != 0)
+ for record in db.table("ddr_scores").search(
+ (where("game_version") == game_version)
+ & (where("pcbid") == pcbid)
+ & (where("ddr_id") != 0)
):
- ddr_id = record['ddr_id']
- playstyle = record['playstyle']
- mcode = record['mcode']
- difficulty = record['difficulty']
- score = record['score']
+ ddr_id = record["ddr_id"]
+ playstyle = record["playstyle"]
+ mcode = record["mcode"]
+ difficulty = record["difficulty"]
+ score = record["score"]
- if (playstyle, mcode, difficulty) not in all_scores or score > all_scores[(playstyle, mcode, difficulty)].get("score"):
+ if (
+ playstyle,
+ mcode,
+ difficulty,
+ ) not in all_scores or score > all_scores[
+ (playstyle, mcode, difficulty)
+ ].get(
+ "score"
+ ):
all_scores[playstyle, mcode, difficulty] = {
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': record['rank'],
- 'lamp': record['lamp'],
- 'score': score,
- 'exscore': record['exscore'],
- 'ghostid': record.doc_id
- }
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": record["rank"],
+ "lamp": record["lamp"],
+ "score": score,
+ "exscore": record["exscore"],
+ "ghostid": record.doc_id,
+ }
scores = list(all_scores.values())
elif loadflag == 2:
all_scores = {}
- for record in db.table('ddr_scores').search(
- (where('game_version') == game_version)
- & (where('shoparea') == shoparea)
- & (where('ddr_id') != 0)
+ for record in db.table("ddr_scores").search(
+ (where("game_version") == game_version)
+ & (where("shoparea") == shoparea)
+ & (where("ddr_id") != 0)
):
- ddr_id = record['ddr_id']
- playstyle = record['playstyle']
- mcode = record['mcode']
- difficulty = record['difficulty']
- score = record['score']
+ ddr_id = record["ddr_id"]
+ playstyle = record["playstyle"]
+ mcode = record["mcode"]
+ difficulty = record["difficulty"]
+ score = record["score"]
- if (playstyle, mcode, difficulty) not in all_scores or score > all_scores[(playstyle, mcode, difficulty)].get("score"):
+ if (
+ playstyle,
+ mcode,
+ difficulty,
+ ) not in all_scores or score > all_scores[
+ (playstyle, mcode, difficulty)
+ ].get(
+ "score"
+ ):
all_scores[playstyle, mcode, difficulty] = {
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': record['rank'],
- 'lamp': record['lamp'],
- 'score': score,
- 'exscore': record['exscore'],
- 'ghostid': record.doc_id
- }
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": record["rank"],
+ "lamp": record["lamp"],
+ "score": score,
+ "exscore": record["exscore"],
+ "ghostid": record.doc_id,
+ }
scores = list(all_scores.values())
elif loadflag == 4:
all_scores = {}
- for record in db.table('ddr_scores').search((where('game_version') == game_version) & (where('ddr_id') != 0)):
- ddr_id = record['ddr_id']
- playstyle = record['playstyle']
- mcode = record['mcode']
- difficulty = record['difficulty']
- score = record['score']
+ for record in db.table("ddr_scores").search(
+ (where("game_version") == game_version) & (where("ddr_id") != 0)
+ ):
+ ddr_id = record["ddr_id"]
+ playstyle = record["playstyle"]
+ mcode = record["mcode"]
+ difficulty = record["difficulty"]
+ score = record["score"]
- if (playstyle, mcode, difficulty) not in all_scores or score > all_scores[(playstyle, mcode, difficulty)].get("score"):
+ if (
+ playstyle,
+ mcode,
+ difficulty,
+ ) not in all_scores or score > all_scores[
+ (playstyle, mcode, difficulty)
+ ].get(
+ "score"
+ ):
all_scores[playstyle, mcode, difficulty] = {
- 'game_version': game_version,
- 'ddr_id': ddr_id,
- 'playstyle': playstyle,
- 'mcode': mcode,
- 'difficulty': difficulty,
- 'rank': record['rank'],
- 'lamp': record['lamp'],
- 'score': score,
- 'exscore': record['exscore'],
- 'ghostid': record.doc_id
- }
+ "game_version": game_version,
+ "ddr_id": ddr_id,
+ "playstyle": playstyle,
+ "mcode": mcode,
+ "difficulty": difficulty,
+ "rank": record["rank"],
+ "lamp": record["lamp"],
+ "score": score,
+ "exscore": record["exscore"],
+ "ghostid": record.doc_id,
+ }
scores = list(all_scores.values())
elif loadflag in (8, 16, 32):
scores = []
- for s in db.table('ddr_scores_best').search(where('ddr_id') == ddrcode):
+ for s in db.table("ddr_scores_best").search(where("ddr_id") == ddrcode):
scores.append(s)
load = []
for r in scores:
s = [
- r['mcode'],
- r['difficulty'],
- r['rank'],
- r['lamp'],
- get_common(r['ddr_id'], game_version, 27),
- int(get_common(r['ddr_id'], game_version, 3), 16),
- r['ddr_id'],
- r['score'],
- r['ghostid'],
+ r["mcode"],
+ r["difficulty"],
+ r["rank"],
+ r["lamp"],
+ get_common(r["ddr_id"], game_version, 27),
+ int(get_common(r["ddr_id"], game_version, 3), 16),
+ r["ddr_id"],
+ r["score"],
+ r["ghostid"],
]
- load.append(b64encode(str.encode(','.join(str(x) for x in s))).decode())
+ load.append(b64encode(str.encode(",".join(str(x) for x in s))).decode())
response = E.response(
E.playerdata_2(
E.result(0, __type="s32"),
E.data(
- *[E.record(
- E.record_csv(s, __type="str"),
- ) for s in load]
- )
+ *[
+ E.record(
+ E.record_csv(s, __type="str"),
+ )
+ for s in load
+ ]
+ ),
)
)
- elif mode == 'inheritance':
+ elif mode == "inheritance":
response = E.response(
E.playerdata_2(
E.result(0, __type="s32"),
@@ -489,50 +542,87 @@ async def usergamedata_advanced(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/playerdata_2/usergamedata_recv')
+@router.post("/{gameinfo}/playerdata_2/usergamedata_recv")
async def usergamedata_recv(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- data = request_info['root'][0].find('data')
- cid = data.find('refid').text
+ data = request_info["root"][0].find("data")
+ cid = data.find("refid").text
profile = get_game_profile(cid, game_version)
- db = get_db().table('ddr_profile')
+ db = get_db().table("ddr_profile")
all_profiles_for_card = db.get(Query().card == cid)
if all_profiles_for_card is None:
load = [
- b64encode(str.encode('1,d,1111111,1,0,0,0,0,0,ffffffffffffffff,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,1010-1010,,,,,,').decode()),
- b64encode(str.encode('0,3,0,0,0,0,0,3,0,0,0,0,1,2,0,0,0,10.000000,10.000000,10.000000,10.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,').decode()),
- b64encode(str.encode('1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,').decode()),
- b64encode(str.encode('0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,').decode()),
+ b64encode(
+ str.encode(
+ "1,d,1111111,1,0,0,0,0,0,ffffffffffffffff,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,1010-1010,,,,,,"
+ ).decode()
+ ),
+ b64encode(
+ str.encode(
+ "0,3,0,0,0,0,0,3,0,0,0,0,1,2,0,0,0,10.000000,10.000000,10.000000,10.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,"
+ ).decode()
+ ),
+ b64encode(
+ str.encode(
+ "1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,"
+ ).decode()
+ ),
+ b64encode(
+ str.encode(
+ "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,,,,,,,,"
+ ).decode()
+ ),
]
else:
calories_disp = ["Off", "On"]
- character = ["All Character Random", "Man Random", "Female Random", "Yuni", "Rage", "Afro", "Jenny", "Emi", "Baby-Lon", "Gus", "Ruby", "Alice", "Julio", "Bonnie", "Zero", "Rinon"]
+ character = [
+ "All Character Random",
+ "Man Random",
+ "Female Random",
+ "Yuni",
+ "Rage",
+ "Afro",
+ "Jenny",
+ "Emi",
+ "Baby-Lon",
+ "Gus",
+ "Ruby",
+ "Alice",
+ "Julio",
+ "Bonnie",
+ "Zero",
+ "Rinon",
+ ]
arrow_skin = ["Normal", "X", "Classic", "Cyber", "Medium", "Small", "Dot"]
screen_filter = ["Off", "Dark", "Darker", "Darkest"]
guideline = ["Off", "Border", "Center"]
priority = ["Judgment", "Arrow"]
timing_disp = ["Off", "On"]
- common = profile['common'].split(',')
- common[5] = calories_disp.index(profile['calories_disp'])
- common[6] = character.index(profile['character'])
- common[9] = 1 # Mobile link
+ common = profile["common"].split(",")
+ common[5] = calories_disp.index(profile["calories_disp"])
+ common[6] = character.index(profile["character"])
+ common[9] = 1 # Mobile link
common_load = ",".join([str(i) for i in common])
- option = profile['option'].split(',')
- option[13] = arrow_skin.index(profile['arrow_skin'])
- option[14] = screen_filter.index(profile['filter'])
- option[15] = guideline.index(profile['guideline'])
- option[17] = priority.index(profile['priority'])
- option[18] = timing_disp.index(profile['timing_disp'])
+ option = profile["option"].split(",")
+ option[13] = arrow_skin.index(profile["arrow_skin"])
+ option[14] = screen_filter.index(profile["filter"])
+ option[15] = guideline.index(profile["guideline"])
+ option[17] = priority.index(profile["priority"])
+ option[18] = timing_disp.index(profile["timing_disp"])
option_load = ",".join([str(i) for i in option])
- rival = profile['rival'].split(',')
- rival_ids = [profile.get('rival_1_ddr_id', 0), profile.get('rival_2_ddr_id', 0), profile.get('rival_3_ddr_id', 0)]
+ rival = profile["rival"].split(",")
+ rival_ids = [
+ profile.get("rival_1_ddr_id", 0),
+ profile.get("rival_2_ddr_id", 0),
+ profile.get("rival_3_ddr_id", 0),
+ ]
for idx, r in enumerate(rival_ids, start=3):
if r != 0:
rival[idx] = idx - 2
@@ -540,10 +630,10 @@ async def usergamedata_recv(request: Request):
rival_load = ",".join([str(i) for i in rival])
load = [
- b64encode(str.encode(common_load.split('ffffffff,COMMON,')[1])).decode(),
- b64encode(str.encode(option_load.split('ffffffff,OPTION,')[1])).decode(),
- b64encode(str.encode(profile['last'].split('ffffffff,LAST,')[1])).decode(),
- b64encode(str.encode(rival_load.split('ffffffff,RIVAL,')[1])).decode()
+ b64encode(str.encode(common_load.split("ffffffff,COMMON,")[1])).decode(),
+ b64encode(str.encode(option_load.split("ffffffff,OPTION,")[1])).decode(),
+ b64encode(str.encode(profile["last"].split("ffffffff,LAST,")[1])).decode(),
+ b64encode(str.encode(rival_load.split("ffffffff,RIVAL,")[1])).decode(),
]
response = E.response(
@@ -551,7 +641,7 @@ async def usergamedata_recv(request: Request):
E.result(0, __type="s32"),
E.player(
E.record(
- *[E.d(p, __type="str")for p in load],
+ *[E.d(p, __type="str") for p in load],
),
E.record_num(4, __type="u32"),
),
@@ -562,33 +652,43 @@ async def usergamedata_recv(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/playerdata_2/usergamedata_send')
+@router.post("/{gameinfo}/playerdata_2/usergamedata_send")
async def usergamedata_send(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- data = request_info['root'][0].find('data')
- cid = data.find('refid').text
- num = int(data.find('datanum').text)
+ data = request_info["root"][0].find("data")
+ cid = data.find("refid").text
+ num = int(data.find("datanum").text)
profile = get_profile(cid)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
if num == 1:
- game_profile['common'] = b64decode(data.find('record')[0].text.split(' top_scores[music_id][chart_id]['ex_score']:
- top_name = db.table('iidx_profile').get(where('iidx_id') == iidx_id)['version'][str(game_version)]['djname']
- top_scores[music_id][chart_id]['djname'] = top_name
- top_scores[music_id][chart_id]['clear_flg'] = 1
- top_scores[music_id][chart_id]['ex_score'] = ex_score
+ if ex_score > top_scores[music_id][chart_id]["ex_score"]:
+ top_name = db.table("iidx_profile").get(where("iidx_id") == iidx_id)[
+ "version"
+ ][str(game_version)]["djname"]
+ top_scores[music_id][chart_id]["djname"] = top_name
+ top_scores[music_id][chart_id]["clear_flg"] = 1
+ top_scores[music_id][chart_id]["ex_score"] = ex_score
response = E.response(
E.IIDX29music(
E.style(type=play_style),
- *[E.m([
- i,
- k,
- *[all_scores[i, k][d]['clear_flg'] for d in range(5)],
- *[all_scores[i, k][d]['ex_score'] for d in range(5)],
- *[all_scores[i, k][d]['miss_count'] for d in range(5)],
- ], __type='s16') for i, k in all_scores],
- *[E.top(
- E.detail([
- k,
- *[top_scores[k][d]['clear_flg'] for d in range(5)],
- *[top_scores[k][d]['ex_score'] for d in range(5)],
- ], __type='s16'),
- name0=top_scores[k][0]['djname'],
- name1=top_scores[k][1]['djname'],
- name2=top_scores[k][2]['djname'],
- name3=top_scores[k][3]['djname'],
- name4=top_scores[k][4]['djname']
- ) for k in top_scores]
+ *[
+ E.m(
+ [
+ i,
+ k,
+ *[all_scores[i, k][d]["clear_flg"] for d in range(5)],
+ *[all_scores[i, k][d]["ex_score"] for d in range(5)],
+ *[all_scores[i, k][d]["miss_count"] for d in range(5)],
+ ],
+ __type="s16",
+ )
+ for i, k in all_scores
+ ],
+ *[
+ E.top(
+ E.detail(
+ [
+ k,
+ *[top_scores[k][d]["clear_flg"] for d in range(5)],
+ *[top_scores[k][d]["ex_score"] for d in range(5)],
+ ],
+ __type="s16",
+ ),
+ name0=top_scores[k][0]["djname"],
+ name1=top_scores[k][1]["djname"],
+ name2=top_scores[k][2]["djname"],
+ name3=top_scores[k][3]["djname"],
+ name4=top_scores[k][4]["djname"],
+ )
+ for k in top_scores
+ ]
)
)
- assert (response is not None)
+ assert response is not None
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29music/crate')
+@router.post("/{gameinfo}/IIDX29music/crate")
async def iidx29music_crate(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
db = get_db()
- all_score_stats = db.table('iidx_score_stats').search(
- (where('music_id') < (game_version + 1) * 1000)
+ all_score_stats = db.table("iidx_score_stats").search(
+ (where("music_id") < (game_version + 1) * 1000)
)
crate = {}
fcrate = {}
for stat in all_score_stats:
- if stat['music_id'] not in crate:
- crate[stat['music_id']] = [1001] * 10
- if stat['music_id'] not in fcrate:
- fcrate[stat['music_id']] = [1001] * 10
+ if stat["music_id"] not in crate:
+ crate[stat["music_id"]] = [1001] * 10
+ if stat["music_id"] not in fcrate:
+ fcrate[stat["music_id"]] = [1001] * 10
- if stat['play_style'] == 1:
+ if stat["play_style"] == 1:
dp_idx = 5
else:
dp_idx = 0
- crate[stat['music_id']][stat['chart_id'] + dp_idx] = int(stat['clear_rate'])
- fcrate[stat['music_id']][stat['chart_id'] + dp_idx] = int(stat['fc_rate'])
+ crate[stat["music_id"]][stat["chart_id"] + dp_idx] = int(stat["clear_rate"])
+ fcrate[stat["music_id"]][stat["chart_id"] + dp_idx] = int(stat["fc_rate"])
response = E.response(
- E.IIDX29music(
- *[E.c(crate[k] + fcrate[k], mid=k, __type="s32") for k in crate]
- )
+ E.IIDX29music(*[E.c(crate[k] + fcrate[k], mid=k, __type="s32") for k in crate])
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29music/reg')
+@router.post("/{gameinfo}/IIDX29music/reg")
async def iidx29music_reg(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
timestamp = time.time()
- log = request_info['root'][0].find('music_play_log')
+ log = request_info["root"][0].find("music_play_log")
- clear_flg = int(request_info['root'][0].attrib['cflg'])
- clid = int(request_info['root'][0].attrib['clid'])
- is_death = int(request_info['root'][0].attrib['is_death'])
- pid = int(request_info['root'][0].attrib['pid'])
+ clear_flg = int(request_info["root"][0].attrib["cflg"])
+ clid = int(request_info["root"][0].attrib["clid"])
+ is_death = int(request_info["root"][0].attrib["is_death"])
+ pid = int(request_info["root"][0].attrib["pid"])
- play_style = int(log.attrib['play_style'])
- ex_score = int(log.attrib['ex_score'])
- folder_type = int(log.attrib['folder_type'])
- gauge_type = int(log.attrib['gauge_type'])
- graph_type = int(log.attrib['graph_type'])
- great_num = int(log.attrib['great_num'])
- iidx_id = int(log.attrib['iidx_id'])
- miss_num = int(log.attrib['miss_num'])
- mode_type = int(log.attrib['mode_type'])
- music_id = int(log.attrib['music_id'])
- note_id = int(log.attrib['note_id'])
- option1 = int(log.attrib['option1'])
- option2 = int(log.attrib['option2'])
- pgreat_num = int(log.attrib['pgreat_num'])
+ play_style = int(log.attrib["play_style"])
+ ex_score = int(log.attrib["ex_score"])
+ folder_type = int(log.attrib["folder_type"])
+ gauge_type = int(log.attrib["gauge_type"])
+ graph_type = int(log.attrib["graph_type"])
+ great_num = int(log.attrib["great_num"])
+ iidx_id = int(log.attrib["iidx_id"])
+ miss_num = int(log.attrib["miss_num"])
+ mode_type = int(log.attrib["mode_type"])
+ music_id = int(log.attrib["music_id"])
+ note_id = int(log.attrib["note_id"])
+ option1 = int(log.attrib["option1"])
+ option2 = int(log.attrib["option2"])
+ pgreat_num = int(log.attrib["pgreat_num"])
ghost = log.find("ghost").text
ghost_gauge = log.find("ghost_gauge").text
db = get_db()
- db.table('iidx_scores').insert(
+ db.table("iidx_scores").insert(
{
- 'timestamp': timestamp,
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'pid': pid,
- 'clear_flg': clear_flg,
- 'is_death': is_death,
- 'music_id': music_id,
- 'play_style': play_style,
- 'chart_id': note_id,
- 'pgreat_num': pgreat_num,
- 'great_num': great_num,
- 'ex_score': ex_score,
- 'miss_count': miss_num,
- 'folder_type': folder_type,
- 'gauge_type': gauge_type,
- 'graph_type': graph_type,
- 'mode_type': mode_type,
- 'option1': option1,
- 'option2': option2,
- 'ghost': ghost,
- 'ghost_gauge': ghost_gauge,
+ "timestamp": timestamp,
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "pid": pid,
+ "clear_flg": clear_flg,
+ "is_death": is_death,
+ "music_id": music_id,
+ "play_style": play_style,
+ "chart_id": note_id,
+ "pgreat_num": pgreat_num,
+ "great_num": great_num,
+ "ex_score": ex_score,
+ "miss_count": miss_num,
+ "folder_type": folder_type,
+ "gauge_type": gauge_type,
+ "graph_type": graph_type,
+ "mode_type": mode_type,
+ "option1": option1,
+ "option2": option2,
+ "ghost": ghost,
+ "ghost_gauge": ghost_gauge,
},
)
- best_score = db.table('iidx_scores_best').get(
- (where('iidx_id') == iidx_id)
- & (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ best_score = db.table("iidx_scores_best").get(
+ (where("iidx_id") == iidx_id)
+ & (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id)
)
best_score = {} if best_score is None else best_score
if clear_flg < ClearFlags.EASY_CLEAR:
miss_num = -1
- best_miss_count = best_score.get('miss_count', miss_num)
+ best_miss_count = best_score.get("miss_count", miss_num)
if best_miss_count == -1:
miss_count = max(miss_num, best_miss_count)
elif clear_flg > ClearFlags.ASSIST_CLEAR:
miss_count = min(miss_num, best_miss_count)
else:
miss_count = best_miss_count
- best_ex_score = best_score.get('ex_score', ex_score)
+ best_ex_score = best_score.get("ex_score", ex_score)
best_score_data = {
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'pid': pid,
- 'play_style': play_style,
- 'music_id': music_id,
- 'chart_id': note_id,
- 'miss_count': miss_count,
- 'ex_score': max(ex_score, best_ex_score),
- 'ghost': ghost if ex_score >= best_ex_score else best_score.get('ghost', ghost),
- 'ghost_gauge': ghost_gauge if ex_score >= best_ex_score else best_score.get('ghost_gauge', ghost_gauge),
- 'clear_flg': max(clear_flg, best_score.get('clear_flg', clear_flg)),
- 'gauge_type': gauge_type if ex_score >= best_ex_score else best_score.get('gauge_type', gauge_type),
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "pid": pid,
+ "play_style": play_style,
+ "music_id": music_id,
+ "chart_id": note_id,
+ "miss_count": miss_count,
+ "ex_score": max(ex_score, best_ex_score),
+ "ghost": ghost if ex_score >= best_ex_score else best_score.get("ghost", ghost),
+ "ghost_gauge": ghost_gauge
+ if ex_score >= best_ex_score
+ else best_score.get("ghost_gauge", ghost_gauge),
+ "clear_flg": max(clear_flg, best_score.get("clear_flg", clear_flg)),
+ "gauge_type": gauge_type
+ if ex_score >= best_ex_score
+ else best_score.get("gauge_type", gauge_type),
}
- db.table('iidx_scores_best').upsert(
+ db.table("iidx_scores_best").upsert(
best_score_data,
- (where('iidx_id') == iidx_id)
- & (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ (where("iidx_id") == iidx_id)
+ & (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id),
)
- score_stats = db.table('iidx_score_stats').get(
- (where('music_id') == music_id)
- & (where('play_style') == play_style)
- & (where('chart_id') == note_id)
+ score_stats = db.table("iidx_score_stats").get(
+ (where("music_id") == music_id)
+ & (where("play_style") == play_style)
+ & (where("chart_id") == note_id)
)
score_stats = {} if score_stats is None else score_stats
- score_stats['game_version'] = game_version
- score_stats['play_style'] = play_style
- score_stats['music_id'] = music_id
- score_stats['chart_id'] = note_id
- score_stats['play_count'] = score_stats.get('play_count', 0) + 1
- score_stats['fc_count'] = score_stats.get('fc_count', 0) + (1 if clear_flg == ClearFlags.FULL_COMBO else 0)
- score_stats['clear_count'] = score_stats.get('clear_count', 0) + (1 if clear_flg >= ClearFlags.EASY_CLEAR else 0)
- score_stats['fc_rate'] = int((score_stats['fc_count'] / score_stats['play_count']) * 1000)
- score_stats['clear_rate'] = int((score_stats['clear_count'] / score_stats['play_count']) * 1000)
+ score_stats["game_version"] = game_version
+ score_stats["play_style"] = play_style
+ score_stats["music_id"] = music_id
+ score_stats["chart_id"] = note_id
+ score_stats["play_count"] = score_stats.get("play_count", 0) + 1
+ score_stats["fc_count"] = score_stats.get("fc_count", 0) + (
+ 1 if clear_flg == ClearFlags.FULL_COMBO else 0
+ )
+ score_stats["clear_count"] = score_stats.get("clear_count", 0) + (
+ 1 if clear_flg >= ClearFlags.EASY_CLEAR else 0
+ )
+ score_stats["fc_rate"] = int(
+ (score_stats["fc_count"] / score_stats["play_count"]) * 1000
+ )
+ score_stats["clear_rate"] = int(
+ (score_stats["clear_count"] / score_stats["play_count"]) * 1000
+ )
- db.table('iidx_score_stats').upsert(
+ db.table("iidx_score_stats").upsert(
score_stats,
- (where('music_id') == music_id)
- & (where('play_style') == play_style)
- & (where('chart_id') == note_id)
+ (where("music_id") == music_id)
+ & (where("play_style") == play_style)
+ & (where("chart_id") == note_id),
)
ranklist_data = []
- ranklist_scores = db.table('iidx_scores_best').search(
- (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ ranklist_scores = db.table("iidx_scores_best").search(
+ (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id)
)
ranklist_scores = [] if ranklist_scores is None else ranklist_scores
ranklist_scores_ranked = []
for score in ranklist_scores:
- profile = db.table('iidx_profile').get(where('iidx_id') == score['iidx_id'])
+ profile = db.table("iidx_profile").get(where("iidx_id") == score["iidx_id"])
- if profile is None or str(game_version) not in profile['version']:
+ if profile is None or str(game_version) not in profile["version"]:
continue
- game_profile = profile['version'][str(game_version)]
+ game_profile = profile["version"][str(game_version)]
- ranklist_scores_ranked.append({
- 'opname': config.arcade,
- 'name': game_profile['djname'],
- 'pid': game_profile['region'],
- 'body': game_profile['body'],
- 'face': game_profile['face'],
- 'hair': game_profile['hair'],
- 'hand': game_profile['hand'],
- 'head': game_profile['head'],
- 'dgrade': game_profile['grade_double'],
- 'sgrade': game_profile['grade_single'],
- 'score': score['ex_score'],
- 'iidx_id': score['iidx_id'],
- 'clflg': score['clear_flg'],
- 'myFlg': score['iidx_id'] == iidx_id
- })
+ ranklist_scores_ranked.append(
+ {
+ "opname": config.arcade,
+ "name": game_profile["djname"],
+ "pid": game_profile["region"],
+ "body": game_profile["body"],
+ "face": game_profile["face"],
+ "hair": game_profile["hair"],
+ "hand": game_profile["hand"],
+ "head": game_profile["head"],
+ "dgrade": game_profile["grade_double"],
+ "sgrade": game_profile["grade_single"],
+ "score": score["ex_score"],
+ "iidx_id": score["iidx_id"],
+ "clflg": score["clear_flg"],
+ "myFlg": score["iidx_id"] == iidx_id,
+ }
+ )
- ranklist_scores_ranked = sorted(ranklist_scores_ranked, key=lambda x: (x['clflg'], x['score']), reverse=True)
+ ranklist_scores_ranked = sorted(
+ ranklist_scores_ranked, key=lambda x: (x["clflg"], x["score"]), reverse=True
+ )
myRank = 0
for rnum, score in enumerate(ranklist_scores_ranked):
r = E.data(
rnum=rnum + 1,
- opname=score['opname'],
- name=score['name'],
- pid=score['pid'],
- body=score['body'],
- face=score['face'],
- hair=score['hair'],
- hand=score['hand'],
- head=score['head'],
- dgrade=score['dgrade'],
- sgrade=score['sgrade'],
- score=score['score'],
- iidx_id=score['iidx_id'],
- clflg=score['clflg'],
- myFlg=score['myFlg'],
+ opname=score["opname"],
+ name=score["name"],
+ pid=score["pid"],
+ body=score["body"],
+ face=score["face"],
+ hair=score["hair"],
+ hand=score["hand"],
+ head=score["head"],
+ dgrade=score["dgrade"],
+ sgrade=score["sgrade"],
+ score=score["score"],
+ iidx_id=score["iidx_id"],
+ clflg=score["clflg"],
+ myFlg=score["myFlg"],
achieve=0,
)
ranklist_data.append(r)
- if score['myFlg']:
+ if score["myFlg"]:
myRank = rnum + 1
response = E.response(
E.IIDX29music(
- E.ranklist(
- *ranklist_data,
- total_user_num=len(ranklist_data)
- ),
- E.shopdata(
- rank=myRank
- ),
+ E.ranklist(*ranklist_data, total_user_num=len(ranklist_data)),
+ E.shopdata(rank=myRank),
clid=clid,
- crate=score_stats['clear_rate'],
- frate=score_stats['fc_rate'],
+ crate=score_stats["clear_rate"],
+ frate=score_stats["fc_rate"],
mid=music_id,
)
)
@@ -374,78 +399,77 @@ async def iidx29music_reg(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29music/appoint')
+@router.post("/{gameinfo}/IIDX29music/appoint")
async def iidx29music_appoint(request: Request):
request_info = await core_process_request(request)
- root = request_info['root'][0]
+ root = request_info["root"][0]
- iidxid = int(root.attrib['iidxid'])
- music_id = int(root.attrib['mid'])
- chart_id = int(root.attrib['clid'])
- ctype = int(root.attrib['ctype'])
- subtype = root.attrib['subtype']
-
+ iidxid = int(root.attrib["iidxid"])
+ music_id = int(root.attrib["mid"])
+ chart_id = int(root.attrib["clid"])
+ ctype = int(root.attrib["ctype"])
+ subtype = root.attrib["subtype"]
db = get_db()
- record = db.table('iidx_scores_best').get(
- (where('iidx_id') == iidxid)
- & (where('music_id') == music_id)
- & (where('chart_id') == chart_id)
+ record = db.table("iidx_scores_best").get(
+ (where("iidx_id") == iidxid)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == chart_id)
)
vals = []
if record is not None:
- vals.append(E.mydata(
- record['ghost'],
- score=record['ex_score'],
- __type="bin",
- __size=len(record['ghost']) // 2,
- ))
+ vals.append(
+ E.mydata(
+ record["ghost"],
+ score=record["ex_score"],
+ __type="bin",
+ __size=len(record["ghost"]) // 2,
+ )
+ )
if ctype == 1:
- sdata = db.table('iidx_scores_best').get(
- (where('iidx_id') == int(subtype))
- & (where('music_id') == music_id)
- & (where('chart_id') == chart_id)
+ sdata = db.table("iidx_scores_best").get(
+ (where("iidx_id") == int(subtype))
+ & (where("music_id") == music_id)
+ & (where("chart_id") == chart_id)
)
elif ctype in (2, 4, 10):
sdata = {
- 'game_version': 29,
- 'ghost': "",
- 'ex_score': 0,
- 'iidx_id': 0,
- 'name': "",
- 'pid': 13
+ "game_version": 29,
+ "ghost": "",
+ "ex_score": 0,
+ "iidx_id": 0,
+ "name": "",
+ "pid": 13,
}
- for record in db.table('iidx_scores_best').search(
- (where('music_id') == music_id)
- & (where('chart_id') == chart_id)
+ for record in db.table("iidx_scores_best").search(
+ (where("music_id") == music_id) & (where("chart_id") == chart_id)
):
- if record['ex_score'] > sdata['ex_score']:
- sdata['game_version'] = record['game_version']
- sdata['ghost'] = record['ghost']
- sdata['ex_score'] = record['ex_score']
- sdata['iidx_id'] = record['iidx_id']
- sdata['pid'] = record['pid']
+ if record["ex_score"] > sdata["ex_score"]:
+ sdata["game_version"] = record["game_version"]
+ sdata["ghost"] = record["ghost"]
+ sdata["ex_score"] = record["ex_score"]
+ sdata["iidx_id"] = record["iidx_id"]
+ sdata["pid"] = record["pid"]
- if ctype in (1, 2, 4, 10) and sdata['ex_score'] != 0:
- vals.append(E.sdata(
- sdata['ghost'],
- score=sdata['ex_score'],
- name=db.table('iidx_profile').get(where('iidx_id') == sdata['iidx_id'])['version'][str(sdata['game_version'])]['djname'],
- pid=sdata['pid'],
- __type="bin",
- __size=len(sdata['ghost']) // 2,
- ))
-
-
- response = E.response(
- E.IIDX29music(
- *vals
+ if ctype in (1, 2, 4, 10) and sdata["ex_score"] != 0:
+ vals.append(
+ E.sdata(
+ sdata["ghost"],
+ score=sdata["ex_score"],
+ name=db.table("iidx_profile").get(where("iidx_id") == sdata["iidx_id"])[
+ "version"
+ ][str(sdata["game_version"])]["djname"],
+ pid=sdata["pid"],
+ __type="bin",
+ __size=len(sdata["ghost"]) // 2,
+ )
)
- )
+
+ response = E.response(E.IIDX29music(*vals))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx29pc.py b/modules/iidx/iidx29pc.py
index 42a5413..e1315fd 100644
--- a/modules/iidx/iidx29pc.py
+++ b/modules/iidx/iidx29pc.py
@@ -13,60 +13,56 @@ router.model_whitelist = ["LDJ"]
def get_profile(cid):
- return get_db().table('iidx_profile').get(
- where('card') == cid
- )
+ return get_db().table("iidx_profile").get(where("card") == cid)
def get_profile_by_id(iidx_id):
- return get_db().table('iidx_profile').get(
- where('iidx_id') == iidx_id
- )
+ return get_db().table("iidx_profile").get(where("iidx_id") == iidx_id)
def get_game_profile(cid, game_version):
profile = get_profile(cid)
- return profile['version'].get(str(game_version), None)
+ return profile["version"].get(str(game_version), None)
def get_game_profile_by_id(iidx_id, game_version):
profile = get_profile_by_id(iidx_id)
- return profile['version'].get(str(game_version), None)
+ return profile["version"].get(str(game_version), None)
def get_id_from_profile(cid):
- profile = get_db().table('iidx_profile').get(
- where('card') == cid
- )
+ profile = get_db().table("iidx_profile").get(where("card") == cid)
- djid = "%08d" % profile['iidx_id']
- djid_split = '-'.join([djid[:4], djid[4:]])
+ djid = "%08d" % profile["iidx_id"]
+ djid_split = "-".join([djid[:4], djid[4:]])
- return profile['iidx_id'], djid_split
+ return profile["iidx_id"], djid_split
def calculate_folder_mask(profile):
- return profile.get('_show_category_grade', 0) << 0 \
- | (profile.get('_show_category_status', 0) << 1) \
- | (profile.get('_show_category_difficulty', 0) << 2) \
- | (profile.get('_show_category_alphabet', 0) << 3) \
- | (profile.get('_show_category_rival_play', 0) << 4) \
- | (profile.get('_show_category_rival_winlose', 0) << 6) \
- | (profile.get('_show_rival_shop_info', 0) << 7) \
- | (profile.get('_hide_play_count', 0) << 8) \
- | (profile.get('_show_score_graph_cutin', 0) << 9) \
- | (profile.get('_classic_hispeed', 0) << 10) \
- | (profile.get('_hide_iidx_id', 0) << 12)
+ return (
+ profile.get("_show_category_grade", 0) << 0
+ | (profile.get("_show_category_status", 0) << 1)
+ | (profile.get("_show_category_difficulty", 0) << 2)
+ | (profile.get("_show_category_alphabet", 0) << 3)
+ | (profile.get("_show_category_rival_play", 0) << 4)
+ | (profile.get("_show_category_rival_winlose", 0) << 6)
+ | (profile.get("_show_rival_shop_info", 0) << 7)
+ | (profile.get("_hide_play_count", 0) << 8)
+ | (profile.get("_show_score_graph_cutin", 0) << 9)
+ | (profile.get("_classic_hispeed", 0) << 10)
+ | (profile.get("_hide_iidx_id", 0) << 12)
+ )
-@router.post('/{gameinfo}/IIDX29pc/get')
+@router.post("/{gameinfo}/IIDX29pc/get")
async def iidx29pc_get(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- cid = request_info['root'][0].attrib['cid']
+ cid = request_info["root"][0].attrib["cid"]
profile = get_game_profile(cid, game_version)
djid, djid_split = get_id_from_profile(cid)
@@ -87,99 +83,107 @@ async def iidx29pc_get(request: Request):
if r == 0:
continue
rivals[idx] = {}
- rivals[idx]['spdp'] = 1 if idx < 5 else 2
+ rivals[idx]["spdp"] = 1 if idx < 5 else 2
rival_profile = get_game_profile_by_id(r, game_version)
rdjid = "%08d" % r
- rdjid_split = '-'.join([rdjid[:4], rdjid[4:]])
-
- rivals[idx]['djid'] = rdjid
- rivals[idx]['djid_split'] = rdjid_split
- rivals[idx]['djname'] = rival_profile['djname']
- rivals[idx]['region'] = rival_profile['region']
- rivals[idx]['sa'] = rival_profile['sach']
- rivals[idx]['sg'] = rival_profile['grade_single']
- rivals[idx]['da'] = rival_profile['dach']
- rivals[idx]['dg'] = rival_profile['grade_double']
- rivals[idx]['body'] = rival_profile['body']
- rivals[idx]['face'] = rival_profile['face']
- rivals[idx]['hair'] = rival_profile['hair']
- rivals[idx]['hand'] = rival_profile['hand']
- rivals[idx]['head'] = rival_profile['head']
+ rdjid_split = "-".join([rdjid[:4], rdjid[4:]])
+ rivals[idx]["djid"] = rdjid
+ rivals[idx]["djid_split"] = rdjid_split
+ rivals[idx]["djname"] = rival_profile["djname"]
+ rivals[idx]["region"] = rival_profile["region"]
+ rivals[idx]["sa"] = rival_profile["sach"]
+ rivals[idx]["sg"] = rival_profile["grade_single"]
+ rivals[idx]["da"] = rival_profile["dach"]
+ rivals[idx]["dg"] = rival_profile["grade_double"]
+ rivals[idx]["body"] = rival_profile["body"]
+ rivals[idx]["face"] = rival_profile["face"]
+ rivals[idx]["hair"] = rival_profile["hair"]
+ rivals[idx]["hand"] = rival_profile["hand"]
+ rivals[idx]["head"] = rival_profile["head"]
response = E.response(
E.IIDX29pc(
E.pcdata(
- d_auto_adjust=profile['d_auto_adjust'],
- d_auto_scrach=profile['d_auto_scrach'],
- d_camera_layout=profile['d_camera_layout'],
- d_disp_judge=profile['d_disp_judge'],
- d_exscore=profile['d_exscore'],
- d_gauge_disp=profile['d_gauge_disp'],
- d_ghost_score=profile['d_ghost_score'],
- d_gno=profile['d_gno'],
- d_graph_score=profile['d_graph_score'],
- d_gtype=profile['d_gtype'],
- d_hispeed=profile['d_hispeed'],
- d_judge=profile['d_judge'],
- d_judgeAdj=profile['d_judgeAdj'],
- d_lane_brignt=profile['d_lane_brignt'],
- d_liflen=profile['d_liflen'],
- d_notes=profile['d_notes'],
- d_opstyle=profile['d_opstyle'],
- d_pace=profile['d_pace'],
- d_sdlen=profile['d_sdlen'],
- d_sdtype=profile['d_sdtype'],
- d_sorttype=profile['d_sorttype'],
- d_sub_gno=profile['d_sub_gno'],
- d_timing=profile['d_timing'],
- d_tsujigiri_disp=profile['d_tsujigiri_disp'],
- d_tune=profile['d_tune'],
- dach=profile['dach'],
- dp_opt=profile['dp_opt'],
- dp_opt2=profile['dp_opt2'],
+ d_auto_adjust=profile["d_auto_adjust"],
+ d_auto_scrach=profile["d_auto_scrach"],
+ d_camera_layout=profile["d_camera_layout"],
+ d_disp_judge=profile["d_disp_judge"],
+ d_exscore=profile["d_exscore"],
+ d_gauge_disp=profile["d_gauge_disp"],
+ d_ghost_score=profile["d_ghost_score"],
+ d_gno=profile["d_gno"],
+ d_graph_score=profile["d_graph_score"],
+ d_gtype=profile["d_gtype"],
+ d_hispeed=profile["d_hispeed"],
+ d_judge=profile["d_judge"],
+ d_judgeAdj=profile["d_judgeAdj"],
+ d_lane_brignt=profile["d_lane_brignt"],
+ d_liflen=profile["d_liflen"],
+ d_notes=profile["d_notes"],
+ d_opstyle=profile["d_opstyle"],
+ d_pace=profile["d_pace"],
+ d_sdlen=profile["d_sdlen"],
+ d_sdtype=profile["d_sdtype"],
+ d_sorttype=profile["d_sorttype"],
+ d_sub_gno=profile["d_sub_gno"],
+ d_timing=profile["d_timing"],
+ d_tsujigiri_disp=profile["d_tsujigiri_disp"],
+ d_tune=profile["d_tune"],
+ dach=profile["dach"],
+ dp_opt=profile["dp_opt"],
+ dp_opt2=profile["dp_opt2"],
dpnum=profile["dpnum"],
- gpos=profile['gpos'],
+ gpos=profile["gpos"],
id=djid,
idstr=djid_split,
- mode=profile['mode'],
- name=profile['djname'],
- ngrade=profile['ngrade'],
- pid=profile['region'],
- pmode=profile['pmode'],
- rtype=profile['rtype'],
- s_auto_adjust=profile['s_auto_adjust'],
- s_auto_scrach=profile['s_auto_scrach'],
- s_camera_layout=profile['s_camera_layout'],
- s_disp_judge=profile['s_disp_judge'],
- s_exscore=profile['s_exscore'],
- s_gauge_disp=profile['s_gauge_disp'],
- s_ghost_score=profile['s_ghost_score'],
- s_gno=profile['s_gno'],
- s_graph_score=profile['s_graph_score'],
- s_gtype=profile['s_gtype'],
- s_hispeed=profile['s_hispeed'],
- s_judge=profile['s_judge'],
- s_judgeAdj=profile['s_judgeAdj'],
- s_lane_brignt=profile['s_lane_brignt'],
- s_liflen=profile['s_liflen'],
- s_notes=profile['s_notes'],
- s_opstyle=profile['s_opstyle'],
- s_pace=profile['s_pace'],
- s_sdlen=profile['s_sdlen'],
- s_sdtype=profile['s_sdtype'],
- s_sorttype=profile['s_sorttype'],
- s_sub_gno=profile['s_sub_gno'],
- s_timing=profile['s_timing'],
- s_tsujigiri_disp=profile['s_tsujigiri_disp'],
- s_tune=profile['s_tune'],
- sach=profile['sach'],
- sp_opt=profile['sp_opt'],
- spnum=profile['spnum'],
+ mode=profile["mode"],
+ name=profile["djname"],
+ ngrade=profile["ngrade"],
+ pid=profile["region"],
+ pmode=profile["pmode"],
+ rtype=profile["rtype"],
+ s_auto_adjust=profile["s_auto_adjust"],
+ s_auto_scrach=profile["s_auto_scrach"],
+ s_camera_layout=profile["s_camera_layout"],
+ s_disp_judge=profile["s_disp_judge"],
+ s_exscore=profile["s_exscore"],
+ s_gauge_disp=profile["s_gauge_disp"],
+ s_ghost_score=profile["s_ghost_score"],
+ s_gno=profile["s_gno"],
+ s_graph_score=profile["s_graph_score"],
+ s_gtype=profile["s_gtype"],
+ s_hispeed=profile["s_hispeed"],
+ s_judge=profile["s_judge"],
+ s_judgeAdj=profile["s_judgeAdj"],
+ s_lane_brignt=profile["s_lane_brignt"],
+ s_liflen=profile["s_liflen"],
+ s_notes=profile["s_notes"],
+ s_opstyle=profile["s_opstyle"],
+ s_pace=profile["s_pace"],
+ s_sdlen=profile["s_sdlen"],
+ s_sdtype=profile["s_sdtype"],
+ s_sorttype=profile["s_sorttype"],
+ s_sub_gno=profile["s_sub_gno"],
+ s_timing=profile["s_timing"],
+ s_tsujigiri_disp=profile["s_tsujigiri_disp"],
+ s_tune=profile["s_tune"],
+ sach=profile["sach"],
+ sp_opt=profile["sp_opt"],
+ spnum=profile["spnum"],
+ ),
+ E.qprodata(
+ [
+ profile["head"],
+ profile["hair"],
+ profile["face"],
+ profile["hand"],
+ profile["body"],
+ ],
+ __type="u32",
+ __size=5 * 4,
),
- E.qprodata([profile["head"], profile["hair"], profile["face"], profile["hand"], profile["body"]],
- __type="u32", __size=5 * 4),
E.skin(
[
profile["frame"],
@@ -203,60 +207,80 @@ async def iidx29pc_get(request: Request):
profile["alternate_hcn"],
profile["kokokara_start"],
],
- __type="s16"),
+ __type="s16",
+ ),
E.rlist(
- *[E.rival(
- E.is_robo(0, __type="bool"),
- E.shop(name=config.arcade),
- E.qprodata(
- body=rivals[r]['body'],
- face=rivals[r]['face'],
- hair=rivals[r]['hair'],
- hand=rivals[r]['hand'],
- head=rivals[r]['head'],
- ),
- da=rivals[r]['da'],
- dg=rivals[r]['dg'],
- djname=rivals[r]['djname'],
- id=rivals[r]['djid'],
- id_str=rivals[r]['djid_split'],
- pid=rivals[r]['region'],
- sa=rivals[r]['sa'],
- sg=rivals[r]['sg'],
- spdp=rivals[r]['spdp'],
- )for r in rivals],
+ *[
+ E.rival(
+ E.is_robo(0, __type="bool"),
+ E.shop(name=config.arcade),
+ E.qprodata(
+ body=rivals[r]["body"],
+ face=rivals[r]["face"],
+ hair=rivals[r]["hair"],
+ hand=rivals[r]["hand"],
+ head=rivals[r]["head"],
+ ),
+ da=rivals[r]["da"],
+ dg=rivals[r]["dg"],
+ djname=rivals[r]["djname"],
+ id=rivals[r]["djid"],
+ id_str=rivals[r]["djid_split"],
+ pid=rivals[r]["region"],
+ sa=rivals[r]["sa"],
+ sg=rivals[r]["sg"],
+ spdp=rivals[r]["spdp"],
+ )
+ for r in rivals
+ ],
),
E.ir_data(),
E.secret_course_data(),
- E.deller(deller=profile['deller'], rate=0),
+ E.deller(deller=profile["deller"], rate=0),
E.secret(
- E.flg1(profile.get('secret_flg1', [-1, -1, -1]), __type="s64"),
- E.flg2(profile.get('secret_flg2', [-1, -1, -1]), __type="s64"),
- E.flg3(profile.get('secret_flg3', [-1, -1, -1]), __type="s64"),
- E.flg4(profile.get('secret_flg4', [-1, -1, -1]), __type="s64"),
+ E.flg1(profile.get("secret_flg1", [-1, -1, -1]), __type="s64"),
+ E.flg2(profile.get("secret_flg2", [-1, -1, -1]), __type="s64"),
+ E.flg3(profile.get("secret_flg3", [-1, -1, -1]), __type="s64"),
+ E.flg4(profile.get("secret_flg4", [-1, -1, -1]), __type="s64"),
),
E.join_shop(join_cflg=1, join_id=10, join_name=config.arcade, joinflg=1),
- E.leggendaria(E.flg1(profile.get('leggendaria_flg1', [-1, -1, -1]), __type="s64")),
+ E.leggendaria(
+ E.flg1(profile.get("leggendaria_flg1", [-1, -1, -1]), __type="s64")
+ ),
E.grade(
- *[E.g(x, __type="u8") for x in profile['grade_values']],
- dgid=profile['grade_double'],
- sgid=profile['grade_single'],
+ *[E.g(x, __type="u8") for x in profile["grade_values"]],
+ dgid=profile["grade_double"],
+ sgid=profile["grade_single"],
),
E.world_tourism_secret_flg(
- E.flg1(profile.get('wt_flg1', [-1, -1, -1]), __type="s64"),
- E.flg2(profile.get('wt_flg2', [-1, -1, -1]), __type="s64"),
+ E.flg1(profile.get("wt_flg1", [-1, -1, -1]), __type="s64"),
+ E.flg2(profile.get("wt_flg2", [-1, -1, -1]), __type="s64"),
),
E.lightning_setting(
- E.slider(profile.get('lightning_setting_slider', [0] * 7), __type="s32"),
- E.light(profile.get('lightning_setting_light', [1] * 10), __type="bool"),
- E.concentration(profile.get('lightning_setting_concentration', 0), __type="bool"),
- headphone_vol=profile.get('lightning_setting_headphone_vol', 0),
- resistance_sp_left=profile.get('lightning_setting_resistance_sp_left', 0),
- resistance_sp_right=profile.get('lightning_setting_resistance_sp_right', 0),
- resistance_dp_left=profile.get('lightning_setting_resistance_dp_left', 0),
- resistance_dp_right=profile.get('lightning_setting_resistance_dp_right', 0),
- skin_0=profile.get('lightning_setting_skin_0', 0),
- flg_skin_0=profile.get('lightning_setting_flg_skin_0', 0),
+ E.slider(
+ profile.get("lightning_setting_slider", [0] * 7), __type="s32"
+ ),
+ E.light(
+ profile.get("lightning_setting_light", [1] * 10), __type="bool"
+ ),
+ E.concentration(
+ profile.get("lightning_setting_concentration", 0), __type="bool"
+ ),
+ headphone_vol=profile.get("lightning_setting_headphone_vol", 0),
+ resistance_sp_left=profile.get(
+ "lightning_setting_resistance_sp_left", 0
+ ),
+ resistance_sp_right=profile.get(
+ "lightning_setting_resistance_sp_right", 0
+ ),
+ resistance_dp_left=profile.get(
+ "lightning_setting_resistance_dp_left", 0
+ ),
+ resistance_dp_right=profile.get(
+ "lightning_setting_resistance_dp_right", 0
+ ),
+ skin_0=profile.get("lightning_setting_skin_0", 0),
+ flg_skin_0=profile.get("lightning_setting_flg_skin_0", 0),
),
E.arena_data(
E.achieve_data(
@@ -292,19 +316,25 @@ async def iidx29pc_get(request: Request):
E.enable_qr_reward(),
E.nostalgia_open(),
E.event_1(
- story_prog=profile.get('event_1_story_prog', 0),
- last_select_area=profile.get('event_1_last_select_area', 0),
- failed_num=profile.get('event_1_failed_num', 0),
- event_play_num=profile.get('event_1_event_play_num', 0),
- last_select_area_id=profile.get('event_1_last_select_area_id', 0),
- last_select_platform_type=profile.get('event_1_last_select_platform_type', 0),
- last_select_platform_id=profile.get('event_1_last_select_platform_id', 0),
+ story_prog=profile.get("event_1_story_prog", 0),
+ last_select_area=profile.get("event_1_last_select_area", 0),
+ failed_num=profile.get("event_1_failed_num", 0),
+ event_play_num=profile.get("event_1_event_play_num", 0),
+ last_select_area_id=profile.get("event_1_last_select_area_id", 0),
+ last_select_platform_type=profile.get(
+ "event_1_last_select_platform_type", 0
+ ),
+ last_select_platform_id=profile.get(
+ "event_1_last_select_platform_id", 0
+ ),
),
- E.language_setting(language=profile['language_setting']),
- E.movie_agreement(agreement_version=profile['movie_agreement']),
+ E.language_setting(language=profile["language_setting"]),
+ E.movie_agreement(agreement_version=profile["movie_agreement"]),
E.bpl_virtual(),
- E.lightning_play_data(spnum=profile['lightning_play_data_spnum'],
- dpnum=profile['lightning_play_data_dpnum']),
+ E.lightning_play_data(
+ spnum=profile["lightning_play_data_spnum"],
+ dpnum=profile["lightning_play_data_dpnum"],
+ ),
E.weekly(
mid=-1,
wid=1,
@@ -345,74 +375,71 @@ async def iidx29pc_get(request: Request):
E.valkyrie_linkage_data(progress=-1),
E.valkyrie_linkage_2_data(progress=-1),
E.achievements(
- E.trophy(
- profile.get('achievements_trophy', [])[:20],
- __type="s64"
- ),
- pack=profile.get('achievements_pack_id', 0),
- pack_comp=profile.get('achievements_pack_comp', 0),
- last_weekly=profile.get('achievements_last_weekly', 0),
- weekly_num=profile.get('achievements_weekly_num', 0),
- visit_flg=profile.get('achievements_visit_flg', 0),
+ E.trophy(profile.get("achievements_trophy", [])[:20], __type="s64"),
+ pack=profile.get("achievements_pack_id", 0),
+ pack_comp=profile.get("achievements_pack_comp", 0),
+ last_weekly=profile.get("achievements_last_weekly", 0),
+ weekly_num=profile.get("achievements_weekly_num", 0),
+ visit_flg=profile.get("achievements_visit_flg", 0),
rival_crush=0,
),
E.notes_radar(
E.radar_score(
- profile['notes_radar_single'],
+ profile["notes_radar_single"],
__type="s32",
),
style=0,
),
E.notes_radar(
E.radar_score(
- profile['notes_radar_double'],
+ profile["notes_radar_double"],
__type="s32",
),
style=1,
),
E.dj_rank(
E.rank(
- profile['dj_rank_single_rank'],
+ profile["dj_rank_single_rank"],
__type="s32",
),
E.point(
- profile['dj_rank_single_point'],
+ profile["dj_rank_single_point"],
__type="s32",
),
style=0,
),
E.dj_rank(
E.rank(
- profile['dj_rank_double_rank'],
+ profile["dj_rank_double_rank"],
__type="s32",
),
E.point(
- profile['dj_rank_double_point'],
+ profile["dj_rank_double_point"],
__type="s32",
),
style=1,
),
E.step(
E.is_track_ticket(
- profile['stepup_is_track_ticket'],
+ profile["stepup_is_track_ticket"],
__type="bool",
),
- dp_level=profile['stepup_dp_level'],
- dp_mplay=profile['stepup_dp_mplay'],
- enemy_damage=profile['stepup_enemy_damage'],
- enemy_defeat_flg=profile['stepup_enemy_defeat_flg'],
- mission_clear_num=profile['stepup_mission_clear_num'],
- progress=profile['stepup_progress'],
- sp_level=profile['stepup_sp_level'],
- sp_mplay=profile['stepup_sp_mplay'],
- tips_read_list=profile['stepup_tips_read_list'],
- total_point=profile['stepup_total_point'],
+ dp_level=profile["stepup_dp_level"],
+ dp_mplay=profile["stepup_dp_mplay"],
+ enemy_damage=profile["stepup_enemy_damage"],
+ enemy_defeat_flg=profile["stepup_enemy_defeat_flg"],
+ mission_clear_num=profile["stepup_mission_clear_num"],
+ progress=profile["stepup_progress"],
+ sp_level=profile["stepup_sp_level"],
+ sp_mplay=profile["stepup_sp_mplay"],
+ tips_read_list=profile["stepup_tips_read_list"],
+ total_point=profile["stepup_total_point"],
),
E.skin_customize_flg(
- skin_frame_flg=profile['skin_customize_flag_frame'],
- skin_bgm_flg=profile['skin_customize_flag_bgm'],
- skin_lane_flg3=profile['skin_customize_flag_lane'],
- )
+ skin_frame_flg=profile["skin_customize_flag_frame"],
+ skin_bgm_flg=profile["skin_customize_flag_bgm"],
+ skin_lane_flg3=profile["skin_customize_flag_lane"],
+ ),
)
)
@@ -420,7 +447,7 @@ async def iidx29pc_get(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/common')
+@router.post("/{gameinfo}/IIDX29pc/common")
async def iidx29pc_common(request: Request):
request_info = await core_process_request(request)
@@ -428,33 +455,35 @@ async def iidx29pc_common(request: Request):
E.IIDX29pc(
E.monthly_mranking(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- __type="u16"),
+ __type="u16",
+ ),
E.total_mranking(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- __type="u16"),
+ __type="u16",
+ ),
# E.internet_ranking(),
# E.secret_ex_course(),
E.kac_mid([-1, -1, -1, -1, -1], __type="s32"),
E.kac_clid([2, 2, 2, 2, 2], __type="s32"),
E.ir(beat=3),
- E.cm(compo='cm_ultimate', folder='cm_ultimate', id=0),
+ E.cm(compo="cm_ultimate", folder="cm_ultimate", id=0),
E.tdj_cm(
- E.cm(filename='cm_bn_001', id=0),
- E.cm(filename='cm_bn_002', id=1),
- E.cm(filename='event_bn_001', id=2),
- E.cm(filename='event_bn_004', id=3),
- E.cm(filename='event_bn_006', id=4),
- E.cm(filename='fipb_001', id=5),
- E.cm(filename='year_bn_004', id=6),
- E.cm(filename='year_bn_005', id=7),
- E.cm(filename='year_bn_006_2', id=8),
- E.cm(filename='year_bn_007', id=9),
+ E.cm(filename="cm_bn_001", id=0),
+ E.cm(filename="cm_bn_002", id=1),
+ E.cm(filename="event_bn_001", id=2),
+ E.cm(filename="event_bn_004", id=3),
+ E.cm(filename="event_bn_006", id=4),
+ E.cm(filename="fipb_001", id=5),
+ E.cm(filename="year_bn_004", id=6),
+ E.cm(filename="year_bn_005", id=7),
+ E.cm(filename="year_bn_006_2", id=8),
+ E.cm(filename="year_bn_007", id=9),
),
# E.playvideo_disable_music(E.music(musicid=-1)),
# E.music_movie_suspend(E.music(music_id=-1, kind=0, name='')),
# E.bpl_virtual(),
E.movie_agreement(version=1),
- E.license('None', __type="str"),
+ E.license("None", __type="str"),
E.file_recovery(url=str(config.ip)),
E.movie_upload(url=str(config.ip)),
# E.button_release_frame(frame=''),
@@ -486,7 +515,7 @@ async def iidx29pc_common(request: Request):
E.lane_gacha(),
# E.fps_fix(),
# E.save_unsync_log(),
- expire=600
+ expire=600,
)
)
@@ -494,227 +523,240 @@ async def iidx29pc_common(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/save')
+@router.post("/{gameinfo}/IIDX29pc/save")
async def iidx29pc_save(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- xid = int(request_info['root'][0].attrib['iidxid'])
- cid = request_info['root'][0].attrib['cid']
- clt = int(request_info['root'][0].attrib['cltype'])
+ xid = int(request_info["root"][0].attrib["iidxid"])
+ cid = request_info["root"][0].attrib["cid"]
+ clt = int(request_info["root"][0].attrib["cltype"])
profile = get_profile(cid)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
for k in [
- 'd_auto_adjust',
- 'd_auto_scrach',
- 'd_camera_layout',
- 'd_disp_judge',
- 'd_gauge_disp',
- 'd_ghost_score',
- 'd_gno',
- 'd_graph_score',
- 'd_gtype',
- 'd_hispeed',
- 'd_judge',
- 'd_judgeAdj',
- 'd_lane_brignt',
- 'd_notes',
- 'd_opstyle',
- 'd_pace',
- 'd_sdlen',
- 'd_sdtype',
- 'd_sorttype',
- 'd_sub_gno',
- 'd_timing',
- 'd_tsujigiri_disp',
- 'dp_opt',
- 'dp_opt2',
- 'gpos',
- 'mode',
- 'ngrade',
- 'pmode',
- 'rtype',
- 's_auto_adjust',
- 's_auto_scrach',
- 's_camera_layout',
- 's_disp_judge',
- 's_gauge_disp',
- 's_ghost_score',
- 's_gno',
- 's_graph_score',
- 's_gtype',
- 's_hispeed',
- 's_judge',
- 's_judgeAdj',
- 's_lane_brignt',
- 's_notes',
- 's_opstyle',
- 's_pace',
- 's_sdlen',
- 's_sdtype',
- 's_sorttype',
- 's_sub_gno',
- 's_timing',
- 's_tsujigiri_disp',
- 'sp_opt',
+ "d_auto_adjust",
+ "d_auto_scrach",
+ "d_camera_layout",
+ "d_disp_judge",
+ "d_gauge_disp",
+ "d_ghost_score",
+ "d_gno",
+ "d_graph_score",
+ "d_gtype",
+ "d_hispeed",
+ "d_judge",
+ "d_judgeAdj",
+ "d_lane_brignt",
+ "d_notes",
+ "d_opstyle",
+ "d_pace",
+ "d_sdlen",
+ "d_sdtype",
+ "d_sorttype",
+ "d_sub_gno",
+ "d_timing",
+ "d_tsujigiri_disp",
+ "dp_opt",
+ "dp_opt2",
+ "gpos",
+ "mode",
+ "ngrade",
+ "pmode",
+ "rtype",
+ "s_auto_adjust",
+ "s_auto_scrach",
+ "s_camera_layout",
+ "s_disp_judge",
+ "s_gauge_disp",
+ "s_ghost_score",
+ "s_gno",
+ "s_graph_score",
+ "s_gtype",
+ "s_hispeed",
+ "s_judge",
+ "s_judgeAdj",
+ "s_lane_brignt",
+ "s_notes",
+ "s_opstyle",
+ "s_pace",
+ "s_sdlen",
+ "s_sdtype",
+ "s_sorttype",
+ "s_sub_gno",
+ "s_timing",
+ "s_tsujigiri_disp",
+ "sp_opt",
]:
- if k in request_info['root'][0].attrib:
- game_profile[k] = request_info['root'][0].attrib[k]
+ if k in request_info["root"][0].attrib:
+ game_profile[k] = request_info["root"][0].attrib[k]
for k in [
- ('d_liflen', 'd_lift'),
- ('dach', 'd_achi'),
- ('s_liflen', 's_lift'),
- ('sach', 's_achi'),
+ ("d_liflen", "d_lift"),
+ ("dach", "d_achi"),
+ ("s_liflen", "s_lift"),
+ ("sach", "s_achi"),
]:
- if k[1] in request_info['root'][0].attrib:
- game_profile[k[0]] = request_info['root'][0].attrib[k[1]]
+ if k[1] in request_info["root"][0].attrib:
+ game_profile[k[0]] = request_info["root"][0].attrib[k[1]]
- lightning_setting = request_info['root'][0].find('lightning_setting')
+ lightning_setting = request_info["root"][0].find("lightning_setting")
if lightning_setting is not None:
for k in [
- 'headphone_vol',
- 'resistance_dp_left',
- 'resistance_dp_right',
- 'resistance_sp_left',
- 'resistance_sp_right',
+ "headphone_vol",
+ "resistance_dp_left",
+ "resistance_dp_right",
+ "resistance_sp_left",
+ "resistance_sp_right",
]:
- game_profile['lightning_setting_' + k] = int(lightning_setting.attrib[k])
+ game_profile["lightning_setting_" + k] = int(lightning_setting.attrib[k])
- slider = lightning_setting.find('slider')
+ slider = lightning_setting.find("slider")
if slider is not None:
- game_profile['lightning_setting_slider'] = [int(x) for x in slider.text.split(' ')]
+ game_profile["lightning_setting_slider"] = [
+ int(x) for x in slider.text.split(" ")
+ ]
- light = lightning_setting.find('light')
+ light = lightning_setting.find("light")
if light is not None:
- game_profile['lightning_setting_light'] = [int(x) for x in light.text.split(' ')]
+ game_profile["lightning_setting_light"] = [
+ int(x) for x in light.text.split(" ")
+ ]
- concentration = lightning_setting.find('concentration')
+ concentration = lightning_setting.find("concentration")
if concentration is not None:
- game_profile['lightning_setting_concentration'] = int(concentration.text)
+ game_profile["lightning_setting_concentration"] = int(concentration.text)
- lightning_customize_flg = request_info['root'][0].find('lightning_customize_flg')
+ lightning_customize_flg = request_info["root"][0].find("lightning_customize_flg")
if lightning_customize_flg is not None:
for k in [
- 'flg_skin_0',
+ "flg_skin_0",
]:
- game_profile['lightning_setting_' + k] = int(lightning_customize_flg.attrib[k])
+ game_profile["lightning_setting_" + k] = int(
+ lightning_customize_flg.attrib[k]
+ )
- secret = request_info['root'][0].find('secret')
+ secret = request_info["root"][0].find("secret")
if secret is not None:
- for k in ['flg1', 'flg2', 'flg3', 'flg4']:
+ for k in ["flg1", "flg2", "flg3", "flg4"]:
flg = secret.find(k)
if flg is not None:
- game_profile['secret_' + k] = [int(x) for x in flg.text.split(' ')]
+ game_profile["secret_" + k] = [int(x) for x in flg.text.split(" ")]
- leggendaria = request_info['root'][0].find('leggendaria')
+ leggendaria = request_info["root"][0].find("leggendaria")
if leggendaria is not None:
- for k in ['flg1']:
+ for k in ["flg1"]:
flg = leggendaria.find(k)
if flg is not None:
- game_profile['leggendaria_' + k] = [int(x) for x in flg.text.split(' ')]
+ game_profile["leggendaria_" + k] = [int(x) for x in flg.text.split(" ")]
- step = request_info['root'][0].find('step')
+ step = request_info["root"][0].find("step")
if step is not None:
for k in [
- 'dp_level',
- 'dp_mplay',
- 'enemy_damage',
- 'enemy_defeat_flg',
- 'mission_clear_num',
- 'progress',
- 'sp_level',
- 'sp_mplay',
- 'tips_read_list',
- 'total_point',
+ "dp_level",
+ "dp_mplay",
+ "enemy_damage",
+ "enemy_defeat_flg",
+ "mission_clear_num",
+ "progress",
+ "sp_level",
+ "sp_mplay",
+ "tips_read_list",
+ "total_point",
]:
- game_profile['stepup_' + k] = int(step.attrib[k])
+ game_profile["stepup_" + k] = int(step.attrib[k])
- is_track_ticket = step.find('is_track_ticket')
+ is_track_ticket = step.find("is_track_ticket")
if is_track_ticket is not None:
- game_profile['stepup_is_track_ticket'] = int(is_track_ticket.text)
+ game_profile["stepup_is_track_ticket"] = int(is_track_ticket.text)
- dj_ranks = request_info['root'][0].findall('dj_rank')
+ dj_ranks = request_info["root"][0].findall("dj_rank")
dj_ranks = [] if dj_ranks is None else dj_ranks
for dj_rank in dj_ranks:
- style = int(dj_rank.attrib['style'])
+ style = int(dj_rank.attrib["style"])
- rank = dj_rank.find('rank')
- game_profile['dj_rank_' + ['single', 'double'][style] + '_rank'] = [int(x) for x in rank.text.split(' ')]
+ rank = dj_rank.find("rank")
+ game_profile["dj_rank_" + ["single", "double"][style] + "_rank"] = [
+ int(x) for x in rank.text.split(" ")
+ ]
- point = dj_rank.find('point')
- game_profile['dj_rank_' + ['single', 'double'][style] + '_point'] = [int(x) for x in point.text.split(' ')]
+ point = dj_rank.find("point")
+ game_profile["dj_rank_" + ["single", "double"][style] + "_point"] = [
+ int(x) for x in point.text.split(" ")
+ ]
- notes_radars = request_info['root'][0].findall('notes_radar')
+ notes_radars = request_info["root"][0].findall("notes_radar")
notes_radars = [] if notes_radars is None else notes_radars
for notes_radar in notes_radars:
- style = int(notes_radar.attrib['style'])
- score = notes_radar.find('radar_score')
- game_profile['notes_radar_' + ['single', 'double'][style]] = [int(x) for x in score.text.split(' ')]
+ style = int(notes_radar.attrib["style"])
+ score = notes_radar.find("radar_score")
+ game_profile["notes_radar_" + ["single", "double"][style]] = [
+ int(x) for x in score.text.split(" ")
+ ]
- achievements = request_info['root'][0].find('achievements')
+ achievements = request_info["root"][0].find("achievements")
if achievements is not None:
for k in [
- 'last_weekly',
- 'pack_comp',
- 'pack_flg',
- 'pack_id',
- 'play_pack',
- 'visit_flg',
- 'weekly_num',
+ "last_weekly",
+ "pack_comp",
+ "pack_flg",
+ "pack_id",
+ "play_pack",
+ "visit_flg",
+ "weekly_num",
]:
- game_profile['achievements_' + k] = int(achievements.attrib[k])
+ game_profile["achievements_" + k] = int(achievements.attrib[k])
- trophy = achievements.find('trophy')
+ trophy = achievements.find("trophy")
if trophy is not None:
- game_profile['achievements_trophy'] = [int(x) for x in trophy.text.split(' ')]
+ game_profile["achievements_trophy"] = [
+ int(x) for x in trophy.text.split(" ")
+ ]
- grade = request_info['root'][0].find('grade')
+ grade = request_info["root"][0].find("grade")
if grade is not None:
grade_values = []
- for g in grade.findall('g'):
- grade_values.append([int(x) for x in g.text.split(' ')])
+ for g in grade.findall("g"):
+ grade_values.append([int(x) for x in g.text.split(" ")])
- profile['grade_single'] = int(grade.attrib['sgid'])
- profile['grade_double'] = int(grade.attrib['dgid'])
- profile['grade_values'] = grade_values
+ profile["grade_single"] = int(grade.attrib["sgid"])
+ profile["grade_double"] = int(grade.attrib["dgid"])
+ profile["grade_values"] = grade_values
- deller_amount = game_profile.get('deller', 0)
- deller = request_info['root'][0].find('deller')
+ deller_amount = game_profile.get("deller", 0)
+ deller = request_info["root"][0].find("deller")
if deller is not None:
- deller_amount = int(deller.attrib['deller'])
- game_profile['deller'] = deller_amount
+ deller_amount = int(deller.attrib["deller"])
+ game_profile["deller"] = deller_amount
- language = request_info['root'][0].find('language_setting')
+ language = request_info["root"][0].find("language_setting")
if language is not None:
- language_value = int(language.attrib['language'])
- game_profile['language_setting'] = language_value
+ language_value = int(language.attrib["language"])
+ game_profile["language_setting"] = language_value
- game_profile['spnum'] = game_profile.get('spnum', 0) + (1 if clt == 0 else 0)
- game_profile['dpnum'] = game_profile.get('dpnum', 0) + (1 if clt == 1 else 0)
+ game_profile["spnum"] = game_profile.get("spnum", 0) + (1 if clt == 0 else 0)
+ game_profile["dpnum"] = game_profile.get("dpnum", 0) + (1 if clt == 1 else 0)
- if request_info['model'] == "TDJ":
- game_profile['lightning_play_data_spnum'] = game_profile.get('lightning_play_data_spnum', 0) + (1 if clt == 0 else 0)
- game_profile['lightning_play_data_dpnum'] = game_profile.get('lightning_play_data_dpnum', 0) + (1 if clt == 1 else 0)
+ if request_info["model"] == "TDJ":
+ game_profile["lightning_play_data_spnum"] = game_profile.get(
+ "lightning_play_data_spnum", 0
+ ) + (1 if clt == 0 else 0)
+ game_profile["lightning_play_data_dpnum"] = game_profile.get(
+ "lightning_play_data_dpnum", 0
+ ) + (1 if clt == 1 else 0)
- profile['version'][str(game_version)] = game_profile
+ profile["version"][str(game_version)] = game_profile
- get_db().table('iidx_profile').upsert(profile, where('card') == cid)
+ get_db().table("iidx_profile").upsert(profile, where("card") == cid)
- response = E.response(
- E.IIDX29pc(
- iidxid=xid,
- cltype=clt
- )
- )
+ response = E.response(E.IIDX29pc(iidxid=xid, cltype=clt))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/visit')
+@router.post("/{gameinfo}/IIDX29pc/visit")
async def iidx29pc_visit(request: Request):
request_info = await core_process_request(request)
@@ -733,235 +775,215 @@ async def iidx29pc_visit(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/reg')
+@router.post("/{gameinfo}/IIDX29pc/reg")
async def iidx29pc_reg(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- cid = request_info['root'][0].attrib['cid']
- name = request_info['root'][0].attrib['name']
- pid = request_info['root'][0].attrib['pid']
+ cid = request_info["root"][0].attrib["cid"]
+ name = request_info["root"][0].attrib["name"]
+ pid = request_info["root"][0].attrib["pid"]
- db = get_db().table('iidx_profile')
+ db = get_db().table("iidx_profile")
all_profiles_for_card = db.get(Query().card == cid)
if all_profiles_for_card is None:
- all_profiles_for_card = {
- 'card': cid,
- 'version': {}
- }
+ all_profiles_for_card = {"card": cid, "version": {}}
- if 'iidx_id' not in all_profiles_for_card:
+ if "iidx_id" not in all_profiles_for_card:
iidx_id = random.randint(10000000, 99999999)
- all_profiles_for_card['iidx_id'] = iidx_id
-
- all_profiles_for_card['version'][str(game_version)] = {
- 'game_version': game_version,
- 'djname': name,
- 'region': int(pid),
- 'head': 0,
- 'hair': 0,
- 'face': 0,
- 'hand': 0,
- 'body': 0,
- 'frame': 0,
- 'turntable': 0,
- 'explosion': 0,
- 'bgm': 0,
- 'folder_mask': 0,
- 'sudden': 0,
- 'judge_pos': 0,
- 'categoryvoice': 0,
- 'note': 0,
- 'fullcombo': 0,
- 'keybeam': 0,
- 'judgestring': 0,
- 'soundpreview': 0,
- 'grapharea': 0,
- 'effector_lock': 0,
- 'effector_type': 0,
- 'explosion_size': 0,
- 'alternate_hcn': 0,
- 'kokokara_start': 0,
- 'd_auto_adjust': 0,
- 'd_auto_scrach': 0,
- 'd_camera_layout': 0,
- 'd_disp_judge': 0,
- 'd_exscore': 0,
- 'd_gauge_disp': 0,
- 'd_ghost_score': 0,
- 'd_gno': 0,
- 'd_graph_score': 0,
- 'd_gtype': 0,
- 'd_hispeed': 0.000000,
- 'd_judge': 0,
- 'd_judgeAdj': 0,
- 'd_lane_brignt': 0,
- 'd_liflen': 0,
- 'd_notes': 0.000000,
- 'd_opstyle': 0,
- 'd_pace': 0,
- 'd_sdlen': 0,
- 'd_sdtype': 0,
- 'd_sorttype': 0,
- 'd_sub_gno': 0,
- 'd_timing': 0,
- 'd_tsujigiri_disp': 0,
- 'd_tune': 0,
- 'dach': 0,
- 'dp_opt': 0,
- 'dp_opt2': 0,
- 'dpnum': 0,
- 'gpos': 0,
- 'mode': 0,
- 'ngrade': 0,
- 'pmode': 0,
- 'rtype': 0,
- 's_auto_adjust': 0,
- 's_auto_scrach': 0,
- 's_camera_layout': 0,
- 's_disp_judge': 0,
- 's_exscore': 0,
- 's_gauge_disp': 0,
- 's_ghost_score': 0,
- 's_gno': 0,
- 's_graph_score': 0,
- 's_gtype': 0,
- 's_hispeed': 0.000000,
- 's_judge': 0,
- 's_judgeAdj': 0,
- 's_lane_brignt': 0,
- 's_liflen': 0,
- 's_notes': 0.000000,
- 's_opstyle': 0,
- 's_pace': 0,
- 's_sdlen': 0,
- 's_sdtype': 0,
- 's_sorttype': 0,
- 's_sub_gno': 0,
- 's_timing': 0,
- 's_tsujigiri_disp': 0,
- 's_tune': 0,
- 'sach': 0,
- 'sp_opt': 0,
- 'spnum': 0,
- 'deller': 0,
+ all_profiles_for_card["iidx_id"] = iidx_id
+ all_profiles_for_card["version"][str(game_version)] = {
+ "game_version": game_version,
+ "djname": name,
+ "region": int(pid),
+ "head": 0,
+ "hair": 0,
+ "face": 0,
+ "hand": 0,
+ "body": 0,
+ "frame": 0,
+ "turntable": 0,
+ "explosion": 0,
+ "bgm": 0,
+ "folder_mask": 0,
+ "sudden": 0,
+ "judge_pos": 0,
+ "categoryvoice": 0,
+ "note": 0,
+ "fullcombo": 0,
+ "keybeam": 0,
+ "judgestring": 0,
+ "soundpreview": 0,
+ "grapharea": 0,
+ "effector_lock": 0,
+ "effector_type": 0,
+ "explosion_size": 0,
+ "alternate_hcn": 0,
+ "kokokara_start": 0,
+ "d_auto_adjust": 0,
+ "d_auto_scrach": 0,
+ "d_camera_layout": 0,
+ "d_disp_judge": 0,
+ "d_exscore": 0,
+ "d_gauge_disp": 0,
+ "d_ghost_score": 0,
+ "d_gno": 0,
+ "d_graph_score": 0,
+ "d_gtype": 0,
+ "d_hispeed": 0.000000,
+ "d_judge": 0,
+ "d_judgeAdj": 0,
+ "d_lane_brignt": 0,
+ "d_liflen": 0,
+ "d_notes": 0.000000,
+ "d_opstyle": 0,
+ "d_pace": 0,
+ "d_sdlen": 0,
+ "d_sdtype": 0,
+ "d_sorttype": 0,
+ "d_sub_gno": 0,
+ "d_timing": 0,
+ "d_tsujigiri_disp": 0,
+ "d_tune": 0,
+ "dach": 0,
+ "dp_opt": 0,
+ "dp_opt2": 0,
+ "dpnum": 0,
+ "gpos": 0,
+ "mode": 0,
+ "ngrade": 0,
+ "pmode": 0,
+ "rtype": 0,
+ "s_auto_adjust": 0,
+ "s_auto_scrach": 0,
+ "s_camera_layout": 0,
+ "s_disp_judge": 0,
+ "s_exscore": 0,
+ "s_gauge_disp": 0,
+ "s_ghost_score": 0,
+ "s_gno": 0,
+ "s_graph_score": 0,
+ "s_gtype": 0,
+ "s_hispeed": 0.000000,
+ "s_judge": 0,
+ "s_judgeAdj": 0,
+ "s_lane_brignt": 0,
+ "s_liflen": 0,
+ "s_notes": 0.000000,
+ "s_opstyle": 0,
+ "s_pace": 0,
+ "s_sdlen": 0,
+ "s_sdtype": 0,
+ "s_sorttype": 0,
+ "s_sub_gno": 0,
+ "s_timing": 0,
+ "s_tsujigiri_disp": 0,
+ "s_tune": 0,
+ "sach": 0,
+ "sp_opt": 0,
+ "spnum": 0,
+ "deller": 0,
# Step up mode
- 'stepup_dp_level': 0,
- 'stepup_dp_mplay': 0,
- 'stepup_enemy_damage': 0,
- 'stepup_enemy_defeat_flg': 0,
- 'stepup_mission_clear_num': 0,
- 'stepup_progress': 0,
- 'stepup_sp_level': 0,
- 'stepup_sp_mplay': 0,
- 'stepup_tips_read_list': 0,
- 'stepup_total_point': 0,
- 'stepup_is_track_ticket': 0,
-
+ "stepup_dp_level": 0,
+ "stepup_dp_mplay": 0,
+ "stepup_enemy_damage": 0,
+ "stepup_enemy_defeat_flg": 0,
+ "stepup_mission_clear_num": 0,
+ "stepup_progress": 0,
+ "stepup_sp_level": 0,
+ "stepup_sp_mplay": 0,
+ "stepup_tips_read_list": 0,
+ "stepup_total_point": 0,
+ "stepup_is_track_ticket": 0,
# DJ Rank
- 'dj_rank_single_rank': [0] * 15,
- 'dj_rank_double_rank': [0] * 15,
- 'dj_rank_single_point': [0] * 15,
- 'dj_rank_double_point': [0] * 15,
-
+ "dj_rank_single_rank": [0] * 15,
+ "dj_rank_double_rank": [0] * 15,
+ "dj_rank_single_point": [0] * 15,
+ "dj_rank_double_point": [0] * 15,
# Notes Radar
- 'notes_radar_single': [0] * 6,
- 'notes_radar_double': [0] * 6,
-
+ "notes_radar_single": [0] * 6,
+ "notes_radar_double": [0] * 6,
# Grades
- 'grade_single': -1,
- 'grade_double': -1,
- 'grade_values': [],
-
+ "grade_single": -1,
+ "grade_double": -1,
+ "grade_values": [],
# Achievements
- 'achievements_trophy': [0] * 160,
- 'achievements_last_weekly': 0,
- 'achievements_pack_comp': 0,
- 'achievements_pack_flg': 0,
- 'achievements_pack_id': 0,
- 'achievements_play_pack': 0,
- 'achievements_visit_flg': 0,
- 'achievements_weekly_num': 0,
-
+ "achievements_trophy": [0] * 160,
+ "achievements_last_weekly": 0,
+ "achievements_pack_comp": 0,
+ "achievements_pack_flg": 0,
+ "achievements_pack_id": 0,
+ "achievements_play_pack": 0,
+ "achievements_visit_flg": 0,
+ "achievements_weekly_num": 0,
# Other
- 'language_setting': 0,
- 'movie_agreement': 0,
- 'lightning_play_data_spnum': 0,
- 'lightning_play_data_dpnum': 0,
-
+ "language_setting": 0,
+ "movie_agreement": 0,
+ "lightning_play_data_spnum": 0,
+ "lightning_play_data_dpnum": 0,
# Lightning model settings
- 'lightning_setting_slider': [0] * 7,
- 'lightning_setting_light': [1] * 10,
- 'lightning_setting_concentration': 0,
- 'lightning_setting_headphone_vol': 0,
- 'lightning_setting_resistance_sp_left': 0,
- 'lightning_setting_resistance_sp_right': 0,
- 'lightning_setting_resistance_dp_left': 0,
- 'lightning_setting_resistance_dp_right': 0,
- 'lightning_setting_skin_0': 0,
- 'lightning_setting_flg_skin_0': 0,
-
+ "lightning_setting_slider": [0] * 7,
+ "lightning_setting_light": [1] * 10,
+ "lightning_setting_concentration": 0,
+ "lightning_setting_headphone_vol": 0,
+ "lightning_setting_resistance_sp_left": 0,
+ "lightning_setting_resistance_sp_right": 0,
+ "lightning_setting_resistance_dp_left": 0,
+ "lightning_setting_resistance_dp_right": 0,
+ "lightning_setting_skin_0": 0,
+ "lightning_setting_flg_skin_0": 0,
# Event_1 settings
- 'event_1_story_prog': 0,
- 'event_1_last_select_area': 0,
- 'event_1_failed_num': 0,
- 'event_1_event_play_num': 0,
- 'event_1_last_select_area_id': 0,
- 'event_1_last_select_platform_type': 0,
- 'event_1_last_select_platform_id': 0,
-
+ "event_1_story_prog": 0,
+ "event_1_last_select_area": 0,
+ "event_1_failed_num": 0,
+ "event_1_event_play_num": 0,
+ "event_1_last_select_area_id": 0,
+ "event_1_last_select_platform_type": 0,
+ "event_1_last_select_platform_id": 0,
# Web UI/Other options
- '_show_category_grade': 0,
- '_show_category_status': 1,
- '_show_category_difficulty': 1,
- '_show_category_alphabet': 1,
- '_show_category_rival_play': 0,
- '_show_category_rival_winlose': 1,
- '_show_category_all_rival_play': 0,
- '_show_category_arena_winlose': 1,
- '_show_rival_shop_info': 1,
- '_hide_play_count': 0,
- '_show_score_graph_cutin': 1,
- '_hide_iidx_id': 0,
- '_classic_hispeed': 0,
- '_beginner_option_swap': 1,
- '_show_lamps_as_no_play_in_arena': 0,
-
- 'skin_customize_flag_frame': 0,
- 'skin_customize_flag_bgm': 0,
- 'skin_customize_flag_lane': 0,
-
+ "_show_category_grade": 0,
+ "_show_category_status": 1,
+ "_show_category_difficulty": 1,
+ "_show_category_alphabet": 1,
+ "_show_category_rival_play": 0,
+ "_show_category_rival_winlose": 1,
+ "_show_category_all_rival_play": 0,
+ "_show_category_arena_winlose": 1,
+ "_show_rival_shop_info": 1,
+ "_hide_play_count": 0,
+ "_show_score_graph_cutin": 1,
+ "_hide_iidx_id": 0,
+ "_classic_hispeed": 0,
+ "_beginner_option_swap": 1,
+ "_show_lamps_as_no_play_in_arena": 0,
+ "skin_customize_flag_frame": 0,
+ "skin_customize_flag_bgm": 0,
+ "skin_customize_flag_lane": 0,
# Rivals
- 'sp_rival_1_iidx_id': 0,
- 'sp_rival_2_iidx_id': 0,
- 'sp_rival_3_iidx_id': 0,
- 'sp_rival_4_iidx_id': 0,
- 'sp_rival_5_iidx_id': 0,
-
- 'dp_rival_1_iidx_id': 0,
- 'dp_rival_2_iidx_id': 0,
- 'dp_rival_3_iidx_id': 0,
- 'dp_rival_4_iidx_id': 0,
- 'dp_rival_5_iidx_id': 0
+ "sp_rival_1_iidx_id": 0,
+ "sp_rival_2_iidx_id": 0,
+ "sp_rival_3_iidx_id": 0,
+ "sp_rival_4_iidx_id": 0,
+ "sp_rival_5_iidx_id": 0,
+ "dp_rival_1_iidx_id": 0,
+ "dp_rival_2_iidx_id": 0,
+ "dp_rival_3_iidx_id": 0,
+ "dp_rival_4_iidx_id": 0,
+ "dp_rival_5_iidx_id": 0,
}
- db.upsert(all_profiles_for_card, where('card') == cid)
+ db.upsert(all_profiles_for_card, where("card") == cid)
card, card_split = get_id_from_profile(cid)
- response = E.response(
- E.IIDX29pc(
- id=card,
- id_str=card_split
- )
- )
+ response = E.response(E.IIDX29pc(id=card, id_str=card_split))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/getLaneGachaTicket')
+@router.post("/{gameinfo}/IIDX29pc/getLaneGachaTicket")
async def iidx29pc_getlanegachaticket(request: Request):
request_info = await core_process_request(request)
@@ -993,7 +1015,7 @@ async def iidx29pc_getlanegachaticket(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/drawLaneGacha')
+@router.post("/{gameinfo}/IIDX29pc/drawLaneGacha")
async def iidx29pc_drawlanegacha(request: Request):
request_info = await core_process_request(request)
@@ -1004,34 +1026,30 @@ async def iidx29pc_drawlanegacha(request: Request):
arrange_id=0,
expire_date=0,
),
- E.session(
- session_id=0
- ),
- status=0
+ E.session(session_id=0),
+ status=0,
)
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/eaappliresult')
+
+@router.post("/{gameinfo}/IIDX29pc/eaappliresult")
async def iidx29pc_eaappliresult(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX29pc()
- )
+ response = E.response(E.IIDX29pc())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29pc/logout')
+
+@router.post("/{gameinfo}/IIDX29pc/logout")
async def iidx29pc_logout(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX29pc()
- )
+ response = E.response(E.IIDX29pc())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx29ranking.py b/modules/iidx/iidx29ranking.py
index e0b622c..8f3f9a3 100644
--- a/modules/iidx/iidx29ranking.py
+++ b/modules/iidx/iidx29ranking.py
@@ -8,13 +8,11 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
-@router.post('/{gameinfo}/IIDX29ranking/getranker')
+@router.post("/{gameinfo}/IIDX29ranking/getranker")
async def iidx29ranking_getranker(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX29ranking()
- )
+ response = E.response(E.IIDX29ranking())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx29shop.py b/modules/iidx/iidx29shop.py
index 74b2ae0..4d8c0a7 100644
--- a/modules/iidx/iidx29shop.py
+++ b/modules/iidx/iidx29shop.py
@@ -8,7 +8,7 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
-@router.post('/{gameinfo}/IIDX29shop/getname')
+@router.post("/{gameinfo}/IIDX29shop/getname")
async def iidx29shop_getname(request: Request):
request_info = await core_process_request(request)
@@ -24,7 +24,7 @@ async def iidx29shop_getname(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29shop/getconvention')
+@router.post("/{gameinfo}/IIDX29shop/getconvention")
async def iidx29shop_getconvention(request: Request):
request_info = await core_process_request(request)
@@ -44,26 +44,21 @@ async def iidx29shop_getconvention(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29shop/sentinfo')
+@router.post("/{gameinfo}/IIDX29shop/sentinfo")
async def iidx29shop_sentinfo(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX29shop()
- )
+ response = E.response(E.IIDX29shop())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX29shop/sendescapepackageinfo')
+
+@router.post("/{gameinfo}/IIDX29shop/sendescapepackageinfo")
async def iidx29shop_sendescapepackageinfo(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX29shop(
- expire=1200
- )
- )
+ response = E.response(E.IIDX29shop(expire=1200))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx30gamesystem.py b/modules/iidx/iidx30gamesystem.py
index 94896ef..1284c27 100644
--- a/modules/iidx/iidx30gamesystem.py
+++ b/modules/iidx/iidx30gamesystem.py
@@ -8,11 +8,11 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
-@router.post('/{gameinfo}/IIDX30gameSystem/systemInfo')
+@router.post("/{gameinfo}/IIDX30gameSystem/systemInfo")
async def iidx30gamesystem_systeminfo(request: Request):
request_info = await core_process_request(request)
- unlock = () #(28008, 28065, 28073, 28088, 28089, 29027, 29094, 29095)
+ unlock = () # (28008, 28065, 28073, 28088, 28089, 29027, 29094, 29095)
sp_dp = (0, 1)
response = E.response(
@@ -30,46 +30,64 @@ async def iidx30gamesystem_systeminfo(request: Request):
E.isEiseiOpenFlg(val=1),
E.WorldTourismOpenList(val=1),
E.BPLBattleOpenPhase(val=2),
- *[E.music_open(
- E.music_id(s, __type="s32"),
- E.kind(0, __type="s32"),
- ) for s in unlock],
- *[E.arena_reward(
- E.index(unlock.index(s), __type="s32"),
- E.cube_num((unlock.index(s) + 1) * 50, __type="s32"),
- E.kind(0, __type="s32"),
- E.value(s, __type="str"),
- ) for s in unlock],
- *[E.arena_music_difficult(
- E.play_style(s, __type="s32"),
- E.arena_class(-1, __type="s32"),
- E.low_difficult(1, __type="s32"),
- E.high_difficult(12, __type="s32"),
- E.is_leggendaria(1, __type="bool"),
- E.force_music_list_id(0, __type="s32"),
- ) for s in sp_dp],
- *[E.arena_cpu_define(
- E.play_style(s, __type="s32"),
- E.arena_class(-1, __type="s32"),
- E.grade_id(18, __type="s32"),
- E.low_music_difficult(8, __type="s32"),
- E.high_music_difficult(12, __type="s32"),
- E.is_leggendaria(0, __type="bool"),
- ) for s in sp_dp],
- *[E.maching_class_range(
- E.play_style(s[0], __type="s32"),
- E.matching_class(s[1], __type="s32"),
- E.low_arena_class(0, __type="s32"),
- E.high_arena_class(19, __type="s32"),
- ) for s in ((0, 2), (0, 1), (1, 2), (1, 1))],
- *[E.arena_force_music(
- E.play_style(s, __type="s32"),
- E.force_music_list_id(0, __type="s32"),
- E.index(0, __type="s32"),
- E.music_id(1000, __type="s32"),
- E.note_grade(0, __type="s32"),
- E.is_active(s, __type="bool"),
- ) for s in sp_dp],
+ *[
+ E.music_open(
+ E.music_id(s, __type="s32"),
+ E.kind(0, __type="s32"),
+ )
+ for s in unlock
+ ],
+ *[
+ E.arena_reward(
+ E.index(unlock.index(s), __type="s32"),
+ E.cube_num((unlock.index(s) + 1) * 50, __type="s32"),
+ E.kind(0, __type="s32"),
+ E.value(s, __type="str"),
+ )
+ for s in unlock
+ ],
+ *[
+ E.arena_music_difficult(
+ E.play_style(s, __type="s32"),
+ E.arena_class(-1, __type="s32"),
+ E.low_difficult(1, __type="s32"),
+ E.high_difficult(12, __type="s32"),
+ E.is_leggendaria(1, __type="bool"),
+ E.force_music_list_id(0, __type="s32"),
+ )
+ for s in sp_dp
+ ],
+ *[
+ E.arena_cpu_define(
+ E.play_style(s, __type="s32"),
+ E.arena_class(-1, __type="s32"),
+ E.grade_id(18, __type="s32"),
+ E.low_music_difficult(8, __type="s32"),
+ E.high_music_difficult(12, __type="s32"),
+ E.is_leggendaria(0, __type="bool"),
+ )
+ for s in sp_dp
+ ],
+ *[
+ E.maching_class_range(
+ E.play_style(s[0], __type="s32"),
+ E.matching_class(s[1], __type="s32"),
+ E.low_arena_class(0, __type="s32"),
+ E.high_arena_class(19, __type="s32"),
+ )
+ for s in ((0, 2), (0, 1), (1, 2), (1, 1))
+ ],
+ *[
+ E.arena_force_music(
+ E.play_style(s, __type="s32"),
+ E.force_music_list_id(0, __type="s32"),
+ E.index(0, __type="s32"),
+ E.music_id(1000, __type="s32"),
+ E.note_grade(0, __type="s32"),
+ E.is_active(s, __type="bool"),
+ )
+ for s in sp_dp
+ ],
)
)
diff --git a/modules/iidx/iidx30grade.py b/modules/iidx/iidx30grade.py
index 4ce76bb..19682e7 100644
--- a/modules/iidx/iidx30grade.py
+++ b/modules/iidx/iidx30grade.py
@@ -10,113 +10,101 @@ from core_database import get_db
router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
-def get_profile(iidx_id):
- return get_db().table('iidx_profile').get(
- where('iidx_id') == iidx_id
- )
-@router.post('/{gameinfo}/IIDX30grade/raised')
+def get_profile(iidx_id):
+ return get_db().table("iidx_profile").get(where("iidx_id") == iidx_id)
+
+
+@router.post("/{gameinfo}/IIDX30grade/raised")
async def iidx30grade_raised(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
timestamp = time.time()
- iidx_id = int(request_info['root'][0].attrib['iidxid'])
- achi = int(request_info['root'][0].attrib['achi'])
- cstage = int(request_info['root'][0].attrib['cstage'])
- gid = int(request_info['root'][0].attrib['gid'])
- gtype = int(request_info['root'][0].attrib['gtype'])
- is_ex = int(request_info['root'][0].attrib['is_ex'])
- is_mirror = int(request_info['root'][0].attrib['is_mirror'])
+ iidx_id = int(request_info["root"][0].attrib["iidxid"])
+ achi = int(request_info["root"][0].attrib["achi"])
+ cstage = int(request_info["root"][0].attrib["cstage"])
+ gid = int(request_info["root"][0].attrib["gid"])
+ gtype = int(request_info["root"][0].attrib["gtype"])
+ is_ex = int(request_info["root"][0].attrib["is_ex"])
+ is_mirror = int(request_info["root"][0].attrib["is_mirror"])
db = get_db()
- db.table('iidx_class').insert(
+ db.table("iidx_class").insert(
{
- 'timestamp': timestamp,
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'achi': achi,
- 'cstage': cstage,
- 'gid': gid,
- 'gtype': gtype,
- 'is_ex': is_ex,
- 'is_mirror': is_mirror,
+ "timestamp": timestamp,
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "achi": achi,
+ "cstage": cstage,
+ "gid": gid,
+ "gtype": gtype,
+ "is_ex": is_ex,
+ "is_mirror": is_mirror,
},
)
profile = get_profile(iidx_id)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
- best_class = db.table('iidx_class_best').get(
- (where('iidx_id') == iidx_id)
- & (where('game_version') == game_version)
- & (where('gid') == gid)
- & (where('gtype') == gtype)
+ best_class = db.table("iidx_class_best").get(
+ (where("iidx_id") == iidx_id)
+ & (where("game_version") == game_version)
+ & (where("gid") == gid)
+ & (where("gtype") == gtype)
)
best_class = {} if best_class is None else best_class
-
+
best_class_data = {
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'achi': max(achi, best_class.get('achi', achi)),
- 'cstage': max(cstage, best_class.get('cstage', cstage)),
- 'gid': gid,
- 'gtype': gtype,
- 'is_ex': is_ex,
- 'is_mirror': is_mirror,
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "achi": max(achi, best_class.get("achi", achi)),
+ "cstage": max(cstage, best_class.get("cstage", cstage)),
+ "gid": gid,
+ "gtype": gtype,
+ "is_ex": is_ex,
+ "is_mirror": is_mirror,
}
- db.table('iidx_class_best').upsert(
+ db.table("iidx_class_best").upsert(
best_class_data,
- (where('iidx_id') == iidx_id)
- & (where('game_version') == game_version)
- & (where('gid') == gid)
- & (where('gtype') == gtype)
+ (where("iidx_id") == iidx_id)
+ & (where("game_version") == game_version)
+ & (where("gid") == gid)
+ & (where("gtype") == gtype),
)
- best_class_plays = db.table('iidx_class_best').search(
- (where('game_version') == game_version)
- & (where('iidx_id') == iidx_id)
+ best_class_plays = db.table("iidx_class_best").search(
+ (where("game_version") == game_version) & (where("iidx_id") == iidx_id)
)
grades = []
for record in best_class_plays:
- grades.append([
- record['gtype'],
- record['gid'],
- record['cstage'],
- record['achi']
- ])
-
- game_profile['grade_values'] = grades
-
- grade_sp = db.table('iidx_class_best').search(
- (where('iidx_id') == iidx_id)
- & (where('gtype') == 0)
- & (where('cstage') == 4)
- )
-
- game_profile['grade_single'] = max([x['gid'] for x in grade_sp], default=-1)
-
- grade_dp = db.table('iidx_class_best').search(
- (where('iidx_id') == iidx_id)
- & (where('gtype') == 1)
- & (where('cstage') == 4)
- )
-
- game_profile['grade_double'] = max([x['gid'] for x in grade_dp], default=-1)
-
- profile['version'][str(game_version)] = game_profile
-
- db.table('iidx_profile').upsert(profile, where('game_version') == game_version)
-
- response = E.response(
- E.IIDX30grade(
- pnum=1
+ grades.append(
+ [record["gtype"], record["gid"], record["cstage"], record["achi"]]
)
+
+ game_profile["grade_values"] = grades
+
+ grade_sp = db.table("iidx_class_best").search(
+ (where("iidx_id") == iidx_id) & (where("gtype") == 0) & (where("cstage") == 4)
)
+ game_profile["grade_single"] = max([x["gid"] for x in grade_sp], default=-1)
+
+ grade_dp = db.table("iidx_class_best").search(
+ (where("iidx_id") == iidx_id) & (where("gtype") == 1) & (where("cstage") == 4)
+ )
+
+ game_profile["grade_double"] = max([x["gid"] for x in grade_dp], default=-1)
+
+ profile["version"][str(game_version)] = game_profile
+
+ db.table("iidx_profile").upsert(profile, where("game_version") == game_version)
+
+ response = E.response(E.IIDX30grade(pnum=1))
+
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx30lobby.py b/modules/iidx/iidx30lobby.py
index 9cbf609..618fbb0 100644
--- a/modules/iidx/iidx30lobby.py
+++ b/modules/iidx/iidx30lobby.py
@@ -8,68 +8,61 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
-@router.post('/{gameinfo}/IIDX30lobby/entry')
+@router.post("/{gameinfo}/IIDX30lobby/entry")
async def iidx30lobby_entry(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30lobby()
- )
+ response = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30lobby/update')
+
+@router.post("/{gameinfo}/IIDX30lobby/update")
async def iidx30lobby_update(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30lobby()
- )
+ response = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30lobby/delete')
+
+@router.post("/{gameinfo}/IIDX30lobby/delete")
async def iidx30lobby_delete(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30lobby()
- )
+ response = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30lobby/bplbattle_entry')
+
+@router.post("/{gameinfo}/IIDX30lobby/bplbattle_entry")
async def iidx30lobby_bplbattle_entry(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30lobby()
- )
+ response = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30lobby/bplbattle_update')
+
+@router.post("/{gameinfo}/IIDX30lobby/bplbattle_update")
async def iidx30lobby_bplbattle_update(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30lobby()
- )
+ response = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30lobby/bplbattle_delete')
+
+@router.post("/{gameinfo}/IIDX30lobby/bplbattle_delete")
async def iidx30lobby_bplbattle_delete(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30lobby()
- )
+ response = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx30music.py b/modules/iidx/iidx30music.py
index a0c035e..62e1a31 100644
--- a/modules/iidx/iidx30music.py
+++ b/modules/iidx/iidx30music.py
@@ -9,8 +9,8 @@ from core_database import get_db
import config
-router = APIRouter(prefix='/local2', tags=['local2'])
-router.model_whitelist = ['LDJ']
+router = APIRouter(prefix="/local2", tags=["local2"])
+router.model_whitelist = ["LDJ"]
class ClearFlags(IntEnum):
@@ -24,23 +24,23 @@ class ClearFlags(IntEnum):
FULL_COMBO = 7
-@router.post('/{gameinfo}/IIDX30music/getrank')
+@router.post("/{gameinfo}/IIDX30music/getrank")
async def iidx30music_getrank(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- root = request_info['root'][0]
+ root = request_info["root"][0]
- play_style = int(root.attrib['cltype'])
+ play_style = int(root.attrib["cltype"])
requested_ids = [
- int(root.get('iidxid', 0)),
- int(root.get('iidxid0', 0)),
- int(root.get('iidxid1', 0)),
- int(root.get('iidxid2', 0)),
- int(root.get('iidxid3', 0)),
- int(root.get('iidxid4', 0)),
- int(root.get('iidxid5', 0)),
+ int(root.get("iidxid", 0)),
+ int(root.get("iidxid0", 0)),
+ int(root.get("iidxid1", 0)),
+ int(root.get("iidxid2", 0)),
+ int(root.get("iidxid3", 0)),
+ int(root.get("iidxid4", 0)),
+ int(root.get("iidxid5", 0)),
]
all_scores = {}
@@ -50,323 +50,348 @@ async def iidx30music_getrank(request: Request):
if iidxid == 0:
continue
- profile = db.table('iidx_profile').get(where('iidx_id') == iidxid)['version'][str(game_version)]
+ profile = db.table("iidx_profile").get(where("iidx_id") == iidxid)["version"][
+ str(game_version)
+ ]
- for record in db.table('iidx_scores_best').search(
- (where('music_id') < (game_version + 1) * 1000)
- & (where('play_style') == play_style)
- & (where('iidx_id') == iidxid)
+ for record in db.table("iidx_scores_best").search(
+ (where("music_id") < (game_version + 1) * 1000)
+ & (where("play_style") == play_style)
+ & (where("iidx_id") == iidxid)
):
- music_id = record['music_id']
- clear_flg = record['clear_flg']
- ex_score = record['ex_score']
- miss_count = record['miss_count']
- chart_id = record['chart_id']
+ music_id = record["music_id"]
+ clear_flg = record["clear_flg"]
+ ex_score = record["ex_score"]
+ miss_count = record["miss_count"]
+ chart_id = record["chart_id"]
if (rival_idx, music_id) not in all_scores:
all_scores[rival_idx, music_id] = {
- 0: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
- 1: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
- 2: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
- 3: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
- 4: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
+ 0: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
+ 1: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
+ 2: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
+ 3: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
+ 4: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
}
- all_scores[rival_idx, music_id][chart_id]['clear_flg'] = clear_flg
- all_scores[rival_idx, music_id][chart_id]['ex_score'] = ex_score
- all_scores[rival_idx, music_id][chart_id]['miss_count'] = miss_count
+ all_scores[rival_idx, music_id][chart_id]["clear_flg"] = clear_flg
+ all_scores[rival_idx, music_id][chart_id]["ex_score"] = ex_score
+ all_scores[rival_idx, music_id][chart_id]["miss_count"] = miss_count
top_scores = {}
- for record in db.table('iidx_scores_best').search(
- (where('music_id') < (game_version + 1) * 1000)
- & (where('play_style') == play_style)
+ for record in db.table("iidx_scores_best").search(
+ (where("music_id") < (game_version + 1) * 1000)
+ & (where("play_style") == play_style)
):
- music_id = record['music_id']
- ex_score = record['ex_score']
- chart_id = record['chart_id']
- iidx_id = record['iidx_id']
+ music_id = record["music_id"]
+ ex_score = record["ex_score"]
+ chart_id = record["chart_id"]
+ iidx_id = record["iidx_id"]
if music_id not in top_scores:
top_scores[music_id] = {
- 0: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
- 1: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
- 2: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
- 3: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
- 4: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
+ 0: {"djname": "", "clear_flg": -1, "ex_score": -1},
+ 1: {"djname": "", "clear_flg": -1, "ex_score": -1},
+ 2: {"djname": "", "clear_flg": -1, "ex_score": -1},
+ 3: {"djname": "", "clear_flg": -1, "ex_score": -1},
+ 4: {"djname": "", "clear_flg": -1, "ex_score": -1},
}
- if ex_score > top_scores[music_id][chart_id]['ex_score']:
- top_name = db.table('iidx_profile').get(where('iidx_id') == iidx_id)['version'][str(game_version)]['djname']
- top_scores[music_id][chart_id]['djname'] = top_name
- top_scores[music_id][chart_id]['clear_flg'] = 1
- top_scores[music_id][chart_id]['ex_score'] = ex_score
+ if ex_score > top_scores[music_id][chart_id]["ex_score"]:
+ top_name = db.table("iidx_profile").get(where("iidx_id") == iidx_id)[
+ "version"
+ ][str(game_version)]["djname"]
+ top_scores[music_id][chart_id]["djname"] = top_name
+ top_scores[music_id][chart_id]["clear_flg"] = 1
+ top_scores[music_id][chart_id]["ex_score"] = ex_score
response = E.response(
E.IIDX30music(
E.style(type=play_style),
- *[E.m([
- i,
- k,
- *[all_scores[i, k][d]['clear_flg'] for d in range(5)],
- *[all_scores[i, k][d]['ex_score'] for d in range(5)],
- *[all_scores[i, k][d]['miss_count'] for d in range(5)],
- ], __type='s16') for i, k in all_scores],
- *[E.top(
- E.detail([
- k,
- *[top_scores[k][d]['clear_flg'] for d in range(5)],
- *[top_scores[k][d]['ex_score'] for d in range(5)],
- ], __type='s16'),
- name0=top_scores[k][0]['djname'],
- name1=top_scores[k][1]['djname'],
- name2=top_scores[k][2]['djname'],
- name3=top_scores[k][3]['djname'],
- name4=top_scores[k][4]['djname']
- ) for k in top_scores]
+ *[
+ E.m(
+ [
+ i,
+ k,
+ *[all_scores[i, k][d]["clear_flg"] for d in range(5)],
+ *[all_scores[i, k][d]["ex_score"] for d in range(5)],
+ *[all_scores[i, k][d]["miss_count"] for d in range(5)],
+ ],
+ __type="s16",
+ )
+ for i, k in all_scores
+ ],
+ *[
+ E.top(
+ E.detail(
+ [
+ k,
+ *[top_scores[k][d]["clear_flg"] for d in range(5)],
+ *[top_scores[k][d]["ex_score"] for d in range(5)],
+ ],
+ __type="s16",
+ ),
+ name0=top_scores[k][0]["djname"],
+ name1=top_scores[k][1]["djname"],
+ name2=top_scores[k][2]["djname"],
+ name3=top_scores[k][3]["djname"],
+ name4=top_scores[k][4]["djname"],
+ )
+ for k in top_scores
+ ]
)
)
- assert (response is not None)
+ assert response is not None
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30music/crate')
+@router.post("/{gameinfo}/IIDX30music/crate")
async def iidx30music_crate(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
db = get_db()
- all_score_stats = db.table('iidx_score_stats').search(
- (where('music_id') < (game_version + 1) * 1000)
+ all_score_stats = db.table("iidx_score_stats").search(
+ (where("music_id") < (game_version + 1) * 1000)
)
crate = {}
fcrate = {}
for stat in all_score_stats:
- if stat['music_id'] not in crate:
- crate[stat['music_id']] = [1001] * 10
- if stat['music_id'] not in fcrate:
- fcrate[stat['music_id']] = [1001] * 10
+ if stat["music_id"] not in crate:
+ crate[stat["music_id"]] = [1001] * 10
+ if stat["music_id"] not in fcrate:
+ fcrate[stat["music_id"]] = [1001] * 10
- if stat['play_style'] == 1:
+ if stat["play_style"] == 1:
dp_idx = 5
else:
dp_idx = 0
- crate[stat['music_id']][stat['chart_id'] + dp_idx] = int(stat['clear_rate'])
- fcrate[stat['music_id']][stat['chart_id'] + dp_idx] = int(stat['fc_rate'])
+ crate[stat["music_id"]][stat["chart_id"] + dp_idx] = int(stat["clear_rate"])
+ fcrate[stat["music_id"]][stat["chart_id"] + dp_idx] = int(stat["fc_rate"])
response = E.response(
- E.IIDX30music(
- *[E.c(crate[k] + fcrate[k], mid=k, __type="s32") for k in crate]
- )
+ E.IIDX30music(*[E.c(crate[k] + fcrate[k], mid=k, __type="s32") for k in crate])
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30music/reg')
+@router.post("/{gameinfo}/IIDX30music/reg")
async def iidx30music_reg(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
timestamp = time.time()
- log = request_info['root'][0].find('music_play_log')
+ log = request_info["root"][0].find("music_play_log")
- clear_flg = int(request_info['root'][0].attrib['cflg'])
- clid = int(request_info['root'][0].attrib['clid'])
- is_death = int(request_info['root'][0].attrib['is_death'])
- pid = int(request_info['root'][0].attrib['pid'])
+ clear_flg = int(request_info["root"][0].attrib["cflg"])
+ clid = int(request_info["root"][0].attrib["clid"])
+ is_death = int(request_info["root"][0].attrib["is_death"])
+ pid = int(request_info["root"][0].attrib["pid"])
- play_style = int(log.attrib['play_style'])
- ex_score = int(log.attrib['ex_score'])
- folder_type = int(log.attrib['folder_type'])
- gauge_type = int(log.attrib['gauge_type'])
- graph_type = int(log.attrib['graph_type'])
- great_num = int(log.attrib['great_num'])
- iidx_id = int(log.attrib['iidx_id'])
- miss_num = int(log.attrib['miss_num'])
- mode_type = int(log.attrib['mode_type'])
- music_id = int(log.attrib['music_id'])
- note_id = int(log.attrib['note_id'])
- option1 = int(log.attrib['option1'])
- option2 = int(log.attrib['option2'])
- pgreat_num = int(log.attrib['pgreat_num'])
+ play_style = int(log.attrib["play_style"])
+ ex_score = int(log.attrib["ex_score"])
+ folder_type = int(log.attrib["folder_type"])
+ gauge_type = int(log.attrib["gauge_type"])
+ graph_type = int(log.attrib["graph_type"])
+ great_num = int(log.attrib["great_num"])
+ iidx_id = int(log.attrib["iidx_id"])
+ miss_num = int(log.attrib["miss_num"])
+ mode_type = int(log.attrib["mode_type"])
+ music_id = int(log.attrib["music_id"])
+ note_id = int(log.attrib["note_id"])
+ option1 = int(log.attrib["option1"])
+ option2 = int(log.attrib["option2"])
+ pgreat_num = int(log.attrib["pgreat_num"])
ghost = log.find("ghost").text
ghost_gauge = log.find("ghost_gauge").text
db = get_db()
- db.table('iidx_scores').insert(
+ db.table("iidx_scores").insert(
{
- 'timestamp': timestamp,
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'pid': pid,
- 'clear_flg': clear_flg,
- 'is_death': is_death,
- 'music_id': music_id,
- 'play_style': play_style,
- 'chart_id': note_id,
- 'pgreat_num': pgreat_num,
- 'great_num': great_num,
- 'ex_score': ex_score,
- 'miss_count': miss_num,
- 'folder_type': folder_type,
- 'gauge_type': gauge_type,
- 'graph_type': graph_type,
- 'mode_type': mode_type,
- 'option1': option1,
- 'option2': option2,
- 'ghost': ghost,
- 'ghost_gauge': ghost_gauge,
+ "timestamp": timestamp,
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "pid": pid,
+ "clear_flg": clear_flg,
+ "is_death": is_death,
+ "music_id": music_id,
+ "play_style": play_style,
+ "chart_id": note_id,
+ "pgreat_num": pgreat_num,
+ "great_num": great_num,
+ "ex_score": ex_score,
+ "miss_count": miss_num,
+ "folder_type": folder_type,
+ "gauge_type": gauge_type,
+ "graph_type": graph_type,
+ "mode_type": mode_type,
+ "option1": option1,
+ "option2": option2,
+ "ghost": ghost,
+ "ghost_gauge": ghost_gauge,
},
)
- best_score = db.table('iidx_scores_best').get(
- (where('iidx_id') == iidx_id)
- & (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ best_score = db.table("iidx_scores_best").get(
+ (where("iidx_id") == iidx_id)
+ & (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id)
)
best_score = {} if best_score is None else best_score
if clear_flg < ClearFlags.EASY_CLEAR:
miss_num = -1
- best_miss_count = best_score.get('miss_count', miss_num)
+ best_miss_count = best_score.get("miss_count", miss_num)
if best_miss_count == -1:
miss_count = max(miss_num, best_miss_count)
elif clear_flg > ClearFlags.ASSIST_CLEAR:
miss_count = min(miss_num, best_miss_count)
else:
miss_count = best_miss_count
- best_ex_score = best_score.get('ex_score', ex_score)
+ best_ex_score = best_score.get("ex_score", ex_score)
best_score_data = {
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'pid': pid,
- 'play_style': play_style,
- 'music_id': music_id,
- 'chart_id': note_id,
- 'miss_count': miss_count,
- 'ex_score': max(ex_score, best_ex_score),
- 'ghost': ghost if ex_score >= best_ex_score else best_score.get('ghost', ghost),
- 'ghost_gauge': ghost_gauge if ex_score >= best_ex_score else best_score.get('ghost_gauge', ghost_gauge),
- 'clear_flg': max(clear_flg, best_score.get('clear_flg', clear_flg)),
- 'gauge_type': gauge_type if ex_score >= best_ex_score else best_score.get('gauge_type', gauge_type),
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "pid": pid,
+ "play_style": play_style,
+ "music_id": music_id,
+ "chart_id": note_id,
+ "miss_count": miss_count,
+ "ex_score": max(ex_score, best_ex_score),
+ "ghost": ghost if ex_score >= best_ex_score else best_score.get("ghost", ghost),
+ "ghost_gauge": ghost_gauge
+ if ex_score >= best_ex_score
+ else best_score.get("ghost_gauge", ghost_gauge),
+ "clear_flg": max(clear_flg, best_score.get("clear_flg", clear_flg)),
+ "gauge_type": gauge_type
+ if ex_score >= best_ex_score
+ else best_score.get("gauge_type", gauge_type),
}
- db.table('iidx_scores_best').upsert(
+ db.table("iidx_scores_best").upsert(
best_score_data,
- (where('iidx_id') == iidx_id)
- & (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ (where("iidx_id") == iidx_id)
+ & (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id),
)
- score_stats = db.table('iidx_score_stats').get(
- (where('music_id') == music_id)
- & (where('play_style') == play_style)
- & (where('chart_id') == note_id)
+ score_stats = db.table("iidx_score_stats").get(
+ (where("music_id") == music_id)
+ & (where("play_style") == play_style)
+ & (where("chart_id") == note_id)
)
score_stats = {} if score_stats is None else score_stats
- score_stats['game_version'] = game_version
- score_stats['play_style'] = play_style
- score_stats['music_id'] = music_id
- score_stats['chart_id'] = note_id
- score_stats['play_count'] = score_stats.get('play_count', 0) + 1
- score_stats['fc_count'] = score_stats.get('fc_count', 0) + (1 if clear_flg == ClearFlags.FULL_COMBO else 0)
- score_stats['clear_count'] = score_stats.get('clear_count', 0) + (1 if clear_flg >= ClearFlags.EASY_CLEAR else 0)
- score_stats['fc_rate'] = int((score_stats['fc_count'] / score_stats['play_count']) * 1000)
- score_stats['clear_rate'] = int((score_stats['clear_count'] / score_stats['play_count']) * 1000)
+ score_stats["game_version"] = game_version
+ score_stats["play_style"] = play_style
+ score_stats["music_id"] = music_id
+ score_stats["chart_id"] = note_id
+ score_stats["play_count"] = score_stats.get("play_count", 0) + 1
+ score_stats["fc_count"] = score_stats.get("fc_count", 0) + (
+ 1 if clear_flg == ClearFlags.FULL_COMBO else 0
+ )
+ score_stats["clear_count"] = score_stats.get("clear_count", 0) + (
+ 1 if clear_flg >= ClearFlags.EASY_CLEAR else 0
+ )
+ score_stats["fc_rate"] = int(
+ (score_stats["fc_count"] / score_stats["play_count"]) * 1000
+ )
+ score_stats["clear_rate"] = int(
+ (score_stats["clear_count"] / score_stats["play_count"]) * 1000
+ )
- db.table('iidx_score_stats').upsert(
+ db.table("iidx_score_stats").upsert(
score_stats,
- (where('music_id') == music_id)
- & (where('play_style') == play_style)
- & (where('chart_id') == note_id)
+ (where("music_id") == music_id)
+ & (where("play_style") == play_style)
+ & (where("chart_id") == note_id),
)
ranklist_data = []
- ranklist_scores = db.table('iidx_scores_best').search(
- (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ ranklist_scores = db.table("iidx_scores_best").search(
+ (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id)
)
ranklist_scores = [] if ranklist_scores is None else ranklist_scores
ranklist_scores_ranked = []
for score in ranklist_scores:
- profile = db.table('iidx_profile').get(where('iidx_id') == score['iidx_id'])
+ profile = db.table("iidx_profile").get(where("iidx_id") == score["iidx_id"])
- if profile is None or str(game_version) not in profile['version']:
+ if profile is None or str(game_version) not in profile["version"]:
continue
- game_profile = profile['version'][str(game_version)]
+ game_profile = profile["version"][str(game_version)]
- ranklist_scores_ranked.append({
- 'opname': config.arcade,
- 'name': game_profile['djname'],
- 'pid': game_profile['region'],
- 'body': game_profile['body'],
- 'face': game_profile['face'],
- 'hair': game_profile['hair'],
- 'hand': game_profile['hand'],
- 'head': game_profile['head'],
- 'dgrade': game_profile['grade_double'],
- 'sgrade': game_profile['grade_single'],
- 'score': score['ex_score'],
- 'iidx_id': score['iidx_id'],
- 'clflg': score['clear_flg'],
- 'myFlg': score['iidx_id'] == iidx_id
- })
+ ranklist_scores_ranked.append(
+ {
+ "opname": config.arcade,
+ "name": game_profile["djname"],
+ "pid": game_profile["region"],
+ "body": game_profile["body"],
+ "face": game_profile["face"],
+ "hair": game_profile["hair"],
+ "hand": game_profile["hand"],
+ "head": game_profile["head"],
+ "dgrade": game_profile["grade_double"],
+ "sgrade": game_profile["grade_single"],
+ "score": score["ex_score"],
+ "iidx_id": score["iidx_id"],
+ "clflg": score["clear_flg"],
+ "myFlg": score["iidx_id"] == iidx_id,
+ }
+ )
- ranklist_scores_ranked = sorted(ranklist_scores_ranked, key=lambda x: (x['clflg'], x['score']), reverse=True)
+ ranklist_scores_ranked = sorted(
+ ranklist_scores_ranked, key=lambda x: (x["clflg"], x["score"]), reverse=True
+ )
myRank = 0
for rnum, score in enumerate(ranklist_scores_ranked):
r = E.data(
rnum=rnum + 1,
- opname=score['opname'],
- name=score['name'],
- pid=score['pid'],
- body=score['body'],
- face=score['face'],
- hair=score['hair'],
- hand=score['hand'],
- head=score['head'],
- dgrade=score['dgrade'],
- sgrade=score['sgrade'],
- score=score['score'],
- iidx_id=score['iidx_id'],
- clflg=score['clflg'],
- myFlg=score['myFlg'],
+ opname=score["opname"],
+ name=score["name"],
+ pid=score["pid"],
+ body=score["body"],
+ face=score["face"],
+ hair=score["hair"],
+ hand=score["hand"],
+ head=score["head"],
+ dgrade=score["dgrade"],
+ sgrade=score["sgrade"],
+ score=score["score"],
+ iidx_id=score["iidx_id"],
+ clflg=score["clflg"],
+ myFlg=score["myFlg"],
achieve=0,
)
ranklist_data.append(r)
- if score['myFlg']:
+ if score["myFlg"]:
myRank = rnum + 1
response = E.response(
E.IIDX30music(
- E.ranklist(
- *ranklist_data,
- total_user_num=len(ranklist_data)
- ),
- E.shopdata(
- rank=myRank
- ),
+ E.ranklist(*ranklist_data, total_user_num=len(ranklist_data)),
+ E.shopdata(rank=myRank),
clid=clid,
- crate=score_stats['clear_rate'],
- frate=score_stats['fc_rate'],
+ crate=score_stats["clear_rate"],
+ frate=score_stats["fc_rate"],
mid=music_id,
)
)
@@ -375,78 +400,77 @@ async def iidx30music_reg(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30music/appoint')
+@router.post("/{gameinfo}/IIDX30music/appoint")
async def iidx30music_appoint(request: Request):
request_info = await core_process_request(request)
- root = request_info['root'][0]
+ root = request_info["root"][0]
- iidxid = int(root.attrib['iidxid'])
- music_id = int(root.attrib['mid'])
- chart_id = int(root.attrib['clid'])
- ctype = int(root.attrib['ctype'])
- subtype = root.attrib['subtype']
-
+ iidxid = int(root.attrib["iidxid"])
+ music_id = int(root.attrib["mid"])
+ chart_id = int(root.attrib["clid"])
+ ctype = int(root.attrib["ctype"])
+ subtype = root.attrib["subtype"]
db = get_db()
- record = db.table('iidx_scores_best').get(
- (where('iidx_id') == iidxid)
- & (where('music_id') == music_id)
- & (where('chart_id') == chart_id)
+ record = db.table("iidx_scores_best").get(
+ (where("iidx_id") == iidxid)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == chart_id)
)
vals = []
if record is not None:
- vals.append(E.mydata(
- record['ghost'],
- score=record['ex_score'],
- __type="bin",
- __size=len(record['ghost']) // 2,
- ))
+ vals.append(
+ E.mydata(
+ record["ghost"],
+ score=record["ex_score"],
+ __type="bin",
+ __size=len(record["ghost"]) // 2,
+ )
+ )
if ctype == 1:
- sdata = db.table('iidx_scores_best').get(
- (where('iidx_id') == int(subtype))
- & (where('music_id') == music_id)
- & (where('chart_id') == chart_id)
+ sdata = db.table("iidx_scores_best").get(
+ (where("iidx_id") == int(subtype))
+ & (where("music_id") == music_id)
+ & (where("chart_id") == chart_id)
)
elif ctype in (2, 4, 10):
sdata = {
- 'game_version': 29,
- 'ghost': "",
- 'ex_score': 0,
- 'iidx_id': 0,
- 'name': "",
- 'pid': 13
+ "game_version": 29,
+ "ghost": "",
+ "ex_score": 0,
+ "iidx_id": 0,
+ "name": "",
+ "pid": 13,
}
- for record in db.table('iidx_scores_best').search(
- (where('music_id') == music_id)
- & (where('chart_id') == chart_id)
+ for record in db.table("iidx_scores_best").search(
+ (where("music_id") == music_id) & (where("chart_id") == chart_id)
):
- if record['ex_score'] > sdata['ex_score']:
- sdata['game_version'] = record['game_version']
- sdata['ghost'] = record['ghost']
- sdata['ex_score'] = record['ex_score']
- sdata['iidx_id'] = record['iidx_id']
- sdata['pid'] = record['pid']
+ if record["ex_score"] > sdata["ex_score"]:
+ sdata["game_version"] = record["game_version"]
+ sdata["ghost"] = record["ghost"]
+ sdata["ex_score"] = record["ex_score"]
+ sdata["iidx_id"] = record["iidx_id"]
+ sdata["pid"] = record["pid"]
- if ctype in (1, 2, 4, 10) and sdata['ex_score'] != 0:
- vals.append(E.sdata(
- sdata['ghost'],
- score=sdata['ex_score'],
- name=db.table('iidx_profile').get(where('iidx_id') == sdata['iidx_id'])['version'][str(sdata['game_version'])]['djname'],
- pid=sdata['pid'],
- __type="bin",
- __size=len(sdata['ghost']) // 2,
- ))
-
-
- response = E.response(
- E.IIDX30music(
- *vals
+ if ctype in (1, 2, 4, 10) and sdata["ex_score"] != 0:
+ vals.append(
+ E.sdata(
+ sdata["ghost"],
+ score=sdata["ex_score"],
+ name=db.table("iidx_profile").get(where("iidx_id") == sdata["iidx_id"])[
+ "version"
+ ][str(sdata["game_version"])]["djname"],
+ pid=sdata["pid"],
+ __type="bin",
+ __size=len(sdata["ghost"]) // 2,
+ )
)
- )
+
+ response = E.response(E.IIDX30music(*vals))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx30pc.py b/modules/iidx/iidx30pc.py
index 31659d2..e4c0f4d 100644
--- a/modules/iidx/iidx30pc.py
+++ b/modules/iidx/iidx30pc.py
@@ -13,60 +13,56 @@ router.model_whitelist = ["LDJ"]
def get_profile(cid):
- return get_db().table('iidx_profile').get(
- where('card') == cid
- )
+ return get_db().table("iidx_profile").get(where("card") == cid)
def get_profile_by_id(iidx_id):
- return get_db().table('iidx_profile').get(
- where('iidx_id') == iidx_id
- )
+ return get_db().table("iidx_profile").get(where("iidx_id") == iidx_id)
def get_game_profile(cid, game_version):
profile = get_profile(cid)
- return profile['version'].get(str(game_version), None)
+ return profile["version"].get(str(game_version), None)
def get_game_profile_by_id(iidx_id, game_version):
profile = get_profile_by_id(iidx_id)
- return profile['version'].get(str(game_version), None)
+ return profile["version"].get(str(game_version), None)
def get_id_from_profile(cid):
- profile = get_db().table('iidx_profile').get(
- where('card') == cid
- )
+ profile = get_db().table("iidx_profile").get(where("card") == cid)
- djid = "%08d" % profile['iidx_id']
- djid_split = '-'.join([djid[:4], djid[4:]])
+ djid = "%08d" % profile["iidx_id"]
+ djid_split = "-".join([djid[:4], djid[4:]])
- return profile['iidx_id'], djid_split
+ return profile["iidx_id"], djid_split
def calculate_folder_mask(profile):
- return profile.get('_show_category_grade', 0) << 0 \
- | (profile.get('_show_category_status', 0) << 1) \
- | (profile.get('_show_category_difficulty', 0) << 2) \
- | (profile.get('_show_category_alphabet', 0) << 3) \
- | (profile.get('_show_category_rival_play', 0) << 4) \
- | (profile.get('_show_category_rival_winlose', 0) << 6) \
- | (profile.get('_show_rival_shop_info', 0) << 7) \
- | (profile.get('_hide_play_count', 0) << 8) \
- | (profile.get('_show_score_graph_cutin', 0) << 9) \
- | (profile.get('_classic_hispeed', 0) << 10) \
- | (profile.get('_hide_iidx_id', 0) << 12)
+ return (
+ profile.get("_show_category_grade", 0) << 0
+ | (profile.get("_show_category_status", 0) << 1)
+ | (profile.get("_show_category_difficulty", 0) << 2)
+ | (profile.get("_show_category_alphabet", 0) << 3)
+ | (profile.get("_show_category_rival_play", 0) << 4)
+ | (profile.get("_show_category_rival_winlose", 0) << 6)
+ | (profile.get("_show_rival_shop_info", 0) << 7)
+ | (profile.get("_hide_play_count", 0) << 8)
+ | (profile.get("_show_score_graph_cutin", 0) << 9)
+ | (profile.get("_classic_hispeed", 0) << 10)
+ | (profile.get("_hide_iidx_id", 0) << 12)
+ )
-@router.post('/{gameinfo}/IIDX30pc/get')
+@router.post("/{gameinfo}/IIDX30pc/get")
async def iidx30pc_get(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- cid = request_info['root'][0].attrib['cid']
+ cid = request_info["root"][0].attrib["cid"]
profile = get_game_profile(cid, game_version)
djid, djid_split = get_id_from_profile(cid)
@@ -89,103 +85,111 @@ async def iidx30pc_get(request: Request):
if r == 0:
continue
rivals[idx] = {}
- rivals[idx]['spdp'] = 1 if idx < 6 else 2
+ rivals[idx]["spdp"] = 1 if idx < 6 else 2
rival_profile = get_game_profile_by_id(r, game_version)
rdjid = "%08d" % r
- rdjid_split = '-'.join([rdjid[:4], rdjid[4:]])
-
- rivals[idx]['djid'] = rdjid
- rivals[idx]['djid_split'] = rdjid_split
- rivals[idx]['djname'] = rival_profile['djname']
- rivals[idx]['region'] = rival_profile['region']
- rivals[idx]['sa'] = rival_profile['sach']
- rivals[idx]['sg'] = rival_profile['grade_single']
- rivals[idx]['da'] = rival_profile['dach']
- rivals[idx]['dg'] = rival_profile['grade_double']
- rivals[idx]['body'] = rival_profile['body']
- rivals[idx]['face'] = rival_profile['face']
- rivals[idx]['hair'] = rival_profile['hair']
- rivals[idx]['hand'] = rival_profile['hand']
- rivals[idx]['head'] = rival_profile['head']
+ rdjid_split = "-".join([rdjid[:4], rdjid[4:]])
+ rivals[idx]["djid"] = rdjid
+ rivals[idx]["djid_split"] = rdjid_split
+ rivals[idx]["djname"] = rival_profile["djname"]
+ rivals[idx]["region"] = rival_profile["region"]
+ rivals[idx]["sa"] = rival_profile["sach"]
+ rivals[idx]["sg"] = rival_profile["grade_single"]
+ rivals[idx]["da"] = rival_profile["dach"]
+ rivals[idx]["dg"] = rival_profile["grade_double"]
+ rivals[idx]["body"] = rival_profile["body"]
+ rivals[idx]["face"] = rival_profile["face"]
+ rivals[idx]["hair"] = rival_profile["hair"]
+ rivals[idx]["hand"] = rival_profile["hand"]
+ rivals[idx]["head"] = rival_profile["head"]
response = E.response(
E.IIDX30pc(
E.pcdata(
- d_auto_adjust=profile['d_auto_adjust'],
- d_auto_scrach=profile['d_auto_scrach'],
- d_camera_layout=profile['d_camera_layout'],
- d_disp_judge=profile['d_disp_judge'],
- d_exscore=profile['d_exscore'],
- d_gauge_disp=profile['d_gauge_disp'],
- d_ghost_score=profile['d_ghost_score'],
- d_gno=profile['d_gno'],
- d_graph_score=profile['d_graph_score'],
- d_gtype=profile['d_gtype'],
- d_hispeed=profile['d_hispeed'],
- d_judge=profile['d_judge'],
- d_judgeAdj=profile['d_judgeAdj'],
- d_lane_brignt=profile['d_lane_brignt'],
- d_liflen=profile['d_liflen'],
- d_notes=profile['d_notes'],
- d_opstyle=profile['d_opstyle'],
- d_pace=profile['d_pace'],
- d_sdlen=profile['d_sdlen'],
- d_sdtype=profile['d_sdtype'],
- d_sorttype=profile['d_sorttype'],
- d_sub_gno=profile['d_sub_gno'],
- d_timing=profile['d_timing'],
- d_timing_split=profile['d_timing_split'],
- d_tsujigiri_disp=profile['d_tsujigiri_disp'],
- d_tune=profile['d_tune'],
- d_visualization=profile['d_visualization'],
- dach=profile['dach'],
- dp_opt=profile['dp_opt'],
- dp_opt2=profile['dp_opt2'],
+ d_auto_adjust=profile["d_auto_adjust"],
+ d_auto_scrach=profile["d_auto_scrach"],
+ d_camera_layout=profile["d_camera_layout"],
+ d_disp_judge=profile["d_disp_judge"],
+ d_exscore=profile["d_exscore"],
+ d_gauge_disp=profile["d_gauge_disp"],
+ d_ghost_score=profile["d_ghost_score"],
+ d_gno=profile["d_gno"],
+ d_graph_score=profile["d_graph_score"],
+ d_gtype=profile["d_gtype"],
+ d_hispeed=profile["d_hispeed"],
+ d_judge=profile["d_judge"],
+ d_judgeAdj=profile["d_judgeAdj"],
+ d_lane_brignt=profile["d_lane_brignt"],
+ d_liflen=profile["d_liflen"],
+ d_notes=profile["d_notes"],
+ d_opstyle=profile["d_opstyle"],
+ d_pace=profile["d_pace"],
+ d_sdlen=profile["d_sdlen"],
+ d_sdtype=profile["d_sdtype"],
+ d_sorttype=profile["d_sorttype"],
+ d_sub_gno=profile["d_sub_gno"],
+ d_timing=profile["d_timing"],
+ d_timing_split=profile["d_timing_split"],
+ d_tsujigiri_disp=profile["d_tsujigiri_disp"],
+ d_tune=profile["d_tune"],
+ d_visualization=profile["d_visualization"],
+ dach=profile["dach"],
+ dp_opt=profile["dp_opt"],
+ dp_opt2=profile["dp_opt2"],
dpnum=profile["dpnum"],
- gpos=profile['gpos'],
+ gpos=profile["gpos"],
id=djid,
idstr=djid_split,
- mode=profile['mode'],
- name=profile['djname'],
- ngrade=profile['ngrade'],
- pid=profile['region'],
- pmode=profile['pmode'],
- rtype=profile['rtype'],
- s_auto_adjust=profile['s_auto_adjust'],
- s_auto_scrach=profile['s_auto_scrach'],
- s_camera_layout=profile['s_camera_layout'],
- s_disp_judge=profile['s_disp_judge'],
- s_exscore=profile['s_exscore'],
- s_gauge_disp=profile['s_gauge_disp'],
- s_ghost_score=profile['s_ghost_score'],
- s_gno=profile['s_gno'],
- s_graph_score=profile['s_graph_score'],
- s_gtype=profile['s_gtype'],
- s_hispeed=profile['s_hispeed'],
- s_judge=profile['s_judge'],
- s_judgeAdj=profile['s_judgeAdj'],
- s_lane_brignt=profile['s_lane_brignt'],
- s_liflen=profile['s_liflen'],
- s_notes=profile['s_notes'],
- s_opstyle=profile['s_opstyle'],
- s_pace=profile['s_pace'],
- s_sdlen=profile['s_sdlen'],
- s_sdtype=profile['s_sdtype'],
- s_sorttype=profile['s_sorttype'],
- s_sub_gno=profile['s_sub_gno'],
- s_timing=profile['s_timing'],
- s_timing_split=profile['s_timing_split'],
- s_tsujigiri_disp=profile['s_tsujigiri_disp'],
- s_tune=profile['s_tune'],
- s_visualization=profile['s_visualization'],
- sach=profile['sach'],
- sp_opt=profile['sp_opt'],
- spnum=profile['spnum'],
+ mode=profile["mode"],
+ name=profile["djname"],
+ ngrade=profile["ngrade"],
+ pid=profile["region"],
+ pmode=profile["pmode"],
+ rtype=profile["rtype"],
+ s_auto_adjust=profile["s_auto_adjust"],
+ s_auto_scrach=profile["s_auto_scrach"],
+ s_camera_layout=profile["s_camera_layout"],
+ s_disp_judge=profile["s_disp_judge"],
+ s_exscore=profile["s_exscore"],
+ s_gauge_disp=profile["s_gauge_disp"],
+ s_ghost_score=profile["s_ghost_score"],
+ s_gno=profile["s_gno"],
+ s_graph_score=profile["s_graph_score"],
+ s_gtype=profile["s_gtype"],
+ s_hispeed=profile["s_hispeed"],
+ s_judge=profile["s_judge"],
+ s_judgeAdj=profile["s_judgeAdj"],
+ s_lane_brignt=profile["s_lane_brignt"],
+ s_liflen=profile["s_liflen"],
+ s_notes=profile["s_notes"],
+ s_opstyle=profile["s_opstyle"],
+ s_pace=profile["s_pace"],
+ s_sdlen=profile["s_sdlen"],
+ s_sdtype=profile["s_sdtype"],
+ s_sorttype=profile["s_sorttype"],
+ s_sub_gno=profile["s_sub_gno"],
+ s_timing=profile["s_timing"],
+ s_timing_split=profile["s_timing_split"],
+ s_tsujigiri_disp=profile["s_tsujigiri_disp"],
+ s_tune=profile["s_tune"],
+ s_visualization=profile["s_visualization"],
+ sach=profile["sach"],
+ sp_opt=profile["sp_opt"],
+ spnum=profile["spnum"],
+ ),
+ E.qprodata(
+ [
+ profile["head"],
+ profile["hair"],
+ profile["face"],
+ profile["hand"],
+ profile["body"],
+ ],
+ __type="u32",
+ __size=5 * 4,
),
- E.qprodata([profile["head"], profile["hair"], profile["face"], profile["hand"], profile["body"]],
- __type="u32", __size=5 * 4),
E.skin(
[
profile["frame"],
@@ -209,60 +213,80 @@ async def iidx30pc_get(request: Request):
profile["alternate_hcn"],
profile["kokokara_start"],
],
- __type="s16"),
+ __type="s16",
+ ),
E.rlist(
- *[E.rival(
- E.is_robo(0, __type="bool"),
- E.shop(name=config.arcade),
- E.qprodata(
- body=rivals[r]['body'],
- face=rivals[r]['face'],
- hair=rivals[r]['hair'],
- hand=rivals[r]['hand'],
- head=rivals[r]['head'],
- ),
- da=rivals[r]['da'],
- dg=rivals[r]['dg'],
- djname=rivals[r]['djname'],
- id=rivals[r]['djid'],
- id_str=rivals[r]['djid_split'],
- pid=rivals[r]['region'],
- sa=rivals[r]['sa'],
- sg=rivals[r]['sg'],
- spdp=rivals[r]['spdp'],
- )for r in rivals],
+ *[
+ E.rival(
+ E.is_robo(0, __type="bool"),
+ E.shop(name=config.arcade),
+ E.qprodata(
+ body=rivals[r]["body"],
+ face=rivals[r]["face"],
+ hair=rivals[r]["hair"],
+ hand=rivals[r]["hand"],
+ head=rivals[r]["head"],
+ ),
+ da=rivals[r]["da"],
+ dg=rivals[r]["dg"],
+ djname=rivals[r]["djname"],
+ id=rivals[r]["djid"],
+ id_str=rivals[r]["djid_split"],
+ pid=rivals[r]["region"],
+ sa=rivals[r]["sa"],
+ sg=rivals[r]["sg"],
+ spdp=rivals[r]["spdp"],
+ )
+ for r in rivals
+ ],
),
E.ir_data(),
E.secret_course_data(),
- E.deller(deller=profile['deller'], rate=0),
+ E.deller(deller=profile["deller"], rate=0),
E.secret(
- E.flg1(profile.get('secret_flg1', [-1, -1, -1]), __type="s64"),
- E.flg2(profile.get('secret_flg2', [-1, -1, -1]), __type="s64"),
- E.flg3(profile.get('secret_flg3', [-1, -1, -1]), __type="s64"),
- E.flg4(profile.get('secret_flg4', [-1, -1, -1]), __type="s64"),
+ E.flg1(profile.get("secret_flg1", [-1, -1, -1]), __type="s64"),
+ E.flg2(profile.get("secret_flg2", [-1, -1, -1]), __type="s64"),
+ E.flg3(profile.get("secret_flg3", [-1, -1, -1]), __type="s64"),
+ E.flg4(profile.get("secret_flg4", [-1, -1, -1]), __type="s64"),
),
E.join_shop(join_cflg=1, join_id=10, join_name=config.arcade, joinflg=1),
- E.leggendaria(E.flg1(profile.get('leggendaria_flg1', [-1, -1, -1]), __type="s64")),
+ E.leggendaria(
+ E.flg1(profile.get("leggendaria_flg1", [-1, -1, -1]), __type="s64")
+ ),
E.grade(
- *[E.g(x, __type="u8") for x in profile['grade_values']],
- dgid=profile['grade_double'],
- sgid=profile['grade_single'],
+ *[E.g(x, __type="u8") for x in profile["grade_values"]],
+ dgid=profile["grade_double"],
+ sgid=profile["grade_single"],
),
E.world_tourism_secret_flg(
- E.flg1(profile.get('wt_flg1', [-1, -1, -1]), __type="s64"),
- E.flg2(profile.get('wt_flg2', [-1, -1, -1]), __type="s64"),
+ E.flg1(profile.get("wt_flg1", [-1, -1, -1]), __type="s64"),
+ E.flg2(profile.get("wt_flg2", [-1, -1, -1]), __type="s64"),
),
E.lightning_setting(
- E.slider(profile.get('lightning_setting_slider', [0] * 7), __type="s32"),
- E.light(profile.get('lightning_setting_light', [1] * 10), __type="bool"),
- E.concentration(profile.get('lightning_setting_concentration', 0), __type="bool"),
- headphone_vol=profile.get('lightning_setting_headphone_vol', 0),
- resistance_sp_left=profile.get('lightning_setting_resistance_sp_left', 0),
- resistance_sp_right=profile.get('lightning_setting_resistance_sp_right', 0),
- resistance_dp_left=profile.get('lightning_setting_resistance_dp_left', 0),
- resistance_dp_right=profile.get('lightning_setting_resistance_dp_right', 0),
- skin_0=profile.get('lightning_setting_skin_0', 0),
- flg_skin_0=profile.get('lightning_setting_flg_skin_0', 0),
+ E.slider(
+ profile.get("lightning_setting_slider", [0] * 7), __type="s32"
+ ),
+ E.light(
+ profile.get("lightning_setting_light", [1] * 10), __type="bool"
+ ),
+ E.concentration(
+ profile.get("lightning_setting_concentration", 0), __type="bool"
+ ),
+ headphone_vol=profile.get("lightning_setting_headphone_vol", 0),
+ resistance_sp_left=profile.get(
+ "lightning_setting_resistance_sp_left", 0
+ ),
+ resistance_sp_right=profile.get(
+ "lightning_setting_resistance_sp_right", 0
+ ),
+ resistance_dp_left=profile.get(
+ "lightning_setting_resistance_dp_left", 0
+ ),
+ resistance_dp_right=profile.get(
+ "lightning_setting_resistance_dp_right", 0
+ ),
+ skin_0=profile.get("lightning_setting_skin_0", 0),
+ flg_skin_0=profile.get("lightning_setting_flg_skin_0", 0),
),
E.arena_data(
E.achieve_data(
@@ -297,11 +321,13 @@ async def iidx30pc_get(request: Request):
E.ea_premium_course(),
E.enable_qr_reward(),
E.nostalgia_open(),
- E.language_setting(language=profile['language_setting']),
- E.movie_agreement(agreement_version=profile['movie_agreement']),
+ E.language_setting(language=profile["language_setting"]),
+ E.movie_agreement(agreement_version=profile["movie_agreement"]),
E.bpl_virtual(),
- E.lightning_play_data(spnum=profile['lightning_play_data_spnum'],
- dpnum=profile['lightning_play_data_dpnum']),
+ E.lightning_play_data(
+ spnum=profile["lightning_play_data_spnum"],
+ dpnum=profile["lightning_play_data_dpnum"],
+ ),
E.weekly(
mid=-1,
wid=1,
@@ -342,75 +368,69 @@ async def iidx30pc_get(request: Request):
E.valkyrie_linkage_data(progress=-1),
E.valkyrie_linkage_2_data(progress=-1),
E.achievements(
- E.trophy(
- profile.get('achievements_trophy', [])[:10],
- __type="s64"
- ),
- pack=profile.get('achievements_pack_id', 0),
- pack_comp=profile.get('achievements_pack_comp', 0),
- last_weekly=profile.get('achievements_last_weekly', 0),
- weekly_num=profile.get('achievements_weekly_num', 0),
- visit_flg=profile.get('achievements_visit_flg', 0),
+ E.trophy(profile.get("achievements_trophy", [])[:10], __type="s64"),
+ pack=profile.get("achievements_pack_id", 0),
+ pack_comp=profile.get("achievements_pack_comp", 0),
+ last_weekly=profile.get("achievements_last_weekly", 0),
+ weekly_num=profile.get("achievements_weekly_num", 0),
+ visit_flg=profile.get("achievements_visit_flg", 0),
rival_crush=0,
),
E.notes_radar(
E.radar_score(
- profile['notes_radar_single'],
+ profile["notes_radar_single"],
__type="s32",
),
style=0,
),
E.notes_radar(
E.radar_score(
- profile['notes_radar_double'],
+ profile["notes_radar_double"],
__type="s32",
),
style=1,
),
E.dj_rank(
E.rank(
- profile['dj_rank_single_rank'],
+ profile["dj_rank_single_rank"],
__type="s32",
),
E.point(
- profile['dj_rank_single_point'],
+ profile["dj_rank_single_point"],
__type="s32",
),
style=0,
),
E.dj_rank(
E.rank(
- profile['dj_rank_double_rank'],
+ profile["dj_rank_double_rank"],
__type="s32",
),
E.point(
- profile['dj_rank_double_point'],
+ profile["dj_rank_double_point"],
__type="s32",
),
style=1,
),
E.step(
E.is_track_ticket(
- profile['stepup_is_track_ticket'],
+ profile["stepup_is_track_ticket"],
__type="bool",
),
- dp_fluctuation=profile['stepup_dp_fluctuation'],
- dp_level=profile['stepup_dp_level'],
- dp_mplay=profile['stepup_dp_mplay'],
- enemy_damage=profile['stepup_enemy_damage'],
- enemy_defeat_flg=profile['stepup_enemy_defeat_flg'],
- mission_clear_num=profile['stepup_mission_clear_num'],
- progress=profile['stepup_progress'],
- sp_fluctuation=profile['stepup_sp_fluctuation'],
- sp_level=profile['stepup_sp_level'],
- sp_mplay=profile['stepup_sp_mplay'],
- tips_read_list=profile['stepup_tips_read_list'],
- total_point=profile['stepup_total_point'],
- ),
- E.tsujigiri(
- total_num_sp=287,
- total_num_dp=286
+ dp_fluctuation=profile["stepup_dp_fluctuation"],
+ dp_level=profile["stepup_dp_level"],
+ dp_mplay=profile["stepup_dp_mplay"],
+ enemy_damage=profile["stepup_enemy_damage"],
+ enemy_defeat_flg=profile["stepup_enemy_defeat_flg"],
+ mission_clear_num=profile["stepup_mission_clear_num"],
+ progress=profile["stepup_progress"],
+ sp_fluctuation=profile["stepup_sp_fluctuation"],
+ sp_level=profile["stepup_sp_level"],
+ sp_mplay=profile["stepup_sp_mplay"],
+ tips_read_list=profile["stepup_tips_read_list"],
+ total_point=profile["stepup_total_point"],
),
+ E.tsujigiri(total_num_sp=287, total_num_dp=286),
E.tsujigiri_hidden_chara(
E.appearance_info(
appearance_id=1,
@@ -419,11 +439,9 @@ async def iidx30pc_get(request: Request):
music_2=-1,
chara_0=-1,
chara_1=-1,
- chara_2=-1
- ),
- E.defeat(
- defeat_flg=0
+ chara_2=-1,
),
+ E.defeat(defeat_flg=0),
E.total_defeat(
E.chara(
id=0,
@@ -432,9 +450,9 @@ async def iidx30pc_get(request: Request):
),
),
E.skin_customize_flg(
- skin_frame_flg=profile['skin_customize_flag_frame'],
- skin_bgm_flg=profile['skin_customize_flag_bgm'],
- skin_lane_flg3=profile['skin_customize_flag_lane'],
+ skin_frame_flg=profile["skin_customize_flag_frame"],
+ skin_bgm_flg=profile["skin_customize_flag_bgm"],
+ skin_lane_flg3=profile["skin_customize_flag_lane"],
),
E.badge(
E.badge_data(
@@ -448,8 +466,8 @@ async def iidx30pc_get(request: Request):
badge_flg_id=0,
index=0,
slot=0,
- )
- )
+ ),
+ ),
)
)
@@ -457,7 +475,7 @@ async def iidx30pc_get(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/common')
+@router.post("/{gameinfo}/IIDX30pc/common")
async def iidx30pc_common(request: Request):
request_info = await core_process_request(request)
@@ -465,33 +483,35 @@ async def iidx30pc_common(request: Request):
E.IIDX30pc(
E.monthly_mranking(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- __type="u16"),
+ __type="u16",
+ ),
E.total_mranking(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- __type="u16"),
+ __type="u16",
+ ),
# E.internet_ranking(),
# E.secret_ex_course(),
E.kac_mid([-1, -1, -1, -1, -1], __type="s32"),
E.kac_clid([2, 2, 2, 2, 2], __type="s32"),
E.ir(beat=3),
- E.cm(compo='cm_ultimate', folder='cm_ultimate', id=0),
+ E.cm(compo="cm_ultimate", folder="cm_ultimate", id=0),
E.tdj_cm(
- E.cm(filename='cm_bn_001', id=0),
- E.cm(filename='cm_bn_002', id=1),
- E.cm(filename='event_bn_001', id=2),
- E.cm(filename='event_bn_004', id=3),
- E.cm(filename='event_bn_006', id=4),
- E.cm(filename='fipb_001', id=5),
- E.cm(filename='year_bn_004', id=6),
- E.cm(filename='year_bn_005', id=7),
- E.cm(filename='year_bn_006_2', id=8),
- E.cm(filename='year_bn_007', id=9),
+ E.cm(filename="cm_bn_001", id=0),
+ E.cm(filename="cm_bn_002", id=1),
+ E.cm(filename="event_bn_001", id=2),
+ E.cm(filename="event_bn_004", id=3),
+ E.cm(filename="event_bn_006", id=4),
+ E.cm(filename="fipb_001", id=5),
+ E.cm(filename="year_bn_004", id=6),
+ E.cm(filename="year_bn_005", id=7),
+ E.cm(filename="year_bn_006_2", id=8),
+ E.cm(filename="year_bn_007", id=9),
),
# E.playvideo_disable_music(E.music(musicid=-1)),
# E.music_movie_suspend(E.music(music_id=-1, kind=0, name='')),
# E.bpl_virtual(),
E.movie_agreement(version=1),
- E.license('None', __type="str"),
+ E.license("None", __type="str"),
E.file_recovery(url=str(config.ip)),
E.movie_upload(url=str(config.ip)),
# E.button_release_frame(frame=''),
@@ -523,7 +543,7 @@ async def iidx30pc_common(request: Request):
E.lane_gacha(),
# E.fps_fix(),
# E.save_unsync_log(),
- expire=600
+ expire=600,
)
)
@@ -531,233 +551,246 @@ async def iidx30pc_common(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/save')
+@router.post("/{gameinfo}/IIDX30pc/save")
async def iidx30pc_save(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- xid = int(request_info['root'][0].attrib['iidxid'])
- cid = request_info['root'][0].attrib['cid']
- clt = int(request_info['root'][0].attrib['cltype'])
+ xid = int(request_info["root"][0].attrib["iidxid"])
+ cid = request_info["root"][0].attrib["cid"]
+ clt = int(request_info["root"][0].attrib["cltype"])
profile = get_profile(cid)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
for k in [
- 'd_auto_adjust',
- 'd_auto_scrach',
- 'd_camera_layout',
- 'd_disp_judge',
- 'd_gauge_disp',
- 'd_ghost_score',
- 'd_gno',
- 'd_graph_score',
- 'd_gtype',
- 'd_hispeed',
- 'd_judge',
- 'd_judgeAdj',
- 'd_lane_brignt',
- 'd_notes',
- 'd_opstyle',
- 'd_pace',
- 'd_sdlen',
- 'd_sdtype',
- 'd_sorttype',
- 'd_sub_gno',
- 'd_timing',
- 'd_timing_split',
- 'd_tsujigiri_disp',
- 'd_visualization',
- 'dp_opt',
- 'dp_opt2',
- 'gpos',
- 'mode',
- 'ngrade',
- 'pmode',
- 'rtype',
- 's_auto_adjust',
- 's_auto_scrach',
- 's_camera_layout',
- 's_disp_judge',
- 's_gauge_disp',
- 's_ghost_score',
- 's_gno',
- 's_graph_score',
- 's_gtype',
- 's_hispeed',
- 's_judge',
- 's_judgeAdj',
- 's_lane_brignt',
- 's_notes',
- 's_opstyle',
- 's_pace',
- 's_sdlen',
- 's_sdtype',
- 's_sorttype',
- 's_sub_gno',
- 's_timing',
- 's_timing_split',
- 's_tsujigiri_disp',
- 's_visualization',
- 'sp_opt',
+ "d_auto_adjust",
+ "d_auto_scrach",
+ "d_camera_layout",
+ "d_disp_judge",
+ "d_gauge_disp",
+ "d_ghost_score",
+ "d_gno",
+ "d_graph_score",
+ "d_gtype",
+ "d_hispeed",
+ "d_judge",
+ "d_judgeAdj",
+ "d_lane_brignt",
+ "d_notes",
+ "d_opstyle",
+ "d_pace",
+ "d_sdlen",
+ "d_sdtype",
+ "d_sorttype",
+ "d_sub_gno",
+ "d_timing",
+ "d_timing_split",
+ "d_tsujigiri_disp",
+ "d_visualization",
+ "dp_opt",
+ "dp_opt2",
+ "gpos",
+ "mode",
+ "ngrade",
+ "pmode",
+ "rtype",
+ "s_auto_adjust",
+ "s_auto_scrach",
+ "s_camera_layout",
+ "s_disp_judge",
+ "s_gauge_disp",
+ "s_ghost_score",
+ "s_gno",
+ "s_graph_score",
+ "s_gtype",
+ "s_hispeed",
+ "s_judge",
+ "s_judgeAdj",
+ "s_lane_brignt",
+ "s_notes",
+ "s_opstyle",
+ "s_pace",
+ "s_sdlen",
+ "s_sdtype",
+ "s_sorttype",
+ "s_sub_gno",
+ "s_timing",
+ "s_timing_split",
+ "s_tsujigiri_disp",
+ "s_visualization",
+ "sp_opt",
]:
- if k in request_info['root'][0].attrib:
- game_profile[k] = request_info['root'][0].attrib[k]
+ if k in request_info["root"][0].attrib:
+ game_profile[k] = request_info["root"][0].attrib[k]
for k in [
- ('d_liflen', 'd_lift'),
- ('dach', 'd_achi'),
- ('s_liflen', 's_lift'),
- ('sach', 's_achi'),
+ ("d_liflen", "d_lift"),
+ ("dach", "d_achi"),
+ ("s_liflen", "s_lift"),
+ ("sach", "s_achi"),
]:
- if k[1] in request_info['root'][0].attrib:
- game_profile[k[0]] = request_info['root'][0].attrib[k[1]]
+ if k[1] in request_info["root"][0].attrib:
+ game_profile[k[0]] = request_info["root"][0].attrib[k[1]]
- lightning_setting = request_info['root'][0].find('lightning_setting')
+ lightning_setting = request_info["root"][0].find("lightning_setting")
if lightning_setting is not None:
for k in [
- 'headphone_vol',
- 'resistance_dp_left',
- 'resistance_dp_right',
- 'resistance_sp_left',
- 'resistance_sp_right',
+ "headphone_vol",
+ "resistance_dp_left",
+ "resistance_dp_right",
+ "resistance_sp_left",
+ "resistance_sp_right",
]:
- game_profile['lightning_setting_' + k] = int(lightning_setting.attrib[k])
+ game_profile["lightning_setting_" + k] = int(lightning_setting.attrib[k])
- slider = lightning_setting.find('slider')
+ slider = lightning_setting.find("slider")
if slider is not None:
- game_profile['lightning_setting_slider'] = [int(x) for x in slider.text.split(' ')]
+ game_profile["lightning_setting_slider"] = [
+ int(x) for x in slider.text.split(" ")
+ ]
- light = lightning_setting.find('light')
+ light = lightning_setting.find("light")
if light is not None:
- game_profile['lightning_setting_light'] = [int(x) for x in light.text.split(' ')]
+ game_profile["lightning_setting_light"] = [
+ int(x) for x in light.text.split(" ")
+ ]
- concentration = lightning_setting.find('concentration')
+ concentration = lightning_setting.find("concentration")
if concentration is not None:
- game_profile['lightning_setting_concentration'] = int(concentration.text)
+ game_profile["lightning_setting_concentration"] = int(concentration.text)
- lightning_customize_flg = request_info['root'][0].find('lightning_customize_flg')
+ lightning_customize_flg = request_info["root"][0].find("lightning_customize_flg")
if lightning_customize_flg is not None:
for k in [
- 'flg_skin_0',
+ "flg_skin_0",
]:
- game_profile['lightning_setting_' + k] = int(lightning_customize_flg.attrib[k])
+ game_profile["lightning_setting_" + k] = int(
+ lightning_customize_flg.attrib[k]
+ )
- secret = request_info['root'][0].find('secret')
+ secret = request_info["root"][0].find("secret")
if secret is not None:
- for k in ['flg1', 'flg2', 'flg3', 'flg4']:
+ for k in ["flg1", "flg2", "flg3", "flg4"]:
flg = secret.find(k)
if flg is not None:
- game_profile['secret_' + k] = [int(x) for x in flg.text.split(' ')]
+ game_profile["secret_" + k] = [int(x) for x in flg.text.split(" ")]
- leggendaria = request_info['root'][0].find('leggendaria')
+ leggendaria = request_info["root"][0].find("leggendaria")
if leggendaria is not None:
- for k in ['flg1']:
+ for k in ["flg1"]:
flg = leggendaria.find(k)
if flg is not None:
- game_profile['leggendaria_' + k] = [int(x) for x in flg.text.split(' ')]
+ game_profile["leggendaria_" + k] = [int(x) for x in flg.text.split(" ")]
- step = request_info['root'][0].find('step')
+ step = request_info["root"][0].find("step")
if step is not None:
for k in [
- 'dp_fluctuation',
- 'dp_level',
- 'dp_mplay',
- 'enemy_damage',
- 'enemy_defeat_flg',
- 'mission_clear_num',
- 'progress',
- 'sp_fluctuation',
- 'sp_level',
- 'sp_mplay',
- 'tips_read_list',
- 'total_point',
+ "dp_fluctuation",
+ "dp_level",
+ "dp_mplay",
+ "enemy_damage",
+ "enemy_defeat_flg",
+ "mission_clear_num",
+ "progress",
+ "sp_fluctuation",
+ "sp_level",
+ "sp_mplay",
+ "tips_read_list",
+ "total_point",
]:
- game_profile['stepup_' + k] = int(step.attrib[k])
+ game_profile["stepup_" + k] = int(step.attrib[k])
- is_track_ticket = step.find('is_track_ticket')
+ is_track_ticket = step.find("is_track_ticket")
if is_track_ticket is not None:
- game_profile['stepup_is_track_ticket'] = int(is_track_ticket.text)
+ game_profile["stepup_is_track_ticket"] = int(is_track_ticket.text)
- dj_ranks = request_info['root'][0].findall('dj_rank')
+ dj_ranks = request_info["root"][0].findall("dj_rank")
dj_ranks = [] if dj_ranks is None else dj_ranks
for dj_rank in dj_ranks:
- style = int(dj_rank.attrib['style'])
+ style = int(dj_rank.attrib["style"])
- rank = dj_rank.find('rank')
- game_profile['dj_rank_' + ['single', 'double'][style] + '_rank'] = [int(x) for x in rank.text.split(' ')]
+ rank = dj_rank.find("rank")
+ game_profile["dj_rank_" + ["single", "double"][style] + "_rank"] = [
+ int(x) for x in rank.text.split(" ")
+ ]
- point = dj_rank.find('point')
- game_profile['dj_rank_' + ['single', 'double'][style] + '_point'] = [int(x) for x in point.text.split(' ')]
+ point = dj_rank.find("point")
+ game_profile["dj_rank_" + ["single", "double"][style] + "_point"] = [
+ int(x) for x in point.text.split(" ")
+ ]
- notes_radars = request_info['root'][0].findall('notes_radar')
+ notes_radars = request_info["root"][0].findall("notes_radar")
notes_radars = [] if notes_radars is None else notes_radars
for notes_radar in notes_radars:
- style = int(notes_radar.attrib['style'])
- score = notes_radar.find('radar_score')
- game_profile['notes_radar_' + ['single', 'double'][style]] = [int(x) for x in score.text.split(' ')]
+ style = int(notes_radar.attrib["style"])
+ score = notes_radar.find("radar_score")
+ game_profile["notes_radar_" + ["single", "double"][style]] = [
+ int(x) for x in score.text.split(" ")
+ ]
- achievements = request_info['root'][0].find('achievements')
+ achievements = request_info["root"][0].find("achievements")
if achievements is not None:
for k in [
- 'last_weekly',
- 'pack_comp',
- 'pack_flg',
- 'pack_id',
- 'play_pack',
- 'visit_flg',
- 'weekly_num',
+ "last_weekly",
+ "pack_comp",
+ "pack_flg",
+ "pack_id",
+ "play_pack",
+ "visit_flg",
+ "weekly_num",
]:
- game_profile['achievements_' + k] = int(achievements.attrib[k])
+ game_profile["achievements_" + k] = int(achievements.attrib[k])
- trophy = achievements.find('trophy')
+ trophy = achievements.find("trophy")
if trophy is not None:
- game_profile['achievements_trophy'] = [int(x) for x in trophy.text.split(' ')]
+ game_profile["achievements_trophy"] = [
+ int(x) for x in trophy.text.split(" ")
+ ]
- grade = request_info['root'][0].find('grade')
+ grade = request_info["root"][0].find("grade")
if grade is not None:
grade_values = []
- for g in grade.findall('g'):
- grade_values.append([int(x) for x in g.text.split(' ')])
+ for g in grade.findall("g"):
+ grade_values.append([int(x) for x in g.text.split(" ")])
- profile['grade_single'] = int(grade.attrib['sgid'])
- profile['grade_double'] = int(grade.attrib['dgid'])
- profile['grade_values'] = grade_values
+ profile["grade_single"] = int(grade.attrib["sgid"])
+ profile["grade_double"] = int(grade.attrib["dgid"])
+ profile["grade_values"] = grade_values
- deller_amount = game_profile.get('deller', 0)
- deller = request_info['root'][0].find('deller')
+ deller_amount = game_profile.get("deller", 0)
+ deller = request_info["root"][0].find("deller")
if deller is not None:
- deller_amount = int(deller.attrib['deller'])
- game_profile['deller'] = deller_amount
+ deller_amount = int(deller.attrib["deller"])
+ game_profile["deller"] = deller_amount
- language = request_info['root'][0].find('language_setting')
+ language = request_info["root"][0].find("language_setting")
if language is not None:
- language_value = int(language.attrib['language'])
- game_profile['language_setting'] = language_value
+ language_value = int(language.attrib["language"])
+ game_profile["language_setting"] = language_value
- game_profile['spnum'] = game_profile.get('spnum', 0) + (1 if clt == 0 else 0)
- game_profile['dpnum'] = game_profile.get('dpnum', 0) + (1 if clt == 1 else 0)
+ game_profile["spnum"] = game_profile.get("spnum", 0) + (1 if clt == 0 else 0)
+ game_profile["dpnum"] = game_profile.get("dpnum", 0) + (1 if clt == 1 else 0)
- if request_info['model'] == "TDJ":
- game_profile['lightning_play_data_spnum'] = game_profile.get('lightning_play_data_spnum', 0) + (1 if clt == 0 else 0)
- game_profile['lightning_play_data_dpnum'] = game_profile.get('lightning_play_data_dpnum', 0) + (1 if clt == 1 else 0)
+ if request_info["model"] == "TDJ":
+ game_profile["lightning_play_data_spnum"] = game_profile.get(
+ "lightning_play_data_spnum", 0
+ ) + (1 if clt == 0 else 0)
+ game_profile["lightning_play_data_dpnum"] = game_profile.get(
+ "lightning_play_data_dpnum", 0
+ ) + (1 if clt == 1 else 0)
- profile['version'][str(game_version)] = game_profile
+ profile["version"][str(game_version)] = game_profile
- get_db().table('iidx_profile').upsert(profile, where('card') == cid)
+ get_db().table("iidx_profile").upsert(profile, where("card") == cid)
- response = E.response(
- E.IIDX30pc(
- iidxid=xid,
- cltype=clt
- )
- )
+ response = E.response(E.IIDX30pc(iidxid=xid, cltype=clt))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/visit')
+@router.post("/{gameinfo}/IIDX30pc/visit")
async def iidx30pc_visit(request: Request):
request_info = await core_process_request(request)
@@ -776,234 +809,215 @@ async def iidx30pc_visit(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/reg')
+@router.post("/{gameinfo}/IIDX30pc/reg")
async def iidx30pc_reg(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- cid = request_info['root'][0].attrib['cid']
- name = request_info['root'][0].attrib['name']
- pid = request_info['root'][0].attrib['pid']
+ cid = request_info["root"][0].attrib["cid"]
+ name = request_info["root"][0].attrib["name"]
+ pid = request_info["root"][0].attrib["pid"]
- db = get_db().table('iidx_profile')
+ db = get_db().table("iidx_profile")
all_profiles_for_card = db.get(Query().card == cid)
if all_profiles_for_card is None:
- all_profiles_for_card = {
- 'card': cid,
- 'version': {}
- }
+ all_profiles_for_card = {"card": cid, "version": {}}
- if 'iidx_id' not in all_profiles_for_card:
+ if "iidx_id" not in all_profiles_for_card:
iidx_id = random.randint(10000000, 99999999)
- all_profiles_for_card['iidx_id'] = iidx_id
-
- all_profiles_for_card['version'][str(game_version)] = {
- 'game_version': game_version,
- 'djname': name,
- 'region': int(pid),
- 'head': 0,
- 'hair': 0,
- 'face': 0,
- 'hand': 0,
- 'body': 0,
- 'frame': 0,
- 'turntable': 0,
- 'explosion': 0,
- 'bgm': 0,
- 'folder_mask': 0,
- 'sudden': 0,
- 'judge_pos': 0,
- 'categoryvoice': 0,
- 'note': 0,
- 'fullcombo': 0,
- 'keybeam': 0,
- 'judgestring': 0,
- 'soundpreview': 0,
- 'grapharea': 0,
- 'effector_lock': 0,
- 'effector_type': 0,
- 'explosion_size': 0,
- 'alternate_hcn': 0,
- 'kokokara_start': 0,
- 'd_auto_adjust': 0,
- 'd_auto_scrach': 0,
- 'd_camera_layout': 0,
- 'd_disp_judge': 0,
- 'd_exscore': 0,
- 'd_gauge_disp': 0,
- 'd_ghost_score': 0,
- 'd_gno': 0,
- 'd_graph_score': 0,
- 'd_gtype': 0,
- 'd_hispeed': 0.000000,
- 'd_judge': 0,
- 'd_judgeAdj': 0,
- 'd_lane_brignt': 0,
- 'd_liflen': 0,
- 'd_notes': 0.000000,
- 'd_opstyle': 0,
- 'd_pace': 0,
- 'd_sdlen': 0,
- 'd_sdtype': 0,
- 'd_sorttype': 0,
- 'd_sub_gno': 0,
- 'd_timing': 0,
- 'd_timing_split': 0,
- 'd_tsujigiri_disp': 0,
- 'd_tune': 0,
- 'd_visualization': 0,
- 'dach': 0,
- 'dp_opt': 0,
- 'dp_opt2': 0,
- 'dpnum': 0,
- 'gpos': 0,
- 'mode': 0,
- 'ngrade': 0,
- 'pmode': 0,
- 'rtype': 0,
- 's_auto_adjust': 0,
- 's_auto_scrach': 0,
- 's_camera_layout': 0,
- 's_disp_judge': 0,
- 's_exscore': 0,
- 's_gauge_disp': 0,
- 's_ghost_score': 0,
- 's_gno': 0,
- 's_graph_score': 0,
- 's_gtype': 0,
- 's_hispeed': 0.000000,
- 's_judge': 0,
- 's_judgeAdj': 0,
- 's_lane_brignt': 0,
- 's_liflen': 0,
- 's_notes': 0.000000,
- 's_opstyle': 0,
- 's_pace': 0,
- 's_sdlen': 0,
- 's_sdtype': 0,
- 's_sorttype': 0,
- 's_sub_gno': 0,
- 's_timing': 0,
- 's_timing_split': 0,
- 's_tsujigiri_disp': 0,
- 's_tune': 0,
- 's_visualization': 0,
- 'sach': 0,
- 'sp_opt': 0,
- 'spnum': 0,
- 'deller': 0,
+ all_profiles_for_card["iidx_id"] = iidx_id
+ all_profiles_for_card["version"][str(game_version)] = {
+ "game_version": game_version,
+ "djname": name,
+ "region": int(pid),
+ "head": 0,
+ "hair": 0,
+ "face": 0,
+ "hand": 0,
+ "body": 0,
+ "frame": 0,
+ "turntable": 0,
+ "explosion": 0,
+ "bgm": 0,
+ "folder_mask": 0,
+ "sudden": 0,
+ "judge_pos": 0,
+ "categoryvoice": 0,
+ "note": 0,
+ "fullcombo": 0,
+ "keybeam": 0,
+ "judgestring": 0,
+ "soundpreview": 0,
+ "grapharea": 0,
+ "effector_lock": 0,
+ "effector_type": 0,
+ "explosion_size": 0,
+ "alternate_hcn": 0,
+ "kokokara_start": 0,
+ "d_auto_adjust": 0,
+ "d_auto_scrach": 0,
+ "d_camera_layout": 0,
+ "d_disp_judge": 0,
+ "d_exscore": 0,
+ "d_gauge_disp": 0,
+ "d_ghost_score": 0,
+ "d_gno": 0,
+ "d_graph_score": 0,
+ "d_gtype": 0,
+ "d_hispeed": 0.000000,
+ "d_judge": 0,
+ "d_judgeAdj": 0,
+ "d_lane_brignt": 0,
+ "d_liflen": 0,
+ "d_notes": 0.000000,
+ "d_opstyle": 0,
+ "d_pace": 0,
+ "d_sdlen": 0,
+ "d_sdtype": 0,
+ "d_sorttype": 0,
+ "d_sub_gno": 0,
+ "d_timing": 0,
+ "d_timing_split": 0,
+ "d_tsujigiri_disp": 0,
+ "d_tune": 0,
+ "d_visualization": 0,
+ "dach": 0,
+ "dp_opt": 0,
+ "dp_opt2": 0,
+ "dpnum": 0,
+ "gpos": 0,
+ "mode": 0,
+ "ngrade": 0,
+ "pmode": 0,
+ "rtype": 0,
+ "s_auto_adjust": 0,
+ "s_auto_scrach": 0,
+ "s_camera_layout": 0,
+ "s_disp_judge": 0,
+ "s_exscore": 0,
+ "s_gauge_disp": 0,
+ "s_ghost_score": 0,
+ "s_gno": 0,
+ "s_graph_score": 0,
+ "s_gtype": 0,
+ "s_hispeed": 0.000000,
+ "s_judge": 0,
+ "s_judgeAdj": 0,
+ "s_lane_brignt": 0,
+ "s_liflen": 0,
+ "s_notes": 0.000000,
+ "s_opstyle": 0,
+ "s_pace": 0,
+ "s_sdlen": 0,
+ "s_sdtype": 0,
+ "s_sorttype": 0,
+ "s_sub_gno": 0,
+ "s_timing": 0,
+ "s_timing_split": 0,
+ "s_tsujigiri_disp": 0,
+ "s_tune": 0,
+ "s_visualization": 0,
+ "sach": 0,
+ "sp_opt": 0,
+ "spnum": 0,
+ "deller": 0,
# Step up mode
- 'stepup_dp_fluctuation': 0,
- 'stepup_dp_level': 0,
- 'stepup_dp_mplay': 0,
- 'stepup_enemy_damage': 0,
- 'stepup_enemy_defeat_flg': 0,
- 'stepup_mission_clear_num': 0,
- 'stepup_progress': 0,
- 'stepup_sp_fluctuation': 0,
- 'stepup_sp_level': 0,
- 'stepup_sp_mplay': 0,
- 'stepup_tips_read_list': 0,
- 'stepup_total_point': 0,
- 'stepup_is_track_ticket': 0,
-
+ "stepup_dp_fluctuation": 0,
+ "stepup_dp_level": 0,
+ "stepup_dp_mplay": 0,
+ "stepup_enemy_damage": 0,
+ "stepup_enemy_defeat_flg": 0,
+ "stepup_mission_clear_num": 0,
+ "stepup_progress": 0,
+ "stepup_sp_fluctuation": 0,
+ "stepup_sp_level": 0,
+ "stepup_sp_mplay": 0,
+ "stepup_tips_read_list": 0,
+ "stepup_total_point": 0,
+ "stepup_is_track_ticket": 0,
# DJ Rank
- 'dj_rank_single_rank': [0] * 15,
- 'dj_rank_double_rank': [0] * 15,
- 'dj_rank_single_point': [0] * 15,
- 'dj_rank_double_point': [0] * 15,
-
+ "dj_rank_single_rank": [0] * 15,
+ "dj_rank_double_rank": [0] * 15,
+ "dj_rank_single_point": [0] * 15,
+ "dj_rank_double_point": [0] * 15,
# Notes Radar
- 'notes_radar_single': [0] * 6,
- 'notes_radar_double': [0] * 6,
-
+ "notes_radar_single": [0] * 6,
+ "notes_radar_double": [0] * 6,
# Grades
- 'grade_single': -1,
- 'grade_double': -1,
- 'grade_values': [],
-
+ "grade_single": -1,
+ "grade_double": -1,
+ "grade_values": [],
# Achievements
- 'achievements_trophy': [0] * 160,
- 'achievements_last_weekly': 0,
- 'achievements_pack_comp': 0,
- 'achievements_pack_flg': 0,
- 'achievements_pack_id': 0,
- 'achievements_play_pack': 0,
- 'achievements_visit_flg': 0,
- 'achievements_weekly_num': 0,
-
+ "achievements_trophy": [0] * 160,
+ "achievements_last_weekly": 0,
+ "achievements_pack_comp": 0,
+ "achievements_pack_flg": 0,
+ "achievements_pack_id": 0,
+ "achievements_play_pack": 0,
+ "achievements_visit_flg": 0,
+ "achievements_weekly_num": 0,
# Other
- 'language_setting': 0,
- 'movie_agreement': 0,
- 'lightning_play_data_spnum': 0,
- 'lightning_play_data_dpnum': 0,
-
+ "language_setting": 0,
+ "movie_agreement": 0,
+ "lightning_play_data_spnum": 0,
+ "lightning_play_data_dpnum": 0,
# Lightning model settings
- 'lightning_setting_slider': [0] * 7,
- 'lightning_setting_light': [1] * 10,
- 'lightning_setting_concentration': 0,
- 'lightning_setting_headphone_vol': 0,
- 'lightning_setting_resistance_sp_left': 0,
- 'lightning_setting_resistance_sp_right': 0,
- 'lightning_setting_resistance_dp_left': 0,
- 'lightning_setting_resistance_dp_right': 0,
- 'lightning_setting_skin_0': 0,
- 'lightning_setting_flg_skin_0': 0,
-
+ "lightning_setting_slider": [0] * 7,
+ "lightning_setting_light": [1] * 10,
+ "lightning_setting_concentration": 0,
+ "lightning_setting_headphone_vol": 0,
+ "lightning_setting_resistance_sp_left": 0,
+ "lightning_setting_resistance_sp_right": 0,
+ "lightning_setting_resistance_dp_left": 0,
+ "lightning_setting_resistance_dp_right": 0,
+ "lightning_setting_skin_0": 0,
+ "lightning_setting_flg_skin_0": 0,
# Web UI/Other options
- '_show_category_grade': 0,
- '_show_category_status': 1,
- '_show_category_difficulty': 1,
- '_show_category_alphabet': 1,
- '_show_category_rival_play': 0,
- '_show_category_rival_winlose': 1,
- '_show_category_all_rival_play': 0,
- '_show_category_arena_winlose': 1,
- '_show_rival_shop_info': 1,
- '_hide_play_count': 0,
- '_show_score_graph_cutin': 1,
- '_hide_iidx_id': 0,
- '_classic_hispeed': 0,
- '_beginner_option_swap': 1,
- '_show_lamps_as_no_play_in_arena': 0,
-
- 'skin_customize_flag_frame': 0,
- 'skin_customize_flag_bgm': 0,
- 'skin_customize_flag_lane': 0,
-
+ "_show_category_grade": 0,
+ "_show_category_status": 1,
+ "_show_category_difficulty": 1,
+ "_show_category_alphabet": 1,
+ "_show_category_rival_play": 0,
+ "_show_category_rival_winlose": 1,
+ "_show_category_all_rival_play": 0,
+ "_show_category_arena_winlose": 1,
+ "_show_rival_shop_info": 1,
+ "_hide_play_count": 0,
+ "_show_score_graph_cutin": 1,
+ "_hide_iidx_id": 0,
+ "_classic_hispeed": 0,
+ "_beginner_option_swap": 1,
+ "_show_lamps_as_no_play_in_arena": 0,
+ "skin_customize_flag_frame": 0,
+ "skin_customize_flag_bgm": 0,
+ "skin_customize_flag_lane": 0,
# Rivals
- 'sp_rival_1_iidx_id': 0,
- 'sp_rival_2_iidx_id': 0,
- 'sp_rival_3_iidx_id': 0,
- 'sp_rival_4_iidx_id': 0,
- 'sp_rival_5_iidx_id': 0,
- 'sp_rival_6_iidx_id': 0,
-
- 'dp_rival_1_iidx_id': 0,
- 'dp_rival_2_iidx_id': 0,
- 'dp_rival_3_iidx_id': 0,
- 'dp_rival_4_iidx_id': 0,
- 'dp_rival_5_iidx_id': 0,
- 'dp_rival_6_iidx_id': 0
+ "sp_rival_1_iidx_id": 0,
+ "sp_rival_2_iidx_id": 0,
+ "sp_rival_3_iidx_id": 0,
+ "sp_rival_4_iidx_id": 0,
+ "sp_rival_5_iidx_id": 0,
+ "sp_rival_6_iidx_id": 0,
+ "dp_rival_1_iidx_id": 0,
+ "dp_rival_2_iidx_id": 0,
+ "dp_rival_3_iidx_id": 0,
+ "dp_rival_4_iidx_id": 0,
+ "dp_rival_5_iidx_id": 0,
+ "dp_rival_6_iidx_id": 0,
}
- db.upsert(all_profiles_for_card, where('card') == cid)
+ db.upsert(all_profiles_for_card, where("card") == cid)
card, card_split = get_id_from_profile(cid)
- response = E.response(
- E.IIDX30pc(
- id=card,
- id_str=card_split
- )
- )
+ response = E.response(E.IIDX30pc(id=card, id_str=card_split))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/getLaneGachaTicket')
+@router.post("/{gameinfo}/IIDX30pc/getLaneGachaTicket")
async def iidx30pc_getlanegachaticket(request: Request):
request_info = await core_process_request(request)
@@ -1035,7 +1049,7 @@ async def iidx30pc_getlanegachaticket(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/drawLaneGacha')
+@router.post("/{gameinfo}/IIDX30pc/drawLaneGacha")
async def iidx30pc_drawlanegacha(request: Request):
request_info = await core_process_request(request)
@@ -1046,34 +1060,30 @@ async def iidx30pc_drawlanegacha(request: Request):
arrange_id=0,
expire_date=0,
),
- E.session(
- session_id=0
- ),
- status=0
+ E.session(session_id=0),
+ status=0,
)
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/eaappliresult')
+
+@router.post("/{gameinfo}/IIDX30pc/eaappliresult")
async def iidx30pc_eaappliresult(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30pc()
- )
+ response = E.response(E.IIDX30pc())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30pc/logout')
+
+@router.post("/{gameinfo}/IIDX30pc/logout")
async def iidx30pc_logout(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30pc()
- )
+ response = E.response(E.IIDX30pc())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx30ranking.py b/modules/iidx/iidx30ranking.py
index 31c5290..aaed077 100644
--- a/modules/iidx/iidx30ranking.py
+++ b/modules/iidx/iidx30ranking.py
@@ -8,13 +8,11 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
-@router.post('/{gameinfo}/IIDX30ranking/getranker')
+@router.post("/{gameinfo}/IIDX30ranking/getranker")
async def iidx30ranking_getranker(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30ranking()
- )
+ response = E.response(E.IIDX30ranking())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/iidx30shop.py b/modules/iidx/iidx30shop.py
index fdf8d45..a60d6bc 100644
--- a/modules/iidx/iidx30shop.py
+++ b/modules/iidx/iidx30shop.py
@@ -8,7 +8,7 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
-@router.post('/{gameinfo}/IIDX30shop/getname')
+@router.post("/{gameinfo}/IIDX30shop/getname")
async def iidx30shop_getname(request: Request):
request_info = await core_process_request(request)
@@ -24,7 +24,7 @@ async def iidx30shop_getname(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30shop/getconvention')
+@router.post("/{gameinfo}/IIDX30shop/getconvention")
async def iidx30shop_getconvention(request: Request):
request_info = await core_process_request(request)
@@ -44,26 +44,21 @@ async def iidx30shop_getconvention(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30shop/sentinfo')
+@router.post("/{gameinfo}/IIDX30shop/sentinfo")
async def iidx30shop_sentinfo(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30shop()
- )
+ response = E.response(E.IIDX30shop())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/IIDX30shop/sendescapepackageinfo')
+
+@router.post("/{gameinfo}/IIDX30shop/sendescapepackageinfo")
async def iidx30shop_sendescapepackageinfo(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.IIDX30shop(
- expire=1200
- )
- )
+ response = E.response(E.IIDX30shop(expire=1200))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/music.py b/modules/iidx/music.py
index 406a43e..5bc1a9e 100644
--- a/modules/iidx/music.py
+++ b/modules/iidx/music.py
@@ -9,8 +9,8 @@ from core_database import get_db
import config
-router = APIRouter(prefix='/local', tags=['local'])
-router.model_whitelist = ['LDJ', 'KDZ', 'JDZ']
+router = APIRouter(prefix="/local", tags=["local"])
+router.model_whitelist = ["LDJ", "KDZ", "JDZ"]
class ClearFlags(IntEnum):
@@ -24,129 +24,137 @@ class ClearFlags(IntEnum):
FULL_COMBO = 7
-@router.post('/{gameinfo}/music/getrank')
+@router.post("/{gameinfo}/music/getrank")
async def music_getrank(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- iidxid = int(request_info['root'][0].attrib['iidxid'])
- play_style = int(request_info['root'][0].attrib['cltype'])
+ iidxid = int(request_info["root"][0].attrib["iidxid"])
+ play_style = int(request_info["root"][0].attrib["cltype"])
all_scores = {}
db = get_db()
- for record in db.table('iidx_scores_best').search(
- (where('music_id') < (game_version + 1) * 1000)
- & (where('iidx_id') == iidxid)
- & (where('play_style') == play_style)
+ for record in db.table("iidx_scores_best").search(
+ (where("music_id") < (game_version + 1) * 1000)
+ & (where("iidx_id") == iidxid)
+ & (where("play_style") == play_style)
):
- music_id = record['music_id']
- clear_flg = record['clear_flg']
+ music_id = record["music_id"]
+ clear_flg = record["clear_flg"]
if game_version < 20:
m = str(music_id)
- music_id = int(''.join([m[:len(m)-3], m[-2:]]))
+ music_id = int("".join([m[: len(m) - 3], m[-2:]]))
if clear_flg == ClearFlags.FULL_COMBO and game_version < 19:
clear_flg = 6
- ex_score = record['ex_score']
- miss_count = record['miss_count']
- cid = record['chart_id']
+ ex_score = record["ex_score"]
+ miss_count = record["miss_count"]
+ cid = record["chart_id"]
if cid in (0, 4, 5, 9):
continue
chart_id = cid - 1
if music_id not in all_scores:
all_scores[music_id] = {
- 0: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
- 1: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
- 2: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
+ 0: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
+ 1: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
+ 2: {"clear_flg": -1, "ex_score": -1, "miss_count": -1},
}
- all_scores[music_id][chart_id]['clear_flg'] = clear_flg
- all_scores[music_id][chart_id]['ex_score'] = ex_score
- all_scores[music_id][chart_id]['miss_count'] = miss_count
+ all_scores[music_id][chart_id]["clear_flg"] = clear_flg
+ all_scores[music_id][chart_id]["ex_score"] = ex_score
+ all_scores[music_id][chart_id]["miss_count"] = miss_count
response = E.response(
E.music(
E.style(type=play_style),
- *[E.m([
- -1,
- k,
- *[all_scores[k][d]['clear_flg'] for d in range(3)],
- *[all_scores[k][d]['ex_score'] for d in range(3)],
- *[all_scores[k][d]['miss_count'] for d in range(3)],
- ], __type='s16') for k in all_scores]
+ *[
+ E.m(
+ [
+ -1,
+ k,
+ *[all_scores[k][d]["clear_flg"] for d in range(3)],
+ *[all_scores[k][d]["ex_score"] for d in range(3)],
+ *[all_scores[k][d]["miss_count"] for d in range(3)],
+ ],
+ __type="s16",
+ )
+ for k in all_scores
+ ]
)
)
- assert (response is not None)
+ assert response is not None
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/music/crate')
+@router.post("/{gameinfo}/music/crate")
async def music_crate(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
db = get_db()
- all_score_stats = db.table('iidx_score_stats').search(
- (where('music_id') < (game_version + 1) * 1000)
+ all_score_stats = db.table("iidx_score_stats").search(
+ (where("music_id") < (game_version + 1) * 1000)
)
crate = {}
fcrate = {}
for stat in all_score_stats:
if game_version < 20:
- m = str(stat['music_id'])
- stat['music_id'] = int(''.join([m[:len(m)-3], m[-2:]]))
+ m = str(stat["music_id"])
+ stat["music_id"] = int("".join([m[: len(m) - 3], m[-2:]]))
- if stat['music_id'] not in crate:
- crate[stat['music_id']] = [101] * 6
- if stat['music_id'] not in fcrate:
- fcrate[stat['music_id']] = [101] * 6
+ if stat["music_id"] not in crate:
+ crate[stat["music_id"]] = [101] * 6
+ if stat["music_id"] not in fcrate:
+ fcrate[stat["music_id"]] = [101] * 6
- if stat['play_style'] == 0:
+ if stat["play_style"] == 0:
old_to_new_adjust = -1
- elif stat['play_style'] == 1:
+ elif stat["play_style"] == 1:
old_to_new_adjust = 2
- crate[stat['music_id']][stat['chart_id'] + old_to_new_adjust] = int(stat['clear_rate']) // 10
- fcrate[stat['music_id']][stat['chart_id'] + old_to_new_adjust] = int(stat['fc_rate']) // 10
+ crate[stat["music_id"]][stat["chart_id"] + old_to_new_adjust] = (
+ int(stat["clear_rate"]) // 10
+ )
+ fcrate[stat["music_id"]][stat["chart_id"] + old_to_new_adjust] = (
+ int(stat["fc_rate"]) // 10
+ )
response = E.response(
- E.music(
- *[E.c(crate[k] + fcrate[k], mid=k, __type="u8") for k in crate]
- )
+ E.music(*[E.c(crate[k] + fcrate[k], mid=k, __type="u8") for k in crate])
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/music/reg')
+@router.post("/{gameinfo}/music/reg")
async def music_reg(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
timestamp = time.time()
- root = request_info['root'][0]
+ root = request_info["root"][0]
- clear_flg = int(root.attrib['cflg'])
- clid = int(root.attrib['clid'])
- great_num = int(root.attrib['gnum'])
- iidx_id = int(root.attrib['iidxid'])
- miss_num = int(root.attrib['mnum'])
- pgreat_num = int(root.attrib['pgnum'])
- pid = int(root.attrib['pid'])
+ clear_flg = int(root.attrib["cflg"])
+ clid = int(root.attrib["clid"])
+ great_num = int(root.attrib["gnum"])
+ iidx_id = int(root.attrib["iidxid"])
+ miss_num = int(root.attrib["mnum"])
+ pgreat_num = int(root.attrib["pgnum"])
+ pid = int(root.attrib["pid"])
ex_score = (pgreat_num * 2) + great_num
if game_version == 20:
- is_death = int(root.attrib['is_death'])
- music_id = int(root.attrib['mid'])
+ is_death = int(root.attrib["is_death"])
+ music_id = int(root.attrib["mid"])
else:
is_death = 1 if clear_flg < ClearFlags.ASSIST_CLEAR else 0
- m = str(root.attrib['mid'])
- music_id = int('0'.join([m[:len(m)-2], m[-2:]]))
+ m = str(root.attrib["mid"])
+ music_id = int("0".join([m[: len(m) - 2], m[-2:]]))
if clear_flg == 6 and game_version < 19:
clear_flg = ClearFlags.FULL_COMBO
@@ -160,164 +168,171 @@ async def music_reg(request: Request):
ghost = root.find("ghost").text
db = get_db()
- db.table('iidx_scores').insert(
+ db.table("iidx_scores").insert(
{
- 'timestamp': timestamp,
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'pid': pid,
- 'clear_flg': clear_flg,
- 'is_death': is_death,
- 'music_id': music_id,
- 'play_style': play_style,
- 'chart_id': note_id,
- 'pgreat_num': pgreat_num,
- 'great_num': great_num,
- 'ex_score': ex_score,
- 'miss_count': miss_num,
- 'ghost': ghost,
+ "timestamp": timestamp,
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "pid": pid,
+ "clear_flg": clear_flg,
+ "is_death": is_death,
+ "music_id": music_id,
+ "play_style": play_style,
+ "chart_id": note_id,
+ "pgreat_num": pgreat_num,
+ "great_num": great_num,
+ "ex_score": ex_score,
+ "miss_count": miss_num,
+ "ghost": ghost,
},
)
- best_score = db.table('iidx_scores_best').get(
- (where('iidx_id') == iidx_id)
- & (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ best_score = db.table("iidx_scores_best").get(
+ (where("iidx_id") == iidx_id)
+ & (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id)
)
best_score = {} if best_score is None else best_score
if clear_flg < ClearFlags.EASY_CLEAR:
miss_num = -1
- best_miss_count = best_score.get('miss_count', miss_num)
+ best_miss_count = best_score.get("miss_count", miss_num)
if best_miss_count == -1:
miss_count = max(miss_num, best_miss_count)
elif clear_flg > ClearFlags.ASSIST_CLEAR:
miss_count = min(miss_num, best_miss_count)
else:
miss_count = best_miss_count
- best_ex_score = best_score.get('ex_score', ex_score)
+ best_ex_score = best_score.get("ex_score", ex_score)
best_score_data = {
- 'game_version': game_version,
- 'iidx_id': iidx_id,
- 'pid': pid,
- 'play_style': play_style,
- 'music_id': music_id,
- 'chart_id': note_id,
- 'miss_count': miss_count,
- 'ex_score': max(ex_score, best_ex_score),
- 'ghost': ghost if ex_score >= best_ex_score else best_score.get('ghost', ghost),
- 'ghost_gauge': best_score.get('ghost_gauge', 0),
- 'clear_flg': max(clear_flg, best_score.get('clear_flg', clear_flg)),
- 'gauge_type': best_score.get('gauge_type', 0),
+ "game_version": game_version,
+ "iidx_id": iidx_id,
+ "pid": pid,
+ "play_style": play_style,
+ "music_id": music_id,
+ "chart_id": note_id,
+ "miss_count": miss_count,
+ "ex_score": max(ex_score, best_ex_score),
+ "ghost": ghost if ex_score >= best_ex_score else best_score.get("ghost", ghost),
+ "ghost_gauge": best_score.get("ghost_gauge", 0),
+ "clear_flg": max(clear_flg, best_score.get("clear_flg", clear_flg)),
+ "gauge_type": best_score.get("gauge_type", 0),
}
- db.table('iidx_scores_best').upsert(
+ db.table("iidx_scores_best").upsert(
best_score_data,
- (where('iidx_id') == iidx_id)
- & (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ (where("iidx_id") == iidx_id)
+ & (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id),
)
- score_stats = db.table('iidx_score_stats').get(
- (where('music_id') == music_id)
- & (where('play_style') == play_style)
- & (where('chart_id') == note_id)
+ score_stats = db.table("iidx_score_stats").get(
+ (where("music_id") == music_id)
+ & (where("play_style") == play_style)
+ & (where("chart_id") == note_id)
)
score_stats = {} if score_stats is None else score_stats
- score_stats['game_version'] = game_version
- score_stats['play_style'] = play_style
- score_stats['music_id'] = music_id
- score_stats['chart_id'] = note_id
- score_stats['play_count'] = score_stats.get('play_count', 0) + 1
- score_stats['fc_count'] = score_stats.get('fc_count', 0) + (1 if clear_flg == ClearFlags.FULL_COMBO else 0)
- score_stats['clear_count'] = score_stats.get('clear_count', 0) + (1 if clear_flg >= ClearFlags.EASY_CLEAR else 0)
- score_stats['fc_rate'] = int((score_stats['fc_count'] / score_stats['play_count']) * 1000)
- score_stats['clear_rate'] = int((score_stats['clear_count'] / score_stats['play_count']) * 1000)
+ score_stats["game_version"] = game_version
+ score_stats["play_style"] = play_style
+ score_stats["music_id"] = music_id
+ score_stats["chart_id"] = note_id
+ score_stats["play_count"] = score_stats.get("play_count", 0) + 1
+ score_stats["fc_count"] = score_stats.get("fc_count", 0) + (
+ 1 if clear_flg == ClearFlags.FULL_COMBO else 0
+ )
+ score_stats["clear_count"] = score_stats.get("clear_count", 0) + (
+ 1 if clear_flg >= ClearFlags.EASY_CLEAR else 0
+ )
+ score_stats["fc_rate"] = int(
+ (score_stats["fc_count"] / score_stats["play_count"]) * 1000
+ )
+ score_stats["clear_rate"] = int(
+ (score_stats["clear_count"] / score_stats["play_count"]) * 1000
+ )
- db.table('iidx_score_stats').upsert(
+ db.table("iidx_score_stats").upsert(
score_stats,
- (where('music_id') == music_id)
- & (where('play_style') == play_style)
- & (where('chart_id') == note_id)
+ (where("music_id") == music_id)
+ & (where("play_style") == play_style)
+ & (where("chart_id") == note_id),
)
ranklist_data = []
- ranklist_scores = db.table('iidx_scores_best').search(
- (where('play_style') == play_style)
- & (where('music_id') == music_id)
- & (where('chart_id') == note_id)
+ ranklist_scores = db.table("iidx_scores_best").search(
+ (where("play_style") == play_style)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == note_id)
)
ranklist_scores = [] if ranklist_scores is None else ranklist_scores
ranklist_scores_ranked = []
for score in ranklist_scores:
- profile = db.table('iidx_profile').get(where('iidx_id') == score['iidx_id'])
+ profile = db.table("iidx_profile").get(where("iidx_id") == score["iidx_id"])
- if profile is None or str(game_version) not in profile['version']:
+ if profile is None or str(game_version) not in profile["version"]:
continue
- game_profile = profile['version'][str(game_version)]
+ game_profile = profile["version"][str(game_version)]
- ranklist_scores_ranked.append({
- 'opname': config.arcade,
- 'name': game_profile['djname'],
- 'pid': game_profile['region'],
- 'body': game_profile.get('body', 0),
- 'face': game_profile.get('face', 0),
- 'hair': game_profile.get('hair', 0),
- 'hand': game_profile.get('hand', 0),
- 'head': game_profile.get('head', 0),
- 'dgrade': game_profile['grade_double'],
- 'sgrade': game_profile['grade_single'],
- 'score': score['ex_score'],
- 'iidx_id': score['iidx_id'],
- 'clflg': score['clear_flg'],
- 'myFlg': score['iidx_id'] == iidx_id
- })
+ ranklist_scores_ranked.append(
+ {
+ "opname": config.arcade,
+ "name": game_profile["djname"],
+ "pid": game_profile["region"],
+ "body": game_profile.get("body", 0),
+ "face": game_profile.get("face", 0),
+ "hair": game_profile.get("hair", 0),
+ "hand": game_profile.get("hand", 0),
+ "head": game_profile.get("head", 0),
+ "dgrade": game_profile["grade_double"],
+ "sgrade": game_profile["grade_single"],
+ "score": score["ex_score"],
+ "iidx_id": score["iidx_id"],
+ "clflg": score["clear_flg"],
+ "myFlg": score["iidx_id"] == iidx_id,
+ }
+ )
- ranklist_scores_ranked = sorted(ranklist_scores_ranked, key=lambda x: (x['clflg'], x['score']), reverse=True)
+ ranklist_scores_ranked = sorted(
+ ranklist_scores_ranked, key=lambda x: (x["clflg"], x["score"]), reverse=True
+ )
myRank = 0
for rnum, score in enumerate(ranklist_scores_ranked):
r = E.data(
rnum=rnum + 1,
- opname=score['opname'],
- name=score['name'],
- pid=score['pid'],
- body=score['body'],
- face=score['face'],
- hair=score['hair'],
- hand=score['hand'],
- head=score['head'],
- dgrade=score['dgrade'],
- sgrade=score['sgrade'],
- score=score['score'],
- iidx_id=score['iidx_id'],
- clflg=score['clflg'],
- myFlg=score['myFlg'],
+ opname=score["opname"],
+ name=score["name"],
+ pid=score["pid"],
+ body=score["body"],
+ face=score["face"],
+ hair=score["hair"],
+ hand=score["hand"],
+ head=score["head"],
+ dgrade=score["dgrade"],
+ sgrade=score["sgrade"],
+ score=score["score"],
+ iidx_id=score["iidx_id"],
+ clflg=score["clflg"],
+ myFlg=score["myFlg"],
achieve=0,
)
ranklist_data.append(r)
- if score['myFlg']:
+ if score["myFlg"]:
myRank = rnum + 1
response = E.response(
E.music(
- E.ranklist(
- *ranklist_data,
- total_user_num=len(ranklist_data)
- ),
- E.shopdata(
- rank=myRank
- ),
+ E.ranklist(*ranklist_data, total_user_num=len(ranklist_data)),
+ E.shopdata(rank=myRank),
clid=clid,
- crate=score_stats['clear_rate'] // 10,
- frate=score_stats['fc_rate'] // 10,
+ crate=score_stats["clear_rate"] // 10,
+ frate=score_stats["fc_rate"] // 10,
mid=music_id,
)
)
@@ -326,35 +341,33 @@ async def music_reg(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/music/appoint')
+@router.post("/{gameinfo}/music/appoint")
async def music_appoint(request: Request):
request_info = await core_process_request(request)
- iidxid = int(request_info['root'][0].attrib['iidxid'])
- music_id = int(request_info['root'][0].attrib['mid'])
- chart_id = int(request_info['root'][0].attrib['clid'])
+ iidxid = int(request_info["root"][0].attrib["iidxid"])
+ music_id = int(request_info["root"][0].attrib["mid"])
+ chart_id = int(request_info["root"][0].attrib["clid"])
db = get_db()
- record = db.table('iidx_scores_best').get(
- (where('iidx_id') == iidxid)
- & (where('music_id') == music_id)
- & (where('chart_id') == chart_id)
+ record = db.table("iidx_scores_best").get(
+ (where("iidx_id") == iidxid)
+ & (where("music_id") == music_id)
+ & (where("chart_id") == chart_id)
)
vals = []
if record is not None:
- vals.append(E.mydata(
- record['ghost'],
- score=record['ex_score'],
- __type="bin",
- __size=len(record['ghost']) // 2,
- ))
-
- response = E.response(
- E.music(
- *vals
+ vals.append(
+ E.mydata(
+ record["ghost"],
+ score=record["ex_score"],
+ __type="bin",
+ __size=len(record["ghost"]) // 2,
+ )
)
- )
+
+ response = E.response(E.music(*vals))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/pc.py b/modules/iidx/pc.py
index cb35286..2b5ce77 100644
--- a/modules/iidx/pc.py
+++ b/modules/iidx/pc.py
@@ -13,50 +13,48 @@ router.model_whitelist = ["LDJ", "KDZ", "JDZ"]
def get_profile(cid):
- return get_db().table('iidx_profile').get(
- where('card') == cid
- )
+ return get_db().table("iidx_profile").get(where("card") == cid)
+
def get_profile_by_id(iidx_id):
- return get_db().table('iidx_profile').get(
- where('iidx_id') == iidx_id
- )
+ return get_db().table("iidx_profile").get(where("iidx_id") == iidx_id)
+
def get_game_profile(cid, game_version):
profile = get_profile(cid)
- return profile['version'].get(str(game_version), None)
+ return profile["version"].get(str(game_version), None)
def get_id_from_profile(cid):
- profile = get_db().table('iidx_profile').get(
- where('card') == cid
- )
+ profile = get_db().table("iidx_profile").get(where("card") == cid)
- djid = "%08d" % profile['iidx_id']
- djid_split = '-'.join([djid[:4], djid[4:]])
+ djid = "%08d" % profile["iidx_id"]
+ djid_split = "-".join([djid[:4], djid[4:]])
- return profile['iidx_id'], djid_split
+ return profile["iidx_id"], djid_split
def calculate_folder_mask(profile):
- return profile.get('_show_category_grade', 0) << 0 \
- | (profile.get('_show_category_status', 0) << 1) \
- | (profile.get('_show_category_difficulty', 0) << 2) \
- | (profile.get('_show_category_alphabet', 0) << 3) \
- | (profile.get('_show_category_rival_play', 0) << 4) \
- | (profile.get('_show_category_rival_winlose', 0) << 6) \
- | (profile.get('_show_rival_shop_info', 0) << 7) \
- | (profile.get('_hide_play_count', 0) << 8) \
- | (profile.get('_hide_rival_info', 0) << 9) \
+ return (
+ profile.get("_show_category_grade", 0) << 0
+ | (profile.get("_show_category_status", 0) << 1)
+ | (profile.get("_show_category_difficulty", 0) << 2)
+ | (profile.get("_show_category_alphabet", 0) << 3)
+ | (profile.get("_show_category_rival_play", 0) << 4)
+ | (profile.get("_show_category_rival_winlose", 0) << 6)
+ | (profile.get("_show_rival_shop_info", 0) << 7)
+ | (profile.get("_hide_play_count", 0) << 8)
+ | (profile.get("_hide_rival_info", 0) << 9)
+ )
-@router.post('/{gameinfo}/pc/get')
+@router.post("/{gameinfo}/pc/get")
async def pc_get(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- cid = request_info['root'][0].attrib['rid']
+ cid = request_info["root"][0].attrib["rid"]
profile = get_game_profile(cid, game_version)
djid, djid_split = get_id_from_profile(cid)
@@ -64,35 +62,44 @@ async def pc_get(request: Request):
response = E.response(
E.pc(
E.pcdata(
- dach=profile['dach'],
- dp_opt=profile['dp_opt'],
- dp_opt2=profile['dp_opt2'],
+ dach=profile["dach"],
+ dp_opt=profile["dp_opt"],
+ dp_opt2=profile["dp_opt2"],
dpnum=profile["dpnum"],
- gno=profile['gno'],
- gpos=profile['gpos'],
- help=profile['help'],
- hispeed=profile['hispeed'],
+ gno=profile["gno"],
+ gpos=profile["gpos"],
+ help=profile["help"],
+ hispeed=profile["hispeed"],
id=djid,
idstr=djid_split,
- judge=profile['judge'],
- judgeAdj=profile['judgeAdj'],
- liflen=profile['lift'],
- mode=profile['mode'],
- name=profile['djname'],
- notes=profile['notes'],
- opstyle=profile['opstyle'],
- pase=profile['pase'],
- pid=profile['region'],
- pmode=profile['pmode'],
- sach=profile['sach'],
- sdhd=profile['sdhd'],
- sdtype=profile['sdtype'],
- sp_opt=profile['sp_opt'],
+ judge=profile["judge"],
+ judgeAdj=profile["judgeAdj"],
+ liflen=profile["lift"],
+ mode=profile["mode"],
+ name=profile["djname"],
+ notes=profile["notes"],
+ opstyle=profile["opstyle"],
+ pase=profile["pase"],
+ pid=profile["region"],
+ pmode=profile["pmode"],
+ sach=profile["sach"],
+ sdhd=profile["sdhd"],
+ sdtype=profile["sdtype"],
+ sp_opt=profile["sp_opt"],
spnum=profile["spnum"],
- timing=profile['timing'],
+ timing=profile["timing"],
+ ),
+ E.qprodata(
+ [
+ profile["head"],
+ profile["hair"],
+ profile["face"],
+ profile["hand"],
+ profile["body"],
+ ],
+ __type="u32",
+ __size=5 * 4,
),
- E.qprodata([profile["head"], profile["hair"], profile["face"], profile["hand"], profile["body"]],
- __type="u32", __size=5 * 4),
E.skin(
[
0,
@@ -110,53 +117,62 @@ async def pc_get(request: Request):
-1,
profile["soundpreview"],
],
- __type="s16"),
- E.rlist(),
- E.commonboss(baron=0, deller=profile['deller'], orb=0),
- E.secret(
- E.flg1(profile.get('secret_flg1', [-1]), __type="s64"),
- E.flg2(profile.get('secret_flg2', [-1]), __type="s64"),
- E.flg3(profile.get('secret_flg3', [-1]), __type="s64"),
+ __type="s16",
+ ),
+ E.rlist(),
+ E.commonboss(baron=0, deller=profile["deller"], orb=0),
+ E.secret(
+ E.flg1(profile.get("secret_flg1", [-1]), __type="s64"),
+ E.flg2(profile.get("secret_flg2", [-1]), __type="s64"),
+ E.flg3(profile.get("secret_flg3", [-1]), __type="s64"),
+ ),
+ E.join_shop(
+ join_cflg=1, join_id=10, join_name=config.arcade, joinflg=1
),
- E.join_shop(join_cflg=1, join_id=10, join_name=config.arcade, joinflg=1),
E.grade(
- *[E.g(x, __type="u8") for x in profile['grade_values']],
- dgid=profile['grade_double'],
- sgid=profile['grade_single'],
+ *[E.g(x, __type="u8") for x in profile["grade_values"]],
+ dgid=profile["grade_double"],
+ sgid=profile["grade_single"],
),
E.redboss(
- crush=profile.get('redboss_crush', 0),
- open=profile.get('redboss_open', 0),
- progress=profile.get('redboss_progress', 0),
+ crush=profile.get("redboss_crush", 0),
+ open=profile.get("redboss_open", 0),
+ progress=profile.get("redboss_progress", 0),
),
E.blueboss(
- column0=profile.get('blueboss_column0', 0),
- column1=profile.get('blueboss_column1', 0),
- first_flg=profile.get('blueboss_first_flg', 0),
- gauge=profile.get('blueboss_gauge', 0),
- general=profile.get('blueboss_general', 0),
- item=profile.get('blueboss_item', 0),
- item_flg=profile.get('blueboss_item_flg', 0),
- level=profile.get('blueboss_level', 0),
- row0=profile.get('blueboss_row0', 0),
- row1=profile.get('blueboss_row1', 0),
- sector=profile.get('blueboss_sector', 0),
+ column0=profile.get("blueboss_column0", 0),
+ column1=profile.get("blueboss_column1", 0),
+ first_flg=profile.get("blueboss_first_flg", 0),
+ gauge=profile.get("blueboss_gauge", 0),
+ general=profile.get("blueboss_general", 0),
+ item=profile.get("blueboss_item", 0),
+ item_flg=profile.get("blueboss_item_flg", 0),
+ level=profile.get("blueboss_level", 0),
+ row0=profile.get("blueboss_row0", 0),
+ row1=profile.get("blueboss_row1", 0),
+ sector=profile.get("blueboss_sector", 0),
),
E.yellowboss(
- E.p_attack(profile.get('yellowboss_p_attack', [0] * 7), __type="s32"),
- E.pbest_attack(profile.get('yellowboss_pbest_attack', [0] * 7), __type="s32"),
- E.defeat(profile.get('yellowboss_defeat', [0] * 7), __type="bool"),
- E.shop_damage(profile.get('yellowboss_shop_damage', [0] * 7), __type="s32"),
- critical=profile.get('yellowboss_critical', 0),
- destiny=profile.get('yellowboss_destiny', 0),
- first_flg=profile.get('yellowboss_first_flg', 1),
- heroic0=profile.get('yellowboss_heroic0', 0),
- heroic1=profile.get('yellowboss_heroic1', 0),
- join_num=profile.get('yellowboss_join_num', 0),
- last_select=profile.get('yellowboss_last_select', 0),
- level=profile.get('yellowboss_level', 1),
- shop_message=profile.get('yellowboss_shop_message', ""),
- special_move=profile.get('yellowboss_special_move', ""),
+ E.p_attack(
+ profile.get("yellowboss_p_attack", [0] * 7), __type="s32"
+ ),
+ E.pbest_attack(
+ profile.get("yellowboss_pbest_attack", [0] * 7), __type="s32"
+ ),
+ E.defeat(profile.get("yellowboss_defeat", [0] * 7), __type="bool"),
+ E.shop_damage(
+ profile.get("yellowboss_shop_damage", [0] * 7), __type="s32"
+ ),
+ critical=profile.get("yellowboss_critical", 0),
+ destiny=profile.get("yellowboss_destiny", 0),
+ first_flg=profile.get("yellowboss_first_flg", 1),
+ heroic0=profile.get("yellowboss_heroic0", 0),
+ heroic1=profile.get("yellowboss_heroic1", 0),
+ join_num=profile.get("yellowboss_join_num", 0),
+ last_select=profile.get("yellowboss_last_select", 0),
+ level=profile.get("yellowboss_level", 1),
+ shop_message=profile.get("yellowboss_shop_message", ""),
+ special_move=profile.get("yellowboss_special_move", ""),
),
E.link5(
anisakis=1,
@@ -231,64 +247,70 @@ async def pc_get(request: Request):
E.visitor(anum=1, pnum=2, snum=1, vs_flg=1),
E.gakuen(music_list=-1),
E.achievements(
- E.trophy(
- profile.get('achievements_trophy', [])[:10],
- __type="s64"
- ),
- last_weekly=profile.get('achievements_last_weekly', 0),
- pack=profile.get('achievements_pack_id', 0),
- pack_comp=profile.get('achievements_pack_comp', 0),
+ E.trophy(profile.get("achievements_trophy", [])[:10], __type="s64"),
+ last_weekly=profile.get("achievements_last_weekly", 0),
+ pack=profile.get("achievements_pack_id", 0),
+ pack_comp=profile.get("achievements_pack_comp", 0),
rival_crush=0,
- visit_flg=profile.get('achievements_visit_flg', 0),
- weekly_num=profile.get('achievements_weekly_num', 0),
+ visit_flg=profile.get("achievements_visit_flg", 0),
+ weekly_num=profile.get("achievements_weekly_num", 0),
),
E.step(
- E.stamp(profile.get('stepup_stamp', ""), __type="bin"),
- E.help(profile.get('stepup_help', ""), __type="bin"),
- dp_ach=profile.get('stepup_dp_ach', 0),
- dp_hdpt=profile.get('stepup_dp_hdpt', 0),
- dp_level=profile.get('stepup_dp_level', 0),
- dp_mplay=profile.get('stepup_dp_mplay', 0),
- dp_round=profile.get('stepup_dp_round', 0),
- review=profile.get('stepup_review', 0),
- sp_ach=profile.get('stepup_sp_ach', 0),
- sp_hdpt=profile.get('stepup_sp_hdpt', 0),
- sp_level=profile.get('stepup_sp_level', 0),
- sp_mplay=profile.get('stepup_sp_mplay', 0),
- sp_round=profile.get('stepup_sp_round', 0),
- )
+ E.stamp(profile.get("stepup_stamp", ""), __type="bin"),
+ E.help(profile.get("stepup_help", ""), __type="bin"),
+ dp_ach=profile.get("stepup_dp_ach", 0),
+ dp_hdpt=profile.get("stepup_dp_hdpt", 0),
+ dp_level=profile.get("stepup_dp_level", 0),
+ dp_mplay=profile.get("stepup_dp_mplay", 0),
+ dp_round=profile.get("stepup_dp_round", 0),
+ review=profile.get("stepup_review", 0),
+ sp_ach=profile.get("stepup_sp_ach", 0),
+ sp_hdpt=profile.get("stepup_sp_hdpt", 0),
+ sp_level=profile.get("stepup_sp_level", 0),
+ sp_mplay=profile.get("stepup_sp_mplay", 0),
+ sp_round=profile.get("stepup_sp_round", 0),
+ ),
)
)
elif game_version == 19:
response = E.response(
E.pc(
E.pcdata(
- dach=profile['dach'],
- dp_opt=profile['dp_opt'],
- dp_opt2=profile['dp_opt2'],
+ dach=profile["dach"],
+ dp_opt=profile["dp_opt"],
+ dp_opt2=profile["dp_opt2"],
dpnum=profile["dpnum"],
- gno=profile['gno'],
- help=profile['help'],
+ gno=profile["gno"],
+ help=profile["help"],
id=djid,
idstr=djid_split,
- liflen=profile['lift'],
- mode=profile['mode'],
- name=profile['djname'],
- notes=profile['notes'],
- pase=profile['pase'],
- pid=profile['region'],
- pmode=profile['pmode'],
- sach=profile['sach'],
- sdhd=profile['sdhd'],
- sdtype=profile['sdtype'],
+ liflen=profile["lift"],
+ mode=profile["mode"],
+ name=profile["djname"],
+ notes=profile["notes"],
+ pase=profile["pase"],
+ pid=profile["region"],
+ pmode=profile["pmode"],
+ sach=profile["sach"],
+ sdhd=profile["sdhd"],
+ sdtype=profile["sdtype"],
sflg0=-1,
sflg1=-1,
- sp_opt=profile['sp_opt'],
+ sp_opt=profile["sp_opt"],
spnum=profile["spnum"],
- timing=profile['timing'],
+ timing=profile["timing"],
+ ),
+ E.qprodata(
+ [
+ profile["head"],
+ profile["hair"],
+ profile["face"],
+ profile["hand"],
+ profile["body"],
+ ],
+ __type="u32",
+ __size=5 * 4,
),
- E.qprodata([profile["head"], profile["hair"], profile["face"], profile["hand"], profile["body"]],
- __type="u32", __size=5 * 4),
E.skin(
[
profile["frame"],
@@ -306,10 +328,11 @@ async def pc_get(request: Request):
0,
0,
],
- __type="s16"),
+ __type="s16",
+ ),
E.grade(
- dgid=profile['grade_double'],
- sgid=profile['grade_single'],
+ dgid=profile["grade_double"],
+ sgid=profile["grade_single"],
),
E.ex(),
E.ocrs(),
@@ -367,28 +390,28 @@ async def pc_get(request: Request):
response = E.response(
E.pc(
E.pcdata(
- dach=profile['dach'],
- dp_opt=profile['dp_opt'],
- dp_opt2=profile['dp_opt2'],
+ dach=profile["dach"],
+ dp_opt=profile["dp_opt"],
+ dp_opt2=profile["dp_opt2"],
dpnum=profile["dpnum"],
- gno=profile['gno'],
+ gno=profile["gno"],
id=djid,
idstr=djid_split,
- liflen=profile['lift'],
+ liflen=profile["lift"],
mcomb=0,
- mode=profile['mode'],
- name=profile['djname'],
+ mode=profile["mode"],
+ name=profile["djname"],
ncomb=0,
- pid=profile['region'],
- pmode=profile['pmode'],
- sach=profile['sach'],
- sdhd=profile['sdhd'],
- sdtype=profile['sdtype'],
+ pid=profile["region"],
+ pmode=profile["pmode"],
+ sach=profile["sach"],
+ sdhd=profile["sdhd"],
+ sdtype=profile["sdtype"],
sflg0=-1,
sflg1=-1,
- sp_opt=profile['sp_opt'],
+ sp_opt=profile["sp_opt"],
spnum=profile["spnum"],
- timing=profile['timing'],
+ timing=profile["timing"],
),
E.skin(
[
@@ -405,7 +428,8 @@ async def pc_get(request: Request):
0,
0,
],
- __type="u16"),
+ __type="u16",
+ ),
E.grade(
dgid="-1",
sgid="-1",
@@ -420,17 +444,18 @@ async def pc_get(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/pc/common')
+@router.post("/{gameinfo}/pc/common")
async def pc_common(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
if game_version == 20:
response = E.response(
E.pc(
E.mranking(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
- __type="u16"),
+ __type="u16",
+ ),
E.ir(beat=2),
E.boss(phase=0),
E.red(phase=2),
@@ -438,17 +463,20 @@ async def pc_common(request: Request):
E.limit(phase=25),
E.cafe(open=1),
E.yellow_correct(
- *[E.detail(
- avg_shop=7,
- critical=2,
- max_condition=18,
- max_member=20,
- max_resist=1,
- min_condition=10,
- min_member=1,
- min_resist=1,
- rival=2
- )for detail in range(6)],
+ *[
+ E.detail(
+ avg_shop=7,
+ critical=2,
+ max_condition=18,
+ max_member=20,
+ max_resist=1,
+ min_condition=10,
+ min_member=1,
+ min_resist=1,
+ rival=2,
+ )
+ for detail in range(6)
+ ],
E.detail(
avg_shop=7,
critical=2,
@@ -458,11 +486,11 @@ async def pc_common(request: Request):
min_condition=80,
min_member=1,
min_resist=1,
- rival=2
+ rival=2,
),
avg_shop=7,
),
- expire=600
+ expire=600,
)
)
elif game_version == 19:
@@ -477,7 +505,7 @@ async def pc_common(request: Request):
E.travel(flg=1),
E.lincle(phase=4),
E.monex(no=3),
- expire=600
+ expire=600,
)
)
elif game_version == 18:
@@ -494,7 +522,7 @@ async def pc_common(request: Request):
E.lg(lea=1),
E.ir(beat=3),
E.ev(pha=2),
- expire=600
+ expire=600,
)
)
@@ -502,126 +530,122 @@ async def pc_common(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/pc/save')
+@router.post("/{gameinfo}/pc/save")
async def pc_save(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- root = request_info['root'][0]
+ root = request_info["root"][0]
- xid = int(root.attrib['iidxid'])
- clt = int(root.attrib['cltype'])
+ xid = int(root.attrib["iidxid"])
+ clt = int(root.attrib["cltype"])
profile = get_profile_by_id(xid)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
if clt == 0:
- game_profile['sach'] = root.attrib['achi']
- game_profile['sp_opt'] = root.attrib['opt']
+ game_profile["sach"] = root.attrib["achi"]
+ game_profile["sp_opt"] = root.attrib["opt"]
elif clt == 1:
- game_profile['dach'] = root.attrib['achi']
- game_profile['dp_opt'] = root.attrib['opt']
- game_profile['dp_opt2'] = root.attrib['opt2']
+ game_profile["dach"] = root.attrib["achi"]
+ game_profile["dp_opt"] = root.attrib["opt"]
+ game_profile["dp_opt2"] = root.attrib["opt2"]
for k in [
- 'gno',
- 'gpos',
- 'help',
- 'hispeed',
- 'judge',
- 'judgeAdj',
- 'lift',
- 'mode',
- 'notes',
- 'opstyle',
- 'pnum',
- 'sdhd',
- 'sdtype',
- 'timing',
+ "gno",
+ "gpos",
+ "help",
+ "hispeed",
+ "judge",
+ "judgeAdj",
+ "lift",
+ "mode",
+ "notes",
+ "opstyle",
+ "pnum",
+ "sdhd",
+ "sdtype",
+ "timing",
]:
if k in root.attrib:
game_profile[k] = root.attrib[k]
- secret = root.find('secret')
+ secret = root.find("secret")
if secret is not None:
- for k in ['flg1', 'flg2', 'flg3', 'flg4']:
+ for k in ["flg1", "flg2", "flg3", "flg4"]:
flg = secret.find(k)
if flg is not None:
- game_profile['secret_' + k] = [int(x) for x in flg.text.split(' ')]
+ game_profile["secret_" + k] = [int(x) for x in flg.text.split(" ")]
- step = root.find('step')
+ step = root.find("step")
if step is not None:
for k in [
- 'dp_level',
- 'dp_mplay',
- 'enemy_damage',
- 'enemy_defeat_flg',
- 'mission_clear_num',
- 'progress',
- 'sp_level',
- 'sp_mplay',
- 'tips_read_list',
- 'total_point',
+ "dp_level",
+ "dp_mplay",
+ "enemy_damage",
+ "enemy_defeat_flg",
+ "mission_clear_num",
+ "progress",
+ "sp_level",
+ "sp_mplay",
+ "tips_read_list",
+ "total_point",
]:
- game_profile['stepup_' + k] = int(step.attrib[k])
+ game_profile["stepup_" + k] = int(step.attrib[k])
- is_track_ticket = step.find('is_track_ticket')
+ is_track_ticket = step.find("is_track_ticket")
if is_track_ticket is not None:
- game_profile['stepup_is_track_ticket'] = int(is_track_ticket.text)
+ game_profile["stepup_is_track_ticket"] = int(is_track_ticket.text)
-
- achievements = root.find('achievements')
+ achievements = root.find("achievements")
if achievements is not None:
for k in [
- 'last_weekly',
- 'pack_comp',
- 'pack_flg',
- 'pack_id',
- 'play_pack',
- 'visit_flg',
- 'weekly_num',
+ "last_weekly",
+ "pack_comp",
+ "pack_flg",
+ "pack_id",
+ "play_pack",
+ "visit_flg",
+ "weekly_num",
]:
- game_profile['achievements_' + k] = int(achievements.attrib[k])
+ game_profile["achievements_" + k] = int(achievements.attrib[k])
- trophy = achievements.find('trophy')
+ trophy = achievements.find("trophy")
if trophy is not None:
- game_profile['achievements_trophy'] = [int(x) for x in trophy.text.split(' ')]
+ game_profile["achievements_trophy"] = [
+ int(x) for x in trophy.text.split(" ")
+ ]
- grade = request_info['root'][0].find('grade')
+ grade = request_info["root"][0].find("grade")
if grade is not None:
grade_values = []
- for g in grade.findall('g'):
- grade_values.append([int(x) for x in g.text.split(' ')])
+ for g in grade.findall("g"):
+ grade_values.append([int(x) for x in g.text.split(" ")])
- profile['grade_single'] = int(grade.attrib['sgid'])
- profile['grade_double'] = int(grade.attrib['dgid'])
- profile['grade_values'] = grade_values
+ profile["grade_single"] = int(grade.attrib["sgid"])
+ profile["grade_double"] = int(grade.attrib["dgid"])
+ profile["grade_values"] = grade_values
- deller_amount = game_profile.get('deller', 0)
- commonboss = root.find('commonboss')
+ deller_amount = game_profile.get("deller", 0)
+ commonboss = root.find("commonboss")
if commonboss is not None:
- deller_amount = int(commonboss.attrib['deller'])
- game_profile['deller'] = deller_amount
+ deller_amount = int(commonboss.attrib["deller"])
+ game_profile["deller"] = deller_amount
- game_profile['spnum'] = game_profile.get('spnum', 0) + (1 if clt == 0 else 0)
- game_profile['dpnum'] = game_profile.get('dpnum', 0) + (1 if clt == 1 else 0)
+ game_profile["spnum"] = game_profile.get("spnum", 0) + (1 if clt == 0 else 0)
+ game_profile["dpnum"] = game_profile.get("dpnum", 0) + (1 if clt == 1 else 0)
- profile['version'][str(game_version)] = game_profile
+ profile["version"][str(game_version)] = game_profile
- get_db().table('iidx_profile').upsert(profile, where('iidx_id') == xid)
+ get_db().table("iidx_profile").upsert(profile, where("iidx_id") == xid)
- response = E.response(
- E.pc(
- iidxid=xid,
- cltype=clt
- )
- )
+ response = E.response(E.pc(iidxid=xid, cltype=clt))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/pc/visit')
+@router.post("/{gameinfo}/pc/visit")
async def pc_visit(request: Request):
request_info = await core_process_request(request)
@@ -640,233 +664,215 @@ async def pc_visit(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/pc/reg')
+@router.post("/{gameinfo}/pc/reg")
async def pc_reg(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- cid = request_info['root'][0].attrib['cid']
- name = request_info['root'][0].attrib['name']
- pid = request_info['root'][0].attrib['pid']
+ cid = request_info["root"][0].attrib["cid"]
+ name = request_info["root"][0].attrib["name"]
+ pid = request_info["root"][0].attrib["pid"]
- db = get_db().table('iidx_profile')
+ db = get_db().table("iidx_profile")
all_profiles_for_card = db.get(Query().card == cid)
if all_profiles_for_card is None:
- all_profiles_for_card = {
- 'card': cid,
- 'version': {}
- }
+ all_profiles_for_card = {"card": cid, "version": {}}
- if 'iidx_id' not in all_profiles_for_card:
+ if "iidx_id" not in all_profiles_for_card:
iidx_id = random.randint(10000000, 99999999)
- all_profiles_for_card['iidx_id'] = iidx_id
+ all_profiles_for_card["iidx_id"] = iidx_id
if game_version == 20:
- all_profiles_for_card['version'][str(game_version)] = {
- 'game_version': game_version,
- 'djname': name,
- 'region': int(pid),
- 'head': 0,
- 'hair': 0,
- 'face': 0,
- 'hand': 0,
- 'body': 0,
- 'turntable': 0,
- 'explosion': 0,
- 'bgm': 0,
- 'folder_mask': 0,
- 'sudden': 0,
- 'categoryvoice': 0,
- 'note': 0,
- 'fullcombo': 0,
- 'keybeam': 0,
- 'judgestring': 0,
- 'soundpreview': 0,
- 'dach': 0,
- 'dp_opt': 0,
- 'dp_opt2': 0,
- 'dpnum': 0,
- 'gno': 0,
- 'gpos': 0,
- 'help': 0,
- 'hispeed': 0,
- 'judge': 0,
- 'judgeAdj': 0,
- 'lift': 0,
- 'mode': 0,
- 'notes': 0,
- 'opstyle': 0,
- 'pase': 0,
- 'pmode': 0,
- 'sach': 0,
- 'sdhd': 50,
- 'sdtype': 0,
- 'sp_opt': 0,
- 'spnum': 0,
- 'timing': 0,
- 'deller': 0,
-
+ all_profiles_for_card["version"][str(game_version)] = {
+ "game_version": game_version,
+ "djname": name,
+ "region": int(pid),
+ "head": 0,
+ "hair": 0,
+ "face": 0,
+ "hand": 0,
+ "body": 0,
+ "turntable": 0,
+ "explosion": 0,
+ "bgm": 0,
+ "folder_mask": 0,
+ "sudden": 0,
+ "categoryvoice": 0,
+ "note": 0,
+ "fullcombo": 0,
+ "keybeam": 0,
+ "judgestring": 0,
+ "soundpreview": 0,
+ "dach": 0,
+ "dp_opt": 0,
+ "dp_opt2": 0,
+ "dpnum": 0,
+ "gno": 0,
+ "gpos": 0,
+ "help": 0,
+ "hispeed": 0,
+ "judge": 0,
+ "judgeAdj": 0,
+ "lift": 0,
+ "mode": 0,
+ "notes": 0,
+ "opstyle": 0,
+ "pase": 0,
+ "pmode": 0,
+ "sach": 0,
+ "sdhd": 50,
+ "sdtype": 0,
+ "sp_opt": 0,
+ "spnum": 0,
+ "timing": 0,
+ "deller": 0,
# Step up mode
- 'stepup_stamp': "",
- 'stepup_help': "",
- 'stepup_dp_ach': 0,
- 'stepup_dp_hdpt': 0,
- 'stepup_dp_level': 0,
- 'stepup_dp_mplay': 0,
- 'stepup_dp_round': 0,
- 'stepup_review': 0,
- 'stepup_sp_ach': 0,
- 'stepup_sp_hdpt': 0,
- 'stepup_sp_level': 0,
- 'stepup_sp_mplay': 0,
- 'stepup_sp_round': 0,
-
+ "stepup_stamp": "",
+ "stepup_help": "",
+ "stepup_dp_ach": 0,
+ "stepup_dp_hdpt": 0,
+ "stepup_dp_level": 0,
+ "stepup_dp_mplay": 0,
+ "stepup_dp_round": 0,
+ "stepup_review": 0,
+ "stepup_sp_ach": 0,
+ "stepup_sp_hdpt": 0,
+ "stepup_sp_level": 0,
+ "stepup_sp_mplay": 0,
+ "stepup_sp_round": 0,
# Grades
- 'grade_single': -1,
- 'grade_double': -1,
- 'grade_values': [],
-
+ "grade_single": -1,
+ "grade_double": -1,
+ "grade_values": [],
# Achievements
- 'achievements_trophy': [0] * 80,
- 'achievements_last_weekly': 0,
- 'achievements_pack_comp': 0,
- 'achievements_pack_flg': 0,
- 'achievements_pack_id': 0,
- 'achievements_play_pack': 0,
- 'achievements_visit_flg': 0,
- 'achievements_weekly_num': 0,
-
+ "achievements_trophy": [0] * 80,
+ "achievements_last_weekly": 0,
+ "achievements_pack_comp": 0,
+ "achievements_pack_flg": 0,
+ "achievements_pack_id": 0,
+ "achievements_play_pack": 0,
+ "achievements_visit_flg": 0,
+ "achievements_weekly_num": 0,
# Web UI/Other options
- '_show_category_grade': 0,
- '_show_category_status': 1,
- '_show_category_difficulty': 1,
- '_show_category_alphabet': 1,
- '_show_category_rival_play': 0,
- '_show_category_rival_winlose': 0,
- '_show_rival_shop_info': 0,
- '_hide_play_count': 0,
- '_hide_rival_info': 1,
+ "_show_category_grade": 0,
+ "_show_category_status": 1,
+ "_show_category_difficulty": 1,
+ "_show_category_alphabet": 1,
+ "_show_category_rival_play": 0,
+ "_show_category_rival_winlose": 0,
+ "_show_rival_shop_info": 0,
+ "_hide_play_count": 0,
+ "_hide_rival_info": 1,
}
elif game_version == 19:
- all_profiles_for_card['version'][str(game_version)] = {
- 'game_version': game_version,
- 'djname': name,
- 'region': int(pid),
- 'head': 0,
- 'hair': 0,
- 'face': 0,
- 'hand': 0,
- 'body': 0,
- 'frame': 0,
- 'turntable': 0,
- 'explosion': 0,
- 'bgm': 0,
- 'folder_mask': 0,
- 'sudden': 0,
- 'categoryvoice': 0,
- 'note': 0,
- 'fullcombo': 0,
- 'keybeam': 0,
- 'judgestring': 0,
- 'dach': 0,
- 'dp_opt': 0,
- 'dp_opt2': 0,
- 'dpnum': 0,
- 'gno': 0,
- 'help': 0,
- 'lift': 0,
- 'mode': 0,
- 'notes': 0,
- 'pase': 0,
- 'pmode': 0,
- 'sach': 0,
- 'sdhd': 50,
- 'sdtype': 0,
- 'sp_opt': 0,
- 'spnum': 0,
- 'timing': 0,
-
+ all_profiles_for_card["version"][str(game_version)] = {
+ "game_version": game_version,
+ "djname": name,
+ "region": int(pid),
+ "head": 0,
+ "hair": 0,
+ "face": 0,
+ "hand": 0,
+ "body": 0,
+ "frame": 0,
+ "turntable": 0,
+ "explosion": 0,
+ "bgm": 0,
+ "folder_mask": 0,
+ "sudden": 0,
+ "categoryvoice": 0,
+ "note": 0,
+ "fullcombo": 0,
+ "keybeam": 0,
+ "judgestring": 0,
+ "dach": 0,
+ "dp_opt": 0,
+ "dp_opt2": 0,
+ "dpnum": 0,
+ "gno": 0,
+ "help": 0,
+ "lift": 0,
+ "mode": 0,
+ "notes": 0,
+ "pase": 0,
+ "pmode": 0,
+ "sach": 0,
+ "sdhd": 50,
+ "sdtype": 0,
+ "sp_opt": 0,
+ "spnum": 0,
+ "timing": 0,
# Grades
- 'grade_single': -1,
- 'grade_double': -1,
- 'grade_values': [],
-
+ "grade_single": -1,
+ "grade_double": -1,
+ "grade_values": [],
# Web UI/Other options
- '_show_category_grade': 0,
- '_show_category_status': 1,
- '_show_category_difficulty': 1,
- '_show_category_alphabet': 1,
- '_show_category_rival_play': 0,
- '_show_category_rival_winlose': 0,
- '_show_rival_shop_info': 0,
- '_hide_play_count': 0,
- '_hide_rival_info': 1,
+ "_show_category_grade": 0,
+ "_show_category_status": 1,
+ "_show_category_difficulty": 1,
+ "_show_category_alphabet": 1,
+ "_show_category_rival_play": 0,
+ "_show_category_rival_winlose": 0,
+ "_show_rival_shop_info": 0,
+ "_hide_play_count": 0,
+ "_hide_rival_info": 1,
}
elif game_version == 18:
- all_profiles_for_card['version'][str(game_version)] = {
- 'game_version': game_version,
- 'djname': name,
- 'region': int(pid),
- 'frame': 0,
- 'turntable': 0,
- 'explosion': 0,
- 'bgm': 0,
- 'folder_mask': 0,
- 'sudden': 0,
- 'dach': 0,
- 'dp_opt': 0,
- 'dp_opt2': 0,
- 'dpnum': 0,
- 'gno': 0,
- 'lift': 0,
- 'mode': 0,
- 'pmode': 0,
- 'sach': 0,
- 'sdhd': 50,
- 'sdtype': 0,
- 'sp_opt': 0,
- 'spnum': 0,
- 'timing': 0,
-
+ all_profiles_for_card["version"][str(game_version)] = {
+ "game_version": game_version,
+ "djname": name,
+ "region": int(pid),
+ "frame": 0,
+ "turntable": 0,
+ "explosion": 0,
+ "bgm": 0,
+ "folder_mask": 0,
+ "sudden": 0,
+ "dach": 0,
+ "dp_opt": 0,
+ "dp_opt2": 0,
+ "dpnum": 0,
+ "gno": 0,
+ "lift": 0,
+ "mode": 0,
+ "pmode": 0,
+ "sach": 0,
+ "sdhd": 50,
+ "sdtype": 0,
+ "sp_opt": 0,
+ "spnum": 0,
+ "timing": 0,
# Grades
- 'grade_single': -1,
- 'grade_double': -1,
- 'grade_values': [],
-
+ "grade_single": -1,
+ "grade_double": -1,
+ "grade_values": [],
# Web UI/Other options
- '_show_category_grade': 0,
- '_show_category_status': 1,
- '_show_category_difficulty': 1,
- '_show_category_alphabet': 1,
- '_show_category_rival_play': 0,
- '_show_category_rival_winlose': 0,
- '_show_rival_shop_info': 0,
- '_hide_play_count': 0,
- '_hide_rival_info': 1,
+ "_show_category_grade": 0,
+ "_show_category_status": 1,
+ "_show_category_difficulty": 1,
+ "_show_category_alphabet": 1,
+ "_show_category_rival_play": 0,
+ "_show_category_rival_winlose": 0,
+ "_show_rival_shop_info": 0,
+ "_hide_play_count": 0,
+ "_hide_rival_info": 1,
}
- db.upsert(all_profiles_for_card, where('card') == cid)
+ db.upsert(all_profiles_for_card, where("card") == cid)
card, card_split = get_id_from_profile(cid)
- response = E.response(
- E.pc(
- id=card,
- id_str=card_split
- )
- )
+ response = E.response(E.pc(id=card, id_str=card_split))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/pc/logout')
+@router.post("/{gameinfo}/pc/logout")
async def pc_logout(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.pc()
- )
+ response = E.response(E.pc())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/ranking.py b/modules/iidx/ranking.py
index 05f7634..844ca24 100644
--- a/modules/iidx/ranking.py
+++ b/modules/iidx/ranking.py
@@ -8,13 +8,11 @@ router = APIRouter(prefix="/local", tags=["local"])
router.model_whitelist = ["LDJ", "KDZ", "JDZ"]
-@router.post('/{gameinfo}/ranking/getranker')
+@router.post("/{gameinfo}/ranking/getranker")
async def ranking_getranker(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.ranking()
- )
+ response = E.response(E.ranking())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/iidx/shop.py b/modules/iidx/shop.py
index 991fab2..75177f9 100644
--- a/modules/iidx/shop.py
+++ b/modules/iidx/shop.py
@@ -8,7 +8,7 @@ router = APIRouter(prefix="/local", tags=["local"])
router.model_whitelist = ["LDJ", "KDZ", "JDZ"]
-@router.post('/{gameinfo}/shop/getname')
+@router.post("/{gameinfo}/shop/getname")
async def shop_getname(request: Request):
request_info = await core_process_request(request)
@@ -24,7 +24,7 @@ async def shop_getname(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/shop/getconvention')
+@router.post("/{gameinfo}/shop/getconvention")
async def shop_getconvention(request: Request):
request_info = await core_process_request(request)
@@ -44,26 +44,21 @@ async def shop_getconvention(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/shop/sentinfo')
+@router.post("/{gameinfo}/shop/sentinfo")
async def shop_sentinfo(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.shop()
- )
+ response = E.response(E.shop())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/shop/sendescapepackageinfo')
+
+@router.post("/{gameinfo}/shop/sendescapepackageinfo")
async def shop_sendescapepackageinfo(request: Request):
request_info = await core_process_request(request)
- response = E.response(
- E.shop(
- expire=1200
- )
- )
+ response = E.response(E.shop(expire=1200))
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
diff --git a/modules/sdvx/eventlog.py b/modules/sdvx/eventlog.py
index 32bddcc..4f533c7 100644
--- a/modules/sdvx/eventlog.py
+++ b/modules/sdvx/eventlog.py
@@ -8,8 +8,8 @@ router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["KFC"]
-@router.post('/{gameinfo}/eventlog/write')
-async def eventlog_write(request: Request):
+@router.post("/{gameinfo}/eventlog/write")
+async def sdvx_eventlog_write(request: Request):
request_info = await core_process_request(request)
response = E.response(
diff --git a/modules/sdvx/game.py b/modules/sdvx/game.py
index b34d5c7..21a7235 100644
--- a/modules/sdvx/game.py
+++ b/modules/sdvx/game.py
@@ -14,71 +14,67 @@ router.model_whitelist = ["KFC"]
def get_profile(cid):
- return get_db().table('sdvx_profile').get(
- where('card') == cid
- )
+ return get_db().table("sdvx_profile").get(where("card") == cid)
def get_game_profile(cid, game_version):
profile = get_profile(cid)
- return profile['version'].get(str(game_version), None)
+ return profile["version"].get(str(game_version), None)
def get_id_from_profile(cid):
- profile = get_db().table('sdvx_profile').get(
- where('card') == cid
- )
+ profile = get_db().table("sdvx_profile").get(where("card") == cid)
- djid = "%08d" % profile['sdvx_id']
- djid_split = '-'.join([djid[:4], djid[4:]])
+ djid = "%08d" % profile["sdvx_id"]
+ djid_split = "-".join([djid[:4], djid[4:]])
- return profile['sdvx_id'], djid_split
+ return profile["sdvx_id"], djid_split
-@router.post('/{gameinfo}/game/sv6_common')
+@router.post("/{gameinfo}/game/sv6_common")
async def game_sv6_common(request: Request):
request_info = await core_process_request(request)
event = [
- 'DEMOGAME_PLAY',
- 'MATCHING_MODE',
- 'MATCHING_MODE_FREE_IP',
- 'LEVEL_LIMIT_EASING',
- 'ACHIEVEMENT_ENABLE',
- 'APICAGACHADRAW\t30',
- 'VOLFORCE_ENABLE',
- 'AKANAME_ENABLE',
- 'PAUSE_ONLINEUPDATE',
- 'CONTINUATION',
- 'TENKAICHI_MODE',
- 'QC_MODE',
- 'KAC_MODE',
- 'APPEAL_CARD_GEN_PRICE\t100',
- 'APPEAL_CARD_GEN_NEW_PRICE\t200',
- 'APPEAL_CARD_UNLOCK\t0,20170914,0,20171014,0,20171116,0,20180201,0,20180607,0,20181206,0,20200326,0,20200611,4,10140732,6,10150431',
- 'FAVORITE_APPEALCARD_MAX\t200',
- 'FAVORITE_MUSIC_MAX\t200',
- 'EVENTDATE_APRILFOOL',
- 'KONAMI_50TH_LOGO',
- 'OMEGA_ARS_ENABLE',
- 'DISABLE_MONITOR_ID_CHECK',
- 'SKILL_ANALYZER_ABLE',
- 'BLASTER_ABLE',
- 'STANDARD_UNLOCK_ENABLE',
- 'PLAYERJUDGEADJ_ENABLE',
- 'MIXID_INPUT_ENABLE',
- 'EVENTDATE_ONIGO',
- 'EVENTDATE_GOTT',
- 'GENERATOR_ABLE',
- 'CREW_SELECT_ABLE',
- 'PREMIUM_TIME_ENABLE',
- 'OMEGA_ENABLE\t1,2,3,4,5,6,7,8,9',
- 'HEXA_ENABLE\t1,2,3,4,5',
- 'MEGAMIX_ENABLE',
- 'VALGENE_ENABLE',
- 'ARENA_ENABLE',
- 'DISP_PASELI_BANNER',
+ "DEMOGAME_PLAY",
+ "MATCHING_MODE",
+ "MATCHING_MODE_FREE_IP",
+ "LEVEL_LIMIT_EASING",
+ "ACHIEVEMENT_ENABLE",
+ "APICAGACHADRAW\t30",
+ "VOLFORCE_ENABLE",
+ "AKANAME_ENABLE",
+ "PAUSE_ONLINEUPDATE",
+ "CONTINUATION",
+ "TENKAICHI_MODE",
+ "QC_MODE",
+ "KAC_MODE",
+ # "APPEAL_CARD_GEN_PRICE\t100",
+ # "APPEAL_CARD_GEN_NEW_PRICE\t200",
+ # "APPEAL_CARD_UNLOCK\t0,20170914,0,20171014,0,20171116,0,20180201,0,20180607,0,20181206,0,20200326,0,20200611,4,10140732,6,10150431",
+ "FAVORITE_APPEALCARD_MAX\t200",
+ "FAVORITE_MUSIC_MAX\t200",
+ "EVENTDATE_APRILFOOL",
+ "KONAMI_50TH_LOGO",
+ "OMEGA_ARS_ENABLE",
+ "DISABLE_MONITOR_ID_CHECK",
+ "SKILL_ANALYZER_ABLE",
+ "BLASTER_ABLE",
+ "STANDARD_UNLOCK_ENABLE",
+ "PLAYERJUDGEADJ_ENABLE",
+ "MIXID_INPUT_ENABLE",
+ "EVENTDATE_ONIGO",
+ "EVENTDATE_GOTT",
+ "GENERATOR_ABLE",
+ "CREW_SELECT_ABLE",
+ "PREMIUM_TIME_ENABLE",
+ "OMEGA_ENABLE\t1,2,3,4,5,6,7,8,9",
+ "HEXA_ENABLE\t1,2,3,4,5",
+ "MEGAMIX_ENABLE",
+ "VALGENE_ENABLE",
+ "ARENA_ENABLE",
+ "DISP_PASELI_BANNER",
]
unlock = []
@@ -89,16 +85,22 @@ async def game_sv6_common(request: Request):
response = E.response(
E.game(
E.event(
- *[E.info(
- E.event_id(s, __type="str"),
- )for s in event],
+ *[
+ E.info(
+ E.event_id(s, __type="str"),
+ )
+ for s in event
+ ],
),
E.music_limited(
- *[E.info(
- E.music_id(s[0], __type="s32"),
- E.music_type(s[1], __type="u8"),
- E.limited(3, __type="u8"),
- )for s in unlock],
+ *[
+ E.info(
+ E.music_id(s[0], __type="s32"),
+ E.music_type(s[1], __type="u8"),
+ E.limited(3, __type="u8"),
+ )
+ for s in unlock
+ ],
),
)
)
@@ -107,71 +109,68 @@ async def game_sv6_common(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_new')
+@router.post("/{gameinfo}/game/sv6_new")
async def game_sv6_new(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- root = request_info['root'][0]
+ root = request_info["root"][0]
dataid = root.find("dataid").text
cardno = root.find("cardno").text
name = root.find("name").text
- db = get_db().table('sdvx_profile')
+ db = get_db().table("sdvx_profile")
all_profiles_for_card = db.get(Query().card == dataid)
if all_profiles_for_card is None:
- all_profiles_for_card = {
- 'card': dataid,
- 'version': {}
- }
+ all_profiles_for_card = {"card": dataid, "version": {}}
- if 'sdvx_id' not in all_profiles_for_card:
+ if "sdvx_id" not in all_profiles_for_card:
sdvx_id = random.randint(10000000, 99999999)
- all_profiles_for_card['sdvx_id'] = sdvx_id
+ all_profiles_for_card["sdvx_id"] = sdvx_id
- all_profiles_for_card['version'][str(game_version)] = {
- 'game_version': game_version,
- 'name': name,
- 'appeal_id': 0,
- 'skill_level': 0,
- 'skill_base_id': 0,
- 'skill_name_id': 0,
- 'earned_gamecoin_packet': 0,
- 'earned_gamecoin_block': 0,
- 'earned_blaster_energy': 0,
- 'earned_extrack_energy': 0,
- 'used_packet_booster': 0,
- 'used_block_booster': 0,
- 'hispeed': 0,
- 'lanespeed': 0,
- 'gauge_option': 0,
- 'ars_option': 0,
- 'notes_option': 0,
- 'early_late_disp': 0,
- 'draw_adjust': 0,
- 'eff_c_left': 0,
- 'eff_c_right': 1,
- 'music_id': 0,
- 'music_type': 0,
- 'sort_type': 0,
- 'narrow_down': 0,
- 'headphone': 1,
- 'print_count': 0,
- 'start_option': 0,
- 'bgm': 0,
- 'submonitor': 0,
- 'nemsys': 0,
- 'stampA': 0,
- 'stampB': 0,
- 'stampC': 0,
- 'stampD': 0,
- 'items': [],
- 'params': [],
+ all_profiles_for_card["version"][str(game_version)] = {
+ "game_version": game_version,
+ "name": name,
+ "appeal_id": 0,
+ "skill_level": 0,
+ "skill_base_id": 0,
+ "skill_name_id": 0,
+ "earned_gamecoin_packet": 0,
+ "earned_gamecoin_block": 0,
+ "earned_blaster_energy": 0,
+ "earned_extrack_energy": 0,
+ "used_packet_booster": 0,
+ "used_block_booster": 0,
+ "hispeed": 0,
+ "lanespeed": 0,
+ "gauge_option": 0,
+ "ars_option": 0,
+ "notes_option": 0,
+ "early_late_disp": 0,
+ "draw_adjust": 0,
+ "eff_c_left": 0,
+ "eff_c_right": 1,
+ "music_id": 0,
+ "music_type": 0,
+ "sort_type": 0,
+ "narrow_down": 0,
+ "headphone": 1,
+ "print_count": 0,
+ "start_option": 0,
+ "bgm": 0,
+ "submonitor": 0,
+ "nemsys": 0,
+ "stampA": 0,
+ "stampB": 0,
+ "stampC": 0,
+ "stampD": 0,
+ "items": [],
+ "params": [],
}
- db.upsert(all_profiles_for_card, where('card') == dataid)
+ db.upsert(all_profiles_for_card, where("card") == dataid)
response = E.response(
E.game(
@@ -183,12 +182,12 @@ async def game_sv6_new(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_load')
+@router.post("/{gameinfo}/game/sv6_load")
async def game_sv6_load(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- dataid = request_info['root'][0].find("dataid").text
+ dataid = request_info["root"][0].find("dataid").text
profile = get_game_profile(dataid, game_version)
if profile:
@@ -200,28 +199,42 @@ async def game_sv6_load(request: Request):
for i in range(6001):
unlock.append([i, 1, 1])
unlock.append([599, 4, 10])
- for item in profile['items']:
+ for item in profile["items"]:
unlock.append(item)
- customize = [[2, 2, [profile['bgm'], profile['submonitor'], profile['nemsys'], profile['stampA'], profile['stampB'], profile['stampC'], profile['stampD']]]]
- for item in profile['params']:
+ customize = [
+ [
+ 2,
+ 2,
+ [
+ profile["bgm"],
+ profile["submonitor"],
+ profile["nemsys"],
+ profile["stampA"],
+ profile["stampB"],
+ profile["stampC"],
+ profile["stampD"],
+ ],
+ ]
+ ]
+ for item in profile["params"]:
customize.append(item)
-
+
response = E.response(
E.game(
E.result(0, __type="u8"),
- E.name(profile['name'], __type="str"),
+ E.name(profile["name"], __type="str"),
E.code(djid_split, __type="str"),
E.sdvx_id(djid_split, __type="str"),
- E.appeal_id(profile['appeal_id'], __type="u16"),
- E.skill_level(profile['skill_level'], __type="s16"),
- E.skill_base_id(profile['skill_base_id'], __type="s16"),
- E.skill_name_id(profile['skill_name_id'], __type="s16"),
- E.gamecoin_packet(profile['earned_gamecoin_packet'], __type="u32"),
- E.gamecoin_block(profile['earned_gamecoin_block'], __type="u32"),
- E.blaster_energy(profile['earned_blaster_energy'], __type="u32"),
+ E.appeal_id(profile["appeal_id"], __type="u16"),
+ E.skill_level(profile["skill_level"], __type="s16"),
+ E.skill_base_id(profile["skill_base_id"], __type="s16"),
+ E.skill_name_id(profile["skill_name_id"], __type="s16"),
+ E.gamecoin_packet(profile["earned_gamecoin_packet"], __type="u32"),
+ E.gamecoin_block(profile["earned_gamecoin_block"], __type="u32"),
+ E.blaster_energy(profile["earned_blaster_energy"], __type="u32"),
E.blaster_count(9999, __type="u32"),
- E.extrack_energy(profile['earned_extrack_energy'], __type="u16"),
+ E.extrack_energy(profile["earned_extrack_energy"], __type="u16"),
E.play_count(1001, __type="u32"),
E.day_count(301, __type="u32"),
E.today_count(21, __type="u32"),
@@ -232,41 +245,49 @@ async def game_sv6_load(request: Request):
E.week_chain(31, __type="u32"),
E.max_week_chain(1001, __type="u32"),
E.creator_id(1, __type="u32"),
- E.eaappli(
- E.relation(1, __type="s8")
- ),
+ E.eaappli(E.relation(1, __type="s8")),
E.ea_shop(
E.blaster_pass_enable(1, __type="bool"),
E.blaster_pass_limit_date(1605871200, __type="u64"),
),
- E.kac_id(profile['name'], __type="str"),
+ E.kac_id(profile["name"], __type="str"),
E.block_no(0, __type="s32"),
E.volte_factory(
- *[E.info(
- E.goods_id(s, __type="s32"),
- E.status(1, __type="s32"),
- )for s in range(1, 999)],
- ),
- *[E.campaign(
- E.campaign_id(s, __type="s32"),
- E.jackpot_flg(1, __type="bool"),
- )for s in range(99)],
- E.cloud(
- E.relation(1, __type="s8")
+ *[
+ E.info(
+ E.goods_id(s, __type="s32"),
+ E.status(1, __type="s32"),
+ )
+ for s in range(1, 999)
+ ],
),
+ *[
+ E.campaign(
+ E.campaign_id(s, __type="s32"),
+ E.jackpot_flg(1, __type="bool"),
+ )
+ for s in range(99)
+ ],
+ E.cloud(E.relation(1, __type="s8")),
E.something(
- *[E.info(
- E.ranking_id(s[0], __type="s32"),
- E.value(s[1], __type="s64"),
- )for s in [[1402, 20000]]],
+ *[
+ E.info(
+ E.ranking_id(s[0], __type="s32"),
+ E.value(s[1], __type="s64"),
+ )
+ for s in [[1402, 20000]]
+ ],
),
E.festival(
E.fes_id(1, __type="s32"),
E.live_energy(1000000, __type="s32"),
- *[E.bonus(
- E.energy_type(s, __type="s32"),
- E.live_energy(1000000, __type="s32"),
- )for s in range(1, 6)],
+ *[
+ E.bonus(
+ E.energy_type(s, __type="s32"),
+ E.live_energy(1000000, __type="s32"),
+ )
+ for s in range(1, 6)
+ ],
),
E.valgene_ticket(
E.ticket_num(0, __type="s32"),
@@ -281,33 +302,39 @@ async def game_sv6_load(request: Request):
E.rank_play_cnt(0, __type="s32"),
E.ultimate_play_cnt(0, __type="s32"),
),
- E.hispeed(profile['hispeed'], __type="s32"),
- E.lanespeed(profile['lanespeed'], __type="u32"),
- E.gauge_option(profile['gauge_option'], __type="u8"),
- E.ars_option(profile['ars_option'], __type="u8"),
- E.notes_option(profile['notes_option'], __type="u8"),
- E.early_late_disp(profile['early_late_disp'], __type="u8"),
- E.draw_adjust(profile['draw_adjust'], __type="s32"),
- E.eff_c_left(profile['eff_c_left'], __type="u8"),
- E.eff_c_right(profile['eff_c_right'], __type="u8"),
- E.last_music_id(profile['music_id'], __type="s32"),
- E.last_music_type(profile['music_type'], __type="u8"),
- E.sort_type(profile['sort_type'], __type="u8"),
- E.narrow_down(profile['narrow_down'], __type="u8"),
- E.headphone(profile['headphone'], __type="u8"),
+ E.hispeed(profile["hispeed"], __type="s32"),
+ E.lanespeed(profile["lanespeed"], __type="u32"),
+ E.gauge_option(profile["gauge_option"], __type="u8"),
+ E.ars_option(profile["ars_option"], __type="u8"),
+ E.notes_option(profile["notes_option"], __type="u8"),
+ E.early_late_disp(profile["early_late_disp"], __type="u8"),
+ E.draw_adjust(profile["draw_adjust"], __type="s32"),
+ E.eff_c_left(profile["eff_c_left"], __type="u8"),
+ E.eff_c_right(profile["eff_c_right"], __type="u8"),
+ E.last_music_id(profile["music_id"], __type="s32"),
+ E.last_music_type(profile["music_type"], __type="u8"),
+ E.sort_type(profile["sort_type"], __type="u8"),
+ E.narrow_down(profile["narrow_down"], __type="u8"),
+ E.headphone(profile["headphone"], __type="u8"),
E.item(
- *[E.info(
- E.id(s[0], __type="u32"),
- E.type(s[1], __type="u8"),
- E.param(s[2], __type="u32"),
- )for s in unlock],
+ *[
+ E.info(
+ E.id(s[0], __type="u32"),
+ E.type(s[1], __type="u8"),
+ E.param(s[2], __type="u32"),
+ )
+ for s in unlock
+ ],
),
E.param(
- *[E.info(
- E.type(s[0], __type="s32"),
- E.id(s[1], __type="s32"),
- E.param(s[2], __type="s32", __count=len(s[2])),
- )for s in customize],
+ *[
+ E.info(
+ E.type(s[0], __type="s32"),
+ E.id(s[1], __type="s32"),
+ E.param(s[2], __type="s32", __count=len(s[2])),
+ )
+ for s in customize
+ ],
),
),
)
@@ -323,51 +350,55 @@ async def game_sv6_load(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_load_m')
+@router.post("/{gameinfo}/game/sv6_load_m")
async def game_sv6_load_m(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- dataid = request_info['root'][0].find("refid").text
+ dataid = request_info["root"][0].find("refid").text
profile = get_game_profile(dataid, game_version)
djid, djid_split = get_id_from_profile(dataid)
best_scores = []
db = get_db()
- for record in db.table('sdvx_scores_best').search(
- (where('game_version') == game_version)
- & (where('sdvx_id') == djid)
+ for record in db.table("sdvx_scores_best").search(
+ (where("game_version") == game_version) & (where("sdvx_id") == djid)
):
- best_scores.append([
- record['music_id'],
- record['music_type'],
- record['score'],
- record['exscore'],
- record['clear_type'],
- record['score_grade'],
- 0,
- 0,
- record['btn_rate'],
- record['long_rate'],
- record['vol_rate'],
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- ])
+ best_scores.append(
+ [
+ record["music_id"],
+ record["music_type"],
+ record["score"],
+ record["exscore"],
+ record["clear_type"],
+ record["score_grade"],
+ 0,
+ 0,
+ record["btn_rate"],
+ record["long_rate"],
+ record["vol_rate"],
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ ]
+ )
response = E.response(
E.game(
E.music(
- *[E.info(
- E.param(x, __type="u32"),
- )for x in best_scores],
+ *[
+ E.info(
+ E.param(x, __type="u32"),
+ )
+ for x in best_scores
+ ],
),
),
)
@@ -376,67 +407,79 @@ async def game_sv6_load_m(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_save')
+@router.post("/{gameinfo}/game/sv6_save")
async def game_sv6_save(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
- dataid = request_info['root'][0].find("refid").text
+ dataid = request_info["root"][0].find("refid").text
profile = get_profile(dataid)
- game_profile = profile['version'].get(str(game_version), {})
+ game_profile = profile["version"].get(str(game_version), {})
- root = request_info['root'][0]
+ root = request_info["root"][0]
- game_profile['appeal_id'] = int(root.find('appeal_id').text)
+ game_profile["appeal_id"] = int(root.find("appeal_id").text)
nodes = [
- 'appeal_id',
- 'skill_level',
- 'skill_base_id',
- 'skill_name_id',
- 'earned_gamecoin_packet',
- 'earned_gamecoin_block',
- 'earned_blaster_energy',
- 'earned_extrack_energy',
- 'hispeed',
- 'lanespeed',
- 'gauge_option',
- 'ars_option',
- 'notes_option',
- 'early_late_disp',
- 'draw_adjust',
- 'eff_c_left',
- 'eff_c_right',
- 'music_id',
- 'music_type',
- 'sort_type',
- 'narrow_down',
- 'headphone',
- 'start_option',
+ "appeal_id",
+ "skill_level",
+ "skill_base_id",
+ "skill_name_id",
+ "earned_gamecoin_packet",
+ "earned_gamecoin_block",
+ "earned_blaster_energy",
+ "earned_extrack_energy",
+ "hispeed",
+ "lanespeed",
+ "gauge_option",
+ "ars_option",
+ "notes_option",
+ "early_late_disp",
+ "draw_adjust",
+ "eff_c_left",
+ "eff_c_right",
+ "music_id",
+ "music_type",
+ "sort_type",
+ "narrow_down",
+ "headphone",
+ "start_option",
]
-
+
for node in nodes:
game_profile[node] = int(root.find(node).text)
- game_profile['used_packet_booster'] = int(root.find('ea_shop')[0].text)
- game_profile['used_block_booster'] = int(root.find('ea_shop')[1].text)
- game_profile['print_count'] = int(root.find('print')[0].text)
+ game_profile["used_packet_booster"] = int(root.find("ea_shop")[0].text)
+ game_profile["used_block_booster"] = int(root.find("ea_shop")[1].text)
+ game_profile["print_count"] = int(root.find("print")[0].text)
items = []
- for info in root.find('item'):
- items.append([int(info.find('id').text), int(info.find('type').text), int(info.find('param').text)])
- game_profile['items'] = items
+ for info in root.find("item"):
+ items.append(
+ [
+ int(info.find("id").text),
+ int(info.find("type").text),
+ int(info.find("param").text),
+ ]
+ )
+ game_profile["items"] = items
params = []
- for info in root.find('param'):
- p = info.find('param')
- params.append([int(info.find('type').text), int(info.find('id').text), [int(x) for x in p.text.split(' ')]])
- game_profile['params'] = params
+ for info in root.find("param"):
+ p = info.find("param")
+ params.append(
+ [
+ int(info.find("type").text),
+ int(info.find("id").text),
+ [int(x) for x in p.text.split(" ")],
+ ]
+ )
+ game_profile["params"] = params
- profile['version'][str(game_version)] = game_profile
+ profile["version"][str(game_version)] = game_profile
- get_db().table('sdvx_profile').upsert(profile, where('card') == dataid)
+ get_db().table("sdvx_profile").upsert(profile, where("card") == dataid)
response = E.response(
E.game(),
@@ -446,20 +489,19 @@ async def game_sv6_save(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_save_m')
+@router.post("/{gameinfo}/game/sv6_save_m")
async def game_sv6_save_m(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
timestamp = time.time()
- root = request_info['root'][0]
+ root = request_info["root"][0]
dataid = root.find("dataid").text
profile = get_game_profile(dataid, game_version)
djid, djid_split = get_id_from_profile(dataid)
-
track = root.find("track")
play_id = int(track.find("play_id").text)
music_id = int(track.find("music_id").text)
@@ -484,70 +526,70 @@ async def game_sv6_save_m(request: Request):
local_num = int(track.find("local_num").text)
challenge_type = int(track.find("challenge_type").text)
retry_cnt = int(track.find("retry_cnt").text)
- judge = [int(x) for x in track.find("judge").text.split(' ')]
+ judge = [int(x) for x in track.find("judge").text.split(" ")]
db = get_db()
- db.table('sdvx_scores').insert(
+ db.table("sdvx_scores").insert(
{
- 'timestamp': timestamp,
- 'game_version': game_version,
- 'sdvx_id': djid,
- 'play_id': play_id,
- 'music_id': music_id,
- 'music_type': music_type,
- 'score': score,
- 'exscore': exscore,
- 'clear_type': clear_type,
- 'score_grade': score_grade,
- 'max_chain': max_chain,
- 'just': just,
- 'critical': critical,
- 'near': near,
- 'error': error,
- 'effective_rate': effective_rate,
- 'btn_rate': btn_rate,
- 'long_rate': long_rate,
- 'vol_rate': vol_rate,
- 'mode': mode,
- 'gauge_type': gauge_type,
- 'notes_option': notes_option,
- 'online_num': online_num,
- 'local_num': local_num,
- 'challenge_type': challenge_type,
- 'retry_cnt': retry_cnt,
- 'judge': judge,
+ "timestamp": timestamp,
+ "game_version": game_version,
+ "sdvx_id": djid,
+ "play_id": play_id,
+ "music_id": music_id,
+ "music_type": music_type,
+ "score": score,
+ "exscore": exscore,
+ "clear_type": clear_type,
+ "score_grade": score_grade,
+ "max_chain": max_chain,
+ "just": just,
+ "critical": critical,
+ "near": near,
+ "error": error,
+ "effective_rate": effective_rate,
+ "btn_rate": btn_rate,
+ "long_rate": long_rate,
+ "vol_rate": vol_rate,
+ "mode": mode,
+ "gauge_type": gauge_type,
+ "notes_option": notes_option,
+ "online_num": online_num,
+ "local_num": local_num,
+ "challenge_type": challenge_type,
+ "retry_cnt": retry_cnt,
+ "judge": judge,
},
)
-
- best = db.table('sdvx_scores_best').get(
- (where('sdvx_id') == djid)
- & (where('game_version') == game_version)
- & (where('music_id') == music_id)
- & (where('music_type') == music_type)
+
+ best = db.table("sdvx_scores_best").get(
+ (where("sdvx_id") == djid)
+ & (where("game_version") == game_version)
+ & (where("music_id") == music_id)
+ & (where("music_type") == music_type)
)
best = {} if best is None else best
best_score_data = {
- 'game_version': game_version,
- 'sdvx_id': djid,
- 'name': profile['name'],
- 'music_id': music_id,
- 'music_type': music_type,
- 'score': max(score, best.get('score', score)),
- 'exscore': max(exscore, best.get('exscore', exscore)),
- 'clear_type': max(clear_type, best.get('clear_type', clear_type)),
- 'score_grade': max(score_grade, best.get('score_grade', score_grade)),
- 'btn_rate': max(btn_rate, best.get('btn_rate', btn_rate)),
- 'long_rate': max(long_rate, best.get('long_rate', long_rate)),
- 'vol_rate': max(vol_rate, best.get('vol_rate', vol_rate)),
+ "game_version": game_version,
+ "sdvx_id": djid,
+ "name": profile["name"],
+ "music_id": music_id,
+ "music_type": music_type,
+ "score": max(score, best.get("score", score)),
+ "exscore": max(exscore, best.get("exscore", exscore)),
+ "clear_type": max(clear_type, best.get("clear_type", clear_type)),
+ "score_grade": max(score_grade, best.get("score_grade", score_grade)),
+ "btn_rate": max(btn_rate, best.get("btn_rate", btn_rate)),
+ "long_rate": max(long_rate, best.get("long_rate", long_rate)),
+ "vol_rate": max(vol_rate, best.get("vol_rate", vol_rate)),
}
- db.table('sdvx_scores_best').upsert(
+ db.table("sdvx_scores_best").upsert(
best_score_data,
- (where('sdvx_id') == djid)
- & (where('game_version') == game_version)
- & (where('music_id') == music_id)
- & (where('music_type') == music_type)
+ (where("sdvx_id") == djid)
+ & (where("game_version") == game_version)
+ & (where("music_id") == music_id)
+ & (where("music_type") == music_type),
)
response = E.response(
@@ -558,37 +600,42 @@ async def game_sv6_save_m(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_hiscore')
+@router.post("/{gameinfo}/game/sv6_hiscore")
async def game_sv6_hiscore(request: Request):
request_info = await core_process_request(request)
- game_version = request_info['game_version']
+ game_version = request_info["game_version"]
best_scores = []
db = get_db()
- for record in db.table('sdvx_scores_best').search(
- (where('game_version') == game_version)
+ for record in db.table("sdvx_scores_best").search(
+ (where("game_version") == game_version)
):
- best_scores.append([
- record['music_id'],
- record['music_type'],
- record['sdvx_id'],
- record['name'],
- record['score'],
- ])
+ best_scores.append(
+ [
+ record["music_id"],
+ record["music_type"],
+ record["sdvx_id"],
+ record["name"],
+ record["score"],
+ ]
+ )
response = E.response(
E.game(
E.sc(
- *[E.d(
- E.id(s[0], __type="u32"),
- E.ty(s[1], __type="u32"),
- E.a_sq(s[2], __type="str"),
- E.a_nm(s[3], __type="str"),
- E.a_sc(s[4], __type="u32"),
- E.l_sq(s[2], __type="str"),
- E.l_nm(s[3], __type="str"),
- E.l_sc(s[4], __type="u32"),
- )for s in best_scores],
+ *[
+ E.d(
+ E.id(s[0], __type="u32"),
+ E.ty(s[1], __type="u32"),
+ E.a_sq(s[2], __type="str"),
+ E.a_nm(s[3], __type="str"),
+ E.a_sc(s[4], __type="u32"),
+ E.l_sq(s[2], __type="str"),
+ E.l_nm(s[3], __type="str"),
+ E.l_sc(s[4], __type="u32"),
+ )
+ for s in best_scores
+ ],
),
),
)
@@ -597,28 +644,24 @@ async def game_sv6_hiscore(request: Request):
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_lounge')
+@router.post("/{gameinfo}/game/sv6_lounge")
async def game_sv6_lounge(request: Request):
request_info = await core_process_request(request)
response = E.response(
- E.game(
- E.interval(30, __type="u32")
- ),
+ E.game(E.interval(30, __type="u32")),
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
-@router.post('/{gameinfo}/game/sv6_shop')
+@router.post("/{gameinfo}/game/sv6_shop")
async def game_sv6_shop(request: Request):
request_info = await core_process_request(request)
response = E.response(
- E.game(
- E.nxt_time(1000 * 5 * 60, __type="u32")
- ),
+ E.game(E.nxt_time(1000 * 5 * 60, __type="u32")),
)
response_body, response_headers = await core_prepare_response(request, response)
@@ -626,17 +669,18 @@ async def game_sv6_shop(request: Request):
for stub in [
- 'load_r',
- 'frozen',
- 'save_e',
- 'save_mega',
- 'play_e',
- 'play_s',
- 'entry_s',
- 'entry_e',
- 'log'
+ "load_r",
+ "frozen",
+ "save_e",
+ "save_mega",
+ "play_e",
+ "play_s",
+ "entry_s",
+ "entry_e",
+ "log",
]:
- @router.post(f'/{{gameinfo}}/game/sv6_{stub}')
+
+ @router.post(f"/{{gameinfo}}/game/sv6_{stub}")
async def game_sv6_stub(request: Request):
request_info = await core_process_request(request)
diff --git a/pyeamu.py b/pyeamu.py
index 7e26ab4..80c0007 100644
--- a/pyeamu.py
+++ b/pyeamu.py
@@ -10,12 +10,14 @@ import modules
from core_common import core_process_request, core_prepare_response, E
-def urlpathjoin(parts, sep='/'):
+def urlpathjoin(parts, sep="/"):
return sep + sep.join([x.lstrip(sep) for x in parts])
server_address = f"{config.ip}:{config.port}"
-server_services_url = urlunparse(('http', server_address, config.services_prefix, None, None, None))
+server_services_url = urlunparse(
+ ("http", server_address, config.services_prefix, None, None, None)
+)
keepalive_address = "127.0.0.1"
app = FastAPI()
@@ -38,7 +40,7 @@ if __name__ == "__main__":
print("|____/ \__,_|___/_|_| |_|\___||___/___/")
print()
print(f"{server_services_url}")
- print("1")
+ print('1')
print()
uvicorn.run("pyeamu:app", host=config.ip, port=config.port, reload=True)
@@ -50,18 +52,20 @@ async def services_get(request: Request):
services = {}
for service in modules.routers:
- model_blacklist = services.get('model_blacklist', [])
- model_whitelist = services.get('model_whitelist', [])
+ model_blacklist = services.get("model_blacklist", [])
+ model_whitelist = services.get("model_whitelist", [])
- if request_info['model'] in model_blacklist:
+ if request_info["model"] in model_blacklist:
continue
- if model_whitelist and request_info['model'] not in model_whitelist:
+ if model_whitelist and request_info["model"] not in model_whitelist:
continue
- k = (service.tags[0] if service.tags else service.prefix).strip('/')
+ k = (service.tags[0] if service.tags else service.prefix).strip("/")
if k not in services:
- services[k] = urlunparse(('http', server_address, service.prefix, None, None, None))
+ services[k] = urlunparse(
+ ("http", server_address, service.prefix, None, None, None)
+ )
keepalive_params = {
"pa": keepalive_address,
@@ -71,19 +75,27 @@ async def services_get(request: Request):
"t1": 2,
"t2": 10,
}
- services["keepalive"] = urlunparse(('http', keepalive_address, "/keepalive", None, urlencode(keepalive_params), None))
- services["ntp"] = urlunparse(('ntp', "pool.ntp.org", "/", None, None, None))
- services["services"] = urlunparse(('http', server_address, "/core", None, None, None))
+ services["keepalive"] = urlunparse(
+ (
+ "http",
+ keepalive_address,
+ "/keepalive",
+ None,
+ urlencode(keepalive_params),
+ None,
+ )
+ )
+ services["ntp"] = urlunparse(("ntp", "pool.ntp.org", "/", None, None, None))
+ services["services"] = urlunparse(
+ ("http", server_address, "/core", None, None, None)
+ )
response = E.response(
E.services(
expire=10800,
- mode='operation',
+ mode="operation",
product_domain=1,
- *[E.item(
- name=k,
- url=services[k]
- ) for k in services]
+ *[E.item(name=k, url=services[k]) for k in services],
)
)
diff --git a/requirements.txt b/requirements.txt
index 67bea99..3e01414 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,16 +1,18 @@
-anyio
-asgiref
-click
-colorama
-fastapi
-h11
-idna
-kbinxml
-lxml
-pycryptodomex
-pydantic
-sniffio
-starlette
-tinydb
-typing_extensions
-uvicorn
+anyio==3.6.2
+asgiref==3.5.2
+click==8.1.3
+colorama==0.4.6
+fastapi==0.86.0
+h11==0.14.0
+idna==3.4
+kbinxml==1.7
+lxml==4.9.1
+pycryptodomex==3.15.0
+pydantic==1.10.2
+python-multipart==0.0.5
+six==1.16.0
+sniffio==1.3.0
+starlette==0.20.4
+tinydb==4.7.0
+typing_extensions==4.4.0
+uvicorn==0.19.0
diff --git a/utils/arc4.py b/utils/arc4.py
index d19e8d8..d49f8ea 100644
--- a/utils/arc4.py
+++ b/utils/arc4.py
@@ -3,9 +3,10 @@ from Cryptodome.Hash import MD5
class EamuseARC4:
-
def __init__(self, eamuseKey):
- self.internal_key = bytearray.fromhex("69D74627D985EE2187161570D08D93B12455035B6DF0D8205DF5")
+ self.internal_key = bytearray.fromhex(
+ "69D74627D985EE2187161570D08D93B12455035B6DF0D8205DF5"
+ )
self.key = MD5.new(eamuseKey + self.internal_key).digest()
def decrypt(self, data):
diff --git a/utils/card.py b/utils/card.py
index 1630799..d6e112e 100644
--- a/utils/card.py
+++ b/utils/card.py
@@ -30,14 +30,14 @@ def pack_5(data):
data = "".join(f"{i:05b}" for i in data)
if len(data) % 8 != 0:
data += "0" * (8 - (len(data) % 8))
- return bytes(int(data[i:i+8], 2) for i in range(0, len(data), 8))
+ return bytes(int(data[i : i + 8], 2) for i in range(0, len(data), 8))
def unpack_5(data):
data = "".join(f"{i:08b}" for i in data)
if len(data) % 5 != 0:
data += "0" * (5 - (len(data) % 5))
- return bytes(int(data[i:i+5], 2) for i in range(0, len(data), 5))
+ return bytes(int(data[i : i + 5], 2) for i in range(0, len(data), 5))
def to_konami_id(uid):
@@ -74,7 +74,9 @@ def to_uid(konami_id):
raise ValueError("Invalid ID")
assert len(konami_id) == 16, f"ID must be 16 characters"
- assert all(i in valid_characters for i in konami_id), "ID contains invalid characters"
+ assert all(
+ i in valid_characters for i in konami_id
+ ), "ID contains invalid characters"
card = [valid_characters.index(i) for i in konami_id]
assert card[11] % 2 == card[12] % 2, "Parity check failed"
assert card[13] == card[12] ^ 1, "Card invalid"
@@ -98,4 +100,6 @@ def to_uid(konami_id):
if __name__ == "__main__":
assert to_konami_id("0000000000000000") == "007TUT8XJNSSPN2P", "To KID failed"
assert to_uid("007TUT8XJNSSPN2P") == "0000000000000000", "From KID failed"
- assert to_uid(to_konami_id("000000100200F000")) == "000000100200F000", "Roundtrip failed"
+ assert (
+ to_uid(to_konami_id("000000100200F000")) == "000000100200F000"
+ ), "Roundtrip failed"
diff --git a/utils/lz77.py b/utils/lz77.py
index 4a4f9b2..36cea6d 100644
--- a/utils/lz77.py
+++ b/utils/lz77.py
@@ -14,8 +14,8 @@ class EamuseLZ77:
else:
if offset >= data_length:
break
- lookback_flag = int.from_bytes(data[offset:offset+2], 'big')
- lookback_length = (lookback_flag & 0x000f) + 3
+ lookback_flag = int.from_bytes(data[offset : offset + 2], "big")
+ lookback_length = (lookback_flag & 0x000F) + 3
lookback_offset = lookback_flag >> 4
offset += 2
if lookback_flag == 0: