Exemplo n.º 1
0
        public void Auth()
        {
            var pb = new CMsgAuthTicket();

            pb.gameid       = App;
            pb.h_steam_pipe = 327684;

            using (var stream = Bitstream.CreateWith(PendingTicketForAuth.ToArray())) {
                pb.ticket_crc = CrcUtils.Compute32(stream);
            }

            pb.ticket = PendingTicketForAuth.ToArray();

            var msg = new ClientMsgProtobuf <CMsgClientAuthList>(EMsg.ClientAuthList);

            msg.Body.tokens_left = Bot.TokenCount;
            msg.Body.app_ids.Add(App);
            msg.Body.tickets.Add(pb);
            msg.Body.message_sequence = AuthSequence++;
            Bot.Client.Send(msg);
            log.Debug("Sent auth list with crc " + msg.Body.tickets[0].ticket_crc + "/" + msg.Body.message_sequence);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Connect to the game server. Will use existing lobby on default.
        /// </summary>
        /// <param name="lobb"></param>
        public void Connect(CSODOTALobby lobb = null)
        {
            if (_connectDetails != null)
            {
                Disconnect();
            }

            lobb = lobb ?? DotaGc.Lobby;
            if (lobb == null)
            {
                Log("No lobby so not connecting.");
                return;
            }

            _connectLobby = lobb;
            if (_appOwnershipTicket == null)
            {
                Log("Waiting for ownership ticket...");
                _waitingForAuthTicket = true;
                FetchAppTicket();
                return;
            }

            _authTicket = AuthTicket.CreateAuthTicket(_gameConnectTokens.Dequeue(), publicIP);

            var ver = new CMsgAuthTicket
            {
                gameid       = (uint)DotaGc.GameID,
                h_steam_pipe = 327684,
                ticket       = _authTicket
            };

            using (var stream = Bitstream.CreateWith(_authTicket))
                ver.ticket_crc = CrcUtils.Compute32(stream);

            _connectDetails = new DOTAConnectDetails
            {
                AuthTicket       = _authTicket,
                ServerAuthTicket = AuthTicket.CreateServerTicket(DotaGc.SteamClient.SteamID, _authTicket, _appOwnershipTicket),
                ConnectInfo      = lobb.connect,
                ConnectID        = _connectAttempt++,
                AuthTicketCRC    = ver.ticket_crc,
                Name             = DotaGc.SteamClient.GetHandler <SteamFriends>().GetPersonaName(),
                PassKey          = lobb.pass_key,
                SteamId          = DotaGc.SteamClient.SteamID.ConvertToUInt64()
            };

            var msg = new ClientMsgProtobuf <CMsgClientAuthList>(EMsg.ClientAuthList)
            {
                Body =
                {
                    tokens_left      = (uint)_gameConnectTokens.Count,
                    app_ids          = { (uint)DotaGc.GameID },
                    tickets          = { ver },
                    message_sequence = 2 // Second in sequence.
                }
            };

            DotaGc.SteamClient.Send(msg);
            Log("Sent crc ticket auth list, hash: " + ver.ticket_crc + ".");
        }