예제 #1
0
        private void LaunchRust()
        {
            _username = _steamFriends.GetPersonaName();
            ConsoleSystem.Log("Logged in! Launching Rust...");

            // we've logged into the account
            // now we need to inform the steam server that we're playing dota (in order to receive GC messages)

            // steamkit doesn't expose the "play game" message through any handler, so we'll just send the message manually
            var playGame = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed);

            playGame.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed
            {
                game_id = new GameID(252490) // or game_id = APPID,
            });

            // send it off
            // notice here we're sending this message directly using the SteamClient
            _steamClient.Send(playGame);

            // delay a little to give steam some time to establish a GC connection to us
            Thread.Sleep(5000);

            var index = GetAuthSessionTicket(252490, 327684);
            var bytes = GetAuthTicket(index);

            Framework.RunToMainThread(o =>
            {
                _quitAfterDisconnect = false;
                var server           = Framework.Bootstraper.AddType <VirtualServer>();
                server.Init(_steamUser.SteamID.ConvertToUInt64(), _username, bytes.Ticket, _quitAfterConnected);
                server.Connect(_ip, _port);
            }, null);
        }
예제 #2
0
        private void OnLoggedOn(SteamUser.LoggedOnCallback obj)
        {
            logger.Info($"Log on to Steam with bot {BotName} is successful.");

            var playGame = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed);

            playGame.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed
            {
                game_id = new GameID(Dota2AppId)
            });

            logger.Info("Hello message is sending...");
            steamClient.Send(playGame);

            logger.Info("Connecting to Game Coordinator...");
            Thread.Sleep(5000);
            logger.Info("Connection to Game Coordinator is successful (just waiting 5 seconds).");

            var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello);

            clientHello.Body.engine = ESourceEngine.k_ESE_Source2;

            logger.Info("Sending Hello message...");
            gameCoordinator.Send(clientHello, Dota2AppId);
        }
예제 #3
0
        private AsyncJob <SteamTicketAccepted> VerifyTicket(uint appId, MemoryStream stream, out uint crc)
        {
            var authTicket = stream.ToArray();

            crc = BitConverter.ToUInt32(CryptoHelper.CRCHash(authTicket));
            var items = _gameTickets.GetOrAdd(appId, new List <CMsgAuthTicket>());

            items.Add(new CMsgAuthTicket()
            {
                gameid     = appId,
                ticket     = authTicket,
                ticket_crc = crc
            });

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

            authList.Body.tokens_left = (uint)_gcTokens.Count;
            authList.Body.app_ids.AddRange(_gameTickets.Keys);
            authList.Body.tickets.AddRange(_gameTickets.Values.SelectMany(x => x));
            authList.SourceJobID = Client.GetNextJobID();
            Client.Send(authList);

            return(new AsyncJob <SteamTicketAccepted>(Client, authList.SourceJobID));
        }