Skip to content

Commit

Permalink
Correct High Score logic to incorporate fight number into key to prev…
Browse files Browse the repository at this point in the history
…ent overriding
  • Loading branch information
Drevarr committed Nov 13, 2024
1 parent df25c8e commit 2216c71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions output_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,9 +1548,9 @@ def build_high_scores_tid(high_scores: dict, skill_data: dict, buff_data: dict,

# Determine the header based on category
if category in ["statTarget_max", "totalDamageTaken_max"]:
header += "|@@display:block;width:200px;Player@@ |@@display:block;width:250px;Skill@@ | @@display:block;width:100px;Score@@|h"
header += "|@@display:block;width:200px;Player-Fight@@ |@@display:block;width:250px;Skill@@ | @@display:block;width:100px;Score@@|h"
else:
header += "|@@display:block;width:200px;Player@@ | @@display:block;width:100px;Score@@|h"
header += "|@@display:block;width:200px;Player-Fight@@ | @@display:block;width:100px;Score@@|h"

rows.append(header)

Expand Down
22 changes: 11 additions & 11 deletions parser_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def determine_player_role(player_data: dict) -> str:
return "DPS"


def get_player_fight_dps(dpsTargets: dict, name: str, profession: str, fight_time: int) -> None:
def get_player_fight_dps(dpsTargets: dict, name: str, profession: str, fight_num: int, fight_time: int) -> None:
"""
Get the maximum damage hit by skill.
Expand All @@ -143,12 +143,12 @@ def get_player_fight_dps(dpsTargets: dict, name: str, profession: str, fight_tim

update_high_score(
"fight_dps",
"{{"+profession+"}}"+name+" | DPS",
"{{"+profession+"}}"+name+"-"+str(fight_num)+" | DPS",
target_damage
)


def get_player_stats_targets(statsTargets: dict, name: str, profession: str, fight_time: int) -> None:
def get_player_stats_targets(statsTargets: dict, name: str, profession: str, fight_num: int, fight_time: int) -> None:
fight_stat_value= 0
fight_stats = ["killed", "downed", "downContribution"]
for stat in fight_stats:
Expand All @@ -158,7 +158,7 @@ def get_player_stats_targets(statsTargets: dict, name: str, profession: str, fig

fight_stat_value = round(fight_stat_value / fight_time, 3)

update_high_score(f"statTarget_{stat}", "{{"+profession+"}}"+name+" | "+stat, fight_stat_value)
update_high_score(f"statTarget_{stat}", "{{"+profession+"}}"+name+"-"+str(fight_num)+" | "+stat, fight_stat_value)


def get_total_shield_damage(fight_data: dict) -> int:
Expand Down Expand Up @@ -387,7 +387,7 @@ def get_stat_by_key(fight_num: int, player: dict, stat_category: str, name_prof:
for stat, value in player[stat_category][0].items():
if stat in config.high_scores:
high_score_value = round(value/(player['activeTimes'][0]/1000),3)
update_high_score(f"{stat_category}_{stat}", "{{"+player["profession"]+"}}"+player["name"]+" | "+stat, high_score_value)
update_high_score(f"{stat_category}_{stat}", "{{"+player["profession"]+"}}"+player["name"]+"-"+str(fight_num)+" | "+stat, high_score_value)
top_stats['player'][name_prof][stat_category][stat] = top_stats['player'][name_prof][stat_category].get(stat, 0) + value
top_stats['fight'][fight_num][stat_category][stat] = top_stats['fight'][fight_num][stat_category].get(stat, 0) + value
top_stats['overall'][stat_category][stat] = top_stats['overall'][stat_category].get(stat, 0) + value
Expand Down Expand Up @@ -417,7 +417,7 @@ def get_stat_by_target_and_skill(fight_num: int, player: dict, stat_category: st

for stat, value in skill.items():
if stat == 'max':
update_high_score(f"statTarget_{stat}", "{{"+player["profession"]+"}}"+player["name"]+" | "+str(skill_id), value)
update_high_score(f"statTarget_{stat}", "{{"+player["profession"]+"}}"+player["name"]+"-"+str(fight_num)+" | "+str(skill_id), value)
if value > top_stats['player'][name_prof][stat_category][skill_id].get(stat, 0):
top_stats['player'][name_prof][stat_category][skill_id][stat] = value
top_stats['fight'][fight_num][stat_category][skill_id][stat] = value
Expand Down Expand Up @@ -479,7 +479,7 @@ def get_stat_by_skill(fight_num: int, player: dict, stat_category: str, name_pro
for stat, value in skill.items():
if stat != 'id':
if stat == 'max':
update_high_score(f"{stat_category}_{stat}", "{{"+player["profession"]+"}}"+player["name"]+" | "+str(skill_id), value)
update_high_score(f"{stat_category}_{stat}", "{{"+player["profession"]+"}}"+player["name"]+"-"+str(fight_num)+" | "+str(skill_id), value)
top_stats['player'][name_prof][stat_category][skill_id][stat] = top_stats['player'][name_prof][stat_category][skill_id].get(stat, 0) + value
top_stats['fight'][fight_num][stat_category][skill_id][stat] = top_stats['fight'][fight_num][stat_category][skill_id].get(stat, 0) + value
top_stats['overall'][stat_category][skill_id][stat] = top_stats['overall'][stat_category][skill_id].get(stat, 0) + value
Expand Down Expand Up @@ -763,7 +763,7 @@ def get_healStats_data(fight_num: int, player: dict, players: dict, stat_categor
top_stats['overall'][stat_category]['downed_healing'] = (
top_stats['overall'][stat_category].get('downed_healing', 0) + downed_healing
)
update_high_score(f"{stat_category}_Healing", "{{"+player["profession"]+"}}"+player["name"]+" | Healing", round(fight_healing/(fight_time/1000), 2))
update_high_score(f"{stat_category}_Healing", "{{"+player["profession"]+"}}"+player["name"]+"-"+str(fight_num)+" | Healing", round(fight_healing/(fight_time/1000), 2))

fight_barrier = 0
if stat_category == 'extBarrierStats' and 'extBarrierStats' in player:
Expand Down Expand Up @@ -798,7 +798,7 @@ def get_healStats_data(fight_num: int, player: dict, players: dict, stat_categor
top_stats['overall'][stat_category]['outgoing_barrier'] = (
top_stats['overall'][stat_category].get('outgoing_barrier', 0) + outgoing_barrier
)
update_high_score(f"{stat_category}_Barrier", "{{"+player["profession"]+"}}"+player["name"]+" | Barrier", round(fight_barrier/(fight_time/1000), 2))
update_high_score(f"{stat_category}_Barrier", "{{"+player["profession"]+"}}"+player["name"]+"-"+str(fight_num)+" | Barrier", round(fight_barrier/(fight_time/1000), 2))


def get_healing_skill_data(player: dict, stat_category: str, name_prof: str) -> None:
Expand Down Expand Up @@ -1237,8 +1237,8 @@ def parse_file(file_path, fight_num, guild_data):

get_firebrand_pages(player, name_prof, name, account,fight_duration_ms)

get_player_fight_dps(player["dpsTargets"], name, profession, (fight_duration_ms/1000))
get_player_stats_targets(player["statsTargets"], name, profession, (fight_duration_ms/1000))
get_player_fight_dps(player["dpsTargets"], name, profession, fight_num, (fight_duration_ms/1000))
get_player_stats_targets(player["statsTargets"], name, profession, fight_num, (fight_duration_ms/1000))

get_minions_by_player(player, name, profession)

Expand Down

0 comments on commit 2216c71

Please sign in to comment.