Ejemplo n.º 1
0
        private Event?Process(CSVCMsg_PacketEntities message)
        {
            log.Debug("svc_PacketEntities is_delta: "
                      + message.is_delta
                      + " baseline: " + message.baseline
                      + " update_baseline: " + message.update_baseline
                      + " delta: " + message.delta_from);

            using (var stream = Bitstream.CreateWith(message.entity_data)) {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                client.Baseline = message.baseline;
                return(Event.BASELINE);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        private Event?Process(CSVCMsg_PacketEntities message)
        {
            log.Debug("svc_PacketEntities is_delta: "
                      + message.is_delta
                      + " baseline: " + message.baseline
                      + " update_baseline: " + message.update_baseline
                      + " delta: " + message.delta_from);

            using (var stream = Bitstream.CreateWith(message.entity_data)) {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                var ack = new CCLCMsg_BaselineAck();
                ack.baseline_nr   = client.Baseline;
                ack.baseline_tick = (int)client.ServerTick;
                var ackMsg = Connection.ConvertProtoToMessage <CCLCMsg_BaselineAck>(
                    (uint)CLC_Messages.clc_BaselineAck,
                    ack);
                connection.SendReliably(ackMsg);
                return(null);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        public Event? Process(byte[] response) {
            using (var stream = Bitstream.CreateWith(response)) {
                byte type = stream.ReadByte();

                if (type == S2C_CHALLENGE) {
                    Preconditions.CheckArgument(stream.ReadUInt32() == SOURCE_PROTOCOL,
                        "Packet not SOURCE_PROTOCOL");
                    server_challenge = stream.ReadUInt32();
                    Preconditions.CheckArgument(stream.ReadUInt32() == client_challenge,
                        "Packet doesn't match client challenge");
                    Preconditions.CheckArgument(stream.ReadUInt32() == STEAM_VERSION,
                        "Packet STEAM_VERSION mismatch");
                    server_id = stream.ReadUInt64();
                    log.Info("challenge mystery byte is " + stream.ReadByte());
                    Preconditions.CheckArgument(stream.Eof, "Packet S2C_CHALLENGE continues");
                    return Event.HANDSHAKE_CHALLENGE;
                } else if (type == S2C_ACCEPT) {
                    Preconditions.CheckArgument(stream.ReadUInt32() == client_challenge,
                        "Packet doesn't match client challenge");
                    Preconditions.CheckArgument(stream.Eof, "Packet S2C_ACCEPT continues");
                    return Event.HANDSHAKE_COMPLETE;
                } else if (type == S2C_REJECT) {
                    Preconditions.CheckArgument(stream.ReadUInt32() == client_challenge,
                        "Packet doesn't match client challenge");

                    log.Error("Rejected:\n" + stream.ReadString());
                    return Event.REJECTED;
                } else {
                    throw new ArgumentException("Unknown response type " + type);
                }
            }
        }
Ejemplo n.º 4
0
 public Event?Process(Connection.Message message)
 {
     using (var stream = Bitstream.CreateWith(message.Data)) {
         if (message.Type == (uint)NET_Messages.net_NOP)
         {
             return(null);
         }
         else if (message.Type == (uint)NET_Messages.net_Disconnect)
         {
             return(Process(Serializer.Deserialize <CNETMsg_Disconnect>(stream)));
         }
         else if (message.Type == (uint)NET_Messages.net_StringCmd)
         {
             return(Process(Serializer.Deserialize <CNETMsg_StringCmd>(stream)));
         }
         else if (message.Type == (uint)NET_Messages.net_Tick)
         {
             return(Process(Serializer.Deserialize <CNETMsg_Tick>(stream)));
         }
         else if (message.Type == (uint)SVC_Messages.svc_PacketEntities)
         {
             return(Process(Serializer.Deserialize <CSVCMsg_PacketEntities>(stream)));
         }
         else if (message.Type == (uint)SVC_Messages.svc_UpdateStringTable)
         {
             return(Process(Serializer.Deserialize <CSVCMsg_UpdateStringTable>(stream)));
         }
         else if (message.Type == (uint)SVC_Messages.svc_UserMessage)
         {
             return(Process(Serializer.Deserialize <CSVCMsg_UserMessage>(stream)));
         }
         else if (message.Type == (uint)SVC_Messages.svc_GameEvent)
         {
             return(Process(Serializer.Deserialize <CSVCMsg_GameEvent>(stream)));
         }
         else
         {
             log.Warn("Unknown message " + message.Type);
             return(null);
         }
     }
 }
Ejemplo n.º 5
0
 private Event?Process(CSVCMsg_UserMessage message)
 {
     if (message.msg_type == (int)EBaseUserMessages.UM_SayText2)
     {
         using (var stream = Bitstream.CreateWith(message.msg_data)) {
             return(Process(Serializer.Deserialize <CUserMsg_SayText2>(stream)));
         }
     }
     else if (message.msg_type == (int)EDotaUserMessages.DOTA_UM_ChatEvent)
     {
         using (var stream = Bitstream.CreateWith(message.msg_data)) {
             return(Process(Serializer.Deserialize <CDOTAUserMsg_ChatEvent>(stream)));
         }
     }
     else
     {
         log.DebugFormat("CSVCMsg_UserMessage: unknown type {0} with {1} bytes of data",
                         message.msg_type, message.msg_data.Length);
         return(null);
     }
 }