Commit graph

42 commits

Author SHA1 Message Date
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
ChillerDragon e24b3959ce Start working on skin change test 2023-04-07 16:57:04 +02:00
ChillerDragon 9615392156 Fix parsing messages with ids higher than 31
See my thought process here
https://github.com/ChillerDragon/teeworlds-protocol/pull/15
2023-04-07 16:10:56 +02:00
ChillerDragon df3448d001 Add failing call vote packet test 2023-04-07 14:31:04 +02:00
ChillerDragon a9ba5bd703 Sanitize string unpack by default the same way tw does it
This sadly probably comes with some hefty performance implications
2023-04-07 12:46:50 +02:00
ChillerDragon 1a864d903c Add test for client side token packing 2023-04-07 10:45:35 +02:00
ChillerDragon 639edda489 Add support for control messages 2023-04-06 17:44:17 +02:00
ChillerDragon 37730deaa2 Start drafting control message layout 2023-04-02 21:01:44 +02:00
ChillerDragon a75c95d2ad Run ruff --fix . 2023-04-02 20:06:31 +02:00
ChillerDragon e20fd4c019 Use vanilla server defaults for tunes 2023-04-02 11:51:21 +02:00
ChillerDragon 029cebcb25 Fully support tune params 2023-04-02 10:39:52 +02:00
ChillerDragon da6d0cfc40 Prepare test for tune params 2023-04-02 09:42:20 +02:00
ChillerDragon d6727ddcbe Test rcon_cmd and sys input fields 2023-04-02 09:22:20 +02:00
ChillerDragon b2f2ff2f9a Generate system and game message classes
Most of the code is generated by

`./scripts/generate_messages.py`
2023-03-31 10:26:04 +02:00
ChillerDragon e0203ebc78 Fix map change msg field rename
`chunks_per_request` -> `msg.num_response_chunks_per_request`
2023-03-31 09:32:47 +02:00
ChillerDragon e77422bf1f Add broadcast packet test (not passing yet) 2023-03-29 13:26:34 +02:00
ChillerDragon 992a855a57 Fix and finish map change msg 2023-03-26 12:22:13 +02:00
ChillerDragon a55817e8ab Some progress on packing (pack() and unpack raw) 2023-03-26 11:19:47 +02:00
ChillerDragon 9d2524c199 Support parsing compressed packets 2023-03-25 16:12:27 +01:00
ChillerDragon 0988cff4c9 Refactor to prepare proper msg unpacking
Rename `name` -> `message_name`
Replaced `GameMessage` and `SysMessage` with duck typed `NetMessage`
Split up packet.py in multiple files
2023-03-25 14:22:45 +01:00
ChillerDragon d96367374e Use map change as the first sample message 2023-03-23 13:29:44 +01:00
ChillerDragon cec1edcaa5 First draft of chunk header parsing 2023-03-19 18:03:13 +01:00
ChillerDragon 1a0e195060 Add tests for int unpacker 2023-03-19 14:24:44 +01:00
ChillerDragon 6240dd36e5 Polish and test int packer 2023-03-19 11:40:15 +01:00
ChillerDragon dd888341d3 Add chunk parsing tests 2023-03-18 11:47:20 +01:00
ChillerDragon c8f8ca6a21 Break api packet.parse -> packet.parse7
Rename the main `twnet_parser.packet.parse()` method.
Into more explicit `parse6()` and `parse7()`
2023-03-18 10:04:11 +01:00
ChillerDragon 6f2a9eda51 Some thoughts on edge cases and performance 2023-03-18 09:08:12 +01:00
ChillerDragon 18f5c146b4 Overengineer release script 2023-03-16 16:51:57 +01:00
ChillerDragon 0abf651b87 Add tests 2023-03-16 14:04:48 +01:00