Skip to content

Commit

Permalink
Fixed Python 3.11 compatibility + fixed difficulty detection. (#6)
Browse files Browse the repository at this point in the history
* Fixed Python 3.11 compatibility + fixed difficulty detection.

* Removed debug prints.
  • Loading branch information
Kraust authored Feb 18, 2024
1 parent c4792d2 commit 74d1171
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion OSCR/baseparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) <= \
Expand Down
6 changes: 2 additions & 4 deletions OSCR/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
2 changes: 1 addition & 1 deletion OSCR/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion OSCR/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")}'

0 comments on commit 74d1171

Please sign in to comment.