Пример #1
0
        static void OnCSGOMatchDetails(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchList>(packetMsg);

            CSGOMatchHistoryCallback.SafeInvoke(packetMsg);
            //Stream stream = Helpers.GetStreamFromUrl(msg.Body.matches[0].roundstats.map);
        }
Пример #2
0
        public override void OnMatchmakingHelloResponse(IPacketGCMsg msg)
        {
            var response = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingGC2ClientHello>(msg);

            if (response.Body.penalty_reasonSpecified)
            {
                Cooldown cooldown = response.Body.penalty_reason;

                _log.Error("This account has received a {type} cooldown: {reason}",
                           cooldown.Permanent ? "global" : "temporary", cooldown.Reason);

                if (cooldown.Permanent)
                {
                    _log.Error("This ban is permanent. Botting with banned accounts is not possible.");
                }
                else
                {
                    var penalty = TimeSpan.FromSeconds(response.Body.penalty_seconds);
                    var time    = penalty.Minutes >= 60 ? penalty.Hours + " Hours" : penalty.Minutes + " Minutes";

                    _log.Error("This ban will end in {end}. Botting with banned accounts is not possible.", time);
                }

                Result = Result.AccountBanned;
                Stop();
                return;
            }

            // When the CS:GO GC sends a vac_banned (type 2) but not a penalty_reason (type 0)
            // the account has received a yellow "This account has been banned by Overwatch"
            // banner in-game and has no longer the ability to report or commend.
            if (response.Body.vac_bannedSpecified && !response.Body.penalty_reasonSpecified &&
                response.Body.vac_banned == 2 && !response.Body.penalty_secondsSpecified)
            {
                _log.Error("This account has been banned by Valve Anti Cheat. Botting with banned " +
                           "accounts is not possible and will not give successfull results. Aborting!");
                Result = Result.AccountBanned;

                Stop();
                return;
            }

            var type = _liveGameInfo != null ? "Live Game Request" : (_reportInfo != null ? "Report" : "Commend");

            _log.Debug("Received hello from CS:GO matchmaking services. Authentificated as {id}. Sending {type}.",
                       response.Body.account_id, type);

            if (_liveGameInfo != null)
            {
                _gameCoordinator.Send(GetLiveGamePayload(), GetAppID());
            }
            else if (_reportInfo != null)
            {
                _gameCoordinator.Send(GetReportPayload(), GetAppID());
            }
            else
            {
                _gameCoordinator.Send(GetCommendPayload(), GetAppID());
            }
        }
Пример #3
0
        void OnLobbyCreate(IPacketGCMsg packetMsg)
        {
            var msg = packetMsg;

            waitTime         = 5;
            checkCreateLobby = false;
        }
Пример #4
0
        static async void OnMatchmakingClientHello(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingGC2ClientHello>(packetMsg);

            if (SteamAccountID != 0 ||
                msg == null ||
                msg.Body == null ||
                msg.Body.ranking == null ||
                msg.Body.commendation == null)
            {
                await Task.Delay(1000).ConfigureAwait(false);

                return;
            }
            if (msg.Body.vac_banned == 0)
            {
                banned = true;
            }
            else
            {
                banned = false;
            }
            rankID         = 0;
            SteamAccountID = msg.Body.ranking.account_id;
            var commendation = msg.Body.commendation;

            rankID = (RankName)msg.Body.ranking.rank_id;
            level  = msg.Body.player_level;
        }
Пример #5
0
        static void OnClientWelcome(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf <CMsgClientWelcome>(packetMsg);

            clientWelcome = true;
            CSGOClientWelcomeCallback.SafeInvoke();
        }
Пример #6
0
        static void OnRecentMatchesResponse(IPacketGCMsg packetMsg)
        {
            var  msg                    = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchList>(packetMsg);
            uint serverTime             = msg.Body.servertime;
            uint expectedLastReportTime = 0;

            foreach (var match in msg.Body.matches)
            {
                int matchDuration = 0;
                foreach (var round in match.roundstatsall)
                {
                    matchDuration = matchDuration < round.match_duration ? round.match_duration : matchDuration;
                }
                if (expectedLastReportTime < match.matchtime + matchDuration)
                {
                    expectedLastReportTime = match.matchtime + (uint)matchDuration;
                }
            }

            LastMatchInfo matchInfo = new LastMatchInfo();

            matchInfo.lastCheck  = serverTime;
            matchInfo.matchEnded = expectedLastReportTime;
            File.WriteAllText("data/" + Config.SteamLogin + ".lastmatch", JsonConvert.SerializeObject(matchInfo));

            checkOWBypass(serverTime, expectedLastReportTime);
            isRunning = false;
        }
Пример #7
0
        private void HandlePingRequest(IPacketGCMsg obj)
        {
            var req = new ClientGCMsgProtobuf <CMsgGCClientPing>(obj);

            Pong();
            Client.PostCallback(new PingRequest(req.Body));
        }
Пример #8
0
        //Initial message sent when connected to the GC
        private void HandleWelcome(IPacketGCMsg msg)
        {
            gcConnectTimer.Stop();

            Ready = true;

            // Clear these. They will be updated in the subscriptions if they exist still.
            Lobby       = null;
            Party       = null;
            PartyInvite = null;

            var wel = new ClientGCMsgProtobuf <CMsgClientWelcome>(msg);

            Client.PostCallback(new GCWelcomeCallback(wel.Body));

            //Handle any cache subscriptions
            foreach (CMsgSOCacheSubscribed cache in wel.Body.outofdate_subscribed_caches)
            {
                foreach (CMsgSOCacheSubscribed.SubscribedType obj in cache.objects)
                {
                    HandleSubscribedType(obj);
                }
            }

            UploadRichPresence();
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientGCMsgProtobuf&lt;BodyType&gt;"/> class.
        /// This is a recieve constructor.
        /// </summary>
        /// <param name="msg">The packet message to build this gc message from.</param>
        public ClientGCMsgProtobuf(IPacketGCMsg msg)
            : this(msg.MsgType)
        {
            DebugLog.Assert(msg.IsProto, "ClientGCMsgProtobuf", "ClientGCMsgProtobuf used for non-proto message!");

            Deserialize(msg.GetData());
        }
Пример #10
0
        /// <summary>
        /// Handle when a cache is destroyed.
        /// </summary>
        /// <param name="obj">Message</param>
        public void HandleCacheDestroy(IPacketGCMsg obj)
        {
            var dest = new ClientGCMsgProtobuf <CMsgSOSingleObject>(obj);

            if (PartyInvite != null && dest.Body.type_id == (int)CSOTypes.PARTYINVITE)
            {
                PartyInvite = null;
                Client.PostCallback(new PartyInviteLeave(null));
            }
            else if (Lobby != null && dest.Body.type_id == (int)CSOTypes.LOBBY)
            {
                Lobby = null;
                Client.PostCallback(new PracticeLobbyLeave(null));
            }
            else if (Party != null && dest.Body.type_id == (int)CSOTypes.PARTY)
            {
                Party = null;
                Client.PostCallback(new PartyLeave(null));
            }
            else if (LobbyInvite != null && dest.Body.type_id == (int)CSOTypes.LOBBYINVITE)
            {
                LobbyInvite = null;
                Client.PostCallback(new LobbyInviteLeave(null));
            }
        }
Пример #11
0
        private void onMatchDetailsReceived(IPacketGCMsg msg)
        {
            Console.Error.WriteLine("Match Details Received");
            ClientGCMsgProtobuf <CMsgGCMatchDetailsResponse> response = new ClientGCMsgProtobuf <CMsgGCMatchDetailsResponse>(msg);

            if ((EResult)response.Body.result != EResult.OK)
            {
                Console.Error.WriteLine("Unable to request match details: {0}", response.Body.result);
                return;
            }

            CMsgDOTAMatch match = response.Body.match;

            if (match.replay_state != CMsgDOTAMatch.ReplayState.REPLAY_AVAILABLE)
            {
                Console.Error.WriteLine("Replay cannot be downloaded");
                return;
            }

            uint   replayCluster = match.cluster;
            ulong  matchID       = match.match_id;
            uint   replaySalt    = match.replay_salt;
            string replayURL     = String.Format("http://replay{0}.valve.net/{1}/{2}_{3}.dem.bz2", replayCluster, DOTA_APP_ID, matchID, replaySalt);

            receivedReplayURLs.Add(replayURL);
            Console.WriteLine(replayURL);
        }
Пример #12
0
        public override void OnClientWelcome(IPacketGCMsg msg)
        {
            switch (GetAppID())
            {
            case CSGO_APPID:
            {
                var welcome = new ClientGCMsgProtobuf <SteamKit2.GC.CSGO.Internal.CMsgClientWelcome>(msg);

                _log.Debug("Received welcome from CS:GO GC version {v} (Connected to {loc}). " +
                           "Sending hello the CS:GO's matchmaking service.",
                           welcome.Body.version, welcome.Body.location.country);

                var mmHello = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingClient2GCHello>(
                    (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello
                    );

                _gameCoordinator.Send(mmHello, GetAppID());
                break;
            }

            case TF2_APPID:
            {
                var welcome = new ClientGCMsgProtobuf <SteamKit2.GC.TF2.Internal.CMsgClientWelcome>(msg);

                _log.Debug("Received welcome from TF2 GC version {v}. Sending report...",
                           welcome.Body.version);

                _gameCoordinator.Send(GetReportPayload(), GetAppID());
                break;
            }
            }
        }
Пример #13
0
        private void HandleUpdateMultiple(IPacketGCMsg obj)
        {
            var  resp    = new ClientGCMsgProtobuf <CMsgSOMultipleObjects>(obj);
            bool handled = true;

            foreach (CMsgSOMultipleObjects.SingleObject mObj in resp.Body.objects_modified)
            {
                if (mObj.type_id == 2004)
                {
                    HandleLobbySnapshot(mObj.object_data, true);
                }
                else if (mObj.type_id == 2003)
                {
                    HandlePartySnapshot(mObj.object_data, true);
                }
                else if (mObj.type_id == 2006)
                {
                    //HandlePartyInviteSnapshot(mObj.object_data, true);
                }
                else
                {
                    handled = false;
                }
            }
            if (!handled)
            {
                Client.PostCallback(new UnhandledDotaGCCallback(obj));
            }
        }
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientGCMsg&lt;BodyType&gt;"/> class.
        /// This is a recieve constructor.
        /// </summary>
        /// <param name="msg">The packet message to build this gc message from.</param>
        public ClientGCMsg(IPacketGCMsg msg)
            : this()
        {
            DebugLog.Assert(!msg.IsProto, "ClientGCMsg", "ClientGCMsg used for proto message!");

            Deserialize(msg.GetData());
        }
Пример #15
0
 internal MessageCallback(CMsgGCClient gcMsg)
 {
     this.eMsg    = gcMsg.msgtype;
     this.AppID   = gcMsg.appid;
     this.Message = GetPacketGCMsg(gcMsg.msgtype, gcMsg.payload);
     this.JobID   = this.Message.TargetJobID;
 }
Пример #16
0
        public override void OnCommendResponse(IPacketGCMsg msg)
        {
            _log.Information("Successfully commended target {Target}.", _info.Target);

            Result = Result.Success;

            Stop();
        }
Пример #17
0
 private void EventOnPlayerMatchHistoryResponse(IPacketGCMsg packetMsg)
 {
     if (OnPlayerMatchHistoryResponse != null)
     {
         var response = new ClientGCMsgProtobuf <CMsgDOTAGetPlayerMatchHistoryResponse>(packetMsg);
         OnPlayerMatchHistoryResponse(response);
     }
 }
Пример #18
0
 private void EventOnChatMessage(IPacketGCMsg packetMsg)
 {
     if (OnChatMessage != null)
     {
         var response = new ClientGCMsgProtobuf <CMsgDOTAChatMessage>(packetMsg);
         OnChatMessage(response);
     }
 }
Пример #19
0
 private void EventOnChatChannelJoin(IPacketGCMsg packetMsg)
 {
     if (OnChatChannelJoined != null)
     {
         var response = new ClientGCMsgProtobuf <CMsgDOTAJoinChatChannelResponse>(packetMsg);
         OnChatChannelJoined(response);
     }
 }
Пример #20
0
        private void EventOnClientWelcome(IPacketGCMsg packetMsg)
        {
            var response = new ClientGCMsgProtobuf <CMsgClientWelcome>(packetMsg);

            _clientVersion = response.Body.version;
            _logger.Info(String.Format("Dota 2 launch successful - Client version: {0}", _clientVersion));
            OnDota2Launched?.Invoke();
        }
Пример #21
0
 private void EventOnMatchDetailsResponse(IPacketGCMsg packetMsg)
 {
     if (OnMatchDetailsResponse != null)
     {
         var response = new ClientGCMsgProtobuf <CMsgGCMatchDetailsResponse>(packetMsg);
         OnMatchDetailsResponse(response);
     }
 }
Пример #22
0
 private void EventOnReadyUpStatus(IPacketGCMsg packetMsg)
 {
     if (OnReadyUpStatus != null)
     {
         var response = new ClientGCMsgProtobuf <CMsgReadyUpStatus>(packetMsg);
         OnReadyUpStatus(response);
     }
 }
Пример #23
0
        private void OnMatchmakingHelloResponse(IPacketGCMsg obj)
        {
            Logger.Log("Received client hello!");
            LastActionTime = DateTime.Now;

            IsSuccess = true;
            IsDone    = true;
        }
Пример #24
0
        private void OnSystemMessage(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf <CMsgSystemBroadcast>(packetMsg).Body;

            Log.WriteInfo(Name, "Message: {0}", msg.message);

            IRC.SendMain("{0}{1}{2} system message:{3} {4}", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL, Colors.OLIVE, msg.message);
        }
Пример #25
0
        public override void OnCommendResponse(IPacketGCMsg msg)
        {
            _log.Information("Successfully commended target {Target}.", _commendInfo.SteamID.ConvertToUInt64());

            Result = Result.Success;

            Stop();
        }
Пример #26
0
        private void HandleCacheSubscribed(IPacketGCMsg obj)
        {
            var sub = new ClientGCMsgProtobuf <CMsgSOCacheSubscribed>(obj);

            foreach (CMsgSOCacheSubscribed.SubscribedType cache in sub.Body.objects)
            {
                HandleSubscribedType(cache);
            }
        }
Пример #27
0
        public static uint GetMsgTypeWithNullCheck(this IPacketGCMsg msg, string name)
        {
            if (msg == null)
            {
                throw new ArgumentNullException(name);
            }

            return(msg.MsgType);
        }
        private void OnSystemMessage(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf <CMsgSystemBroadcast>(packetMsg).Body;

            var message = string.Format("{0}{1}{2} system message:{3} {4}", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL, Colors.OLIVE, msg.message);

            IRC.Instance.SendMain(message);
            IRC.Instance.SendAnnounce(message);
        }
Пример #29
0
        void OnGCUpdateItemSchema(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf <CMsgUpdateItemSchema>(packetMsg);

            Logger.WriteLine("Item schema version: " + msg.Body.item_schema_version);

            UpdateBackpack();
            Logger.WriteLine("Loaded backpack: {0} items found", Backpack.Items.Length);
        }
Пример #30
0
        public void HandleCacheDestroy(IPacketGCMsg obj)
        {
            var dest = new ClientGCMsgProtobuf <CMsgSOSingleObject>(obj);

            if (PartyInvite != null && dest.Body.type_id == 2006)
            {
                PartyInvite = null;
                Client.PostCallback(new PartyInviteLeave(null));
            }
        }
Пример #31
0
 private void HandleGuildCancelInviteResponse(IPacketGCMsg obj)
 {
     var resp = new ClientGCMsgProtobuf<CMsgDOTAGuildCancelInviteResponse>(obj);
     Client.PostCallback(new GuildCancelInviteResponse(resp.Body));
 }
        private void OnWelcome(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgClientWelcome>(packetMsg).Body;

            var info = GetSessionInfo(appID);

            string message = string.Format("{0}{1}{2} new GC session", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL);

            if (info.Version == 0 || info.Version == msg.version)
            {
                message += string.Format(" {0}(version {1})", Colors.DARKGRAY, msg.version);
            }
            else
            {
                message += string.Format(" {0}(version changed from {1} to {2})", Colors.DARKGRAY, info.Version, msg.version);

                IRC.Instance.SendMain(message);
            }

            IRC.Instance.SendAnnounce(message);

            info.Version = msg.version;
            info.Status = GCConnectionStatus.GCConnectionStatus_HAVE_SESSION;
        }
Пример #33
0
        // this message arrives when the GC welcomes a client
        // this happens after telling steam that we launched dota (with the ClientGamesPlayed message)
        // this can also happen after the GC has restarted (due to a crash or new version)
        void OnClientWelcome( IPacketGCMsg packetMsg )
        {
            // in order to get at the contents of the message, we need to create a ClientGCMsgProtobuf from the packet message we recieve
            // note here the difference between ClientGCMsgProtobuf and the ClientMsgProtobuf used when sending ClientGamesPlayed
            // this message is used for the GC, while the other is used for general steam messages
            var msg = new ClientGCMsgProtobuf<CMsgClientWelcome>( packetMsg );

            Console.WriteLine( "GC is welcoming us. Version: {0}", msg.Body.version );

            Console.WriteLine( "Requesting details of match {0}", matchId );

            // at this point, the GC is now ready to accept messages from us
            // so now we'll request the details of the match we're looking for

            var requestMatch = new ClientGCMsgProtobuf<CMsgGCMatchDetailsRequest>( ( uint )EDOTAGCMsg.k_EMsgGCMatchDetailsRequest );
            requestMatch.Body.match_id = matchId;

            gameCoordinator.Send( requestMatch, APPID );
        }
        private void OnItemBroadcast(uint appID, IPacketGCMsg packetMsg)
        {
            if (appID != 440)
            {
                // This message should be TF2 specific, but just in case
                return;
            }

            var msg = new ClientGCMsgProtobuf<CMsgGCTFSpecificItemBroadcast>(packetMsg).Body;

            var itemName = GetItemName(441, msg.item_def_index);

            IRC.Instance.SendMain("{0}{1}{2} item notification: {3}{4}{5} {6} {7}{8}{9}!",
                Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL,
                Colors.BLUE, msg.user_name, Colors.NORMAL,
                msg.was_destruction ? "has destroyed their" : "just received a",
                Colors.OLIVE, itemName, Colors.NORMAL
            );
        }
        private void OnSystemMessage(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgSystemBroadcast>(packetMsg).Body;

            IRC.Instance.SendMain("{0}{1}{2} system message:{3} {4}", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL, Colors.OLIVE, msg.message);
        }
Пример #36
0
 private void HandleProfileCardResponse(IPacketGCMsg obj)
 {
     var resp = new ClientGCMsgProtobuf<CMsgDOTAProfileCard>(obj);
     Client.PostCallback(new ProfileCardResponse(resp.Body));
 }
Пример #37
0
 private void HandleGuildData(IPacketGCMsg obj)
 {
     var resp = new ClientGCMsgProtobuf<CMsgDOTAGuildSDO>(obj);
     Client.PostCallback(new GuildDataResponse(resp.Body));
 }
Пример #38
0
 private void HandleInvitationCreated(IPacketGCMsg obj)
 {
     var msg = new ClientGCMsgProtobuf<CMsgInvitationCreated>(obj);
     Client.PostCallback(new InvitationCreated(msg.Body));
 }
Пример #39
0
 internal abstract void Run( IPacketGCMsg msg );
Пример #40
0
 /// <summary>
 ///     GC tells us if there are tournaments running.
 /// </summary>
 /// <param name="obj"></param>
 private void HandleLiveLeageGameUpdate(IPacketGCMsg obj)
 {
     var resp = new ClientGCMsgProtobuf<CMsgDOTALiveLeagueGameUpdate>(obj);
     Client.PostCallback(new LiveLeagueGameUpdate(resp.Body));
 }
Пример #41
0
 private void HandleCacheSubscribed(IPacketGCMsg obj)
 {
     var sub = new ClientGCMsgProtobuf<CMsgSOCacheSubscribed>(obj);
     foreach (CMsgSOCacheSubscribed.SubscribedType cache in sub.Body.objects)
     {
         HandleSubscribedType(cache);
     }
 }
Пример #42
0
        //Initial message sent when connected to the GC
        private void HandleWelcome(IPacketGCMsg msg)
        {
            gcConnectTimer.Stop();

            Ready = true;

            // Clear these. They will be updated in the subscriptions if they exist still.
            Lobby = null;
            Party = null;
            PartyInvite = null;

            var wel = new ClientGCMsgProtobuf<CMsgClientWelcome>(msg);
            Client.PostCallback(new GCWelcomeCallback(wel.Body));

            //Handle any cache subscriptions
            foreach (CMsgSOCacheSubscribed cache in wel.Body.outofdate_subscribed_caches)
                foreach (CMsgSOCacheSubscribed.SubscribedType obj in cache.objects)
                    HandleSubscribedType(obj);

            UploadRichPresence();
        }
Пример #43
0
 internal MessageCallback( CMsgGCClient gcMsg )
 {
     this.eMsg = gcMsg.msgtype;
     this.AppID = gcMsg.appid;
     this.Message = GetPacketGCMsg( gcMsg.msgtype, gcMsg.payload );
 }
Пример #44
0
        void OnClientWelcome( IPacketGCMsg msg )
        {
            var clientWelcome = new ClientGCMsgProtobuf<CMsgClientWelcome>( msg );

            clientVersion = clientWelcome.Body.version;
            DebugLog.WriteLine( "DotaGCClient", "GC is version {0}", clientWelcome.Body.version );

            var findGames = new ClientGCMsgProtobuf<CMsgFindSourceTVGames>( EGCMsg.FindSourceTVGames );
            findGames.Body.num_games = 10;

            SteamGameCoordinator.Send( findGames, APPID );
        }
Пример #45
0
        private void OnWelcome(uint appID, IPacketGCMsg packetMsg)
        {
            uint version = 0;

            switch (appID)
            {
                case 730:
                    version = new ClientGCMsgProtobuf<SteamKit2.GC.CSGO.Internal.CMsgClientWelcome>(packetMsg).Body.version;
                    break;

                case 440:
                    version = new ClientGCMsgProtobuf<SteamKit2.GC.TF2.Internal.CMsgClientWelcome>(packetMsg).Body.version;
                    break;

                default:
                    version = new ClientGCMsgProtobuf<CMsgClientWelcome>(packetMsg).Body.version;
                    break;
            }

            var info = GetSessionInfo(appID);

            string message = string.Format("{0}{1}{2} new GC session", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL);

            if (info.Version == 0 || info.Version == version)
            {
                message += string.Format(" {0}(version {1})", Colors.DARKGRAY, version);
            }
            else
            {
                message += string.Format(" {0}(version changed from {1} to {2})", Colors.DARKGRAY, info.Version, version);
            }

            IRC.Instance.SendAnnounce(message);

            info.Version = version;
            info.Status = GCConnectionStatus.GCConnectionStatus_HAVE_SESSION;
        }
Пример #46
0
        void OnSourceTVGames( IPacketGCMsg msg )
        {
            var gamesList = new ClientGCMsgProtobuf<CMsgSourceTVGamesResponse>( msg );

            DebugLog.WriteLine( "DotaGCClient", "There are currently {0} viewable games", gamesList.Body.num_total_games );

            var game = gamesList.Body.games[ 0 ];

            var watchGame = new ClientGCMsgProtobuf<CMsgWatchGame>( EGCMsg.WatchGame );
            watchGame.Body.client_version = clientVersion;
            watchGame.Body.server_steamid = game.server_steamid;

            SteamGameCoordinator.Send( watchGame, APPID );
        }
Пример #47
0
        void OnWatchGame( IPacketGCMsg msg )
        {
            var response = new ClientGCMsgProtobuf<CMsgWatchGameResponse>( msg );

            if ( response.Body.watch_game_result == CMsgWatchGameResponse.WatchGameResult.PENDING )
            {
                DebugLog.WriteLine( "DotaGCClient", "STV details pending..." );
                return;
            }

            if ( response.Body.watch_game_result != CMsgWatchGameResponse.WatchGameResult.READY )
            {
                DebugLog.WriteLine( "DotaGCClient", "Unable to get STV details: {0}", response.Body.watch_game_result );
                return;
            }

            IPEndPoint server = new IPEndPoint(
                NetHelpers.GetIPAddress( response.Body.source_tv_public_addr ),
                ( int )response.Body.source_tv_port
            );

            DebugLog.WriteLine("DotaGCClient", "Got STV details: {0} ({1}) ({2})", server, response.Body.watch_tv_unique_secret_code, server);

            if ( FoundMatch != null )
            {
                FoundMatch( this, new FoundMatchEventArgs
                {
                    Server = server,
                    Password = response.Body.watch_tv_unique_secret_code.ToString(),
                } );
            }
        }
Пример #48
0
 internal UnhandledDotaGCCallback(IPacketGCMsg msg)
 {
     Message = msg;
 }
        private void OnConnectionStatus(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgConnectionStatus>(packetMsg).Body;

            GetSessionInfo(appID).Status = msg.status;

            string extraInfo = string.Empty;

            if (msg.status == GCConnectionStatus.GCConnectionStatus_NO_SESSION_IN_LOGON_QUEUE)
            {
                extraInfo = string.Format(" {0}(queue: {1}/{2}, waited {3} of an estimated {4} seconds)",
                    Colors.DARKGRAY, msg.queue_position, msg.queue_size, msg.wait_seconds, msg.estimated_wait_seconds_remaining
                );
            }

            IRC.Instance.SendAnnounce("{0}{1}{2} status:{3} {4}{5}", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL, Colors.OLIVE, msg.status, extraInfo);
        }
        private void OnClientConnectionStatus(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgConnectionStatus>(packetMsg).Body;

            LastStatus = msg.status;

            Log.WriteInfo(Name, "Status: {0}", LastStatus);

            string message = string.Format("{0}{1}{2} GC status:{3} {4}", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL, Colors.OLIVE, LastStatus);

            IRC.SendAnnounce(message);

            if (LastStatus == GCConnectionStatus.GCConnectionStatus_NO_SESSION)
            {
                Timer.Interval = TimeSpan.FromSeconds(5).TotalMilliseconds;
                Timer.Start();
            }

            UpdateStatus(AppID, LastStatus.ToString());
        }
        private void OnItemSchemaUpdate(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgUpdateItemSchema>(packetMsg).Body;

            var info = GetSessionInfo(appID);

            if (info.SchemaVersion != 0 && info.SchemaVersion != msg.item_schema_version)
            {
                IRC.Instance.SendMain("{0}{1}{2} item schema updated: {3}{4}{5} -{6} {7}", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL, Colors.DARKGRAY, msg.item_schema_version.ToString("X4"), Colors.NORMAL, Colors.DARKBLUE, msg.items_game_url);
            }

            info.SchemaVersion = msg.item_schema_version;
        }
        private void OnClientWelcome(IPacketGCMsg packetMsg)
        {
            Timer.Stop();

            var msg = new ClientGCMsgProtobuf<CMsgClientWelcome>(packetMsg).Body;

            Log.WriteInfo(Name, "New GC session ({0} -> {1})", LastVersion, msg.version);

            string message = string.Format("New {0}{1}{2} GC session", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL);

            if (LastVersion == -1 || LastVersion == msg.version)
            {
                message += string.Format(" {0}(version {1})", Colors.DARK_GRAY, msg.version);
            }
            else
            {
                message += string.Format(" {0}(version changed from {1} to {2})", Colors.DARK_GRAY, LastVersion, msg.version);
            }

            if (LastVersion != -1 && (LastVersion != msg.version || LastStatus != GCConnectionStatus.GCConnectionStatus_HAVE_SESSION))
            {
                IRC.SendMain(message);
            }

            IRC.SendAnnounce(message);

            LastVersion = (int)msg.version;
            LastStatus = GCConnectionStatus.GCConnectionStatus_HAVE_SESSION;

            UpdateStatus(AppID, LastStatus.ToString());
        }
        private void OnVersionUpdate(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgGCClientVersionUpdated>(packetMsg).Body;

            var info = GetSessionInfo(appID);

            IRC.Instance.SendMain("{0}{1}{2} client version changed:{3} {4} {5}(from {6})", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL, Colors.BLUE, msg.client_version, Colors.DARKGRAY, info.Version);

            info.Version = msg.client_version;
        }
        private void OnItemSchemaUpdate(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgUpdateItemSchema>(packetMsg).Body;

            if (LastSchemaVersion != 0 && LastSchemaVersion != msg.item_schema_version)
            {
                Log.WriteInfo(Name, "Schema change from {0} to {1}", LastSchemaVersion, msg.item_schema_version);

                IRC.SendMain("{0}{1}{2} item schema updated: {3}{4}{5} -{6} {7}", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL, Colors.DARK_GRAY, msg.item_schema_version.ToString("X4"), Colors.NORMAL, Colors.DARK_BLUE, msg.items_game_url);
            }

            LastSchemaVersion = msg.item_schema_version;
        }
        private void OnWrenchBroadcast(uint appID, IPacketGCMsg packetMsg)
        {
            if (appID != 440)
            {
                // This message should be TF2 specific, but just in case
                return;
            }

            var msg = new ClientGCMsgProtobuf<CMsgTFGoldenWrenchBroadcast>(packetMsg).Body;

            IRC.Instance.SendMain("{0}{1}{2} item notification: {3}{4}{5} has {6} Golden Wrench no. {7}{8}{9}!",
                Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL,
                Colors.BLUE, msg.user_name, Colors.NORMAL,
                msg.deleted ? "destroyed" : "found",
                Colors.OLIVE, msg.wrench_number, Colors.NORMAL
            );
        }
        private void OnSystemMessage(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgSystemBroadcast>(packetMsg).Body;

            Log.WriteInfo(Name, "Message: {0}", msg.message);

            IRC.SendMain("{0}{1}{2} system message:{3} {4}", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL, Colors.OLIVE, msg.message);
        }
Пример #57
0
        // this message arrives after we've requested the details for a match
        void OnMatchDetails( IPacketGCMsg packetMsg )
        {
            var msg = new ClientGCMsgProtobuf<CMsgGCMatchDetailsResponse>( packetMsg );

            EResult result = ( EResult )msg.Body.result;
            if ( result != EResult.OK )
            {
                Console.WriteLine( "Unable to request match details: {0}", result );
            }

            gotMatch = true;
            Match = msg.Body.match;

            // we've got everything we need, we can disconnect from steam now
            client.Disconnect();
        }
Пример #58
0
 private void HandleGuildAccountRoleResponse(IPacketGCMsg obj)
 {
     var resp = new ClientGCMsgProtobuf<CMsgDOTAGuildSetAccountRoleResponse>(obj);
     Client.PostCallback(new GuildSetRoleResponse(resp.Body));
 }
Пример #59
0
 /// <summary>
 /// Handle when a cache is destroyed.
 /// </summary>
 /// <param name="obj">Message</param>
 public void HandleCacheDestroy(IPacketGCMsg obj)
 {
     var dest = new ClientGCMsgProtobuf<CMsgSOSingleObject>(obj);
     if (PartyInvite != null && dest.Body.type_id == (int) CSOTypes.PARTYINVITE)
     {
         PartyInvite = null;
         Client.PostCallback(new PartyInviteLeave(null));
     }
     else if (Lobby != null && dest.Body.type_id == (int) CSOTypes.LOBBY)
     {
         Lobby = null;
         Client.PostCallback(new PracticeLobbyLeave(null));
     }
     else if (Party != null && dest.Body.type_id == (int) CSOTypes.PARTY)
     {
         Party = null;
         Client.PostCallback(new PartyLeave(null));
     }
     else if (LobbyInvite != null && dest.Body.type_id == (int) CSOTypes.LOBBYINVITE)
     {
         LobbyInvite = null;
         Client.PostCallback(new LobbyInviteLeave(null));
     }
 }
Пример #60
0
 private void HandleCacheUnsubscribed(IPacketGCMsg obj)
 {
     var unSub = new ClientGCMsgProtobuf<CMsgSOCacheUnsubscribed>(obj);
     if (Lobby != null && unSub.Body.owner_soid.id == Lobby.lobby_id)
     {
         Lobby = null;
         Client.PostCallback(new PracticeLobbyLeave(unSub.Body));
     }
     else if (Party != null && unSub.Body.owner_soid.id == Party.party_id)
     {
         Party = null;
         Client.PostCallback(new PartyLeave(unSub.Body));
     }
     else if (PartyInvite != null && unSub.Body.owner_soid.id == PartyInvite.group_id)
     {
         PartyInvite = null;
         Client.PostCallback(new PartyInviteLeave(unSub.Body));
     }
     else
         Client.PostCallback(new CacheUnsubscribed(unSub.Body));
 }