diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 6cd568a..de01463 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -38,7 +38,7 @@ class ChuniBase: self.logger.warn( "User ID %d attempted to log in while having a profile lock expiring on %s.", user_id, lock_result["expires_at"], - extra=lock_result["extra"] + extra=lock_result["extra"] or {} ) return {"returnCode": 0} @@ -669,9 +669,12 @@ class ChuniBase: return bytes([ord(c) for c in src]).decode("utf-8") async def handle_get_user_preview_api_request(self, data: Dict) -> Dict: - profile = await self.data.profile.get_profile_preview(data["userId"], self.version) + user_id = int(data["userId"]) + profile = await self.data.profile.get_profile_preview(user_id, self.version) + if profile is None: return None + profile_character = await self.data.item.get_character( data["userId"], profile["characterId"] ) @@ -683,10 +686,12 @@ class ChuniBase: chara.pop("id") chara.pop("user") + lock_result = await self.data.user.check_lock_for_game(user_id, self.game) + return { "userId": data["userId"], # Current Login State - "isLogin": False, + "isLogin": lock_result is not None, "lastLoginDate": profile["lastPlayDate"], # User Profile "userName": profile["userName"], diff --git a/titles/chuni/new.py b/titles/chuni/new.py index 12d04e7..37a73a3 100644 --- a/titles/chuni/new.py +++ b/titles/chuni/new.py @@ -152,9 +152,12 @@ class ChuniNew(ChuniBase): return {"userId": data["userId"], "symbolCharInfoList": []} async def handle_get_user_preview_api_request(self, data: Dict) -> Dict: - profile = await self.data.profile.get_profile_preview(data["userId"], self.version) + user_id = int(data["userId"]) + profile = await self.data.profile.get_profile_preview(user_id, self.version) + if profile is None: return None + profile_character = await self.data.item.get_character( data["userId"], profile["characterId"] ) @@ -165,11 +168,13 @@ class ChuniNew(ChuniBase): chara = profile_character._asdict() chara.pop("id") chara.pop("user") + + lock_result = await self.data.user.check_lock_for_game(user_id, self.game) data1 = { "userId": data["userId"], # Current Login State - "isLogin": False, + "isLogin": lock_result is not None, "lastLoginDate": profile["lastPlayDate"], # User Profile "userName": profile["userName"],