Create chunk header instance for every message

This commit is contained in:
ChillerDragon 2023-04-16 16:51:28 +02:00
parent 6a351073d3
commit 18dd35f4fa
64 changed files with 178 additions and 85 deletions

View file

@ -408,8 +408,13 @@ class CodeGenerator():
game: Literal['system', 'game'], game: Literal['system', 'game'],
name_snake: str name_snake: str
) -> None: ) -> None:
out_file.write(' def __init__(\n') comma: str = ''
out_file.write(' self,\n') if len(msg['members']) > 0:
comma = ',\n'
out_file.write( \
' def __init__(\n' \
' self,\n' \
f' chunk_header: ChunkHeader = ChunkHeader(){comma}')
args: list[str] = [] args: list[str] = []
for member in msg['members']: for member in msg['members']:
# { # {
@ -440,7 +445,7 @@ class CodeGenerator():
# {"name": ["mode"], "type": {"kind": "enum", "enum": ["chat"]}}, # {"name": ["mode"], "type": {"kind": "enum", "enum": ["chat"]}},
elif member['type']['kind'] == 'enum': elif member['type']['kind'] == 'enum':
enum_name: str = name_to_camel(member['type']['enum']) enum_name: str = name_to_camel(member['type']['enum'])
ftype = f'int' ftype = 'int'
default = self.get_default_enum7(enum_name) default = self.get_default_enum7(enum_name)
default = f"enum7.{default}.value" default = f"enum7.{default}.value"
elif member['type']['kind'] in ('int32', 'tick'): elif member['type']['kind'] in ('int32', 'tick'):
@ -529,15 +534,12 @@ class CodeGenerator():
out_file.write(get_dependencies(msg)) out_file.write(get_dependencies(msg))
out_file.write('\n') out_file.write('\n')
out_file.write(f'class Msg{name_camel}(PrettyPrint):\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)
self.write_init_method_header(out_file, msg, game, name_snake)
else:
out_file.write(' def __init__(self) -> None:\n')
out_file.write(f" self.message_name: str = '{name_snake}'\n") out_file.write(f" self.message_name: str = '{name_snake}'\n")
sys: str = 'True' if game == 'system' else 'False' sys: str = 'True' if game == 'system' else 'False'
out_file.write(f" self.system_message: bool = {sys}\n") out_file.write(f" self.system_message: bool = {sys}\n")
out_file.write(f" self.message_id: int = {msg['id']}\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') out_file.write('\n')
for member in msg['members']: for member in msg['members']:
# { # {

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
class MsgClCallVote(PrettyPrint): class MsgClCallVote(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
type: str = 'default', type: str = 'default',
value: str = 'default', value: str = 'default',
reason: str = 'default', reason: str = 'default',
@ -16,7 +17,7 @@ class MsgClCallVote(PrettyPrint):
self.message_name: str = 'cl_call_vote' self.message_name: str = 'cl_call_vote'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 32 self.message_id: int = 32
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.type: str = type self.type: str = type
self.value: str = value self.value: str = value

View file

@ -8,13 +8,14 @@ from twnet_parser.packer import SANITIZE_CC, pack_str
class MsgClCommand(PrettyPrint): class MsgClCommand(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default', name: str = 'default',
arguments: str = 'default' arguments: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'cl_command' self.message_name: str = 'cl_command'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 39 self.message_id: int = 39
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name
self.arguments: str = arguments self.arguments: str = arguments

View file

@ -9,12 +9,13 @@ import twnet_parser.enum7 as enum7
class MsgClEmoticon(PrettyPrint): class MsgClEmoticon(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
emoticon: int = enum7.Emoticon.OOP.value emoticon: int = enum7.Emoticon.OOP.value
) -> None: ) -> None:
self.message_name: str = 'cl_emoticon' self.message_name: str = 'cl_emoticon'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 30 self.message_id: int = 30
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.emoticon: int = emoticon self.emoticon: int = emoticon

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgClKill(PrettyPrint): class MsgClKill(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'cl_kill' self.message_name: str = 'cl_kill'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 28 self.message_id: int = 28
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgClReadyChange(PrettyPrint): class MsgClReadyChange(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'cl_ready_change' self.message_name: str = 'cl_ready_change'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 29 self.message_id: int = 29
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7
class MsgClSay(PrettyPrint): class MsgClSay(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
mode: int = enum7.Chat.NONE.value, mode: int = enum7.Chat.NONE.value,
target: int = 0, target: int = 0,
message: str = 'default' message: str = 'default'
@ -16,7 +17,7 @@ class MsgClSay(PrettyPrint):
self.message_name: str = 'cl_say' self.message_name: str = 'cl_say'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 24 self.message_id: int = 24
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.mode: int = mode self.mode: int = mode
self.target: int = target self.target: int = target

View file

@ -9,13 +9,14 @@ import twnet_parser.enum7 as enum7
class MsgClSetSpectatorMode(PrettyPrint): class MsgClSetSpectatorMode(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
spec_mode: int = enum7.Spec.FREEVIEW.value, spec_mode: int = enum7.Spec.FREEVIEW.value,
spectator_id: int = 0 spectator_id: int = 0
) -> None: ) -> None:
self.message_name: str = 'cl_set_spectator_mode' self.message_name: str = 'cl_set_spectator_mode'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 26 self.message_id: int = 26
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.spec_mode: int = spec_mode self.spec_mode: int = spec_mode
self.spectator_id: int = spectator_id self.spectator_id: int = spectator_id

View file

@ -9,12 +9,13 @@ import twnet_parser.enum7 as enum7
class MsgClSetTeam(PrettyPrint): class MsgClSetTeam(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
team: int = enum7.Team.SPECTATORS.value team: int = enum7.Team.SPECTATORS.value
) -> None: ) -> None:
self.message_name: str = 'cl_set_team' self.message_name: str = 'cl_set_team'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 25 self.message_id: int = 25
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.team: int = team self.team: int = team

View file

@ -9,6 +9,7 @@ from typing import Annotated
class MsgClSkinChange(PrettyPrint): class MsgClSkinChange(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
skin_part_names: Annotated[list[str], 6] = \ skin_part_names: Annotated[list[str], 6] = \
['', '', '', '', '', ''], ['', '', '', '', '', ''],
use_custom_colors: Annotated[list[bool], 6] = \ use_custom_colors: Annotated[list[bool], 6] = \
@ -19,7 +20,7 @@ class MsgClSkinChange(PrettyPrint):
self.message_name: str = 'cl_skin_change' self.message_name: str = 'cl_skin_change'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 34 self.message_id: int = 34
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.skin_part_names = skin_part_names self.skin_part_names = skin_part_names
self.use_custom_colors = use_custom_colors self.use_custom_colors = use_custom_colors

View file

@ -9,6 +9,7 @@ from typing import Annotated
class MsgClStartInfo(PrettyPrint): class MsgClStartInfo(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default', name: str = 'default',
clan: str = 'default', clan: str = 'default',
country: int = 0, country: int = 0,
@ -22,7 +23,7 @@ class MsgClStartInfo(PrettyPrint):
self.message_name: str = 'cl_start_info' self.message_name: str = 'cl_start_info'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 27 self.message_id: int = 27
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name
self.clan: str = clan self.clan: str = clan

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_int
class MsgClVote(PrettyPrint): class MsgClVote(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
vote: int = 0 vote: int = 0
) -> None: ) -> None:
self.message_name: str = 'cl_vote' self.message_name: str = 'cl_vote'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 31 self.message_id: int = 31
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.vote: int = vote self.vote: int = vote

View file

@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7
class MsgDeClientEnter(PrettyPrint): class MsgDeClientEnter(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default', name: str = 'default',
client_id: int = 0, client_id: int = 0,
team: int = enum7.Team.SPECTATORS.value team: int = enum7.Team.SPECTATORS.value
@ -16,7 +17,7 @@ class MsgDeClientEnter(PrettyPrint):
self.message_name: str = 'de_client_enter' self.message_name: str = 'de_client_enter'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 22 self.message_id: int = 22
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name
self.client_id: int = client_id self.client_id: int = client_id

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
class MsgDeClientLeave(PrettyPrint): class MsgDeClientLeave(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default', name: str = 'default',
client_id: int = 0, client_id: int = 0,
reason: str = 'default' reason: str = 'default'
@ -15,7 +16,7 @@ class MsgDeClientLeave(PrettyPrint):
self.message_name: str = 'de_client_leave' self.message_name: str = 'de_client_leave'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 23 self.message_id: int = 23
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name
self.client_id: int = client_id self.client_id: int = client_id

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgSvBroadcast(PrettyPrint): class MsgSvBroadcast(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
message: str = 'default' message: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'sv_broadcast' self.message_name: str = 'sv_broadcast'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 2 self.message_id: int = 2
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.message: str = message self.message: str = message

View file

@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7
class MsgSvChat(PrettyPrint): class MsgSvChat(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
mode: int = enum7.Chat.NONE.value, mode: int = enum7.Chat.NONE.value,
client_id: int = 0, client_id: int = 0,
target_id: int = 0, target_id: int = 0,
@ -17,7 +18,7 @@ class MsgSvChat(PrettyPrint):
self.message_name: str = 'sv_chat' self.message_name: str = 'sv_chat'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 3 self.message_id: int = 3
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.mode: int = mode self.mode: int = mode
self.client_id: int = client_id self.client_id: int = client_id

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_int
class MsgSvCheckpoint(PrettyPrint): class MsgSvCheckpoint(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
diff: int = 0 diff: int = 0
) -> None: ) -> None:
self.message_name: str = 'sv_checkpoint' self.message_name: str = 'sv_checkpoint'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 36 self.message_id: int = 36
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.diff: int = diff self.diff: int = diff

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
class MsgSvClientDrop(PrettyPrint): class MsgSvClientDrop(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
client_id: int = 0, client_id: int = 0,
reason: str = 'default', reason: str = 'default',
silent: bool = False silent: bool = False
@ -15,7 +16,7 @@ class MsgSvClientDrop(PrettyPrint):
self.message_name: str = 'sv_client_drop' self.message_name: str = 'sv_client_drop'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 20 self.message_id: int = 20
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.client_id: int = client_id self.client_id: int = client_id
self.reason: str = reason self.reason: str = reason

View file

@ -10,6 +10,7 @@ import twnet_parser.enum7 as enum7
class MsgSvClientInfo(PrettyPrint): class MsgSvClientInfo(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
client_id: int = 0, client_id: int = 0,
local: bool = False, local: bool = False,
team: int = enum7.Team.SPECTATORS.value, team: int = enum7.Team.SPECTATORS.value,
@ -27,7 +28,7 @@ class MsgSvClientInfo(PrettyPrint):
self.message_name: str = 'sv_client_info' self.message_name: str = 'sv_client_info'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 18 self.message_id: int = 18
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.client_id: int = client_id self.client_id: int = client_id
self.local: bool = local self.local: bool = local

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import SANITIZE_CC, pack_str
class MsgSvCommandInfo(PrettyPrint): class MsgSvCommandInfo(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default', name: str = 'default',
args_format: str = 'default', args_format: str = 'default',
help_text: str = 'default' help_text: str = 'default'
@ -15,7 +16,7 @@ class MsgSvCommandInfo(PrettyPrint):
self.message_name: str = 'sv_command_info' self.message_name: str = 'sv_command_info'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 37 self.message_id: int = 37
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name
self.args_format: str = args_format self.args_format: str = args_format

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import SANITIZE_CC, pack_str
class MsgSvCommandInfoRemove(PrettyPrint): class MsgSvCommandInfoRemove(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default' name: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'sv_command_info_remove' self.message_name: str = 'sv_command_info_remove'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 38 self.message_id: int = 38
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name

View file

@ -9,13 +9,14 @@ import twnet_parser.enum7 as enum7
class MsgSvEmoticon(PrettyPrint): class MsgSvEmoticon(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
client_id: int = 0, client_id: int = 0,
emoticon: int = enum7.Emoticon.OOP.value emoticon: int = enum7.Emoticon.OOP.value
) -> None: ) -> None:
self.message_name: str = 'sv_emoticon' self.message_name: str = 'sv_emoticon'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 10 self.message_id: int = 10
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.client_id: int = client_id self.client_id: int = client_id
self.emoticon: int = emoticon self.emoticon: int = emoticon

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_int
class MsgSvExtraProjectile(PrettyPrint): class MsgSvExtraProjectile(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
projectile: int = 0 projectile: int = 0
) -> None: ) -> None:
self.message_name: str = 'sv_extra_projectile' self.message_name: str = 'sv_extra_projectile'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 7 self.message_id: int = 7
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.projectile: int = projectile self.projectile: int = projectile

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int
class MsgSvGameInfo(PrettyPrint): class MsgSvGameInfo(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
game_flags: int = 0, game_flags: int = 0,
score_limit: int = 0, score_limit: int = 0,
time_limit: int = 0, time_limit: int = 0,
@ -17,7 +18,7 @@ class MsgSvGameInfo(PrettyPrint):
self.message_name: str = 'sv_game_info' self.message_name: str = 'sv_game_info'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 19 self.message_id: int = 19
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.game_flags: int = game_flags self.game_flags: int = game_flags
self.score_limit: int = score_limit self.score_limit: int = score_limit

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgSvGameMsg(PrettyPrint): class MsgSvGameMsg(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'sv_game_msg' self.message_name: str = 'sv_game_msg'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 21 self.message_id: int = 21
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int
class MsgSvKillMsg(PrettyPrint): class MsgSvKillMsg(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
killer: int = 0, killer: int = 0,
victim: int = 0, victim: int = 0,
weapon: int = 0, weapon: int = 0,
@ -16,7 +17,7 @@ class MsgSvKillMsg(PrettyPrint):
self.message_name: str = 'sv_kill_msg' self.message_name: str = 'sv_kill_msg'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 5 self.message_id: int = 5
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.killer: int = killer self.killer: int = killer
self.victim: int = victim self.victim: int = victim

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgSvMotd(PrettyPrint): class MsgSvMotd(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
message: str = 'default' message: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'sv_motd' self.message_name: str = 'sv_motd'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 1 self.message_id: int = 1
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.message: str = message self.message: str = message

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int
class MsgSvRaceFinish(PrettyPrint): class MsgSvRaceFinish(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
client_id: int = 0, client_id: int = 0,
time: int = 0, time: int = 0,
diff: int = 0, diff: int = 0,
@ -17,7 +18,7 @@ class MsgSvRaceFinish(PrettyPrint):
self.message_name: str = 'sv_race_finish' self.message_name: str = 'sv_race_finish'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 35 self.message_id: int = 35
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.client_id: int = client_id self.client_id: int = client_id
self.time: int = time self.time: int = time

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgSvReadyToEnter(PrettyPrint): class MsgSvReadyToEnter(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'sv_ready_to_enter' self.message_name: str = 'sv_ready_to_enter'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 8 self.message_id: int = 8
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int
class MsgSvServerSettings(PrettyPrint): class MsgSvServerSettings(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
kick_vote: bool = False, kick_vote: bool = False,
kick_min: int = 0, kick_min: int = 0,
spec_vote: bool = False, spec_vote: bool = False,
@ -18,7 +19,7 @@ class MsgSvServerSettings(PrettyPrint):
self.message_name: str = 'sv_server_settings' self.message_name: str = 'sv_server_settings'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 17 self.message_id: int = 17
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.kick_vote: bool = kick_vote self.kick_vote: bool = kick_vote
self.kick_min: int = kick_min self.kick_min: int = kick_min

View file

@ -9,6 +9,7 @@ from typing import Annotated
class MsgSvSkinChange(PrettyPrint): class MsgSvSkinChange(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
client_id: int = 0, client_id: int = 0,
skin_part_names: Annotated[list[str], 6] = \ skin_part_names: Annotated[list[str], 6] = \
['', '', '', '', '', ''], ['', '', '', '', '', ''],
@ -20,7 +21,7 @@ class MsgSvSkinChange(PrettyPrint):
self.message_name: str = 'sv_skin_change' self.message_name: str = 'sv_skin_change'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 33 self.message_id: int = 33
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.client_id: int = client_id self.client_id: int = client_id
self.skin_part_names = skin_part_names self.skin_part_names = skin_part_names

View file

@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7
class MsgSvTeam(PrettyPrint): class MsgSvTeam(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
client_id: int = 0, client_id: int = 0,
team: int = enum7.Team.SPECTATORS.value, team: int = enum7.Team.SPECTATORS.value,
silent: bool = False, silent: bool = False,
@ -17,7 +18,7 @@ class MsgSvTeam(PrettyPrint):
self.message_name: str = 'sv_team' self.message_name: str = 'sv_team'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 4 self.message_id: int = 4
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.client_id: int = client_id self.client_id: int = client_id
self.team: int = team self.team: int = team

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int
class MsgSvTuneParams(PrettyPrint): class MsgSvTuneParams(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
ground_control_speed: float = 10, ground_control_speed: float = 10,
ground_control_accel: float = 2, ground_control_accel: float = 2,
ground_friction: float = 0.5, ground_friction: float = 0.5,
@ -44,7 +45,7 @@ class MsgSvTuneParams(PrettyPrint):
self.message_name: str = 'sv_tune_params' self.message_name: str = 'sv_tune_params'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 6 self.message_id: int = 6
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.ground_control_speed: float = ground_control_speed self.ground_control_speed: float = ground_control_speed
self.ground_control_accel: float = ground_control_accel self.ground_control_accel: float = ground_control_accel

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgSvVoteClearOptions(PrettyPrint): class MsgSvVoteClearOptions(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'sv_vote_clear_options' self.message_name: str = 'sv_vote_clear_options'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 11 self.message_id: int = 11
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import SANITIZE_CC, pack_str
class MsgSvVoteOptionAdd(PrettyPrint): class MsgSvVoteOptionAdd(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
description: str = 'default' description: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'sv_vote_option_add' self.message_name: str = 'sv_vote_option_add'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 13 self.message_id: int = 13
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.description: str = description self.description: str = description

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgSvVoteOptionListAdd(PrettyPrint): 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.message_name: str = 'sv_vote_option_list_add'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 12 self.message_id: int = 12
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import SANITIZE_CC, pack_str
class MsgSvVoteOptionRemove(PrettyPrint): class MsgSvVoteOptionRemove(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
description: str = 'default' description: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'sv_vote_option_remove' self.message_name: str = 'sv_vote_option_remove'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 14 self.message_id: int = 14
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.description: str = description self.description: str = description

View file

@ -9,6 +9,7 @@ import twnet_parser.enum7 as enum7
class MsgSvVoteSet(PrettyPrint): class MsgSvVoteSet(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
client_id: int = 0, client_id: int = 0,
type: int = enum7.Vote.UNKNOWN.value, type: int = enum7.Vote.UNKNOWN.value,
timeout: int = 0, timeout: int = 0,
@ -18,7 +19,7 @@ class MsgSvVoteSet(PrettyPrint):
self.message_name: str = 'sv_vote_set' self.message_name: str = 'sv_vote_set'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 15 self.message_id: int = 15
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.client_id: int = client_id self.client_id: int = client_id
self.type: int = type self.type: int = type

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int
class MsgSvVoteStatus(PrettyPrint): class MsgSvVoteStatus(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
yes: int = 0, yes: int = 0,
no: int = 0, no: int = 0,
pass_: int = 0, pass_: int = 0,
@ -16,7 +17,7 @@ class MsgSvVoteStatus(PrettyPrint):
self.message_name: str = 'sv_vote_status' self.message_name: str = 'sv_vote_status'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 16 self.message_id: int = 16
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.yes: int = yes self.yes: int = yes
self.no: int = no self.no: int = no

View file

@ -9,12 +9,13 @@ import twnet_parser.enum7 as enum7
class MsgSvWeaponPickup(PrettyPrint): class MsgSvWeaponPickup(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
weapon: int = enum7.Weapon.HAMMER.value weapon: int = enum7.Weapon.HAMMER.value
) -> None: ) -> None:
self.message_name: str = 'sv_weapon_pickup' self.message_name: str = 'sv_weapon_pickup'
self.system_message: bool = False self.system_message: bool = False
self.message_id: int = 9 self.message_id: int = 9
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.weapon: int = weapon self.weapon: int = weapon

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgConReady(PrettyPrint): class MsgConReady(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'con_ready' self.message_name: str = 'con_ready'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 5 self.message_id: int = 5
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgEnterGame(PrettyPrint): class MsgEnterGame(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'enter_game' self.message_name: str = 'enter_game'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 19 self.message_id: int = 19
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int, pack_str
class MsgInfo(PrettyPrint): class MsgInfo(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
version: str = 'default', version: str = 'default',
password: str = '', password: str = '',
client_version: int = 0 client_version: int = 0
@ -15,7 +16,7 @@ class MsgInfo(PrettyPrint):
self.message_name: str = 'info' self.message_name: str = 'info'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 1 self.message_id: int = 1
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.version: str = version self.version: str = version
self.password: str = password self.password: str = password

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_int
class MsgInput(PrettyPrint): class MsgInput(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
ack_snapshot: int = 0, ack_snapshot: int = 0,
intended_tick: int = 0, intended_tick: int = 0,
input_size: int = 0, input_size: int = 0,
@ -16,7 +17,7 @@ class MsgInput(PrettyPrint):
self.message_name: str = 'input' self.message_name: str = 'input'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 20 self.message_id: int = 20
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.ack_snapshot: int = ack_snapshot self.ack_snapshot: int = ack_snapshot
self.intended_tick: int = intended_tick self.intended_tick: int = intended_tick

View file

@ -8,13 +8,14 @@ from twnet_parser.packer import pack_int
class MsgInputTiming(PrettyPrint): class MsgInputTiming(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
input_pred_tick: int = 0, input_pred_tick: int = 0,
time_left: int = 0 time_left: int = 0
) -> None: ) -> None:
self.message_name: str = 'input_timing' self.message_name: str = 'input_timing'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 10 self.message_id: int = 10
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.input_pred_tick: int = input_pred_tick self.input_pred_tick: int = input_pred_tick
self.time_left: int = time_left self.time_left: int = time_left

View file

@ -9,6 +9,7 @@ from typing import Annotated
class MsgMapChange(PrettyPrint): class MsgMapChange(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default', name: str = 'default',
crc: int = 0, crc: int = 0,
size: int = 0, size: int = 0,
@ -19,7 +20,7 @@ class MsgMapChange(PrettyPrint):
self.message_name: str = 'map_change' self.message_name: str = 'map_change'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 2 self.message_id: int = 2
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name
self.crc: int = crc self.crc: int = crc

View file

@ -7,12 +7,13 @@ from twnet_parser.chunk_header import ChunkHeader
class MsgMapData(PrettyPrint): class MsgMapData(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
data: bytes = b'\x00' data: bytes = b'\x00'
) -> None: ) -> None:
self.message_name: str = 'map_data' self.message_name: str = 'map_data'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 3 self.message_id: int = 3
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.data: bytes = data self.data: bytes = data

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgMaplistEntryAdd(PrettyPrint): class MsgMaplistEntryAdd(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default' name: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'maplist_entry_add' self.message_name: str = 'maplist_entry_add'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 29 self.message_id: int = 29
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgMaplistEntryRem(PrettyPrint): class MsgMaplistEntryRem(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default' name: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'maplist_entry_rem' self.message_name: str = 'maplist_entry_rem'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 30 self.message_id: int = 30
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgPing(PrettyPrint): class MsgPing(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'ping' self.message_name: str = 'ping'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 26 self.message_id: int = 26
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgPingReply(PrettyPrint): class MsgPingReply(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'ping_reply' self.message_name: str = 'ping_reply'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 27 self.message_id: int = 27
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgRconAuth(PrettyPrint): class MsgRconAuth(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
password: str = 'default' password: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'rcon_auth' self.message_name: str = 'rcon_auth'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 22 self.message_id: int = 22
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.password: str = password self.password: str = password

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgRconAuthOff(PrettyPrint): class MsgRconAuthOff(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'rcon_auth_off' self.message_name: str = 'rcon_auth_off'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 12 self.message_id: int = 12
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgRconAuthOn(PrettyPrint): class MsgRconAuthOn(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'rcon_auth_on' self.message_name: str = 'rcon_auth_on'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 11 self.message_id: int = 11
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgRconCmd(PrettyPrint): class MsgRconCmd(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
cmd: str = 'default' cmd: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'rcon_cmd' self.message_name: str = 'rcon_cmd'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 21 self.message_id: int = 21
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.cmd: str = cmd self.cmd: str = cmd

View file

@ -8,6 +8,7 @@ from twnet_parser.packer import pack_str
class MsgRconCmdAdd(PrettyPrint): class MsgRconCmdAdd(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default', name: str = 'default',
help: str = 'default', help: str = 'default',
params: str = 'default' params: str = 'default'
@ -15,7 +16,7 @@ class MsgRconCmdAdd(PrettyPrint):
self.message_name: str = 'rcon_cmd_add' self.message_name: str = 'rcon_cmd_add'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 14 self.message_id: int = 14
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name
self.help: str = help self.help: str = help

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgRconCmdRem(PrettyPrint): class MsgRconCmdRem(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default' name: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'rcon_cmd_rem' self.message_name: str = 'rcon_cmd_rem'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 15 self.message_id: int = 15
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.name: str = name self.name: str = name

View file

@ -8,12 +8,13 @@ from twnet_parser.packer import pack_str
class MsgRconLine(PrettyPrint): class MsgRconLine(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
line: str = 'default' line: str = 'default'
) -> None: ) -> None:
self.message_name: str = 'rcon_line' self.message_name: str = 'rcon_line'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 13 self.message_id: int = 13
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.line: str = line self.line: str = line

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgReady(PrettyPrint): class MsgReady(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'ready' self.message_name: str = 'ready'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 18 self.message_id: int = 18
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -4,11 +4,14 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader from twnet_parser.chunk_header import ChunkHeader
class MsgRequestMapData(PrettyPrint): class MsgRequestMapData(PrettyPrint):
def __init__(self) -> None: def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_name: str = 'request_map_data' self.message_name: str = 'request_map_data'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 23 self.message_id: int = 23
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
# first byte of data # first byte of data

View file

@ -7,12 +7,13 @@ from twnet_parser.chunk_header import ChunkHeader
class MsgServerInfo(PrettyPrint): class MsgServerInfo(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
data: bytes = b'\x00' data: bytes = b'\x00'
) -> None: ) -> None:
self.message_name: str = 'server_info' self.message_name: str = 'server_info'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 4 self.message_id: int = 4
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.data: bytes = data self.data: bytes = data

View file

@ -9,6 +9,7 @@ from typing import Optional
class MsgSnap(PrettyPrint): class MsgSnap(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
tick: int = 0, tick: int = 0,
delta_tick: int = 0, delta_tick: int = 0,
num_parts: int = 0, num_parts: int = 0,
@ -20,7 +21,7 @@ class MsgSnap(PrettyPrint):
self.message_name: str = 'snap' self.message_name: str = 'snap'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 6 self.message_id: int = 6
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.tick: int = tick self.tick: int = tick
self.delta_tick: int = delta_tick self.delta_tick: int = delta_tick

View file

@ -8,13 +8,14 @@ from twnet_parser.packer import pack_int
class MsgSnapEmpty(PrettyPrint): class MsgSnapEmpty(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
tick: int = 0, tick: int = 0,
delta_tick: int = 0 delta_tick: int = 0
) -> None: ) -> None:
self.message_name: str = 'snap_empty' self.message_name: str = 'snap_empty'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 7 self.message_id: int = 7
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.tick: int = tick self.tick: int = tick
self.delta_tick: int = delta_tick self.delta_tick: int = delta_tick

View file

@ -9,6 +9,7 @@ from typing import Optional
class MsgSnapSingle(PrettyPrint): class MsgSnapSingle(PrettyPrint):
def __init__( def __init__(
self, self,
chunk_header: ChunkHeader = ChunkHeader(),
tick: int = 0, tick: int = 0,
delta_tick: int = 0, delta_tick: int = 0,
crc: int = 0, crc: int = 0,
@ -18,7 +19,7 @@ class MsgSnapSingle(PrettyPrint):
self.message_name: str = 'snap_single' self.message_name: str = 'snap_single'
self.system_message: bool = True self.system_message: bool = True
self.message_id: int = 8 self.message_id: int = 8
self.header: ChunkHeader self.header: ChunkHeader = chunk_header
self.tick: int = tick self.tick: int = tick
self.delta_tick: int = delta_tick self.delta_tick: int = delta_tick