from construct import Struct, Padding, Int8sl from typing import Final, List from .base import * NUM_LOGS: Final[int] = 20 NUM_LEN_LOG_EX: Final[int] = 48 class AmLogEx: def __init__(self, data: bytes) -> None: self.aime_id, status, self.user_id, self.credit_ct, self.bet_ct, self.won_ct, self.local_time, \ self.tseq, self.place_id = struct.unpack(" None: super().__init__(data) self.aime_id, status = struct.unpack_from(" None: super().__init__(data) self.aime_id, status, self.user_id, self.credit_ct, self.bet_ct, self.won_ct = struct.unpack_from(" None: super().__init__(data) self.logs: List[AmLogEx] = [] for x in range(NUM_LOGS): self.logs.append(AmLogEx(data[0x20 + (NUM_LEN_LOG_EX * x): 0x50 + (NUM_LEN_LOG_EX * x)])) self.num_logs = struct.unpack_from(" None: super().__init__(code, length, status, game_id, store_id, keychip_id, protocol_ver) @classmethod def from_req(cls, req: ADBHeader) -> "ADBLogExResponse": c = cls(req.game_id, req.store_id, req.keychip_id, req.protocol_ver) return c def make(self) -> bytes: resp_struct = Struct( "log_result" / Int8sl[NUM_LOGS], Padding(12) ) body = resp_struct.build(dict( log_result = [1] * NUM_LOGS )) self.head.length = HEADER_SIZE + len(body) return self.head.make() + body