forked from Dniel97/artemis
sao: stub give_free_ticket
This commit is contained in:
parent
2c1958eb04
commit
3bfc9cc845
@ -42,6 +42,14 @@ class SaoBase:
|
||||
resp = SaoGetMaintResponse(header.cmd +1)
|
||||
return resp.make()
|
||||
|
||||
def handle_c12a(self, header: SaoRequestHeader, request: bytes) -> bytes:
|
||||
#common/give_free_ticket
|
||||
req = SaoGiveFreeTicketRequest(header, request)
|
||||
self.logger.info(f"Give {req.give_num} free tickets (id {req.ticket_id}) to user {req.user_id}")
|
||||
resp = SaoGiveFreeTicketResponse(header.cmd +1)
|
||||
return resp.make()
|
||||
|
||||
|
||||
def handle_c12e(self, header: SaoRequestHeader, request: bytes) -> bytes:
|
||||
#common/ac_cabinet_boot_notification
|
||||
resp = SaoCommonAcCabinetBootNotificationResponse(header.cmd +1)
|
||||
|
@ -3230,3 +3230,25 @@ class GetMResEarnCampaignShopsResponse(SaoBaseResponse):
|
||||
|
||||
self.header.length = len(ret)
|
||||
return super().make() + ret
|
||||
|
||||
class SaoGiveFreeTicketRequest(SaoBaseRequest):
|
||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||
super().__init__(header, data)
|
||||
off = 0
|
||||
self.ticket_id, new_off = decode_str(data, off)
|
||||
off += new_off
|
||||
|
||||
self.user_id, new_off = decode_str(data, off)
|
||||
off += new_off
|
||||
|
||||
self.give_num = decode_byte(data, off)
|
||||
off += BYTE_OFF
|
||||
|
||||
class SaoGiveFreeTicketResponse(SaoBaseResponse):
|
||||
def __init__(self, cmd_id: int) -> None:
|
||||
super().__init__(cmd_id)
|
||||
self.result = 1 # byte
|
||||
|
||||
def make(self) -> bytes:
|
||||
ret = encode_byte(self.result)
|
||||
return super().make() + ret
|
||||
|
Loading…
Reference in New Issue
Block a user