From 18dd35f4fae39889d943538f384d05af049858a1 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Sun, 16 Apr 2023 16:51:28 +0200 Subject: [PATCH] Create chunk header instance for every message --- scripts/generate_messages.py | 18 ++++++++++-------- twnet_parser/messages7/game/cl_call_vote.py | 3 ++- twnet_parser/messages7/game/cl_command.py | 3 ++- twnet_parser/messages7/game/cl_emoticon.py | 3 ++- twnet_parser/messages7/game/cl_kill.py | 7 +++++-- twnet_parser/messages7/game/cl_ready_change.py | 7 +++++-- twnet_parser/messages7/game/cl_say.py | 3 ++- .../messages7/game/cl_set_spectator_mode.py | 3 ++- twnet_parser/messages7/game/cl_set_team.py | 3 ++- twnet_parser/messages7/game/cl_skin_change.py | 3 ++- twnet_parser/messages7/game/cl_start_info.py | 3 ++- twnet_parser/messages7/game/cl_vote.py | 3 ++- twnet_parser/messages7/game/de_client_enter.py | 3 ++- twnet_parser/messages7/game/de_client_leave.py | 3 ++- twnet_parser/messages7/game/sv_broadcast.py | 3 ++- twnet_parser/messages7/game/sv_chat.py | 3 ++- twnet_parser/messages7/game/sv_checkpoint.py | 3 ++- twnet_parser/messages7/game/sv_client_drop.py | 3 ++- twnet_parser/messages7/game/sv_client_info.py | 3 ++- twnet_parser/messages7/game/sv_command_info.py | 3 ++- .../messages7/game/sv_command_info_remove.py | 3 ++- twnet_parser/messages7/game/sv_emoticon.py | 3 ++- .../messages7/game/sv_extra_projectile.py | 3 ++- twnet_parser/messages7/game/sv_game_info.py | 3 ++- twnet_parser/messages7/game/sv_game_msg.py | 7 +++++-- twnet_parser/messages7/game/sv_kill_msg.py | 3 ++- twnet_parser/messages7/game/sv_motd.py | 3 ++- twnet_parser/messages7/game/sv_race_finish.py | 3 ++- .../messages7/game/sv_ready_to_enter.py | 7 +++++-- .../messages7/game/sv_server_settings.py | 3 ++- twnet_parser/messages7/game/sv_skin_change.py | 3 ++- twnet_parser/messages7/game/sv_team.py | 3 ++- twnet_parser/messages7/game/sv_tune_params.py | 3 ++- .../messages7/game/sv_vote_clear_options.py | 7 +++++-- .../messages7/game/sv_vote_option_add.py | 3 ++- .../messages7/game/sv_vote_option_list_add.py | 7 +++++-- .../messages7/game/sv_vote_option_remove.py | 3 ++- twnet_parser/messages7/game/sv_vote_set.py | 3 ++- twnet_parser/messages7/game/sv_vote_status.py | 3 ++- .../messages7/game/sv_weapon_pickup.py | 3 ++- twnet_parser/messages7/system/con_ready.py | 7 +++++-- twnet_parser/messages7/system/enter_game.py | 7 +++++-- twnet_parser/messages7/system/info.py | 3 ++- twnet_parser/messages7/system/input.py | 3 ++- twnet_parser/messages7/system/input_timing.py | 3 ++- twnet_parser/messages7/system/map_change.py | 3 ++- twnet_parser/messages7/system/map_data.py | 3 ++- .../messages7/system/maplist_entry_add.py | 3 ++- .../messages7/system/maplist_entry_rem.py | 3 ++- twnet_parser/messages7/system/ping.py | 7 +++++-- twnet_parser/messages7/system/ping_reply.py | 7 +++++-- twnet_parser/messages7/system/rcon_auth.py | 3 ++- twnet_parser/messages7/system/rcon_auth_off.py | 7 +++++-- twnet_parser/messages7/system/rcon_auth_on.py | 7 +++++-- twnet_parser/messages7/system/rcon_cmd.py | 3 ++- twnet_parser/messages7/system/rcon_cmd_add.py | 3 ++- twnet_parser/messages7/system/rcon_cmd_rem.py | 3 ++- twnet_parser/messages7/system/rcon_line.py | 3 ++- twnet_parser/messages7/system/ready.py | 7 +++++-- .../messages7/system/request_map_data.py | 7 +++++-- twnet_parser/messages7/system/server_info.py | 3 ++- twnet_parser/messages7/system/snap.py | 3 ++- twnet_parser/messages7/system/snap_empty.py | 3 ++- twnet_parser/messages7/system/snap_single.py | 3 ++- 64 files changed, 178 insertions(+), 85 deletions(-) diff --git a/scripts/generate_messages.py b/scripts/generate_messages.py index f9c8926..4c38092 100755 --- a/scripts/generate_messages.py +++ b/scripts/generate_messages.py @@ -408,8 +408,13 @@ class CodeGenerator(): game: Literal['system', 'game'], name_snake: str ) -> None: - out_file.write(' def __init__(\n') - out_file.write(' self,\n') + comma: str = '' + if len(msg['members']) > 0: + comma = ',\n' + out_file.write( \ + ' def __init__(\n' \ + ' self,\n' \ + f' chunk_header: ChunkHeader = ChunkHeader(){comma}') args: list[str] = [] for member in msg['members']: # { @@ -440,7 +445,7 @@ class CodeGenerator(): # {"name": ["mode"], "type": {"kind": "enum", "enum": ["chat"]}}, elif member['type']['kind'] == 'enum': enum_name: str = name_to_camel(member['type']['enum']) - ftype = f'int' + ftype = 'int' default = self.get_default_enum7(enum_name) default = f"enum7.{default}.value" elif member['type']['kind'] in ('int32', 'tick'): @@ -529,15 +534,12 @@ class CodeGenerator(): out_file.write(get_dependencies(msg)) out_file.write('\n') out_file.write(f'class Msg{name_camel}(PrettyPrint):\n') - if len(msg['members']) > 0: - self.write_init_method_header(out_file, msg, game, name_snake) - else: - out_file.write(' def __init__(self) -> None:\n') + self.write_init_method_header(out_file, msg, game, name_snake) out_file.write(f" self.message_name: str = '{name_snake}'\n") sys: str = 'True' if game == 'system' else 'False' out_file.write(f" self.system_message: bool = {sys}\n") out_file.write(f" self.message_id: int = {msg['id']}\n") - out_file.write(" self.header: ChunkHeader\n") + out_file.write(" self.header: ChunkHeader = chunk_header\n") out_file.write('\n') for member in msg['members']: # { diff --git a/twnet_parser/messages7/game/cl_call_vote.py b/twnet_parser/messages7/game/cl_call_vote.py index caea2b1..c1e9c26 100644 --- a/twnet_parser/messages7/game/cl_call_vote.py +++ b/twnet_parser/messages7/game/cl_call_vote.py @@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str class MsgClCallVote(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), type: str = 'default', value: str = 'default', reason: str = 'default', @@ -16,7 +17,7 @@ class MsgClCallVote(PrettyPrint): self.message_name: str = 'cl_call_vote' self.system_message: bool = False self.message_id: int = 32 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.type: str = type self.value: str = value diff --git a/twnet_parser/messages7/game/cl_command.py b/twnet_parser/messages7/game/cl_command.py index 1f82479..f98ba40 100644 --- a/twnet_parser/messages7/game/cl_command.py +++ b/twnet_parser/messages7/game/cl_command.py @@ -8,13 +8,14 @@ from twnet_parser.packer import SANITIZE_CC, pack_str class MsgClCommand(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default', arguments: str = 'default' ) -> None: self.message_name: str = 'cl_command' self.system_message: bool = False self.message_id: int = 39 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name self.arguments: str = arguments diff --git a/twnet_parser/messages7/game/cl_emoticon.py b/twnet_parser/messages7/game/cl_emoticon.py index ac595f9..da06316 100644 --- a/twnet_parser/messages7/game/cl_emoticon.py +++ b/twnet_parser/messages7/game/cl_emoticon.py @@ -9,12 +9,13 @@ import twnet_parser.enum7 as enum7 class MsgClEmoticon(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), emoticon: int = enum7.Emoticon.OOP.value ) -> None: self.message_name: str = 'cl_emoticon' self.system_message: bool = False self.message_id: int = 30 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.emoticon: int = emoticon diff --git a/twnet_parser/messages7/game/cl_kill.py b/twnet_parser/messages7/game/cl_kill.py index 87e65a5..3640f5c 100644 --- a/twnet_parser/messages7/game/cl_kill.py +++ b/twnet_parser/messages7/game/cl_kill.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgClKill(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'cl_kill' self.system_message: bool = False self.message_id: int = 28 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/game/cl_ready_change.py b/twnet_parser/messages7/game/cl_ready_change.py index 6b2e363..b236b60 100644 --- a/twnet_parser/messages7/game/cl_ready_change.py +++ b/twnet_parser/messages7/game/cl_ready_change.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgClReadyChange(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'cl_ready_change' self.system_message: bool = False self.message_id: int = 29 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/game/cl_say.py b/twnet_parser/messages7/game/cl_say.py index 84df455..74c621a 100644 --- a/twnet_parser/messages7/game/cl_say.py +++ b/twnet_parser/messages7/game/cl_say.py @@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7 class MsgClSay(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), mode: int = enum7.Chat.NONE.value, target: int = 0, message: str = 'default' @@ -16,7 +17,7 @@ class MsgClSay(PrettyPrint): self.message_name: str = 'cl_say' self.system_message: bool = False self.message_id: int = 24 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.mode: int = mode self.target: int = target diff --git a/twnet_parser/messages7/game/cl_set_spectator_mode.py b/twnet_parser/messages7/game/cl_set_spectator_mode.py index 6e40fbb..ad9b8fc 100644 --- a/twnet_parser/messages7/game/cl_set_spectator_mode.py +++ b/twnet_parser/messages7/game/cl_set_spectator_mode.py @@ -9,13 +9,14 @@ import twnet_parser.enum7 as enum7 class MsgClSetSpectatorMode(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), spec_mode: int = enum7.Spec.FREEVIEW.value, spectator_id: int = 0 ) -> None: self.message_name: str = 'cl_set_spectator_mode' self.system_message: bool = False self.message_id: int = 26 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.spec_mode: int = spec_mode self.spectator_id: int = spectator_id diff --git a/twnet_parser/messages7/game/cl_set_team.py b/twnet_parser/messages7/game/cl_set_team.py index b7e2c2c..042c922 100644 --- a/twnet_parser/messages7/game/cl_set_team.py +++ b/twnet_parser/messages7/game/cl_set_team.py @@ -9,12 +9,13 @@ import twnet_parser.enum7 as enum7 class MsgClSetTeam(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), team: int = enum7.Team.SPECTATORS.value ) -> None: self.message_name: str = 'cl_set_team' self.system_message: bool = False self.message_id: int = 25 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.team: int = team diff --git a/twnet_parser/messages7/game/cl_skin_change.py b/twnet_parser/messages7/game/cl_skin_change.py index ec177b0..00234c6 100644 --- a/twnet_parser/messages7/game/cl_skin_change.py +++ b/twnet_parser/messages7/game/cl_skin_change.py @@ -9,6 +9,7 @@ from typing import Annotated class MsgClSkinChange(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), skin_part_names: Annotated[list[str], 6] = \ ['', '', '', '', '', ''], use_custom_colors: Annotated[list[bool], 6] = \ @@ -19,7 +20,7 @@ class MsgClSkinChange(PrettyPrint): self.message_name: str = 'cl_skin_change' self.system_message: bool = False self.message_id: int = 34 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.skin_part_names = skin_part_names self.use_custom_colors = use_custom_colors diff --git a/twnet_parser/messages7/game/cl_start_info.py b/twnet_parser/messages7/game/cl_start_info.py index 60bf55d..230532e 100644 --- a/twnet_parser/messages7/game/cl_start_info.py +++ b/twnet_parser/messages7/game/cl_start_info.py @@ -9,6 +9,7 @@ from typing import Annotated class MsgClStartInfo(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default', clan: str = 'default', country: int = 0, @@ -22,7 +23,7 @@ class MsgClStartInfo(PrettyPrint): self.message_name: str = 'cl_start_info' self.system_message: bool = False self.message_id: int = 27 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name self.clan: str = clan diff --git a/twnet_parser/messages7/game/cl_vote.py b/twnet_parser/messages7/game/cl_vote.py index 54cb504..e26adda 100644 --- a/twnet_parser/messages7/game/cl_vote.py +++ b/twnet_parser/messages7/game/cl_vote.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_int class MsgClVote(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), vote: int = 0 ) -> None: self.message_name: str = 'cl_vote' self.system_message: bool = False self.message_id: int = 31 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.vote: int = vote diff --git a/twnet_parser/messages7/game/de_client_enter.py b/twnet_parser/messages7/game/de_client_enter.py index d1f8cbc..ea3e375 100644 --- a/twnet_parser/messages7/game/de_client_enter.py +++ b/twnet_parser/messages7/game/de_client_enter.py @@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7 class MsgDeClientEnter(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default', client_id: int = 0, team: int = enum7.Team.SPECTATORS.value @@ -16,7 +17,7 @@ class MsgDeClientEnter(PrettyPrint): self.message_name: str = 'de_client_enter' self.system_message: bool = False self.message_id: int = 22 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name self.client_id: int = client_id diff --git a/twnet_parser/messages7/game/de_client_leave.py b/twnet_parser/messages7/game/de_client_leave.py index 2708d13..dd80ce3 100644 --- a/twnet_parser/messages7/game/de_client_leave.py +++ b/twnet_parser/messages7/game/de_client_leave.py @@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str class MsgDeClientLeave(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default', client_id: int = 0, reason: str = 'default' @@ -15,7 +16,7 @@ class MsgDeClientLeave(PrettyPrint): self.message_name: str = 'de_client_leave' self.system_message: bool = False self.message_id: int = 23 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name self.client_id: int = client_id diff --git a/twnet_parser/messages7/game/sv_broadcast.py b/twnet_parser/messages7/game/sv_broadcast.py index 9a77d6a..1b414d2 100644 --- a/twnet_parser/messages7/game/sv_broadcast.py +++ b/twnet_parser/messages7/game/sv_broadcast.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgSvBroadcast(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), message: str = 'default' ) -> None: self.message_name: str = 'sv_broadcast' self.system_message: bool = False self.message_id: int = 2 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.message: str = message diff --git a/twnet_parser/messages7/game/sv_chat.py b/twnet_parser/messages7/game/sv_chat.py index 356d353..932f007 100644 --- a/twnet_parser/messages7/game/sv_chat.py +++ b/twnet_parser/messages7/game/sv_chat.py @@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7 class MsgSvChat(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), mode: int = enum7.Chat.NONE.value, client_id: int = 0, target_id: int = 0, @@ -17,7 +18,7 @@ class MsgSvChat(PrettyPrint): self.message_name: str = 'sv_chat' self.system_message: bool = False self.message_id: int = 3 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.mode: int = mode self.client_id: int = client_id diff --git a/twnet_parser/messages7/game/sv_checkpoint.py b/twnet_parser/messages7/game/sv_checkpoint.py index 0bd8f5c..96f67ef 100644 --- a/twnet_parser/messages7/game/sv_checkpoint.py +++ b/twnet_parser/messages7/game/sv_checkpoint.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_int class MsgSvCheckpoint(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), diff: int = 0 ) -> None: self.message_name: str = 'sv_checkpoint' self.system_message: bool = False self.message_id: int = 36 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.diff: int = diff diff --git a/twnet_parser/messages7/game/sv_client_drop.py b/twnet_parser/messages7/game/sv_client_drop.py index 64f5ee7..2cc1601 100644 --- a/twnet_parser/messages7/game/sv_client_drop.py +++ b/twnet_parser/messages7/game/sv_client_drop.py @@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str class MsgSvClientDrop(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), client_id: int = 0, reason: str = 'default', silent: bool = False @@ -15,7 +16,7 @@ class MsgSvClientDrop(PrettyPrint): self.message_name: str = 'sv_client_drop' self.system_message: bool = False self.message_id: int = 20 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.client_id: int = client_id self.reason: str = reason diff --git a/twnet_parser/messages7/game/sv_client_info.py b/twnet_parser/messages7/game/sv_client_info.py index 59628a7..6c33826 100644 --- a/twnet_parser/messages7/game/sv_client_info.py +++ b/twnet_parser/messages7/game/sv_client_info.py @@ -10,6 +10,7 @@ import twnet_parser.enum7 as enum7 class MsgSvClientInfo(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), client_id: int = 0, local: bool = False, team: int = enum7.Team.SPECTATORS.value, @@ -27,7 +28,7 @@ class MsgSvClientInfo(PrettyPrint): self.message_name: str = 'sv_client_info' self.system_message: bool = False self.message_id: int = 18 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.client_id: int = client_id self.local: bool = local diff --git a/twnet_parser/messages7/game/sv_command_info.py b/twnet_parser/messages7/game/sv_command_info.py index b9698ba..6016c79 100644 --- a/twnet_parser/messages7/game/sv_command_info.py +++ b/twnet_parser/messages7/game/sv_command_info.py @@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_str class MsgSvCommandInfo(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default', args_format: str = 'default', help_text: str = 'default' @@ -15,7 +16,7 @@ class MsgSvCommandInfo(PrettyPrint): self.message_name: str = 'sv_command_info' self.system_message: bool = False self.message_id: int = 37 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name self.args_format: str = args_format diff --git a/twnet_parser/messages7/game/sv_command_info_remove.py b/twnet_parser/messages7/game/sv_command_info_remove.py index 28cbca8..3c3ed99 100644 --- a/twnet_parser/messages7/game/sv_command_info_remove.py +++ b/twnet_parser/messages7/game/sv_command_info_remove.py @@ -8,12 +8,13 @@ from twnet_parser.packer import SANITIZE_CC, pack_str class MsgSvCommandInfoRemove(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default' ) -> None: self.message_name: str = 'sv_command_info_remove' self.system_message: bool = False self.message_id: int = 38 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name diff --git a/twnet_parser/messages7/game/sv_emoticon.py b/twnet_parser/messages7/game/sv_emoticon.py index 6dde997..4db3688 100644 --- a/twnet_parser/messages7/game/sv_emoticon.py +++ b/twnet_parser/messages7/game/sv_emoticon.py @@ -9,13 +9,14 @@ import twnet_parser.enum7 as enum7 class MsgSvEmoticon(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), client_id: int = 0, emoticon: int = enum7.Emoticon.OOP.value ) -> None: self.message_name: str = 'sv_emoticon' self.system_message: bool = False self.message_id: int = 10 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.client_id: int = client_id self.emoticon: int = emoticon diff --git a/twnet_parser/messages7/game/sv_extra_projectile.py b/twnet_parser/messages7/game/sv_extra_projectile.py index 762772d..7bc4ac0 100644 --- a/twnet_parser/messages7/game/sv_extra_projectile.py +++ b/twnet_parser/messages7/game/sv_extra_projectile.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_int class MsgSvExtraProjectile(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), projectile: int = 0 ) -> None: self.message_name: str = 'sv_extra_projectile' self.system_message: bool = False self.message_id: int = 7 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.projectile: int = projectile diff --git a/twnet_parser/messages7/game/sv_game_info.py b/twnet_parser/messages7/game/sv_game_info.py index 250a045..25e4028 100644 --- a/twnet_parser/messages7/game/sv_game_info.py +++ b/twnet_parser/messages7/game/sv_game_info.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int class MsgSvGameInfo(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), game_flags: int = 0, score_limit: int = 0, time_limit: int = 0, @@ -17,7 +18,7 @@ class MsgSvGameInfo(PrettyPrint): self.message_name: str = 'sv_game_info' self.system_message: bool = False self.message_id: int = 19 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.game_flags: int = game_flags self.score_limit: int = score_limit diff --git a/twnet_parser/messages7/game/sv_game_msg.py b/twnet_parser/messages7/game/sv_game_msg.py index ba8ebf7..ec1bc22 100644 --- a/twnet_parser/messages7/game/sv_game_msg.py +++ b/twnet_parser/messages7/game/sv_game_msg.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgSvGameMsg(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'sv_game_msg' self.system_message: bool = False self.message_id: int = 21 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/game/sv_kill_msg.py b/twnet_parser/messages7/game/sv_kill_msg.py index f80abeb..e97fee3 100644 --- a/twnet_parser/messages7/game/sv_kill_msg.py +++ b/twnet_parser/messages7/game/sv_kill_msg.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int class MsgSvKillMsg(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), killer: int = 0, victim: int = 0, weapon: int = 0, @@ -16,7 +17,7 @@ class MsgSvKillMsg(PrettyPrint): self.message_name: str = 'sv_kill_msg' self.system_message: bool = False self.message_id: int = 5 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.killer: int = killer self.victim: int = victim diff --git a/twnet_parser/messages7/game/sv_motd.py b/twnet_parser/messages7/game/sv_motd.py index 621af27..bc6205c 100644 --- a/twnet_parser/messages7/game/sv_motd.py +++ b/twnet_parser/messages7/game/sv_motd.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgSvMotd(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), message: str = 'default' ) -> None: self.message_name: str = 'sv_motd' self.system_message: bool = False self.message_id: int = 1 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.message: str = message diff --git a/twnet_parser/messages7/game/sv_race_finish.py b/twnet_parser/messages7/game/sv_race_finish.py index bf4d76a..d3f9f2d 100644 --- a/twnet_parser/messages7/game/sv_race_finish.py +++ b/twnet_parser/messages7/game/sv_race_finish.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int class MsgSvRaceFinish(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), client_id: int = 0, time: int = 0, diff: int = 0, @@ -17,7 +18,7 @@ class MsgSvRaceFinish(PrettyPrint): self.message_name: str = 'sv_race_finish' self.system_message: bool = False self.message_id: int = 35 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.client_id: int = client_id self.time: int = time diff --git a/twnet_parser/messages7/game/sv_ready_to_enter.py b/twnet_parser/messages7/game/sv_ready_to_enter.py index 70fa08a..23527ca 100644 --- a/twnet_parser/messages7/game/sv_ready_to_enter.py +++ b/twnet_parser/messages7/game/sv_ready_to_enter.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgSvReadyToEnter(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'sv_ready_to_enter' self.system_message: bool = False self.message_id: int = 8 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/game/sv_server_settings.py b/twnet_parser/messages7/game/sv_server_settings.py index 344d65c..5ddb82c 100644 --- a/twnet_parser/messages7/game/sv_server_settings.py +++ b/twnet_parser/messages7/game/sv_server_settings.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int class MsgSvServerSettings(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), kick_vote: bool = False, kick_min: int = 0, spec_vote: bool = False, @@ -18,7 +19,7 @@ class MsgSvServerSettings(PrettyPrint): self.message_name: str = 'sv_server_settings' self.system_message: bool = False self.message_id: int = 17 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.kick_vote: bool = kick_vote self.kick_min: int = kick_min diff --git a/twnet_parser/messages7/game/sv_skin_change.py b/twnet_parser/messages7/game/sv_skin_change.py index 37d18d6..57249b0 100644 --- a/twnet_parser/messages7/game/sv_skin_change.py +++ b/twnet_parser/messages7/game/sv_skin_change.py @@ -9,6 +9,7 @@ from typing import Annotated class MsgSvSkinChange(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), client_id: int = 0, skin_part_names: Annotated[list[str], 6] = \ ['', '', '', '', '', ''], @@ -20,7 +21,7 @@ class MsgSvSkinChange(PrettyPrint): self.message_name: str = 'sv_skin_change' self.system_message: bool = False self.message_id: int = 33 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.client_id: int = client_id self.skin_part_names = skin_part_names diff --git a/twnet_parser/messages7/game/sv_team.py b/twnet_parser/messages7/game/sv_team.py index 59bcdec..e374d07 100644 --- a/twnet_parser/messages7/game/sv_team.py +++ b/twnet_parser/messages7/game/sv_team.py @@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7 class MsgSvTeam(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), client_id: int = 0, team: int = enum7.Team.SPECTATORS.value, silent: bool = False, @@ -17,7 +18,7 @@ class MsgSvTeam(PrettyPrint): self.message_name: str = 'sv_team' self.system_message: bool = False self.message_id: int = 4 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.client_id: int = client_id self.team: int = team diff --git a/twnet_parser/messages7/game/sv_tune_params.py b/twnet_parser/messages7/game/sv_tune_params.py index 69d6159..b88943c 100644 --- a/twnet_parser/messages7/game/sv_tune_params.py +++ b/twnet_parser/messages7/game/sv_tune_params.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int class MsgSvTuneParams(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), ground_control_speed: float = 10, ground_control_accel: float = 2, ground_friction: float = 0.5, @@ -44,7 +45,7 @@ class MsgSvTuneParams(PrettyPrint): self.message_name: str = 'sv_tune_params' self.system_message: bool = False self.message_id: int = 6 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.ground_control_speed: float = ground_control_speed self.ground_control_accel: float = ground_control_accel diff --git a/twnet_parser/messages7/game/sv_vote_clear_options.py b/twnet_parser/messages7/game/sv_vote_clear_options.py index e83e57d..a42c936 100644 --- a/twnet_parser/messages7/game/sv_vote_clear_options.py +++ b/twnet_parser/messages7/game/sv_vote_clear_options.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgSvVoteClearOptions(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'sv_vote_clear_options' self.system_message: bool = False self.message_id: int = 11 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/game/sv_vote_option_add.py b/twnet_parser/messages7/game/sv_vote_option_add.py index ade0d1f..055cbbc 100644 --- a/twnet_parser/messages7/game/sv_vote_option_add.py +++ b/twnet_parser/messages7/game/sv_vote_option_add.py @@ -8,12 +8,13 @@ from twnet_parser.packer import SANITIZE_CC, pack_str class MsgSvVoteOptionAdd(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), description: str = 'default' ) -> None: self.message_name: str = 'sv_vote_option_add' self.system_message: bool = False self.message_id: int = 13 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.description: str = description diff --git a/twnet_parser/messages7/game/sv_vote_option_list_add.py b/twnet_parser/messages7/game/sv_vote_option_list_add.py index 60fb521..9265e40 100644 --- a/twnet_parser/messages7/game/sv_vote_option_list_add.py +++ b/twnet_parser/messages7/game/sv_vote_option_list_add.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgSvVoteOptionListAdd(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'sv_vote_option_list_add' self.system_message: bool = False self.message_id: int = 12 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/game/sv_vote_option_remove.py b/twnet_parser/messages7/game/sv_vote_option_remove.py index 7246746..f2c2d76 100644 --- a/twnet_parser/messages7/game/sv_vote_option_remove.py +++ b/twnet_parser/messages7/game/sv_vote_option_remove.py @@ -8,12 +8,13 @@ from twnet_parser.packer import SANITIZE_CC, pack_str class MsgSvVoteOptionRemove(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), description: str = 'default' ) -> None: self.message_name: str = 'sv_vote_option_remove' self.system_message: bool = False self.message_id: int = 14 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.description: str = description diff --git a/twnet_parser/messages7/game/sv_vote_set.py b/twnet_parser/messages7/game/sv_vote_set.py index be0cdc8..d63c5bd 100644 --- a/twnet_parser/messages7/game/sv_vote_set.py +++ b/twnet_parser/messages7/game/sv_vote_set.py @@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7 class MsgSvVoteSet(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), client_id: int = 0, type: int = enum7.Vote.UNKNOWN.value, timeout: int = 0, @@ -18,7 +19,7 @@ class MsgSvVoteSet(PrettyPrint): self.message_name: str = 'sv_vote_set' self.system_message: bool = False self.message_id: int = 15 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.client_id: int = client_id self.type: int = type diff --git a/twnet_parser/messages7/game/sv_vote_status.py b/twnet_parser/messages7/game/sv_vote_status.py index 5d2e3c9..4e01999 100644 --- a/twnet_parser/messages7/game/sv_vote_status.py +++ b/twnet_parser/messages7/game/sv_vote_status.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int class MsgSvVoteStatus(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), yes: int = 0, no: int = 0, pass_: int = 0, @@ -16,7 +17,7 @@ class MsgSvVoteStatus(PrettyPrint): self.message_name: str = 'sv_vote_status' self.system_message: bool = False self.message_id: int = 16 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.yes: int = yes self.no: int = no diff --git a/twnet_parser/messages7/game/sv_weapon_pickup.py b/twnet_parser/messages7/game/sv_weapon_pickup.py index 3520e16..f172a3f 100644 --- a/twnet_parser/messages7/game/sv_weapon_pickup.py +++ b/twnet_parser/messages7/game/sv_weapon_pickup.py @@ -9,12 +9,13 @@ import twnet_parser.enum7 as enum7 class MsgSvWeaponPickup(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), weapon: int = enum7.Weapon.HAMMER.value ) -> None: self.message_name: str = 'sv_weapon_pickup' self.system_message: bool = False self.message_id: int = 9 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.weapon: int = weapon diff --git a/twnet_parser/messages7/system/con_ready.py b/twnet_parser/messages7/system/con_ready.py index a3ff5db..474ce87 100644 --- a/twnet_parser/messages7/system/con_ready.py +++ b/twnet_parser/messages7/system/con_ready.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgConReady(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'con_ready' self.system_message: bool = True self.message_id: int = 5 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/enter_game.py b/twnet_parser/messages7/system/enter_game.py index d921c70..5df0f96 100644 --- a/twnet_parser/messages7/system/enter_game.py +++ b/twnet_parser/messages7/system/enter_game.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgEnterGame(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'enter_game' self.system_message: bool = True self.message_id: int = 19 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/info.py b/twnet_parser/messages7/system/info.py index 7871844..4ce126d 100644 --- a/twnet_parser/messages7/system/info.py +++ b/twnet_parser/messages7/system/info.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int, pack_str class MsgInfo(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), version: str = 'default', password: str = '', client_version: int = 0 @@ -15,7 +16,7 @@ class MsgInfo(PrettyPrint): self.message_name: str = 'info' self.system_message: bool = True self.message_id: int = 1 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.version: str = version self.password: str = password diff --git a/twnet_parser/messages7/system/input.py b/twnet_parser/messages7/system/input.py index cb989af..a9aa790 100644 --- a/twnet_parser/messages7/system/input.py +++ b/twnet_parser/messages7/system/input.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int class MsgInput(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), ack_snapshot: int = 0, intended_tick: int = 0, input_size: int = 0, @@ -16,7 +17,7 @@ class MsgInput(PrettyPrint): self.message_name: str = 'input' self.system_message: bool = True self.message_id: int = 20 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.ack_snapshot: int = ack_snapshot self.intended_tick: int = intended_tick diff --git a/twnet_parser/messages7/system/input_timing.py b/twnet_parser/messages7/system/input_timing.py index cd7f039..3e75431 100644 --- a/twnet_parser/messages7/system/input_timing.py +++ b/twnet_parser/messages7/system/input_timing.py @@ -8,13 +8,14 @@ from twnet_parser.packer import pack_int class MsgInputTiming(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), input_pred_tick: int = 0, time_left: int = 0 ) -> None: self.message_name: str = 'input_timing' self.system_message: bool = True self.message_id: int = 10 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.input_pred_tick: int = input_pred_tick self.time_left: int = time_left diff --git a/twnet_parser/messages7/system/map_change.py b/twnet_parser/messages7/system/map_change.py index 68068c0..b8568d0 100644 --- a/twnet_parser/messages7/system/map_change.py +++ b/twnet_parser/messages7/system/map_change.py @@ -9,6 +9,7 @@ from typing import Annotated class MsgMapChange(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default', crc: int = 0, size: int = 0, @@ -19,7 +20,7 @@ class MsgMapChange(PrettyPrint): self.message_name: str = 'map_change' self.system_message: bool = True self.message_id: int = 2 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name self.crc: int = crc diff --git a/twnet_parser/messages7/system/map_data.py b/twnet_parser/messages7/system/map_data.py index 283051e..8ae20c6 100644 --- a/twnet_parser/messages7/system/map_data.py +++ b/twnet_parser/messages7/system/map_data.py @@ -7,12 +7,13 @@ from twnet_parser.chunk_header import ChunkHeader class MsgMapData(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), data: bytes = b'\x00' ) -> None: self.message_name: str = 'map_data' self.system_message: bool = True self.message_id: int = 3 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.data: bytes = data diff --git a/twnet_parser/messages7/system/maplist_entry_add.py b/twnet_parser/messages7/system/maplist_entry_add.py index dda963d..7df821a 100644 --- a/twnet_parser/messages7/system/maplist_entry_add.py +++ b/twnet_parser/messages7/system/maplist_entry_add.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgMaplistEntryAdd(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default' ) -> None: self.message_name: str = 'maplist_entry_add' self.system_message: bool = True self.message_id: int = 29 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name diff --git a/twnet_parser/messages7/system/maplist_entry_rem.py b/twnet_parser/messages7/system/maplist_entry_rem.py index 3f1f115..f98567d 100644 --- a/twnet_parser/messages7/system/maplist_entry_rem.py +++ b/twnet_parser/messages7/system/maplist_entry_rem.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgMaplistEntryRem(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default' ) -> None: self.message_name: str = 'maplist_entry_rem' self.system_message: bool = True self.message_id: int = 30 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name diff --git a/twnet_parser/messages7/system/ping.py b/twnet_parser/messages7/system/ping.py index ddf748d..4649570 100644 --- a/twnet_parser/messages7/system/ping.py +++ b/twnet_parser/messages7/system/ping.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgPing(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'ping' self.system_message: bool = True self.message_id: int = 26 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/ping_reply.py b/twnet_parser/messages7/system/ping_reply.py index 356f1d8..9565eb5 100644 --- a/twnet_parser/messages7/system/ping_reply.py +++ b/twnet_parser/messages7/system/ping_reply.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgPingReply(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'ping_reply' self.system_message: bool = True self.message_id: int = 27 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/rcon_auth.py b/twnet_parser/messages7/system/rcon_auth.py index ce41b6a..aa3372c 100644 --- a/twnet_parser/messages7/system/rcon_auth.py +++ b/twnet_parser/messages7/system/rcon_auth.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgRconAuth(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), password: str = 'default' ) -> None: self.message_name: str = 'rcon_auth' self.system_message: bool = True self.message_id: int = 22 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.password: str = password diff --git a/twnet_parser/messages7/system/rcon_auth_off.py b/twnet_parser/messages7/system/rcon_auth_off.py index 7e6ab12..98cfbec 100644 --- a/twnet_parser/messages7/system/rcon_auth_off.py +++ b/twnet_parser/messages7/system/rcon_auth_off.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgRconAuthOff(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'rcon_auth_off' self.system_message: bool = True self.message_id: int = 12 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/rcon_auth_on.py b/twnet_parser/messages7/system/rcon_auth_on.py index fd14fb5..cce3c58 100644 --- a/twnet_parser/messages7/system/rcon_auth_on.py +++ b/twnet_parser/messages7/system/rcon_auth_on.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgRconAuthOn(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'rcon_auth_on' self.system_message: bool = True self.message_id: int = 11 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/rcon_cmd.py b/twnet_parser/messages7/system/rcon_cmd.py index 3d4184e..345c163 100644 --- a/twnet_parser/messages7/system/rcon_cmd.py +++ b/twnet_parser/messages7/system/rcon_cmd.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgRconCmd(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), cmd: str = 'default' ) -> None: self.message_name: str = 'rcon_cmd' self.system_message: bool = True self.message_id: int = 21 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.cmd: str = cmd diff --git a/twnet_parser/messages7/system/rcon_cmd_add.py b/twnet_parser/messages7/system/rcon_cmd_add.py index 65208b6..836aa80 100644 --- a/twnet_parser/messages7/system/rcon_cmd_add.py +++ b/twnet_parser/messages7/system/rcon_cmd_add.py @@ -8,6 +8,7 @@ from twnet_parser.packer import pack_str class MsgRconCmdAdd(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default', help: str = 'default', params: str = 'default' @@ -15,7 +16,7 @@ class MsgRconCmdAdd(PrettyPrint): self.message_name: str = 'rcon_cmd_add' self.system_message: bool = True self.message_id: int = 14 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name self.help: str = help diff --git a/twnet_parser/messages7/system/rcon_cmd_rem.py b/twnet_parser/messages7/system/rcon_cmd_rem.py index ea848df..39225cb 100644 --- a/twnet_parser/messages7/system/rcon_cmd_rem.py +++ b/twnet_parser/messages7/system/rcon_cmd_rem.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgRconCmdRem(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), name: str = 'default' ) -> None: self.message_name: str = 'rcon_cmd_rem' self.system_message: bool = True self.message_id: int = 15 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.name: str = name diff --git a/twnet_parser/messages7/system/rcon_line.py b/twnet_parser/messages7/system/rcon_line.py index d48c20d..17170e9 100644 --- a/twnet_parser/messages7/system/rcon_line.py +++ b/twnet_parser/messages7/system/rcon_line.py @@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str class MsgRconLine(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), line: str = 'default' ) -> None: self.message_name: str = 'rcon_line' self.system_message: bool = True self.message_id: int = 13 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.line: str = line diff --git a/twnet_parser/messages7/system/ready.py b/twnet_parser/messages7/system/ready.py index 0d33545..6c1dcd3 100644 --- a/twnet_parser/messages7/system/ready.py +++ b/twnet_parser/messages7/system/ready.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgReady(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'ready' self.system_message: bool = True self.message_id: int = 18 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/request_map_data.py b/twnet_parser/messages7/system/request_map_data.py index e40a786..0b2c95f 100644 --- a/twnet_parser/messages7/system/request_map_data.py +++ b/twnet_parser/messages7/system/request_map_data.py @@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint from twnet_parser.chunk_header import ChunkHeader class MsgRequestMapData(PrettyPrint): - def __init__(self) -> None: + def __init__( + self, + chunk_header: ChunkHeader = ChunkHeader() + ) -> None: self.message_name: str = 'request_map_data' self.system_message: bool = True self.message_id: int = 23 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header # first byte of data diff --git a/twnet_parser/messages7/system/server_info.py b/twnet_parser/messages7/system/server_info.py index b1ed81d..0fd391b 100644 --- a/twnet_parser/messages7/system/server_info.py +++ b/twnet_parser/messages7/system/server_info.py @@ -7,12 +7,13 @@ from twnet_parser.chunk_header import ChunkHeader class MsgServerInfo(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), data: bytes = b'\x00' ) -> None: self.message_name: str = 'server_info' self.system_message: bool = True self.message_id: int = 4 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.data: bytes = data diff --git a/twnet_parser/messages7/system/snap.py b/twnet_parser/messages7/system/snap.py index 2fc79ff..4a1ce4c 100644 --- a/twnet_parser/messages7/system/snap.py +++ b/twnet_parser/messages7/system/snap.py @@ -9,6 +9,7 @@ from typing import Optional class MsgSnap(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), tick: int = 0, delta_tick: int = 0, num_parts: int = 0, @@ -20,7 +21,7 @@ class MsgSnap(PrettyPrint): self.message_name: str = 'snap' self.system_message: bool = True self.message_id: int = 6 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.tick: int = tick self.delta_tick: int = delta_tick diff --git a/twnet_parser/messages7/system/snap_empty.py b/twnet_parser/messages7/system/snap_empty.py index d34d627..8bc7543 100644 --- a/twnet_parser/messages7/system/snap_empty.py +++ b/twnet_parser/messages7/system/snap_empty.py @@ -8,13 +8,14 @@ from twnet_parser.packer import pack_int class MsgSnapEmpty(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), tick: int = 0, delta_tick: int = 0 ) -> None: self.message_name: str = 'snap_empty' self.system_message: bool = True self.message_id: int = 7 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.tick: int = tick self.delta_tick: int = delta_tick diff --git a/twnet_parser/messages7/system/snap_single.py b/twnet_parser/messages7/system/snap_single.py index 925a0e1..116904c 100644 --- a/twnet_parser/messages7/system/snap_single.py +++ b/twnet_parser/messages7/system/snap_single.py @@ -9,6 +9,7 @@ from typing import Optional class MsgSnapSingle(PrettyPrint): def __init__( self, + chunk_header: ChunkHeader = ChunkHeader(), tick: int = 0, delta_tick: int = 0, crc: int = 0, @@ -18,7 +19,7 @@ class MsgSnapSingle(PrettyPrint): self.message_name: str = 'snap_single' self.system_message: bool = True self.message_id: int = 8 - self.header: ChunkHeader + self.header: ChunkHeader = chunk_header self.tick: int = tick self.delta_tick: int = delta_tick