From 53c3b6483468f0eda06ce97d5a6b1a03d655067d Mon Sep 17 00:00:00 2001 From: legitatx Date: Sun, 5 Feb 2023 08:59:08 -0600 Subject: [PATCH] Refactor --- fortnite_replay_parser/events/match.py | 6 +++--- fortnite_replay_parser/events/parser.py | 2 +- fortnite_replay_parser/events/player.py | 6 +++--- fortnite_replay_parser/logger.py | 2 +- .../models/{enums => }/fortnite.py | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) rename fortnite_replay_parser/models/{enums => }/fortnite.py (94%) diff --git a/fortnite_replay_parser/events/match.py b/fortnite_replay_parser/events/match.py index edbd302..8a1a473 100644 --- a/fortnite_replay_parser/events/match.py +++ b/fortnite_replay_parser/events/match.py @@ -1,7 +1,7 @@ -from models.events import MatchStatsEventExport, TeamStatsEventExport +from models.events import MatchStatsEvent, TeamStatsEvent -def read_match_stats_buffer(event: MatchStatsEventExport, buffer): +def read_match_stats_buffer(event: MatchStatsEvent, buffer): buffer.skip_bytes(4) event.accuracy = int(buffer.read_float32()) event.assists = buffer.read_uint32() @@ -17,7 +17,7 @@ def read_match_stats_buffer(event: MatchStatsEventExport, buffer): event.damage_to_players = event.other_damage + event.weapon_damage -def read_team_stats_buffer(event: TeamStatsEventExport, buffer): +def read_team_stats_buffer(event: TeamStatsEvent, buffer): buffer.skip_bytes(4) event.placement = buffer.read_uint32() event.totalPlayers = buffer.read_uint32() diff --git a/fortnite_replay_parser/events/parser.py b/fortnite_replay_parser/events/parser.py index 69b1205..10034ad 100644 --- a/fortnite_replay_parser/events/parser.py +++ b/fortnite_replay_parser/events/parser.py @@ -1,6 +1,6 @@ from events.match import read_match_stats_buffer, read_team_stats_buffer from events.player import read_elimination_buffer -from models.enums.fortnite import EventTypes +from models.fortnite import EventTypes from models.events import * from logger import logger diff --git a/fortnite_replay_parser/events/player.py b/fortnite_replay_parser/events/player.py index 0ce3b14..91d3b13 100644 --- a/fortnite_replay_parser/events/player.py +++ b/fortnite_replay_parser/events/player.py @@ -1,16 +1,16 @@ from exceptions import PlayerEliminationException from models.events import PlayerEliminationEvent from models.reader import Header -from models.enums.fortnite import EFortWeaponType +from models.fortnite import EFortWeaponType def get_player_name(buffer): player_type = buffer.read_byte() if player_type == 0x03: return "Bot" - elif player_type == 0x16: + elif player_type == 0x10: return buffer.read_string() - elif player_type == 0x17: + elif player_type == 0x11: buffer.skip_bytes(1) return buffer.read_guid() else: diff --git a/fortnite_replay_parser/logger.py b/fortnite_replay_parser/logger.py index a230af3..151ce30 100644 --- a/fortnite_replay_parser/logger.py +++ b/fortnite_replay_parser/logger.py @@ -2,4 +2,4 @@ logger = logging.getLogger(__name__) -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) diff --git a/fortnite_replay_parser/models/enums/fortnite.py b/fortnite_replay_parser/models/fortnite.py similarity index 94% rename from fortnite_replay_parser/models/enums/fortnite.py rename to fortnite_replay_parser/models/fortnite.py index dcf97bf..848ac8b 100644 --- a/fortnite_replay_parser/models/enums/fortnite.py +++ b/fortnite_replay_parser/models/fortnite.py @@ -124,7 +124,7 @@ class EFortBuildingState(Enum): EFortBuildingState_MAX = 4 -class EFortGameplayState(enum.Enum): +class EFortGameplayState(Enum): NORMAL_GAMEPLAY = 0 WAITING_TO_START = 1 END_OF_ZONE = 2 @@ -135,7 +135,7 @@ class EFortGameplayState(enum.Enum): EFortGameplayState_MAX = 7 -class EFortMovementStyle(enum.Enum): +class EFortMovementStyle(Enum): RUNNING = 0 WALKING = 1 CHARGING = 2 @@ -148,7 +148,7 @@ class EFortMovementStyle(enum.Enum): EFortMovementStyle_MAX = 9 -class EFortPickupTossState(enum.Enum): +class EFortPickupTossState(Enum): NOT_TOSSED = 0 IN_PROGRESS = 1 AT_REST = 2 @@ -156,7 +156,7 @@ class EFortPickupTossState(enum.Enum): EFortPickupTossState_MAX = 4 -class EFortWeaponType(enum.Enum): +class EFortWeaponType(Enum): NONE = 0 RANGED_ANY = 1 PISTOL = 2 @@ -176,7 +176,7 @@ class EFortWeaponType(enum.Enum): MAX = 16 -class ENetRole(enum.Enum): +class ENetRole(Enum): ROLE_NONE = 0 ROLE_SIMULATED_PROXY = 1 ROLE_AUTONOMOUS_PROXY = 2 @@ -185,7 +185,7 @@ class ENetRole(enum.Enum): ROLE_MAX = 5 -class EServerStability(enum.Enum): +class EServerStability(Enum): STABLE = 0 LOW_INSTABILITY = 1 HIGH_INSTABILITY = 2