Skip to content

Commit

Permalink
Fix for tagless logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Drevarr committed Dec 15, 2024
1 parent bfa875e commit 7d4b4b4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 20 deletions.
32 changes: 32 additions & 0 deletions output_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,38 @@ def build_dps_stats_tids(DPSStats: dict, tid_date_time: str, tid_list: list) ->
tid_list
)


def build_support_bubble_chart(top_stats: dict, boons: dict, tid_date_time: str, tid_list: list) -> None:
# ["Name", "Profession", "Cleanses", "Heals", "Boon Score", "color"]
rows = []
tid_title = f"{tid_date_time}-Support-Bubble-Chart"
tid_caption = "Support Bubble Chart"
tid_tags = tid_date_time

chart_data = []
chart_min = 0
chart_max = 0
chart_xAxis = "Cleanses"
chart_yAxis = "Hps + Bps"

for player, player_data in top_stats['player'].items():
name = player_data("name")
profession = player_data("profession")
fight_time = round(player_data(fight_time)/1000)
hps = round(player_data["extHealingStats"].get("outgoing_healing", 0)/fight_time)
bps = round(player_data["extHealingStats"].get("outgoing_barrier", 0)/fight_time)
hps_bps = hps+bps
cps = round(player_data["support"].get("condiCleanse", 0)/fight_time)
player_entry = [name, profession, hps_bps, cps]
boon_ps = 0
for boon in boons:
generated = (player_data["squadBuffs"][boon]["generation"] / 1000)
boon_ps += round(generated / fight_time, 3)
player_entry.append(boon_ps)

chart_data.append(player_entry)


def write_data_to_db(top_stats: dict, last_fight: str) -> None:

print("Writing raid stats to database")
Expand Down
38 changes: 18 additions & 20 deletions parser_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,26 +155,24 @@ def determine_player_role(player_data: dict) -> str:


def get_commander_tag_data(fight_json):
"""Get commander tag data from the fight json."""

commander_tag_data = {}
dead_tag_mark = 999999999
dead_tag = 0

for player in fight_json["players"]:
if player["hasCommanderTag"] and not player["notInSquad"]:
commander_tag_data = player["combatReplayData"]
commander_tag_positions = commander_tag_data["positions"]

if commander_tag_data["dead"]:
for death in commander_tag_data["dead"]:
if death[0] <= 0:
continue
dead_tag_mark = min(death[0], dead_tag_mark)
dead_tag = 1
break

return commander_tag_positions, dead_tag_mark, dead_tag
"""Extract commander tag data from the fight JSON."""

commander_tag_positions = []
earliest_death_time = float('inf')
has_died = False

for player in fight_json["players"]:
if player["hasCommanderTag"] and not player["notInSquad"]:
replay_data = player.get("combatReplayData", {})
commander_tag_positions = replay_data.get("positions", [])

for death_time, _ in replay_data.get("dead", []):
if death_time > 0:
earliest_death_time = min(death_time, earliest_death_time)
has_died = True
break

return commander_tag_positions, earliest_death_time, has_died


def get_player_death_on_tag(player, commander_tag_positions, dead_tag_mark, dead_tag, inch_to_pixel, polling_rate):
Expand Down

0 comments on commit 7d4b4b4

Please sign in to comment.