Пример #1
0
        public void EnterPrespawn() {
            var ss = new CNETMsg_SignonState();
            ss.signon_state = (uint) SIGNONSTATE.SIGNONSTATE_PRESPAWN;
            ss.spawn_count = client.ServerCount;
            ss.num_server_players = 0;

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

            // Send mask for game events? 
            // 0c 23
            //   0d 8b820592
            //   0d 0140e890
            //   0d f6ffff7f
            //   0d ff9bfc6e
            //   0d 0310e87c
            //   0d cbfffff8
            //   0d effc0700
            var le = new CCLCMsg_ListenEvents();
            for (uint i = 0; i < 267; i += 32) {
                le.event_mask.Add(0xffffffff);
            }
            le.event_mask.Add(0x0000000a);
            var leMessage = Connection.ConvertProtoToMessage<CCLCMsg_ListenEvents>(
                (uint) CLC_Messages.clc_ListenEvents,
                le);

            connection.SendReliably(ssMessage, leMessage);
        }
Пример #2
0
        public void EnterNew() {
            var ci = new CCLCMsg_ClientInfo();
            ci.server_count = client.ServerCount;
            var ciMessage = Connection.ConvertProtoToMessage<CCLCMsg_ClientInfo>(
                (uint) CLC_Messages.clc_ClientInfo,
                ci);

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

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

            var scv = new CNETMsg_SetConVar();
            scv.convars = new CMsg_CVars();
            var cvar = new CMsg_CVars.CVar();
            cvar.name = "steamworks_sessionid_client";
            cvar.value = client.SteamworksSessionId.ToString();
            client.CVars["steamworks_sessionid_client"] = client.SteamworksSessionId.ToString();
            scv.convars.cvars.Add(cvar);

            var scvMessage = Connection.ConvertProtoToMessage<CNETMsg_SetConVar>(
                (uint) NET_Messages.net_SetConVar,
                scv);

            connection.SendReliably(ciMessage, ssMessage, scvMessage);
        }
Пример #3
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());
        }
Пример #4
0
        public void EnterConnected() {
            connection.OpenChannel();
            client.Reset();

            var scv = new CNETMsg_SetConVar();
            scv.convars = client.ExposeCVars();

            var scvMessage = Connection.ConvertProtoToMessage<CNETMsg_SetConVar>(
                (uint) NET_Messages.net_SetConVar,
                scv);

            var ss = new CNETMsg_SignonState();
            ss.num_server_players = 0;
            ss.spawn_count = 0xFFFFFFFF;
            ss.signon_state = (uint) SIGNONSTATE.SIGNONSTATE_CONNECTED;

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

            connection.SendReliably(scvMessage, ssMessage);
        }
Пример #5
0
        private Event? Process(CNETMsg_SignonState message) {
            log.Debug(String.Format("CNETMsg_SignonState: {0}", message.signon_state));

            switch (message.signon_state) {
                case (uint) SIGNONSTATE.SIGNONSTATE_CONNECTED: return Event.GO_CONNECTED;
                case (uint) SIGNONSTATE.SIGNONSTATE_NEW: return Event.GO_NEW;
                case (uint) SIGNONSTATE.SIGNONSTATE_PRESPAWN: return Event.GO_PRESPAWN;
                case (uint) SIGNONSTATE.SIGNONSTATE_SPAWN: return Event.GO_SPAWN;
                default: throw new NotImplementedException("Unknown signon state " + message.signon_state);
            }
        }
Пример #6
0
        public void EnterSpawn() {
            var ss = new CNETMsg_SignonState();
            ss.signon_state = (uint) SIGNONSTATE.SIGNONSTATE_SPAWN;
            ss.spawn_count = client.ServerCount;
            ss.num_server_players = 0;

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