diff --git a/scripts/generate_messages.py b/scripts/generate_messages.py index 9c094e8..eacaff1 100755 --- a/scripts/generate_messages.py +++ b/scripts/generate_messages.py @@ -265,7 +265,8 @@ def generate_msg(msg: NetMessageJson, game: Literal['game', 'system']) -> None: out_file.write(' # has to be the first byte of the message payload\n') out_file.write(' # NOT the chunk header and NOT the message id\n') out_file.write(' def unpack(self, data: bytes) -> bool:\n') - out_file.write(' unpacker = Unpacker(data)\n') + if len(msg['members']) > 0: + out_file.write(' unpacker = Unpacker(data)\n') for member in msg['members']: # {'name': ['message'], 'type': {'kind': 'string', 'disallow_cc': False}} unpacker = 'int()' diff --git a/twnet_parser/messages7/game/cl_kill.py b/twnet_parser/messages7/game/cl_kill.py index d649fb0..613e1da 100644 --- a/twnet_parser/messages7/game/cl_kill.py +++ b/twnet_parser/messages7/game/cl_kill.py @@ -18,7 +18,6 @@ class MsgClKill(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/game/cl_ready_change.py b/twnet_parser/messages7/game/cl_ready_change.py index bb5c81b..3df68d8 100644 --- a/twnet_parser/messages7/game/cl_ready_change.py +++ b/twnet_parser/messages7/game/cl_ready_change.py @@ -18,7 +18,6 @@ class MsgClReadyChange(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/game/sv_game_msg.py b/twnet_parser/messages7/game/sv_game_msg.py index beeb8fb..65814e2 100644 --- a/twnet_parser/messages7/game/sv_game_msg.py +++ b/twnet_parser/messages7/game/sv_game_msg.py @@ -18,7 +18,6 @@ class MsgSvGameMsg(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/game/sv_ready_to_enter.py b/twnet_parser/messages7/game/sv_ready_to_enter.py index 0805e93..8cd1034 100644 --- a/twnet_parser/messages7/game/sv_ready_to_enter.py +++ b/twnet_parser/messages7/game/sv_ready_to_enter.py @@ -18,7 +18,6 @@ class MsgSvReadyToEnter(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/game/sv_vote_clear_options.py b/twnet_parser/messages7/game/sv_vote_clear_options.py index 12a101e..615ba82 100644 --- a/twnet_parser/messages7/game/sv_vote_clear_options.py +++ b/twnet_parser/messages7/game/sv_vote_clear_options.py @@ -18,7 +18,6 @@ class MsgSvVoteClearOptions(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/game/sv_vote_option_list_add.py b/twnet_parser/messages7/game/sv_vote_option_list_add.py index 1bd03ea..c39a18c 100644 --- a/twnet_parser/messages7/game/sv_vote_option_list_add.py +++ b/twnet_parser/messages7/game/sv_vote_option_list_add.py @@ -18,7 +18,6 @@ class MsgSvVoteOptionListAdd(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/con_ready.py b/twnet_parser/messages7/system/con_ready.py index fd4cd55..c8a2ac5 100644 --- a/twnet_parser/messages7/system/con_ready.py +++ b/twnet_parser/messages7/system/con_ready.py @@ -18,7 +18,6 @@ class MsgConReady(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/enter_game.py b/twnet_parser/messages7/system/enter_game.py index c09482e..e8f6326 100644 --- a/twnet_parser/messages7/system/enter_game.py +++ b/twnet_parser/messages7/system/enter_game.py @@ -18,7 +18,6 @@ class MsgEnterGame(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/ping.py b/twnet_parser/messages7/system/ping.py index b73ce22..bd13b94 100644 --- a/twnet_parser/messages7/system/ping.py +++ b/twnet_parser/messages7/system/ping.py @@ -18,7 +18,6 @@ class MsgPing(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/ping_reply.py b/twnet_parser/messages7/system/ping_reply.py index 70d5aeb..c6a8ae6 100644 --- a/twnet_parser/messages7/system/ping_reply.py +++ b/twnet_parser/messages7/system/ping_reply.py @@ -18,7 +18,6 @@ class MsgPingReply(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/rcon_auth_off.py b/twnet_parser/messages7/system/rcon_auth_off.py index 8aebcb1..be70fcb 100644 --- a/twnet_parser/messages7/system/rcon_auth_off.py +++ b/twnet_parser/messages7/system/rcon_auth_off.py @@ -18,7 +18,6 @@ class MsgRconAuthOff(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/rcon_auth_on.py b/twnet_parser/messages7/system/rcon_auth_on.py index cde0633..3fd3372 100644 --- a/twnet_parser/messages7/system/rcon_auth_on.py +++ b/twnet_parser/messages7/system/rcon_auth_on.py @@ -18,7 +18,6 @@ class MsgRconAuthOn(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/ready.py b/twnet_parser/messages7/system/ready.py index 2d0c0f5..1a62588 100644 --- a/twnet_parser/messages7/system/ready.py +++ b/twnet_parser/messages7/system/ready.py @@ -18,7 +18,6 @@ class MsgReady(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: diff --git a/twnet_parser/messages7/system/request_map_data.py b/twnet_parser/messages7/system/request_map_data.py index 1d827fd..228b4d6 100644 --- a/twnet_parser/messages7/system/request_map_data.py +++ b/twnet_parser/messages7/system/request_map_data.py @@ -18,7 +18,6 @@ class MsgRequestMapData(PrettyPrint): # has to be the first byte of the message payload # NOT the chunk header and NOT the message id def unpack(self, data: bytes) -> bool: - unpacker = Unpacker(data) return True def pack(self) -> bytes: