Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors names of players you've played with/against before. #190

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,10 @@ def get_ip():
for p in Players:
if p["Subject"] == Requests.puuid:
allyTeam = p["TeamID"]
break
for player in Players:
# used to change player name color
already_seen = False
status.update(f"Loading players... [{playersLoaded}/{len(Players)}]")
playersLoaded += 1

Expand Down Expand Up @@ -323,6 +326,8 @@ def get_ip():
"agent": curr_player_stat["agent"],
"time_diff": time.time() - curr_player_stat["epoch"]
})
# used to change player name color
already_seen = True
else:
if player["TeamID"] == allyTeam:
team_string = "your"
Expand All @@ -335,6 +340,8 @@ def get_ip():
"agent": curr_player_stat["agent"],
"time_diff": time.time() - curr_player_stat["epoch"]
})
# used to change player name color
already_seen = True

party_icon = ''
# set party premade icon
Expand Down Expand Up @@ -374,11 +381,18 @@ def get_ip():
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)
player["Subject"],
Requests.puuid,
agent=player["CharacterID"],
party_members=partyMembersList,
played_before=already_seen)
else:
Namecolor = colors.get_color_from_team(player["TeamID"],
names[player["Subject"]],
player["Subject"], Requests.puuid, party_members=partyMembersList)
player["Subject"],
Requests.puuid,
party_members=partyMembersList,
played_before=already_seen)
if lastTeam != player["TeamID"]:
if lastTeamBoolean:
table.add_empty_row()
Expand Down Expand Up @@ -768,13 +782,13 @@ def get_ip():

if game_state == "MENUS":
table.set_runtime_col_flag('Party', False)
table.set_runtime_col_flag('Agent',False)
table.set_runtime_col_flag('Skin',False)
table.set_runtime_col_flag('Agent', False)
table.set_runtime_col_flag('Skin', False)

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"))
Expand Down Expand Up @@ -811,9 +825,9 @@ def get_ip():
log(traceback.format_exc())
print(color(
"The program has encountered an error. If the problem persists, please reach support"
f" with the logs found in {os.getcwd()}\logs", fore=(255, 0, 0)))
f" with the logs found in {os.getcwd()}\\logs", fore=(255, 0, 0)))
chatlog(color(
"The program has encountered an error. If the problem persists, please reach support"
f" with the logs found in {os.getcwd()}\logs", fore=(255, 0, 0)))
f" with the logs found in {os.getcwd()}\\logs", fore=(255, 0, 0)))
input("press enter to exit...\n")
os._exit(1)
4 changes: 3 additions & 1 deletion src/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, played_before=False):
orig_name = name
if agent is not None:
if self.hide_names:
Expand All @@ -29,6 +29,8 @@ def get_color_from_team(self, team, name, playerPuuid, selfPuuid, agent=None, pa
Teamcolor = color(orig_name, fore=(76, 151, 237))
else:
Teamcolor = ''
if played_before:
Teamcolor = color(orig_name, fore=(10, 211, 8))
if playerPuuid == selfPuuid:
Teamcolor = color(orig_name, fore=(221, 224, 41))
return Teamcolor
Expand Down