Esempio n. 1
0
        public void EnterGame() {
            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);

            var ss = new CNETMsg_SignonState();
            ss.num_server_players = 0;
            ss.signon_state = (uint) SIGNONSTATE.SIGNONSTATE_FULL;
            ss.spawn_count = client.ServerCount;

            var ssMessage = Connection.ConvertProtoToMessage<CNETMsg_SignonState>(
                (uint) NET_Messages.net_SignonState,
                ss);

            var le = new CCLCMsg_ListenEvents();
            for (uint i = 0; i < 267; i += 32) {
                le.event_mask.Add(0xffffffff);
            }
            le.event_mask.Add(0x000003ff);
            var leMessage = Connection.ConvertProtoToMessage<CCLCMsg_ListenEvents>(
                (uint) CLC_Messages.clc_ListenEvents,
                le);

            connection.SendReliably(ackMsg, ssMessage, leMessage);

            List<Connection.Message> clientMsgs = new List<Connection.Message>();
            for (int i = 0; i < 10; ++i) {
                var msg = new CCLCMsg_ClientMessage();
                msg.data = new byte[] { 0x0D, 0xCD, 0xCC, 0xCC, 0x3F };
                msg.msg_type = 2;

                var msgMessage = Connection.ConvertProtoToMessage<CCLCMsg_ClientMessage>(
                    (uint) CLC_Messages.clc_ClientMessage,
                    msg);
                clientMsgs.Add(msgMessage);
            }
            connection.SendUnreliably(clientMsgs.ToArray());
        }
Esempio 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;
            }
        }