diva: add stage_result, end handlers

This commit is contained in:
Kevin Trocolli
2023-10-05 23:47:50 -04:00
parent b2a01d20d5
commit 2b02ed8684
4 changed files with 222 additions and 67 deletions

View File

@@ -1,3 +1,4 @@
from typing import Union
from titles.diva.handlers.base import (
BaseRequest,
BaseResponse,
@@ -25,10 +26,9 @@ class PreStartRequest(BaseRequest):
except AttributeError as e:
raise DivaRequestParseException(f"PreStartRequest: {e}")
class PreStartResponse(BaseResponse):
def __init__(self, cmd_id: str, req_id: int, pd_id: int) -> None:
super().__init__(cmd_id, req_id)
def __init__(self, req_id: int, pd_id: int) -> None:
super().__init__("pre_start", req_id)
self.ps_result = 1
self.pd_id = pd_id
self.accept_idx = 100
@@ -54,7 +54,6 @@ class PreStartResponse(BaseResponse):
# But this is how it's stored in the db, so w/e for now
self.mdl_eqp_ary = "-999,-999,-999"
class StartRequest(BaseRequest):
def __init__(self, raw: str) -> None:
super().__init__(raw)
@@ -65,10 +64,9 @@ class StartRequest(BaseRequest):
except AttributeError as e:
raise DivaRequestParseException(f"StartRequest: {e}")
class StartResponse(BaseResponse):
def __init__(self, cmd_id: str, req_id: int, pv_id: int, pv_name: str) -> None:
super().__init__(cmd_id, req_id)
def __init__(self, req_id: int, pv_id: int, pv_name: str) -> None:
super().__init__("start", req_id)
self.pd_id: int = pv_id
self.start_result: int = 1
self.accept_idx: int = 100
@@ -118,16 +116,15 @@ class StartResponse(BaseResponse):
self.ms_itm_flg_ary = ",".join(["1"] * 12)
class RegisterRequest(BaseRequest):
pmm: str
idm: str
mmgameid: str
mmuid: str
a_code: str
aime_a_code: str
player_name: str
passwd: str
def __init__(self, raw: str) -> None:
self.pmm: str
self.idm: str
self.mmgameid: str
self.mmuid: str
self.a_code: str
self.aime_a_code: str
self.player_name: str
self.passwd: str
super().__init__(raw)
try:
self.aime_id = int(self.aime_id)
@@ -137,7 +134,20 @@ class RegisterRequest(BaseRequest):
raise DivaRequestParseException(f"RegisterRequest: {e}")
class RegisterResponse(BaseResponse):
def __init__(self, cmd_id: str, req_id: int, pv_id: int) -> None:
super().__init__(cmd_id, req_id)
def __init__(self, req_id: int, pv_id: int) -> None:
super().__init__("register", req_id)
self.cd_adm_result: int = 1
self.pd_id: int = pv_id
class EndRequest(BaseRequest):
def __init__(self, raw: str | bytes) -> None:
self.my_qst_id: str
self.my_qst_sts: str
super().__init__(raw)
try:
self.pd_id = int(self.pd_id)
except AttributeError as e:
raise DivaRequestParseException(f"EndRequest: {e}")