diff --git a/lib/chunk.rb b/lib/chunk.rb index 5c1846d..cb38350 100644 --- a/lib/chunk.rb +++ b/lib/chunk.rb @@ -4,7 +4,7 @@ require_relative 'bytes' class NetChunk attr_reader :next, :data, :msg, :sys, :flags - @@sent_vital_chunks = 4 # BIG TODO: SEND READY AND SHIT WITH PROPER HEADER + @@sent_vital_chunks = 3 # BIG TODO: SEND READY AND SHIT WITH PROPER HEADER def initialize(data) @next = nil diff --git a/lib/network.rb b/lib/network.rb index 8263ae8..3f1a5b5 100644 --- a/lib/network.rb +++ b/lib/network.rb @@ -31,6 +31,14 @@ NETMSG_RCON_LINE = 13 # line that should be printed to the remote console NETMSG_RCON_CMD_ADD = 14 NETMSG_RCON_CMD_REM = 15 +# sent by client +NETMSG_READY = 18 +NETMSG_ENTERGAME = 19 +NETMSG_INPUT = 20 # contains the inputdata from the client +NETMSG_RCON_CMD = 21 +NETMSG_RCON_AUTH = 22 +NETMSG_REQUEST_MAP_DATA = 23 + NETMSG_INVALID = 0 NETMSGTYPE_SV_MOTD = 1 NETMSGTYPE_SV_BROADCAST = 2 diff --git a/teeworlds.rb b/teeworlds.rb index 16f8fde..8976d9c 100755 --- a/teeworlds.rb +++ b/teeworlds.rb @@ -119,7 +119,9 @@ class TwClient end def send_enter_game() - @netbase.send_packet([0x40, 0x01, 0x04, 0x27]) + @netbase.send_packet( + NetChunk.create_vital_header({vital: true}, 1) + + [pack_msg_id(NETMSG_READY)]) end ## @@ -330,9 +332,9 @@ class TwClient if @ticks % 8 == 0 send_ctrl_keepalive end - # if @ticks % 20 == 0 - # send_chat("hello world") - # end + if @ticks % 20 == 0 + send_chat("hello world") + end end def disconnect