fix: chunk header being cached across messages

closed #14
This commit is contained in:
ChillerDragon 2024-02-17 12:59:49 +08:00
parent 3b50799bbb
commit 8e02807c59
107 changed files with 529 additions and 311 deletions

View file

@ -415,11 +415,15 @@ class CodeGenerator():
def get_dependencies(
self,
msg: NetMessageJson,
game_or_sys: bool,
typing_dep: Optional[str] = 'Literal'
) -> str:
packer_deps: list[str] = []
typing_deps: list[str] = []
custom_deps: list[str] = []
# the ChunkHeader is Optional
if game_or_sys:
typing_deps.append('Optional')
if typing_dep:
typing_deps.append(typing_dep)
need_enums: bool = False
@ -794,7 +798,7 @@ def match_connless{self.protocol_version}(msg_id: bytes, data: bytes) -> Connles
out_file.write( \
' def __init__(\n' \
' self,\n' \
f' chunk_header: ChunkHeader = ChunkHeader(){comma}')
f' chunk_header: Optional[ChunkHeader] = None{comma}')
args: list[str] = []
for member in msg['members']:
mem_defs: list[str] = self.gen_init_member_header_def(member, name_snake, game)
@ -818,7 +822,7 @@ def match_connless{self.protocol_version}(msg_id: bytes, data: bytes) -> Connles
out_file.write('from twnet_parser.pretty_print import PrettyPrint\n')
if len(obj['members']) > 0:
out_file.write('from twnet_parser.packer import Unpacker\n')
out_file.write(self.get_dependencies(obj, None))
out_file.write(self.get_dependencies(obj, False, None))
out_file.write('\n')
out_file.write(f'class Obj{name_camel}(PrettyPrint):\n')
comma: str = ''
@ -1010,7 +1014,7 @@ def match_connless{self.protocol_version}(msg_id: bytes, data: bytes) -> Connles
if len(msg['members']) > 0:
out_file.write('from twnet_parser.packer import Unpacker\n')
out_file.write('from twnet_parser.chunk_header import ChunkHeader\n')
out_file.write(self.get_dependencies(msg))
out_file.write(self.get_dependencies(msg, True))
out_file.write('\n')
out_file.write(f'class Msg{name_camel}(PrettyPrint):\n')
self.write_init_method_header(out_file, msg, game, name_snake)
@ -1019,7 +1023,9 @@ def match_connless{self.protocol_version}(msg_id: bytes, data: bytes) -> Connles
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 = chunk_header\n")
out_file.write(" self.header: ChunkHeader = ChunkHeader()\n")
out_file.write(" if chunk_header:\n")
out_file.write(" self.header = chunk_header\n")
out_file.write('\n')
self.generate_field_assignments_in_initialize(msg, out_file)
out_file.write('\n')

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgClCallVote(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
type: str = 'default',
value: str = 'default',
reason: str = 'default'
@ -18,7 +18,9 @@ class MsgClCallVote(PrettyPrint):
self.message_name: str = 'cl_call_vote'
self.system_message: bool = False
self.message_id: int = 25
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.type: str = type
self.value: str = value

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgClChangeInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
clan: str = 'default',
country: int = 0,
@ -22,7 +22,9 @@ class MsgClChangeInfo(PrettyPrint):
self.message_name: str = 'cl_change_info'
self.system_message: bool = False
self.message_id: int = 21
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.clan: str = clan

View file

@ -4,20 +4,22 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum6 as enum6
class MsgClEmoticon(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
emoticon: int = enum6.Emoticon.OOP.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_emoticon'
self.system_message: bool = False
self.message_id: int = 23
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.emoticon: int = emoticon

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgClKill(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_kill'
self.system_message: bool = False
self.message_id: int = 22
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgClSay(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
team: bool = False,
message: str = 'default'
) -> None:
@ -17,7 +17,9 @@ class MsgClSay(PrettyPrint):
self.message_name: str = 'cl_say'
self.system_message: bool = False
self.message_id: int = 17
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.team: bool = team
self.message: str = message

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgClSetSpectatorMode(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
spectator_id: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_set_spectator_mode'
self.system_message: bool = False
self.message_id: int = 19
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.spectator_id: int = spectator_id

View file

@ -4,20 +4,22 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum6 as enum6
class MsgClSetTeam(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
team: int = enum6.Team.SPECTATORS.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_set_team'
self.system_message: bool = False
self.message_id: int = 18
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.team: int = team

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgClStartInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
clan: str = 'default',
country: int = 0,
@ -22,7 +22,9 @@ class MsgClStartInfo(PrettyPrint):
self.message_name: str = 'cl_start_info'
self.system_message: bool = False
self.message_id: int = 20
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.clan: str = clan

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgClVote(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
vote: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_vote'
self.system_message: bool = False
self.message_id: int = 24
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.vote: int = vote

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvBroadcast(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
message: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_broadcast'
self.system_message: bool = False
self.message_id: int = 2
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.message: str = message

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvChat(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
team: bool = False,
client_id: int = 0,
message: str = 'default'
@ -18,7 +18,9 @@ class MsgSvChat(PrettyPrint):
self.message_name: str = 'sv_chat'
self.system_message: bool = False
self.message_id: int = 3
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.team: bool = team
self.client_id: int = client_id

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum6 as enum6
class MsgSvEmoticon(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
emoticon: int = enum6.Emoticon.OOP.value
) -> None:
@ -18,7 +18,9 @@ class MsgSvEmoticon(PrettyPrint):
self.message_name: str = 'sv_emoticon'
self.system_message: bool = False
self.message_id: int = 10
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.emoticon: int = emoticon

View file

@ -9,14 +9,16 @@ from twnet_parser.snap6.projectile import ObjProjectile
class MsgSvExtraProjectile(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
projectile: Optional[ObjProjectile] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_extra_projectile'
self.system_message: bool = False
self.message_id: int = 7
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
if not projectile:
projectile = ObjProjectile()

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvKillMsg(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
killer: int = 0,
victim: int = 0,
weapon: int = 0,
@ -19,7 +19,9 @@ class MsgSvKillMsg(PrettyPrint):
self.message_name: str = 'sv_kill_msg'
self.system_message: bool = False
self.message_id: int = 4
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.killer: int = killer
self.victim: int = victim

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvMotd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
message: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_motd'
self.system_message: bool = False
self.message_id: int = 1
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.message: str = message

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgSvReadyToEnter(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_ready_to_enter'
self.system_message: bool = False
self.message_id: int = 8
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,20 +4,22 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum6 as enum6
class MsgSvSoundGlobal(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
sound_id: int = enum6.Sound.GUN_FIRE.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_sound_global'
self.system_message: bool = False
self.message_id: int = 5
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.sound_id: int = sound_id

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvTuneParams(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
ground_control_speed: float = 10,
ground_control_accel: float = 2,
ground_friction: float = 0.5,
@ -48,7 +48,9 @@ class MsgSvTuneParams(PrettyPrint):
self.message_name: str = 'sv_tune_params'
self.system_message: bool = False
self.message_id: int = 6
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.ground_control_speed: float = ground_control_speed
self.ground_control_accel: float = ground_control_accel

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteClearOptions(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_clear_options'
self.system_message: bool = False
self.message_id: int = 11
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteOptionAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
description: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_option_add'
self.system_message: bool = False
self.message_id: int = 13
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.description: str = description

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Annotated, Literal
from typing import Annotated, Literal, Optional
class MsgSvVoteOptionListAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
num_options: int = 0,
description: Annotated[list[str], 15] = \
['', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
@ -18,7 +18,9 @@ class MsgSvVoteOptionListAdd(PrettyPrint):
self.message_name: str = 'sv_vote_option_list_add'
self.system_message: bool = False
self.message_id: int = 12
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.num_options: int = num_options
self.description = description

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteOptionRemove(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
description: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_option_remove'
self.system_message: bool = False
self.message_id: int = 14
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.description: str = description

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteSet(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
timeout: int = 0,
description: str = 'default',
reason: str = 'default'
@ -18,7 +18,9 @@ class MsgSvVoteSet(PrettyPrint):
self.message_name: str = 'sv_vote_set'
self.system_message: bool = False
self.message_id: int = 15
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.timeout: int = timeout
self.description: str = description

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteStatus(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
yes: int = 0,
no: int = 0,
pass_: int = 0,
@ -19,7 +19,9 @@ class MsgSvVoteStatus(PrettyPrint):
self.message_name: str = 'sv_vote_status'
self.system_message: bool = False
self.message_id: int = 16
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.yes: int = yes
self.no: int = no

View file

@ -4,20 +4,22 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum6 as enum6
class MsgSvWeaponPickup(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
weapon: int = enum6.Weapon.HAMMER.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_weapon_pickup'
self.system_message: bool = False
self.message_id: int = 9
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.weapon: int = weapon

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgConReady(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'con_ready'
self.system_message: bool = True
self.message_id: int = 4
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgEnterGame(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'enter_game'
self.system_message: bool = True
self.message_id: int = 15
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -9,7 +9,7 @@ from typing import Literal, Optional
class MsgInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
version: str = '0.7 802f1be60a05665f',
password: str = ''
) -> None:
@ -17,7 +17,9 @@ class MsgInfo(PrettyPrint):
self.message_name: str = 'info'
self.system_message: bool = True
self.message_id: int = 1
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.version: str = version
self.password: Optional[str] = password

View file

@ -10,7 +10,7 @@ from twnet_parser.snap6.player_input import ObjPlayerInput
class MsgInput(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
ack_snapshot: int = 0,
intended_tick: int = 0,
input_size: int = 0,
@ -20,7 +20,9 @@ class MsgInput(PrettyPrint):
self.message_name: str = 'input'
self.system_message: bool = True
self.message_id: int = 16
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.ack_snapshot: int = ack_snapshot
self.intended_tick: int = intended_tick

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgInputTiming(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
input_pred_tick: int = 0,
time_left: int = 0
) -> None:
@ -17,7 +17,9 @@ class MsgInputTiming(PrettyPrint):
self.message_name: str = 'input_timing'
self.system_message: bool = True
self.message_id: int = 9
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.input_pred_tick: int = input_pred_tick
self.time_left: int = time_left

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgMapChange(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
crc: int = 0,
size: int = 0
@ -18,7 +18,9 @@ class MsgMapChange(PrettyPrint):
self.message_name: str = 'map_change'
self.system_message: bool = True
self.message_id: int = 2
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.crc: int = crc

View file

@ -9,7 +9,7 @@ from typing import Literal, Optional
class MsgMapData(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
last: int = 0,
crc: int = 0,
chunk: int = 0,
@ -20,7 +20,9 @@ class MsgMapData(PrettyPrint):
self.message_name: str = 'map_data'
self.system_message: bool = True
self.message_id: int = 3
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.last: int = last
self.crc: int = crc

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgPing(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'ping'
self.system_message: bool = True
self.message_id: int = 20
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgPingReply(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'ping_reply'
self.system_message: bool = True
self.message_id: int = 21
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -9,7 +9,7 @@ from typing import Literal, Optional
class MsgRconAuth(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
_unused: str = 'default',
password: str = 'default',
request_commands: int = 0
@ -18,7 +18,9 @@ class MsgRconAuth(PrettyPrint):
self.message_name: str = 'rcon_auth'
self.system_message: bool = True
self.message_id: int = 18
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self._unused: str = _unused
self.password: str = password

View file

@ -9,7 +9,7 @@ from typing import Literal, Optional
class MsgRconAuthStatus(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
auth_level: int = 0,
receive_commands: int = 0
) -> None:
@ -17,7 +17,9 @@ class MsgRconAuthStatus(PrettyPrint):
self.message_name: str = 'rcon_auth_status'
self.system_message: bool = True
self.message_id: int = 10
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.auth_level: Optional[int] = auth_level
self.receive_commands: Optional[int] = receive_commands

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgRconCmd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
cmd: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_cmd'
self.system_message: bool = True
self.message_id: int = 17
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.cmd: str = cmd

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgRconCmdAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
help: str = 'default',
params: str = 'default'
@ -18,7 +18,9 @@ class MsgRconCmdAdd(PrettyPrint):
self.message_name: str = 'rcon_cmd_add'
self.system_message: bool = True
self.message_id: int = 25
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.help: str = help

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgRconCmdRemove(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_cmd_remove'
self.system_message: bool = True
self.message_id: int = 26
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgRconLine(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
line: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_line'
self.system_message: bool = True
self.message_id: int = 11
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.line: str = line

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgReady(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'ready'
self.system_message: bool = True
self.message_id: int = 14
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgRequestMapData(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
chunk: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'request_map_data'
self.system_message: bool = True
self.message_id: int = 19
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.chunk: int = chunk

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSnapEmpty(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
tick: int = 0,
delta_tick: int = 0
) -> None:
@ -17,7 +17,9 @@ class MsgSnapEmpty(PrettyPrint):
self.message_name: str = 'snap_empty'
self.system_message: bool = True
self.message_id: int = 6
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.tick: int = tick
self.delta_tick: int = delta_tick

View file

@ -9,7 +9,7 @@ from typing import Literal, Optional
class MsgSnapSingle(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
tick: int = 0,
delta_tick: int = 0,
crc: int = 0,
@ -20,7 +20,9 @@ class MsgSnapSingle(PrettyPrint):
self.message_name: str = 'snap_single'
self.system_message: bool = True
self.message_id: int = 7
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.tick: int = tick
self.delta_tick: int = delta_tick

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgClCallVote(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
type: str = 'default',
value: str = 'default',
reason: str = 'default',
@ -19,7 +19,9 @@ class MsgClCallVote(PrettyPrint):
self.message_name: str = 'cl_call_vote'
self.system_message: bool = False
self.message_id: int = 32
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.type: str = type
self.value: str = value

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgClCommand(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
arguments: str = 'default'
) -> None:
@ -17,7 +17,9 @@ class MsgClCommand(PrettyPrint):
self.message_name: str = 'cl_command'
self.system_message: bool = False
self.message_id: int = 39
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.arguments: str = arguments

View file

@ -4,20 +4,22 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgClEmoticon(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
emoticon: int = enum7.Emoticon.OOP.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_emoticon'
self.system_message: bool = False
self.message_id: int = 30
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.emoticon: int = emoticon

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgClKill(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_kill'
self.system_message: bool = False
self.message_id: int = 28
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgClReadyChange(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_ready_change'
self.system_message: bool = False
self.message_id: int = 29
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgClSay(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
mode: int = enum7.Chat.NONE.value,
target: int = -1,
message: str = 'default'
@ -19,7 +19,9 @@ class MsgClSay(PrettyPrint):
self.message_name: str = 'cl_say'
self.system_message: bool = False
self.message_id: int = 24
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.mode: int = mode
self.target: int = target

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgClSetSpectatorMode(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
spec_mode: int = enum7.Spec.FREEVIEW.value,
spectator_id: int = 0
) -> None:
@ -18,7 +18,9 @@ class MsgClSetSpectatorMode(PrettyPrint):
self.message_name: str = 'cl_set_spectator_mode'
self.system_message: bool = False
self.message_id: int = 26
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.spec_mode: int = spec_mode
self.spectator_id: int = spectator_id

View file

@ -4,20 +4,22 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgClSetTeam(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
team: int = enum7.Team.SPECTATORS.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_set_team'
self.system_message: bool = False
self.message_id: int = 25
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.team: int = team

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Annotated, Literal
from typing import Annotated, Literal, Optional
class MsgClSkinChange(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
skin_part_names: Annotated[list[str], 6] = \
['', '', '', '', '', ''],
use_custom_colors: Annotated[list[bool], 6] = \
@ -21,7 +21,9 @@ class MsgClSkinChange(PrettyPrint):
self.message_name: str = 'cl_skin_change'
self.system_message: bool = False
self.message_id: int = 34
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.skin_part_names = skin_part_names
self.use_custom_colors = use_custom_colors

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Annotated, Literal
from typing import Annotated, Literal, Optional
class MsgClStartInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
clan: str = 'default',
country: int = 0,
@ -24,7 +24,9 @@ class MsgClStartInfo(PrettyPrint):
self.message_name: str = 'cl_start_info'
self.system_message: bool = False
self.message_id: int = 27
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.clan: str = clan

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgClVote(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
vote: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_vote'
self.system_message: bool = False
self.message_id: int = 31
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.vote: int = vote

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgDeClientEnter(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
client_id: int = 0,
team: int = enum7.Team.SPECTATORS.value
@ -19,7 +19,9 @@ class MsgDeClientEnter(PrettyPrint):
self.message_name: str = 'de_client_enter'
self.system_message: bool = False
self.message_id: int = 22
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.client_id: int = client_id

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgDeClientLeave(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
client_id: int = 0,
reason: str = 'default'
@ -18,7 +18,9 @@ class MsgDeClientLeave(PrettyPrint):
self.message_name: str = 'de_client_leave'
self.system_message: bool = False
self.message_id: int = 23
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.client_id: int = client_id

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvBroadcast(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
message: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_broadcast'
self.system_message: bool = False
self.message_id: int = 2
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.message: str = message

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgSvChat(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
mode: int = enum7.Chat.NONE.value,
client_id: int = 0,
target_id: int = 0,
@ -20,7 +20,9 @@ class MsgSvChat(PrettyPrint):
self.message_name: str = 'sv_chat'
self.system_message: bool = False
self.message_id: int = 3
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.mode: int = mode
self.client_id: int = client_id

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvCheckpoint(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
diff: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_checkpoint'
self.system_message: bool = False
self.message_id: int = 36
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.diff: int = diff

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvClientDrop(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
reason: str = 'default',
silent: bool = False
@ -18,7 +18,9 @@ class MsgSvClientDrop(PrettyPrint):
self.message_name: str = 'sv_client_drop'
self.system_message: bool = False
self.message_id: int = 20
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.reason: str = reason

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Annotated, Literal
from typing import Annotated, Literal, Optional
import twnet_parser.enum7 as enum7
class MsgSvClientInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
local: bool = False,
team: int = enum7.Team.SPECTATORS.value,
@ -29,7 +29,9 @@ class MsgSvClientInfo(PrettyPrint):
self.message_name: str = 'sv_client_info'
self.system_message: bool = False
self.message_id: int = 18
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.local: bool = local

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvCommandInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
args_format: str = 'default',
help_text: str = 'default'
@ -18,7 +18,9 @@ class MsgSvCommandInfo(PrettyPrint):
self.message_name: str = 'sv_command_info'
self.system_message: bool = False
self.message_id: int = 37
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.args_format: str = args_format

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvCommandInfoRemove(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_command_info_remove'
self.system_message: bool = False
self.message_id: int = 38
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgSvEmoticon(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
emoticon: int = enum7.Emoticon.OOP.value
) -> None:
@ -18,7 +18,9 @@ class MsgSvEmoticon(PrettyPrint):
self.message_name: str = 'sv_emoticon'
self.system_message: bool = False
self.message_id: int = 10
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.emoticon: int = emoticon

View file

@ -9,14 +9,16 @@ from twnet_parser.snap7.projectile import ObjProjectile
class MsgSvExtraProjectile(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
projectile: Optional[ObjProjectile] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_extra_projectile'
self.system_message: bool = False
self.message_id: int = 7
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
if not projectile:
projectile = ObjProjectile()

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvGameInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
game_flags: int = 0,
score_limit: int = 0,
time_limit: int = 0,
@ -20,7 +20,9 @@ class MsgSvGameInfo(PrettyPrint):
self.message_name: str = 'sv_game_info'
self.system_message: bool = False
self.message_id: int = 19
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.game_flags: int = game_flags
self.score_limit: int = score_limit

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgSvGameMsg(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_game_msg'
self.system_message: bool = False
self.message_id: int = 21
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvKillMsg(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
killer: int = 0,
victim: int = 0,
weapon: int = 0,
@ -19,7 +19,9 @@ class MsgSvKillMsg(PrettyPrint):
self.message_name: str = 'sv_kill_msg'
self.system_message: bool = False
self.message_id: int = 5
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.killer: int = killer
self.victim: int = victim

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvMotd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
message: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_motd'
self.system_message: bool = False
self.message_id: int = 1
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.message: str = message

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvRaceFinish(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
time: int = 0,
diff: int = 0,
@ -20,7 +20,9 @@ class MsgSvRaceFinish(PrettyPrint):
self.message_name: str = 'sv_race_finish'
self.system_message: bool = False
self.message_id: int = 35
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.time: int = time

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgSvReadyToEnter(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_ready_to_enter'
self.system_message: bool = False
self.message_id: int = 8
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvServerSettings(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
kick_vote: bool = False,
kick_min: int = 0,
spec_vote: bool = False,
@ -21,7 +21,9 @@ class MsgSvServerSettings(PrettyPrint):
self.message_name: str = 'sv_server_settings'
self.system_message: bool = False
self.message_id: int = 17
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.kick_vote: bool = kick_vote
self.kick_min: int = kick_min

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Annotated, Literal
from typing import Annotated, Literal, Optional
class MsgSvSkinChange(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
skin_part_names: Annotated[list[str], 6] = \
['', '', '', '', '', ''],
@ -22,7 +22,9 @@ class MsgSvSkinChange(PrettyPrint):
self.message_name: str = 'sv_skin_change'
self.system_message: bool = False
self.message_id: int = 33
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.skin_part_names = skin_part_names

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgSvTeam(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
team: int = enum7.Team.SPECTATORS.value,
silent: bool = False,
@ -20,7 +20,9 @@ class MsgSvTeam(PrettyPrint):
self.message_name: str = 'sv_team'
self.system_message: bool = False
self.message_id: int = 4
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.team: int = team

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvTuneParams(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
ground_control_speed: float = 10,
ground_control_accel: float = 2,
ground_friction: float = 0.5,
@ -47,7 +47,9 @@ class MsgSvTuneParams(PrettyPrint):
self.message_name: str = 'sv_tune_params'
self.system_message: bool = False
self.message_id: int = 6
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.ground_control_speed: float = ground_control_speed
self.ground_control_accel: float = ground_control_accel

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteClearOptions(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_clear_options'
self.system_message: bool = False
self.message_id: int = 11
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteOptionAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
description: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_option_add'
self.system_message: bool = False
self.message_id: int = 13
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.description: str = description

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteOptionListAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_option_list_add'
self.system_message: bool = False
self.message_id: int = 12
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_str
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteOptionRemove(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
description: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_option_remove'
self.system_message: bool = False
self.message_id: int = 14
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.description: str = description

View file

@ -4,13 +4,13 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import SANITIZE_CC, pack_int, pack_str
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgSvVoteSet(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
client_id: int = 0,
type: int = enum7.Vote.UNKNOWN.value,
timeout: int = 0,
@ -21,7 +21,9 @@ class MsgSvVoteSet(PrettyPrint):
self.message_name: str = 'sv_vote_set'
self.system_message: bool = False
self.message_id: int = 15
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.client_id: int = client_id
self.type: int = type

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgSvVoteStatus(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
yes: int = 0,
no: int = 0,
pass_: int = 0,
@ -19,7 +19,9 @@ class MsgSvVoteStatus(PrettyPrint):
self.message_name: str = 'sv_vote_status'
self.system_message: bool = False
self.message_id: int = 16
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.yes: int = yes
self.no: int = no

View file

@ -4,20 +4,22 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
import twnet_parser.enum7 as enum7
class MsgSvWeaponPickup(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
weapon: int = enum7.Weapon.HAMMER.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_weapon_pickup'
self.system_message: bool = False
self.message_id: int = 9
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.weapon: int = weapon

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgConReady(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'con_ready'
self.system_message: bool = True
self.message_id: int = 5
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgEnterGame(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'enter_game'
self.system_message: bool = True
self.message_id: int = 19
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -9,7 +9,7 @@ from typing import Literal, Optional
class MsgInfo(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
version: str = '0.7 802f1be60a05665f',
password: str = '',
client_version: int = 1797
@ -18,7 +18,9 @@ class MsgInfo(PrettyPrint):
self.message_name: str = 'info'
self.system_message: bool = True
self.message_id: int = 1
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.version: str = version
self.password: Optional[str] = password

View file

@ -10,7 +10,7 @@ from twnet_parser.snap7.player_input import ObjPlayerInput
class MsgInput(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
ack_snapshot: int = 0,
intended_tick: int = 0,
input_size: int = 0,
@ -20,7 +20,9 @@ class MsgInput(PrettyPrint):
self.message_name: str = 'input'
self.system_message: bool = True
self.message_id: int = 20
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.ack_snapshot: int = ack_snapshot
self.intended_tick: int = intended_tick

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int
from typing import Literal
from typing import Literal, Optional
class MsgInputTiming(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
input_pred_tick: int = 0,
time_left: int = 0
) -> None:
@ -17,7 +17,9 @@ class MsgInputTiming(PrettyPrint):
self.message_name: str = 'input_timing'
self.system_message: bool = True
self.message_id: int = 10
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.input_pred_tick: int = input_pred_tick
self.time_left: int = time_left

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_int, pack_str
from typing import Annotated, Literal
from typing import Annotated, Literal, Optional
class MsgMapChange(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
crc: int = 0,
size: int = 0,
@ -21,7 +21,9 @@ class MsgMapChange(PrettyPrint):
self.message_name: str = 'map_change'
self.system_message: bool = True
self.message_id: int = 2
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.crc: int = crc

View file

@ -3,19 +3,21 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgMapData(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
data: bytes = b'\x00'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'map_data'
self.system_message: bool = True
self.message_id: int = 3
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.data: bytes = data

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgMaplistEntryAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'maplist_entry_add'
self.system_message: bool = True
self.message_id: int = 29
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgMaplistEntryRem(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'maplist_entry_rem'
self.system_message: bool = True
self.message_id: int = 30
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgPing(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'ping'
self.system_message: bool = True
self.message_id: int = 26
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgPingReply(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'ping_reply'
self.system_message: bool = True
self.message_id: int = 27
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgRconAuth(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
password: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_auth'
self.system_message: bool = True
self.message_id: int = 22
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.password: str = password

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgRconAuthOff(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_auth_off'
self.system_message: bool = True
self.message_id: int = 12
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -2,18 +2,20 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
from typing import Literal, Optional
class MsgRconAuthOn(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
chunk_header: Optional[ChunkHeader] = None
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_auth_on'
self.system_message: bool = True
self.message_id: int = 11
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
# first byte of data

View file

@ -4,19 +4,21 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgRconCmd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
cmd: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_cmd'
self.system_message: bool = True
self.message_id: int = 21
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.cmd: str = cmd

View file

@ -4,12 +4,12 @@ from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from twnet_parser.packer import pack_str
from typing import Literal
from typing import Literal, Optional
class MsgRconCmdAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader(),
chunk_header: Optional[ChunkHeader] = None,
name: str = 'default',
help: str = 'default',
params: str = 'default'
@ -18,7 +18,9 @@ class MsgRconCmdAdd(PrettyPrint):
self.message_name: str = 'rcon_cmd_add'
self.system_message: bool = True
self.message_id: int = 14
self.header: ChunkHeader = chunk_header
self.header: ChunkHeader = ChunkHeader()
if chunk_header:
self.header = chunk_header
self.name: str = name
self.help: str = help

Some files were not shown because too many files have changed in this diff Show more