From 74d11711171a65ab869d5a96162abfc5023940ba Mon Sep 17 00:00:00 2001 From: Kraust Date: Sun, 18 Feb 2024 08:38:48 -0500 Subject: [PATCH] Fixed Python 3.11 compatibility + fixed difficulty detection. (#6) * Fixed Python 3.11 compatibility + fixed difficulty detection. * Removed debug prints. --- OSCR/baseparser.py | 2 +- OSCR/cli.py | 6 ++---- OSCR/main.py | 2 +- OSCR/utilities.py | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/OSCR/baseparser.py b/OSCR/baseparser.py index 8d524bf..e9cac2f 100644 --- a/OSCR/baseparser.py +++ b/OSCR/baseparser.py @@ -191,7 +191,7 @@ def identify_difficulty(combat: Combat, computer_dict: dict) -> str: hull_identifiers = MAP_DIFFICULTY_ENTITY_HULL_IDENTIFIERS.get(combat.map, None) if hull_identifiers: for _, entity in computer_dict.items(): - entity_map = hull_identifiers.get(entity.handle, None) + entity_map = hull_identifiers.get(entity.name, None) if entity_map: for diff, damage in entity_map.items(): if damage is not None and abs(damage - entity.total_hull_damage_taken) <= \ diff --git a/OSCR/cli.py b/OSCR/cli.py index 7774e10..29a36e9 100644 --- a/OSCR/cli.py +++ b/OSCR/cli.py @@ -4,19 +4,17 @@ import OSCR + def summary(parser): """Print the combat summary for each combat""" for idx, _ in enumerate(parser.analyzed_combats): parser.shallow_combat_analysis(idx) print(f"{parser.active_combat.map} - {parser.active_combat.difficulty}") - print(f" Players (Damage)") + print(" Players (Damage)") for k, v in parser.active_combat.player_dict.items(): print(f" {v.name}{v.handle}: {v.total_damage:,.0f} ({v.DPS:,.0f} DPS)") - print(f" NPCs (Damage Taken)") - for k, v in parser.active_combat.computer_dict.items(): - print(f" {v.name} - {v.handle}: tot={v.total_damage_taken:,.0f} hull={v.total_hull_damage_taken:,.0f} shield={v.total_shield_damage_taken:,.0f}") def main(): """Main""" diff --git a/OSCR/main.py b/OSCR/main.py index e2ff7f7..24f0762 100644 --- a/OSCR/main.py +++ b/OSCR/main.py @@ -10,7 +10,7 @@ class OSCR(): - version = '2024.02b170' + version = '2024.02b180' def __init__(self, log_path:str = None, settings:dict = None): self.log_path = log_path diff --git a/OSCR/utilities.py b/OSCR/utilities.py index 088fd60..8cbaa2b 100644 --- a/OSCR/utilities.py +++ b/OSCR/utilities.py @@ -55,4 +55,4 @@ def get_handle_from_id(id_str:str) -> str: if handle is None: return '' # the space is intentional to allow for fancy concatenation of name and handle - return f' {handle.group('handle')}' + return f' {handle.group("handle")}'