From b3c1dceec9755ac73423f3136c36081fe6409ac6 Mon Sep 17 00:00:00 2001 From: EmmyHeart Date: Mon, 13 May 2024 08:48:01 +0000 Subject: [PATCH] Add team user points --- titles/chuni/base.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 9e8a634..e53c2d2 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -720,9 +720,14 @@ class ChuniBase: team_id = 65535 team_name = self.game_cfg.team.team_name team_rank = 0 + team_user_point = 0 # Get user profile profile = await self.data.profile.get_profile_data(data["userId"], self.version) + + if profile is None: + return {"userId": data["userId"], "teamId": 0} + if profile and profile["teamId"]: # Get team by id team = await self.data.profile.get_team_by_id(profile["teamId"]) @@ -731,7 +736,12 @@ class ChuniBase: team_id = team["id"] team_name = team["teamName"] team_rank = await self.data.profile.get_team_rank(team["id"]) - + team_point = team["teamPoint"] + if team["userTeamPoint"] is not None and team["userTeamPoint"] is not "": + user_team_point_data = json.loads(team["userTeamPoint"]) + for user_point_data in user_team_point_data: + if user_point_data["user"] == data["userId"]: + team_user_point = int(user_point_data["userPoint"]) # Don't return anything if no team name has been defined for defaults and there is no team set for the player if not profile["teamId"] and team_name == "": return {"userId": data["userId"], "teamId": 0} @@ -741,11 +751,12 @@ class ChuniBase: "teamId": team_id, "teamRank": team_rank, "teamName": team_name, + "assaultTimeRate": 1, # TODO: Figure out assaultTime, which might be team point boost? "userTeamPoint": { "userId": data["userId"], "teamId": team_id, - "orderId": 1, - "teamPoint": 1, + "orderId": 0, + "teamPoint": team_user_point, "aggrDate": data["playDate"], }, }