Skip to content

Commit

Permalink
Add down contribution and resurrects, Fix averages
Browse files Browse the repository at this point in the history
Before, the healing and barrier averages were computed incorrectly when the healing addon was enabled and disabled during a raid.
This is now taken into account in the average computation.
  • Loading branch information
FreyaVF authored and Freyavf committed Aug 26, 2024
1 parent 9d64039 commit 153e9c0
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 111 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Currently supported stats are:
- killing hits
- downing hits
- damage against downed players
- down contribution
- boon rips
- interrupts
- cleanses
Expand All @@ -38,6 +39,7 @@ Currently supported stats are:
- healing dealt to everything else (in wvw: npcs, pets, ...)
- healing from regen
- barrier output
- resurrects
- average distance to tag
- stripped boons (boons that were stripped from the player)
- total damage taken
Expand Down
6 changes: 3 additions & 3 deletions io_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def write_stats_xls(players, top_players, stat, xls_output_filename, config):
# adjust the width of the columns
for col in sheet.columns:
length = max((len(str(cell.value)) for cell in col[4:]), default = 9)
sheet.column_dimensions[col[0].column_letter].width = length + 3
sheet.column_dimensions[col[0].column_letter].width = max(length + 3, 12)
for cell in col:
cell.alignment = cell.alignment.copy(horizontal="left")

Expand Down Expand Up @@ -274,8 +274,8 @@ def create_panda_dataframe(players, top_players, stat, sorting_columns, sort_asc
accounts = (players[top_players[i]].account for i in range(len(top_players)))
names = (players[top_players[i]].name for i in range(len(top_players)))
professions = (players[top_players[i]].profession for i in range(len(top_players)))
num_fights_present = (players[top_players[i]].num_fights_present for i in range(len(top_players)))
duration_present = (players[top_players[i]].duration_present[config.duration_for_averages[stat]] for i in range(len(top_players)))
num_fights_present = (players[top_players[i]].num_fights_present[stat] for i in range(len(top_players)))
duration_present = (players[top_players[i]].duration_present[stat] for i in range(len(top_players)))
consistency_stats = (players[top_players[i]].consistency_stats[stat] for i in range(len(top_players)))
portion_top_stats = (players[top_players[i]].portion_top_stats[stat]*100 for i in range(len(top_players)))
total_stats = list()
Expand Down
18 changes: 15 additions & 3 deletions json_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,13 @@ def get_stat_from_player_json(player_json, stat, fight, player_duration_present,
return -1
return int(player_json['statsAll'][0]['againstDownedDamage'])

if stat == 'down_contrib':
if 'statsTargets' not in player_json or len(player_json['statsTargets']) == 0:
config.errors.append("Could not find statsTargets in json to determine down contribution.")
return -1
down_contribution = sum([stats[0]['downContribution'] for stats in player_json['statsTargets']])
return down_contribution

##################################
### Incoming / Outgoing strips ###
##################################
Expand Down Expand Up @@ -480,9 +487,9 @@ def get_stat_from_player_json(player_json, stat, fight, player_duration_present,
interrupts = sum([stats[0][stat] for stats in player_json['statsTargets']])
return interrupts

######################
### Heal & Barrier ###
######################
##############################
### Heal, Barrier, revives ###
##############################

if stat == 'heal_total':
# check if healing was logged, save it
Expand Down Expand Up @@ -548,6 +555,11 @@ def get_stat_from_player_json(player_json, stat, fight, player_duration_present,
config.errors.append("Could not find regen in json to determine hits_from_regen.")
return -1

if stat == 'resurrects':
if 'support' not in player_json or len(player_json['support']) != 1 or 'resurrects' not in player_json['support'][0]:
config.errors.append("Could not find support or an entry for resurrects in json to determine resurrects.")
return -1
return int(player_json['support'][0]['resurrects'])

###################
### Squad Buffs ###
Expand Down
Loading

0 comments on commit 153e9c0

Please sign in to comment.