Add message_type field for control, game and system messages

This commit is contained in:
ChillerDragon 2023-05-09 11:42:19 +02:00
parent 3b7d46e5a7
commit 2ef0b07282
69 changed files with 139 additions and 10 deletions

View file

@ -229,7 +229,7 @@ def gen_unpack_members(msg: NetMessageJson) -> str:
def get_dependencies(msg: NetMessageJson) -> str:
packer_deps: list[str] = []
typing_deps: list[str] = []
typing_deps: list[str] = ['Literal']
need_enums: bool = False
for member in msg['members']:
if member['type']['kind'] == 'string':
@ -511,7 +511,7 @@ class CodeGenerator():
def generate_msg(
self,
msg: NetMessageJson,
game: Literal['game', 'system']
game: Literal['system', 'game']
) -> None:
name_snake = name_to_snake(msg['name'])
name_camel = name_to_camel(msg['name'])
@ -535,6 +535,7 @@ class CodeGenerator():
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)
out_file.write(f" self.message_type: Literal['system', 'game'] = '{game}'\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")

View file

@ -1,7 +1,9 @@
from typing import Literal
from twnet_parser.pretty_print import PrettyPrint
class CtrlAccept(PrettyPrint):
def __init__(self) -> None:
self.message_type: Literal['control'] = 'control'
self.message_name: str = 'accept'
self.message_id: int = 2

View file

@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Literal
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
@ -9,6 +9,7 @@ class CtrlClose(PrettyPrint):
self,
reason: Optional[str] = None
) -> None:
self.message_type: Literal['control'] = 'control'
self.message_name: str = 'close'
self.message_id: int = 4

View file

@ -1,3 +1,4 @@
from typing import Literal
from twnet_parser.pretty_print import PrettyPrint
class CtrlConnect(PrettyPrint):
@ -5,6 +6,7 @@ class CtrlConnect(PrettyPrint):
self,
response_token: bytes = b'\xff\xff\xff\xff'
) -> None:
self.message_type: Literal['control'] = 'control'
self.message_name: str = 'connect'
self.message_id: int = 1

View file

@ -1,7 +1,9 @@
from typing import Literal
from twnet_parser.pretty_print import PrettyPrint
class CtrlKeepAlive(PrettyPrint):
def __init__(self) -> None:
self.message_type: Literal['control'] = 'control'
self.message_name: str = 'keep_alive'
self.message_id: int = 0

View file

@ -1,3 +1,4 @@
from typing import Literal
from twnet_parser.pretty_print import PrettyPrint
class CtrlToken(PrettyPrint):
@ -5,6 +6,7 @@ class CtrlToken(PrettyPrint):
self,
response_token: bytes = b'\xff\xff\xff\xff'
) -> None:
self.message_type: Literal['control'] = 'control'
self.message_name: str = 'token'
self.message_id: int = 5

View file

@ -4,6 +4,7 @@ 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
class MsgClCallVote(PrettyPrint):
def __init__(
@ -14,6 +15,7 @@ class MsgClCallVote(PrettyPrint):
reason: str = 'default',
force: bool = False
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_call_vote'
self.system_message: bool = False
self.message_id: int = 32

View file

@ -4,6 +4,7 @@ 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
class MsgClCommand(PrettyPrint):
def __init__(
@ -12,6 +13,7 @@ class MsgClCommand(PrettyPrint):
name: str = 'default',
arguments: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_command'
self.system_message: bool = False
self.message_id: int = 39

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgClEmoticon(PrettyPrint):
@ -12,6 +13,7 @@ class MsgClEmoticon(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgClKill(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_kill'
self.system_message: bool = False
self.message_id: int = 28

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgClReadyChange(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> 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

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgClSay(PrettyPrint):
@ -14,6 +15,7 @@ class MsgClSay(PrettyPrint):
target: int = 0,
message: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_say'
self.system_message: bool = False
self.message_id: int = 24

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgClSetSpectatorMode(PrettyPrint):
@ -13,6 +14,7 @@ class MsgClSetSpectatorMode(PrettyPrint):
spec_mode: int = enum7.Spec.FREEVIEW.value,
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 = 26

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgClSetTeam(PrettyPrint):
@ -12,6 +13,7 @@ class MsgClSetTeam(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,7 +4,7 @@ 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
from typing import Annotated, Literal
class MsgClSkinChange(PrettyPrint):
def __init__(
@ -17,6 +17,7 @@ class MsgClSkinChange(PrettyPrint):
skin_part_colors: Annotated[list[int], 6] = \
[0, 0, 0, 0, 0, 0]
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_skin_change'
self.system_message: bool = False
self.message_id: int = 34

View file

@ -4,7 +4,7 @@ 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
from typing import Annotated, Literal
class MsgClStartInfo(PrettyPrint):
def __init__(
@ -20,6 +20,7 @@ class MsgClStartInfo(PrettyPrint):
skin_part_colors: Annotated[list[int], 6] = \
[0, 0, 0, 0, 0, 0]
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'cl_start_info'
self.system_message: bool = False
self.message_id: int = 27

View file

@ -4,6 +4,7 @@ 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
class MsgClVote(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgClVote(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgDeClientEnter(PrettyPrint):
@ -14,6 +15,7 @@ class MsgDeClientEnter(PrettyPrint):
client_id: int = 0,
team: int = enum7.Team.SPECTATORS.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'de_client_enter'
self.system_message: bool = False
self.message_id: int = 22

View file

@ -4,6 +4,7 @@ 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
class MsgDeClientLeave(PrettyPrint):
def __init__(
@ -13,6 +14,7 @@ class MsgDeClientLeave(PrettyPrint):
client_id: int = 0,
reason: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'de_client_leave'
self.system_message: bool = False
self.message_id: int = 23

View file

@ -4,6 +4,7 @@ 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
class MsgSvBroadcast(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgSvBroadcast(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgSvChat(PrettyPrint):
@ -15,6 +16,7 @@ class MsgSvChat(PrettyPrint):
target_id: int = 0,
message: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_chat'
self.system_message: bool = False
self.message_id: int = 3

View file

@ -4,6 +4,7 @@ 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
class MsgSvCheckpoint(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgSvCheckpoint(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
class MsgSvClientDrop(PrettyPrint):
def __init__(
@ -13,6 +14,7 @@ class MsgSvClientDrop(PrettyPrint):
reason: str = 'default',
silent: bool = False
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_client_drop'
self.system_message: bool = False
self.message_id: int = 20

View file

@ -4,7 +4,7 @@ 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
from typing import Annotated, Literal
import twnet_parser.enum7 as enum7
class MsgSvClientInfo(PrettyPrint):
@ -25,6 +25,7 @@ class MsgSvClientInfo(PrettyPrint):
[0, 0, 0, 0, 0, 0],
silent: bool = False
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_client_info'
self.system_message: bool = False
self.message_id: int = 18

View file

@ -4,6 +4,7 @@ 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
class MsgSvCommandInfo(PrettyPrint):
def __init__(
@ -13,6 +14,7 @@ class MsgSvCommandInfo(PrettyPrint):
args_format: str = 'default',
help_text: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_command_info'
self.system_message: bool = False
self.message_id: int = 37

View file

@ -4,6 +4,7 @@ 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
class MsgSvCommandInfoRemove(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgSvCommandInfoRemove(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgSvEmoticon(PrettyPrint):
@ -13,6 +14,7 @@ class MsgSvEmoticon(PrettyPrint):
client_id: int = 0,
emoticon: int = enum7.Emoticon.OOP.value
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_emoticon'
self.system_message: bool = False
self.message_id: int = 10

View file

@ -4,6 +4,7 @@ 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
class MsgSvExtraProjectile(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgSvExtraProjectile(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
projectile: int = 0
) -> 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

View file

@ -4,6 +4,7 @@ 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
class MsgSvGameInfo(PrettyPrint):
def __init__(
@ -15,6 +16,7 @@ class MsgSvGameInfo(PrettyPrint):
match_num: int = 0,
match_current: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_game_info'
self.system_message: bool = False
self.message_id: int = 19

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgSvGameMsg(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> 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

View file

@ -4,6 +4,7 @@ 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
class MsgSvKillMsg(PrettyPrint):
def __init__(
@ -14,6 +15,7 @@ class MsgSvKillMsg(PrettyPrint):
weapon: int = 0,
mode_special: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_kill_msg'
self.system_message: bool = False
self.message_id: int = 5

View file

@ -4,6 +4,7 @@ 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
class MsgSvMotd(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgSvMotd(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
class MsgSvRaceFinish(PrettyPrint):
def __init__(
@ -15,6 +16,7 @@ class MsgSvRaceFinish(PrettyPrint):
record_personal: bool = False,
record_server: bool = False
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_race_finish'
self.system_message: bool = False
self.message_id: int = 35

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgSvReadyToEnter(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> 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

View file

@ -4,6 +4,7 @@ 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
class MsgSvServerSettings(PrettyPrint):
def __init__(
@ -16,6 +17,7 @@ class MsgSvServerSettings(PrettyPrint):
team_balance: bool = False,
player_slots: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_server_settings'
self.system_message: bool = False
self.message_id: int = 17

View file

@ -4,7 +4,7 @@ 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
from typing import Annotated, Literal
class MsgSvSkinChange(PrettyPrint):
def __init__(
@ -18,6 +18,7 @@ class MsgSvSkinChange(PrettyPrint):
skin_part_colors: Annotated[list[int], 6] = \
[0, 0, 0, 0, 0, 0]
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_skin_change'
self.system_message: bool = False
self.message_id: int = 33

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgSvTeam(PrettyPrint):
@ -15,6 +16,7 @@ class MsgSvTeam(PrettyPrint):
silent: bool = False,
cooldown_tick: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_team'
self.system_message: bool = False
self.message_id: int = 4

View file

@ -4,6 +4,7 @@ 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
class MsgSvTuneParams(PrettyPrint):
def __init__(
@ -42,6 +43,7 @@ class MsgSvTuneParams(PrettyPrint):
player_collision: float = 1,
player_hooking: float = 1
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_tune_params'
self.system_message: bool = False
self.message_id: int = 6

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgSvVoteClearOptions(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> 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

View file

@ -4,6 +4,7 @@ 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
class MsgSvVoteOptionAdd(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgSvVoteOptionAdd(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgSvVoteOptionListAdd(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> 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

View file

@ -4,6 +4,7 @@ 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
class MsgSvVoteOptionRemove(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgSvVoteOptionRemove(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgSvVoteSet(PrettyPrint):
@ -16,6 +17,7 @@ class MsgSvVoteSet(PrettyPrint):
description: str = 'default',
reason: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_set'
self.system_message: bool = False
self.message_id: int = 15

View file

@ -4,6 +4,7 @@ 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
class MsgSvVoteStatus(PrettyPrint):
def __init__(
@ -14,6 +15,7 @@ class MsgSvVoteStatus(PrettyPrint):
pass_: int = 0,
total: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'game'
self.message_name: str = 'sv_vote_status'
self.system_message: bool = False
self.message_id: int = 16

View file

@ -4,6 +4,7 @@ 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
import twnet_parser.enum7 as enum7
class MsgSvWeaponPickup(PrettyPrint):
@ -12,6 +13,7 @@ class MsgSvWeaponPickup(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgConReady(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'con_ready'
self.system_message: bool = True
self.message_id: int = 5

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgEnterGame(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'enter_game'
self.system_message: bool = True
self.message_id: int = 19

View file

@ -4,6 +4,7 @@ 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
class MsgInfo(PrettyPrint):
def __init__(
@ -13,6 +14,7 @@ class MsgInfo(PrettyPrint):
password: str = '',
client_version: int = 1797
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'info'
self.system_message: bool = True
self.message_id: int = 1

View file

@ -4,6 +4,7 @@ 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
class MsgInput(PrettyPrint):
def __init__(
@ -14,6 +15,7 @@ class MsgInput(PrettyPrint):
input_size: int = 0,
input: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'input'
self.system_message: bool = True
self.message_id: int = 20

View file

@ -4,6 +4,7 @@ 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
class MsgInputTiming(PrettyPrint):
def __init__(
@ -12,6 +13,7 @@ class MsgInputTiming(PrettyPrint):
input_pred_tick: int = 0,
time_left: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'input_timing'
self.system_message: bool = True
self.message_id: int = 10

View file

@ -4,7 +4,7 @@ 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
from typing import Annotated, Literal
class MsgMapChange(PrettyPrint):
def __init__(
@ -17,6 +17,7 @@ class MsgMapChange(PrettyPrint):
chunk_size: int = 0,
sha256: Annotated[bytes, 32] = bytes(32)
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'map_change'
self.system_message: bool = True
self.message_id: int = 2

View file

@ -3,6 +3,7 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgMapData(PrettyPrint):
def __init__(
@ -10,6 +11,7 @@ class MsgMapData(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
class MsgMaplistEntryAdd(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgMaplistEntryAdd(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
class MsgMaplistEntryRem(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgMaplistEntryRem(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgPing(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'ping'
self.system_message: bool = True
self.message_id: int = 26

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgPingReply(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'ping_reply'
self.system_message: bool = True
self.message_id: int = 27

View file

@ -4,6 +4,7 @@ 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
class MsgRconAuth(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgRconAuth(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgRconAuthOff(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> 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

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgRconAuthOn(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> 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

View file

@ -4,6 +4,7 @@ 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
class MsgRconCmd(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgRconCmd(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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

View file

@ -4,6 +4,7 @@ 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
class MsgRconCmdAdd(PrettyPrint):
def __init__(
@ -13,6 +14,7 @@ class MsgRconCmdAdd(PrettyPrint):
help: str = 'default',
params: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_cmd_add'
self.system_message: bool = True
self.message_id: int = 14

View file

@ -4,6 +4,7 @@ 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
class MsgRconCmdRem(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgRconCmdRem(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
name: str = 'default'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'rcon_cmd_rem'
self.system_message: bool = True
self.message_id: int = 15

View file

@ -4,6 +4,7 @@ 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
class MsgRconLine(PrettyPrint):
def __init__(
@ -11,6 +12,7 @@ class MsgRconLine(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
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 = 13

View file

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

View file

@ -2,12 +2,14 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgRequestMapData(PrettyPrint):
def __init__(
self,
chunk_header: ChunkHeader = ChunkHeader()
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'request_map_data'
self.system_message: bool = True
self.message_id: int = 23

View file

@ -3,6 +3,7 @@
from twnet_parser.pretty_print import PrettyPrint
from twnet_parser.packer import Unpacker
from twnet_parser.chunk_header import ChunkHeader
from typing import Literal
class MsgServerInfo(PrettyPrint):
def __init__(
@ -10,6 +11,7 @@ class MsgServerInfo(PrettyPrint):
chunk_header: ChunkHeader = ChunkHeader(),
data: bytes = b'\x00'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'server_info'
self.system_message: bool = True
self.message_id: int = 4

View file

@ -4,7 +4,7 @@ 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 Optional
from typing import Literal, Optional
class MsgSnap(PrettyPrint):
def __init__(
@ -18,6 +18,7 @@ class MsgSnap(PrettyPrint):
data_size: Optional[int] = None,
data: bytes = b'\x00'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'snap'
self.system_message: bool = True
self.message_id: int = 6

View file

@ -4,6 +4,7 @@ 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
class MsgSnapEmpty(PrettyPrint):
def __init__(
@ -12,6 +13,7 @@ class MsgSnapEmpty(PrettyPrint):
tick: int = 0,
delta_tick: int = 0
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'snap_empty'
self.system_message: bool = True
self.message_id: int = 7

View file

@ -4,7 +4,7 @@ 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 Optional
from typing import Literal, Optional
class MsgSnapSingle(PrettyPrint):
def __init__(
@ -16,6 +16,7 @@ class MsgSnapSingle(PrettyPrint):
data_size: Optional[int] = None,
data: bytes = b'\x00'
) -> None:
self.message_type: Literal['system', 'game'] = 'system'
self.message_name: str = 'snap_single'
self.system_message: bool = True
self.message_id: int = 8