reformat with black in preperation for merge to master

This commit is contained in:
Kevin Trocolli
2023-04-23 21:04:52 -04:00
parent 9d23d59e43
commit 238d437519
70 changed files with 920 additions and 603 deletions

View File

@@ -7,20 +7,23 @@ from core.config import CoreConfig
from ..config import IDZConfig
from ..const import IDZConstants
class IDZHandlerLockProfile(IDZHandlerBase):
cmd_codes = [0x0069, 0x0069, 0x0065, 0x0065]
rsp_codes = [0x006a, 0x006a, 0x0066, 0x0066]
rsp_codes = [0x006A, 0x006A, 0x0066, 0x0066]
name = "lock_profile"
def __init__(self, core_cfg: CoreConfig, game_cfg: IDZConfig, version: int) -> None:
super().__init__(core_cfg, game_cfg, version)
self.size = 0x0020
def handle(self, data: bytes) -> bytearray:
ret = super().handle(data)
profile_data = {
"status": IDZConstants.PROFILE_STATUS.UNLOCKED.value,
"expire_time": int((datetime.now() + timedelta(hours=1)).timestamp() / 1000)
"status": IDZConstants.PROFILE_STATUS.UNLOCKED.value,
"expire_time": int(
(datetime.now() + timedelta(hours=1)).timestamp() / 1000
),
}
user_id = struct.unpack_from("<I", data, 0x04)[0]
profile = None
@@ -29,11 +32,11 @@ class IDZHandlerLockProfile(IDZHandlerBase):
old_profile = None
if old_profile is not None:
profile_data["status"] = IDZConstants.PROFILE_STATUS.OLD.value
return self.handle_common(profile_data, ret)
def handle_common(cls, data: Dict, ret: bytearray) -> bytearray:
struct.pack_into("<B", ret, 0x18, data["status"])
struct.pack_into("<h", ret, 0x1a, -1)
struct.pack_into("<I", ret, 0x1c, data["expire_time"])
struct.pack_into("<h", ret, 0x1A, -1)
struct.pack_into("<I", ret, 0x1C, data["expire_time"])
return ret