Create chunk header instance for every message
This commit is contained in:
parent
6a351073d3
commit
18dd35f4fa
|
@ -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')
|
||||
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']:
|
||||
# {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue