Commit graph

78 commits

Author SHA1 Message Date
ChillerDragon c19f0dfdab fix!: rename PacketHeader -> PacketHeader7 2024-06-16 10:40:45 +08:00
ChillerDragon 4c434752dc feat: calculate ddnet uuids based on name 2024-04-19 10:18:29 +08:00
ChillerDragon 651efbe95a feat: draft ddnet uuid manager structure 2024-04-19 09:06:35 +08:00
ChillerDragon 4f845ea7ee fix!: 0.6.5 chunk header
This change added a version flag to chunk header

``ChunkHeader()`` no longer works! You now have to do
``ChunkHeader(version = '0.6')`` or ``ChunkHeader(version = '0.7')``

This fixes 0.6 chunk header packing.
It has a suddle difference to 0.7 and it is now packed correctly.

Also unpacking 0.6.5 chunk headers is fixed by reading the correct size.
2024-03-10 20:10:43 +08:00
ChillerDragon d997c0b990 chore: run ruff format . --fix 2024-02-26 12:59:19 +08:00
ChillerDragon 946ec2b73b test: add test for 0.6 map_data 2024-02-26 10:04:26 +08:00
ChillerDragon c4af1fb8f8 test: add test for cl_say and also for #14 2024-02-17 13:09:45 +08:00
ChillerDragon 871f6bb406 test: add snap7 multi part snap test 2023-07-13 14:01:54 +02:00
ChillerDragon cd7ec74bba feat: mark all msg 0 as ddnet_uuid for now
This will change as soon as ddnet uuids are properly implemented
2023-07-13 12:38:54 +02:00
ChillerDragon 64ad0c3b1c test: 0.7 req map data 2023-06-25 13:32:32 +02:00
ChillerDragon 3c42c99914 feat: make 0.6 packing smoother
The recommended way now is setting the version when constructing the
packet. Like this:

	packet = TwPacket(version = '0.6')

which will then set the correct header object in version 6 or 7
and thus also set the correct flags. And the version field is also set.

It is not recommended to do this:

	packet = TwPacket() # defaults to 0.7
	packet.version = '0.6'

That might cause confusion. This should be made more failsafe in a new
commit.
2023-06-24 10:09:35 +02:00
ChillerDragon ec507c0dcc test: huffman was never broken the test was 2023-06-18 12:13:08 +02:00
ChillerDragon 57f30ccc0e test: cl emote 0.7 test 2023-06-17 11:59:09 +02:00
ChillerDragon e90f2d5b30 test: add failing cl emoticon test 2023-06-11 12:09:39 +02:00
ChillerDragon e06ce8366f feat!: snap items in sys/game messages
This commit is not about snapshots!

Generated the snap item classes for 0.6 and 0.7
And changed the type used for snap items from int to the snap class

This now allows to properly serialize and deserialize
messages such as sys.input
2023-06-09 13:06:24 +02:00
ChillerDragon cfc9c47d0d test: add incomplete sys input test 2023-06-09 10:54:45 +02:00
ChillerDragon 59d0150ed2 fix!: set packet version to 0.7 by default
no more unknown version that could break things
2023-06-09 10:36:24 +02:00
ChillerDragon 4fd648025f feat!: proper support for optional fields
This sets message fields to `None` if they were not set.
And also does not pack fields that are set to `None`

BREAKING CHANGE: earlier to this commit the control close reason field
was set to an empty string if it was not set. Now it is set to None
2023-06-04 11:43:18 +02:00
ChillerDragon 4cc2888cb0 Fix 0.6.5 connless header 2023-06-03 10:43:09 +02:00
ChillerDragon 9f06c95e8d feat!: set flag token by default in 0.6.5
Set the token flag automatically if a token is provided. So lib users
have less boilerplate code to send a packet. But it can still be
set explicitly to false if desired.

Also add a test for cl_start_info
2023-06-01 09:32:45 +02:00
ChillerDragon 7e11d6d129 Add sv chat 0.6.5 test 2023-05-30 13:17:59 +02:00
ChillerDragon 1fa282b192 Add 0.6.5 system & game message support
Also add a test for sys info
Stills needs more tests. At least one game message.
2023-05-24 09:28:11 +02:00
ChillerDragon 01331e8141 Correctly pack 0.6.5 ctrl connect 2023-05-24 08:54:53 +02:00
ChillerDragon 93ad98ec96 Correctly unpack 0.6.5 ctrl connect 2023-05-23 20:32:44 +02:00
ChillerDragon 77aaa1ada7 Fix 0.6 packet header flags parsing 2023-05-21 10:09:34 +02:00
ChillerDragon c5bd2ea687 Prepare 0.6.5 test 2023-05-19 09:41:50 +02:00
ChillerDragon 81cee81e94 Remove snap message from generation
currently blocked by broken huffman decompression
2023-05-15 11:24:42 +02:00
ChillerDragon 0794cbe0a6 Test packing connless and mark as done 2023-05-13 10:06:59 +02:00
ChillerDragon 8c13ce6c2b Add connless info (inf3) 2023-05-12 17:17:07 +02:00
ChillerDragon e60cd00735 Add tests for connless packets 2023-05-12 10:11:58 +02:00
ChillerDragon ad8511d551 Implemet connless packing 2023-05-10 12:31:27 +02:00
ChillerDragon 04945c770a Fix connless data offset 2023-05-10 11:43:19 +02:00
ChillerDragon 994dde6a1b Verify get_be_uint16 is what we need for ports 2023-05-10 11:04:18 +02:00
ChillerDragon f7ab25ab78 Pick type for packed_addresses (pack not working yet) 2023-05-10 09:45:06 +02:00
ChillerDragon ff4c28fd42 Integrate connless messages into packet.parse7() 2023-05-09 20:39:13 +02:00
ChillerDragon 7874d769aa Start working on connection less messages 2023-05-09 17:06:40 +02:00
ChillerDragon 15e9836195 Compare packed info against bytes in test 2023-05-08 10:31:44 +02:00
ChillerDragon 94d70fd60a Add sys info test 2023-05-07 15:02:02 +02:00
ChillerDragon 781248ae79 Support packing control packets 2023-04-30 13:08:33 +02:00
ChillerDragon 425506d2a3 Implement packing full tw packets (no ctrl messages yet) 2023-04-29 09:07:06 +02:00
ChillerDragon 06b751940f Fix chunk header packing 2023-04-23 11:46:25 +02:00
ChillerDragon f0fd825879 Start working on packet and chunk header packing 2023-04-16 19:17:05 +02:00
ChillerDragon 65cac66724 Add more types to test
This is highlighting the problem of
https://gitlab.com/teeworlds-network/twnet_parser/-/issues/1

Every lib user that wants to use types needs to do a cast
to access the properties of messages
2023-04-16 11:44:09 +02:00
ChillerDragon 4f540fead1 Add some types to packet test 2023-04-16 11:39:30 +02:00
ChillerDragon b9a719ece9 Add pack() method to PacketHeader class
Also removed unused PacketHeader size field
2023-04-09 16:22:35 +02:00
ChillerDragon 3b93a6bba2 Packing python bools as tw net bools just works
python handles bools more like the ints 0 and 1
and those are exactly the values the
teeworlds network protocol expects

I can totally see this breaking in python4
or a new mypy version

maybe one day a ``get_bool()`` could make sense
also for readability

but for now this should be stable as long as the
tests pass
2023-04-09 12:14:13 +02:00
ChillerDragon f1d562f25f Add snap single test 2023-04-09 12:03:16 +02:00
ChillerDragon 7dc9e6de14 Add 48 chunk rcon server response test 2023-04-08 18:30:46 +02:00
ChillerDragon 2c22d3bd39 Finish skin change tests 2023-04-08 15:27:12 +02:00
ChillerDragon 7e7f419597 More skin change tests 2023-04-07 18:14:41 +02:00