diff --git a/main.py b/main.py index 80d7ff48..692d791b 100644 --- a/main.py +++ b/main.py @@ -268,9 +268,11 @@ def program_exit(status: int): # so we don't need to import the entire sys modu for p in Players: if p["Subject"] == Requests.puuid: allyTeam = p["TeamID"] + break for player in Players: status.update(f"Loading players... [{playersLoaded}/{len(Players)}]") playersLoaded += 1 + times = 0 if player["Subject"] in stats_data.keys(): if player["Subject"] != Requests.puuid and player["Subject"] not in partyMembersList: @@ -282,32 +284,41 @@ def program_exit(status: int): # so we don't need to import the entire sys modu curr_player_stat = stats_data[player["Subject"]][-i] if curr_player_stat["match_id"] != coregame.match_id: #checking for party memebers and self players - times = 0 m_set = () for m in stats_data[player["Subject"]]: if m["match_id"] != coregame.match_id and m["match_id"] not in m_set: + # saves if they were on your team or not, defaults to true for old data + teammate = m.get("team", True) times += 1 m_set += (m["match_id"],) + + if teammate: + team = "with" + else: + team = "against" + if player["PlayerIdentity"]["Incognito"] == False: already_played_with.append( - { - "times": times, - "name": curr_player_stat["name"], - "agent": curr_player_stat["agent"], - "time_diff": time.time() - curr_player_stat["epoch"] - }) + { + "times": times, + "name": curr_player_stat["name"], + "agent": curr_player_stat["agent"], + "time_diff": time.time() - curr_player_stat["epoch"], + "team": team + }) else: if player["TeamID"] == allyTeam: team_string = "your" else: team_string = "enemy" already_played_with.append( - { - "times": times, - "name": agent_dict[player["CharacterID"].lower()] + " on " + team_string + " team", - "agent": curr_player_stat["agent"], - "time_diff": time.time() - curr_player_stat["epoch"] - }) + { + "times": times, + "name": agent_dict[player["CharacterID"].lower()] + " on " + team_string + " team", + "agent": curr_player_stat["agent"], + "time_diff": time.time() - curr_player_stat["epoch"], + "team": team + }) party_icon = '' @@ -346,12 +357,17 @@ def program_exit(status: int): # so we don't need to import the entire sys modu if player["PlayerIdentity"]["Incognito"]: Namecolor = colors.get_color_from_team(player["TeamID"], - names[player["Subject"]], - player["Subject"], Requests.puuid, agent=player["CharacterID"], party_members=partyMembersList) + names[player["Subject"]], + player["Subject"], Requests.puuid, + agent=player["CharacterID"], + party_members=partyMembersList, + already_seen=True if times > 0 else False) else: Namecolor = colors.get_color_from_team(player["TeamID"], - names[player["Subject"]], - player["Subject"], Requests.puuid, party_members=partyMembersList) + names[player["Subject"]], + player["Subject"], Requests.puuid, + party_members=partyMembersList, + already_seen=True if times > 0 else False) if lastTeam != player["TeamID"]: if lastTeamBoolean: table.add_empty_row() @@ -435,6 +451,7 @@ def program_exit(status: int): # so we don't need to import the entire sys modu "rr": rr, "match_id": coregame.match_id, "epoch": time.time(), + "team": player["TeamID"] == allyTeam } } ) @@ -695,7 +712,7 @@ def program_exit(status: int): # so we don't need to import the entire sys modu if game_state == "INGAME": if isRange: table.set_runtime_col_flag('Party', False) - table.set_runtime_col_flag('Agent',False) + table.set_runtime_col_flag('Agent', False) # We don't to show the RR column if the "aggregate_rank_rr" feature flag is True. table.set_runtime_col_flag('RR', cfg.table.get("rr") and not cfg.get_feature_flag("aggregate_rank_rr")) @@ -716,8 +733,8 @@ def program_exit(status: int): # so we don't need to import the entire sys modu if len(already_played_with) > 0: print("\n") for played in already_played_with: - print(f"Already played with {played['name']} (last {played['agent']}) {stats.convert_time(played['time_diff'])} ago. (Total played {played['times']} times)") - chatlog(f"Already played with {played['name']} (last {played['agent']}) {stats.convert_time(played['time_diff'])} ago. (Total played {played['times']} times)") + print(f"Already played {played['team']} {played['name']} (last {played['agent']}) {stats.convert_time(played['time_diff'])} ago. (Total played {played['times']} times)") + chatlog(f"Already played {played['team']} {played['name']} (last {played['agent']}) {stats.convert_time(played['time_diff'])} ago. (Total played {played['times']} times)") already_played_with = [] if cfg.cooldown == 0: input("Press enter to fetch again...") diff --git a/src/colors.py b/src/colors.py index 04a2a8bd..7ecc5d10 100644 --- a/src/colors.py +++ b/src/colors.py @@ -9,7 +9,7 @@ def __init__(self, hide_names, agent_dict, AGENTCOLORLIST): self.tier_dict = tierDict self.AGENTCOLORLIST = AGENTCOLORLIST - def get_color_from_team(self, team, name, playerPuuid, selfPuuid, agent=None, party_members=None): + def get_color_from_team(self, team, name, playerPuuid, selfPuuid, agent=None, party_members=None, already_seen=None): orig_name = name if agent is not None: if self.hide_names: @@ -17,18 +17,16 @@ def get_color_from_team(self, team, name, playerPuuid, selfPuuid, agent=None, pa name = self.agent_dict[agent.lower()] else: name = "Player" + if playerPuuid in party_members: + name = orig_name if team == 'Red': - if playerPuuid not in party_members: - Teamcolor = color(name, fore=(238, 77, 77)) - else: - Teamcolor = color(orig_name, fore=(238, 77, 77)) + Teamcolor = color(name, fore=(238, 77, 77)) elif team == 'Blue': - if playerPuuid not in party_members: - Teamcolor = color(name, fore=(76, 151, 237)) - else: - Teamcolor = color(orig_name, fore=(76, 151, 237)) + Teamcolor = color(name, fore=(76, 151, 237)) else: Teamcolor = '' + if already_seen: + Teamcolor = color(name, fore=(10, 211, 8)) if playerPuuid == selfPuuid: Teamcolor = color(orig_name, fore=(221, 224, 41)) return Teamcolor