static public void ClientToGC() { var ClientToGC = new ClientGCMsgProtobuf <PlayerMedalsInfo>((uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_SetMyMedalsInfo); ClientToGC.Body.medal_global = 1318; gameCoordinator.Send(ClientToGC, 730); }
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); }
private void createButton_Click(object sender, EventArgs e) { var leavelobby = new ClientGCMsgProtobuf <CMsgPracticeLobbyLeave>((uint)EDOTAGCMsg.k_EMsgGCPracticeLobbyLeave); _steamGameCoordinator.Send(leavelobby, 570); var createLobby = new ClientGCMsgProtobuf <CMsgPracticeLobbyCreate>((uint)EDOTAGCMsg.k_EMsgGCPracticeLobbyCreate); createLobby.Body.lobby_details = new CMsgPracticeLobbySetDetails(); createLobby.Body.lobby_details.game_name = nameBox.Text; createLobby.Body.lobby_details.pass_key = passBox.Text; createLobby.Body.lobby_details.server_region = (uint)(DotaServerRegions)serverBox.SelectedValue; createLobby.Body.lobby_details.lan = createLobby.Body.lobby_details.server_region == 0; createLobby.Body.lobby_details.game_mode = (uint)(DotaGameModes)gmodeBox.SelectedValue; createLobby.Body.lobby_details.allow_cheats = cheatsButton1.Checked; createLobby.Body.lobby_details.cm_pick = draftRadiantButton.Checked ? DOTA_CM_PICK.DOTA_CM_GOOD_GUYS : DOTA_CM_PICK.DOTA_CM_BAD_GUYS; createLobby.Body.lobby_details.penalty_level_radiant = (uint)(DotaDraftPenalty)penaltyRadiantBox.SelectedValue; createLobby.Body.lobby_details.penalty_level_dire = (uint)(DotaDraftPenalty)penaltyDireBox.SelectedValue; createLobby.Body.lobby_details.visibility = DOTALobbyVisibility.DOTALobbyVisibility_Unlisted; _steamGameCoordinator.Send(createLobby, 570); var ss = new ClientGCMsgProtobuf <CMsgInviteToLobby>((uint)EGCBaseMsg.k_EMsgGCInviteToLobby) { Body = { steam_id = new SteamID(76561198065864003) } }; _steamGameCoordinator.Send(ss, 570); }
void OnLoggedOn(SteamUser.LoggedOnCallback callback) { if (callback.Result != EResult.OK) { Console.WriteLine("Unable to logon to Steam: {0}", callback.Result); gotMatch = true; return; } Console.WriteLine("Logged in! Launching DOTA..."); var playGame = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); playGame.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = new GameID(APPID), }); client.Send(playGame); Thread.Sleep(5000); var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); clientHello.Body.engine = ESourceEngine.k_ESE_Source2; gameCoordinator.Send(clientHello, APPID); }
public override void OnFreeLicenseResponse(ClientMsgProtobuf <CMsgClientRequestFreeLicenseResponse> payload) { if (!payload.Body.granted_appids.Contains(GetAppID())) { // We already own it, let's continue } _log.Debug("Successfully acquired license for app. Starting game..."); var playGames = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); playGames.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = GetAppID() }); _steamClient.Send(playGames); Thread.Sleep(TimeSpan.FromSeconds(2)); _log.Debug("Successfully registered app {game}. Sending client hello to gc services.", GetAppID()); switch (GetAppID()) { case CSGO_APPID: { var clientHello = new ClientGCMsgProtobuf <SteamKit2.GC.CSGO.Internal.CMsgClientHello>( (uint)SteamKit2.GC.CSGO.Internal.EGCBaseClientMsg.k_EMsgGCClientHello ); _gameCoordinator.Send(clientHello, GetAppID()); break; } case TF2_APPID: { var clientInit = new ClientGCMsgProtobuf <CMsgTFClientInit>( (uint)ETFGCMsg.k_EMsgGC_TFClientInit ) { Body = { client_version = 4478108, // up2date as of 17th may 2018 client_versionSpecified = true, language = 0,// We are english languageSpecified = true } }; _gameCoordinator.Send(clientInit, GetAppID()); var clientHello = new ClientGCMsgProtobuf <SteamKit2.GC.TF2.Internal.CMsgClientHello>( (uint)SteamKit2.GC.TF2.Internal.EGCBaseClientMsg.k_EMsgGCClientHello ); _gameCoordinator.Send(clientHello, GetAppID()); break; } } }
public CMsgDOTAMatch getMatchDetail(ulong match_id) { var requestMatch = new ClientGCMsgProtobuf <CMsgGCMatchDetailsRequest>((uint)EDOTAGCMsg.k_EMsgGCMatchDetailsRequest); requestMatch.Body.match_id = match_id; tmpMatch = null; steamGameCoordinator.Send(requestMatch, APPID); while (tmpMatch == null) { callbackMgr.RunWaitCallbacks(TimeSpan.FromSeconds(1)); } return(tmpMatch); }
public void Start() { //get game coordinator handler, use in game _steamGameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>(); _callbackManager.Subscribe <SteamGameCoordinator.MessageCallback>(OnGcMessage); //tell that we are playing DOTA var playGame = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); playGame.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = new GameID(570), // or game_id = APPID, }); _steamClient.Send(playGame); // inform the dota GC that we want a session var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello) { Body = { engine = ESourceEngine.k_ESE_Source2, client_session_need = 104 } }; AddMessageHandler((uint)EGCBaseClientMsg.k_EMsgGCClientWelcome, Connected); AddMessageHandler((uint)ESOMsg.k_ESOMsg_CacheSubscribed, OnCacheSubscribed); AddMessageHandler((uint)ESOMsg.k_ESOMsg_UpdateMultiple, OnUpdateMultiple); _steamGameCoordinator.Send(clientHello, 570); _status = DotaManagerStatus.Connecting; }
private void OnSessionTick(object sender, ElapsedEventArgs e) { if (!Steam.Instance.Client.IsConnected) { return; } foreach (var appID in Settings.Current.GameCoordinatorIdlers) { var info = GetSessionInfo(appID); if (info.Status == GCConnectionStatus.GCConnectionStatus_NO_SESSION || info.Status == GCConnectionStatus.GCConnectionStatus_GC_GOING_DOWN) { var hello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); if (info.AppID == 570) { hello.Body.engine = ESourceEngine.k_ESE_Source2; } SteamGameCoordinator.Send(hello, appID); } } }
private static void Dota() { //tell steam that we are playing dota var playGame = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); playGame.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = new GameID(570) }); steamClient.Send(playGame); //give game coordinator time Thread.Sleep(5000); //send a dota client hello message(ensures dota client has started) var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); clientHello.Body.engine = ESourceEngine.k_ESE_Source2; gameCoordinator.Send(clientHello, 570); manager.RunWaitCallbacks(TimeSpan.FromSeconds(15)); //give dota time Thread.Sleep(5000); //run a request to establish a stream SteamBotModule.CallIsPro(gameCoordinator, 36343070); dotaResponse = true; manager.RunWaitAllCallbacks(TimeSpan.FromSeconds(5)); SteamBotModule.CallSourceTv(gameCoordinator); }
public static void CallSourceTv(SteamGameCoordinator gc) { var sourceTvRequest = new ClientGCMsgProtobuf <CMsgClientToGCFindTopSourceTVGames>((uint)EDOTAGCMsg.k_EMsgClientToGCFindTopSourceTVGames); sourceTvRequest.Body.start_game = 50; gc.Send(sourceTvRequest, 570); }
public static void CallProfileCard(SteamGameCoordinator gc, UInt32 steamId32) { var requestProfileCard = new ClientGCMsgProtobuf <CMsgDOTAProfileCard>((uint)EDOTAGCMsg.k_EMsgClientToGCGetProfileCard); requestProfileCard.Body.account_id = steamId32; gc.Send(requestProfileCard, 570); }
public static void CallPlayerInfo(SteamGameCoordinator gc, ProPlayers proPlayers) { var w = new ClientGCMsgProtobuf <CMsgGCPlayerInfoRequest>((uint)EDOTAGCMsg.k_EMsgGCPlayerInfoRequest); w.Body.player_infos = proPlayers.PlayerInfoRequest; gc.Send(w, 570); }
public static void CallIsPro(SteamGameCoordinator gc, UInt32 steamId32) { var msg = new ClientGCMsgProtobuf <CMsgGCIsProQuery>((uint)EDOTAGCMsg.k_EMsgGCIsProQuery); msg.Body.account_id = 36343070; gc.Send(msg, 570); }
public override void OnClientWelcome(IPacketGCMsg msg) { _log.Debug("Successfully received client hello from CS:GO services. Sending {Mode}...", _liveGameInfo != null ? "Live Game Request" : (_reportInfo != null ? "Report" : "Commend")); if (_liveGameInfo != null) { _gameCoordinator.Send(GetLiveGamePayload(), GetAppID()); } else if (_reportInfo != null) { _gameCoordinator.Send(GetReportPayload(), GetAppID()); } else { _gameCoordinator.Send(GetCommendPayload(), GetAppID()); } }
public void ConnectToGC(ulong appId) { var playMsg = new ClientMsgProtobuf <CMsgClientGamesPlayed>( EMsg.ClientGamesPlayedWithDataBlob); var game = new CMsgClientGamesPlayed.GamePlayed { game_id = new GameID(appId), game_extra_info = "Mist - Portable Steam Client", }; playMsg.Body.games_played.Add(game); SteamClient.Send(playMsg); if (appId == 570) { Thread.Sleep(1000); var helloMsg = new ClientGCMsgProtobuf <CMsgClientHello>(4006); SteamGC.Send(helloMsg, 570); } }
void OnLoggedOn(SteamUser.LoggedOnCallback callback) { if (callback.Result != EResult.OK) { if (callback.Result == EResult.AccountLogonDenied) { // if we recieve AccountLogonDenied or one of it's flavors (AccountLogonDeniedNoMailSent, etc) // then the account we're logging into is SteamGuard protected // see sample 5 for how SteamGuard can be handled Console.WriteLine("Unable to logon to Steam: This account is SteamGuard protected."); isRunning = false; return; } steamFriends.SetPersonaState(EPersonaState.Online); Console.WriteLine("Unable to logon to Steam: {0} / {1}", callback.Result, callback.ExtendedResult); isRunning = false; return; } Console.WriteLine("Logged in! Launching DOTA..."); // 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(APPID), // 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); // inform the dota GC that we want a session var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); clientHello.Body.engine = ESourceEngine.k_ESE_Source2; gameCoordinator.Send(clientHello, APPID); // at this point, we'd be able to perform actions on Steam // for this sample we'll just log off // steamUser.LogOff(); }
public void OpenDota() { CMsgClientGamesPlayed.GamePlayed playingDota2 = new CMsgClientGamesPlayed.GamePlayed(); playingDota2.game_id = new GameID(DOTA_APP_ID); ClientMsgProtobuf <CMsgClientGamesPlayed> playMsg = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); playMsg.Body.games_played.Add(playingDota2); steam.Send(playMsg); Thread.Sleep(5000); // TODO: Can we not wait for something a bit more reliable? Like a callback or something? ClientGCMsgProtobuf <CMsgClientHello> dotaHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); dotaHello.Body.engine = ESourceEngine.k_ESE_Source2; gameCoordinator.Send(dotaHello, DOTA_APP_ID); while (!welcomed) { manager.RunWaitCallbacks(TimeSpan.FromMilliseconds(100)); } }
// called when the client successfully (or unsuccessfully) logs onto an account void OnLoggedOn(SteamUser.LoggedOnCallback callback) { if (callback.Result != EResult.OK) { // logon failed (password incorrect, steamguard enabled, etc) // an EResult of AccountLogonDenied means the account has SteamGuard enabled and an email containing the authcode was sent // in that case, you would get the auth code from the email and provide it in the LogOnDetails Console.WriteLine("Unable to logon to Steam: {0}", callback.Result); gotMatch = true; // we didn't actually get the match details, but we need to jump out of the callback loop return; } Console.WriteLine("Logged in! Launching DOTA..."); // 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(APPID), // or game_id = APPID, }); // send it off // notice here we're sending this message directly using the SteamClient client.Send(playGame); // delay a little to give steam some time to establish a GC connection to us Thread.Sleep(5000); // inform the dota GC that we want a session var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>(( uint )EGCBaseClientMsg.k_EMsgGCClientHello); clientHello.Body.engine = ESourceEngine.k_ESE_Source2; gameCoordinator.Send(clientHello, APPID); }
public bool ProcessSendQueue() { lock (sendQueue) { if (sendQueue.Count > 0) { var item = sendQueue.Dequeue(); switch (item.Type) { case SendInfo.SendType.SteamClient: steamClient.Send((IClientMsg)item.Packet); break; case SendInfo.SendType.SteamGameCoordinator: steamGameCoordinator.Send((IClientGCMsg)item.Packet, APPID_CSGO); break; } return(true); } } return(false); }
async void OnLoggedOn(SteamUser.LoggedOnCallback callback) { if (callback == null) { return; } switch (callback.Result) { case EResult.TwoFactorCodeMismatch: case EResult.AccountLoginDeniedNeedTwoFactor: case EResult.AccountLogonDenied: form.AddLog("[ERROR] SteamGuard needed for this account!"); return; case EResult.InvalidPassword: form.AddLog("[ERROR] Unable to login to Steam: " + callback.Result); return; case EResult.OK: form.AddLog("Successfully connected!"); isConnected = true; if (steamFriends.GetPersonaState() != EPersonaState.Online) { steamFriends.SetPersonaState(EPersonaState.Online); } var gamePlayed = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); gamePlayed.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = new GameID(CSGO_APPID) }); steamClient.Send(gamePlayed); Thread.Sleep(TimeSpan.FromSeconds(5)); //Send ClientToGC GCClientHello to valve servers var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); clientHello.Body.version = CSGO_VERSION; clientHello.Body.client_session_need = 0; clientHello.Body.client_launcher = 0; steamGameCoordinator.Send(clientHello, CSGO_APPID); var clientCertRequest = new ClientMsgProtobuf <CMsgClientNetworkingCertRequest>(EMsg.ClientNetworkingCertRequest); clientCertRequest.Body.key_data = new byte[] { }; //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX4 clientCertRequest.Body.app_id = CSGO_APPID; steamClient.Send(clientCertRequest); break; default: form.AddLog(String.Format("[ERROR] Can't connect to steam: {0} / {1}", callback.Result, callback.ExtendedResult)); return; } await Task.Delay(5000).ConfigureAwait(false); }
static void OnLoggedOn(SteamUser.LoggedOnCallback callback) { bool isSteamGuard = callback.Result == EResult.AccountLogonDenied; bool is2FA = callback.Result == EResult.AccountLoginDeniedNeedTwoFactor; if (isSteamGuard || is2FA) { Console.WriteLine("This account is SteamGuard protected!"); if (is2FA) { Console.Write("Please enter your 2 factor auth code from your authenticator app: "); twoFactorAuth = Console.ReadLine(); } else { Console.Write("Please enter the auth code sent to the email at {0}: ", callback.EmailDomain); authCode = Console.ReadLine(); } return; } if (callback.Result != EResult.OK) { Console.WriteLine("Unable to logon to Steam: {0} / {1}", callback.Result, callback.ExtendedResult); isRunning = false; return; } Console.WriteLine("Successfully logged on!"); // at this point, we'd be able to perform actions on Steam ClientMsgProtobuf <CMsgClientGamesPlayed> msg = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed, 64); CMsgClientGamesPlayed.GamePlayed item = new CMsgClientGamesPlayed.GamePlayed { game_id = (ulong)new GameID(730) }; msg.Body.games_played.Add(item); steamClient.Send(msg); Thread.Sleep(5000); var clienthello = new ClientGCMsgProtobuf <CMsgClientHello>(4006); gameCoordinator.Send(clienthello, 730); }
public bool Send(SteamGameCoordinator steamGC) { var request = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockRequest>((uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_Client2GCEconPreviewDataBlockRequest); request.Body.param_s = param_s; request.Body.param_a = param_a; request.Body.param_d = param_d; request.Body.param_m = param_m; //Console.WriteLine($"Requesting skin: ASSETID[{param_a}], DICKID[{param_d}], STEAMID[{param_s}], MARKETID[{param_m}]"); steamGC.Send(request, 730); return(true); }
public void Test() { var lobby = new ClientGCMsgProtobuf <CMsgPracticeLobbyCreate>((uint)EDOTAGCMsg.k_EMsgGCPracticeLobbyCreate) { Body = { lobby_details = new CMsgPracticeLobbySetDetails { allow_cheats = true, visibility = DOTALobbyVisibility.DOTALobbyVisibility_Unlisted, dota_tv_delay = LobbyDotaTVDelay.LobbyDotaTV_300, pause_setting = LobbyDotaPauseSetting.LobbyDotaPauseSetting_Limited } } }; _steamGameCoordinator.Send(lobby, 570); var test = new ClientGCMsgProtobuf <CMsgPracticeLobbyJoinBroadcastChannel>((uint)EDOTAGCMsg.k_EMsgGCPracticeLobbyJoinBroadcastChannel) { Body = { channel = 0, preferred_country_code = "ee", preferred_description = "Estonia Main", preferred_language_code = "english" } }; _steamGameCoordinator.Send(test, 570); var ss = new ClientGCMsgProtobuf <CMsgInviteToLobby>((uint)EGCBaseMsg.k_EMsgGCInviteToLobby) { Body = { steam_id = new SteamID(76561198065864003) } }; _steamGameCoordinator.Send(ss, 570); }
// 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 ); }
static void OnLoggedOn(SteamUser.LoggedOnCallback callback) { bool isSteamGuard = callback.Result == EResult.AccountLogonDenied; bool is2FA = callback.Result == EResult.AccountLoginDeniedNeedTwoFactor; if (isSteamGuard || is2FA) { if (is2FA) { twoFactorAuth = Console.ReadLine(); } else { authCode = Console.ReadLine(); } return; } if (callback.Result != EResult.OK) { mainform.isjoinlobby = false; return; } statusteam = "Зашел в аккаунт!"; // at this point, we'd be able to perform actions on Steam ClientMsgProtobuf <CMsgClientGamesPlayed> msg = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed, 64); CMsgClientGamesPlayed.GamePlayed item = new CMsgClientGamesPlayed.GamePlayed { game_id = (ulong)new GameID(730) }; msg.Body.games_played.Add(item); steamClient.Send(msg); Thread.Sleep(5000); var clienthello = new ClientGCMsgProtobuf <CMsgClientHello>(4006); gameCoordinator.Send(clienthello, 730); }
public void HandleInvite(byte[] cache) { using (var stream = new MemoryStream(cache)) { var party = Serializer.Deserialize <CSODOTAPartyInvite>(stream); var message = "You were invited to a "; if (party.low_priority_status == false) { message += "high priority party\n"; } else { message += "LOW priority party\n"; } message += "Invite from: " + party.sender_name + "\n"; message += "People in party: \n"; foreach (var member in party.members) { message += "---" + member.name; if (member.is_coach) { message += " as coach"; } message += "\n"; } message += "Accept?"; var partyinviteresponse = new ClientGCMsgProtobuf <CMsgPartyInviteResponse>((uint)EGCBaseMsg.k_EMsgGCPartyInviteResponse); partyinviteresponse.Body.party_id = party.group_id; if (MessageBox.Show(message, "Party invite received", MessageBoxButtons.YesNo) == DialogResult.Yes) { partyinviteresponse.Body.accept = true; } else { partyinviteresponse.Body.accept = false; } _steamGameCoordinator.Send(partyinviteresponse, 570); } }
public void Run() { isRunning = true; steamClient.Connect(); while (isRunning) { manager.RunWaitAllCallbacks(TimeSpan.FromSeconds(5)); if (sw.Elapsed.Seconds > 5) { Console.WriteLine("Resending CMsgClientHello"); var ClientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); SteamGameCoordinator.Send(ClientHello, 730); sw.Restart(); } } }
public override void OnLoggedOn(SteamUser.LoggedOnCallback callback) { switch (callback.Result) { case EResult.OK: _log.Debug("Successfully logged in. Registering that we're playing app {app id}...", GetAppID()); _steamFriends.SetPersonaState(EPersonaState.Online); /*if (!Titan.Instance.Options.NoSteamGroup) * { * LoginWebInterface(callback.ClientSteamID); * JoinSteamGroup(); // https://steamcommunity.com/groups/TitanReportBot * return; * }*/ var playGames = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); playGames.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = GetAppID() }); _steamClient.Send(playGames); Thread.Sleep(TimeSpan.FromSeconds(2)); _log.Debug("Successfully registered app {game}. Sending client hello to gc services.", GetAppID()); switch (GetAppID()) { case CSGO_APPID: { var clientHello = new ClientGCMsgProtobuf <SteamKit2.GC.CSGO.Internal.CMsgClientHello>( (uint)SteamKit2.GC.CSGO.Internal.EGCBaseClientMsg.k_EMsgGCClientHello ); _gameCoordinator.Send(clientHello, GetAppID()); break; } case TF2_APPID: { var clientInit = new ClientGCMsgProtobuf <CMsgTFClientInit>( (uint)ETFGCMsg.k_EMsgGC_TFClientInit ) { Body = { client_version = 4478108, // up2date as of 17th may 2018 client_versionSpecified = true, language = 0,// We are english languageSpecified = true } }; _gameCoordinator.Send(clientInit, GetAppID()); var clientHello = new ClientGCMsgProtobuf <SteamKit2.GC.TF2.Internal.CMsgClientHello>( (uint)SteamKit2.GC.TF2.Internal.EGCBaseClientMsg.k_EMsgGCClientHello ); _gameCoordinator.Send(clientHello, GetAppID()); break; } } break; case EResult.AccountLoginDeniedNeedTwoFactor: case EResult.AccountLogonDenied: _log.Error("Two Factor Authentification is activated on this account. Please set " + "Sentry to {true} in the accounts.json for this account.", true); Result = Result.SentryRequired; Stop(); break; case EResult.InvalidPassword: _log.Error("Unable to connect to Steam: {mismatch}. Please check your account details.", "Invalid Password"); Result = Result.Code2FAWrong; // FIXME: Might want to specify a real result sometime Stop(); break; case EResult.TwoFactorCodeMismatch: case EResult.NoConnection: case EResult.Timeout: case EResult.TryAnotherCM: case EResult.ServiceUnavailable: _log.Error("Unable to connect to Steam: {Reason}. Retrying...", callback.ExtendedResult); break; case EResult.RateLimitExceeded: _log.Debug("Steam Rate Limit has been reached. Please try it again in a few minutes..."); Result = Result.RateLimit; Stop(); break; case EResult.AccountDisabled: _log.Error("This account has been permanently disabled by the Steam network."); Result = Result.AccountBanned; Stop(); break; default: _log.Error("Unable to logon to account: {Result}: {ExtendedResult}", callback.Result, callback.ExtendedResult); Stop(); break; } }
public override void OnLoggedOn(SteamUser.LoggedOnCallback callback) { switch (callback.Result) { case EResult.OK: _log.Debug("Successfully logged in. Checking for any VAC or game bans..."); if (Titan.Instance.WebHandle.RequestBanInfo(_steamUser.SteamID.ConvertToUInt64(), out var banInfo)) { if (banInfo.VacBanned || banInfo.GameBanCount > 0) { _log.Warning("The account has a ban on record. " + "If the VAC/Game ban ban is from CS:GO, a {Mode} is not possible. " + "Proceeding with caution.", _reportInfo != null ? "report" :"commend"); Result = Result.AccountBanned; } } _log.Debug("Registering that we're playing CS:GO..."); _steamFriends.SetPersonaState(EPersonaState.Online); var playGames = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); if (_idleInfo != null) { foreach (var gameID in _idleInfo.GameID) { var gamesPlayed = new CMsgClientGamesPlayed.GamePlayed { game_id = Convert.ToUInt64(gameID) }; if (gameID == 0) { gamesPlayed.game_extra_info = Titan.Instance.UIManager.GetForm <General>(UIType.General) .CustomGameName; } playGames.Body.games_played.Add(gamesPlayed); } } else { playGames.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = 730 }); } _steamClient.Send(playGames); Thread.Sleep(5000); if (_idleInfo == null) { _log.Debug("Successfully registered playing CS:GO. Sending client hello to CS:GO services."); var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); _gameCoordinator.Send(clientHello, 730); } else { Trigger = TriggerBuilder.Create() .WithIdentity("Idle Trigger - " + JsonAccount.Username + " (Unprotected)", "Titan") .StartNow() .WithSimpleSchedule(x => x .WithIntervalInMinutes(_idleInfo.Minutes) .WithRepeatCount(1)) .Build(); Titan.Instance.Scheduler.ScheduleJob(Job, Trigger); _idleInfo.StartTick = DateTime.Now.Ticks; _log.Debug("Successfully registered idling in requested games. Starting scheduler."); } break; case EResult.AccountLoginDeniedNeedTwoFactor: case EResult.AccountLogonDenied: _log.Debug("Two Factor Authentification is activated on this account. Please set " + "Sentry to {true} in the accounts.json for this account.", true); Stop(); IsRunning = false; Result = Result.SentryRequired; break; case EResult.InvalidPassword: case EResult.NoConnection: case EResult.Timeout: case EResult.TryAnotherCM: case EResult.TwoFactorCodeMismatch: case EResult.ServiceUnavailable: _log.Error("Unable to connect to Steam: {Reason}. Retrying...", callback.ExtendedResult); break; case EResult.RateLimitExceeded: _log.Debug("Steam Rate Limit has been reached. Please try it again in a few minutes..."); Stop(); IsRunning = false; Result = Result.RateLimit; break; case EResult.AccountDisabled: _log.Error("This account has been permanently disabled by the Steam network."); Stop(); IsRunning = false; Result = Result.AccountBanned; break; default: _log.Error("Unable to logon to account: {Result}: {ExtendedResult}", callback.Result, callback.ExtendedResult); Stop(); IsRunning = false; break; } }
public override void OnLoggedOn(SteamUser.LoggedOnCallback callback) { switch (callback.Result) { case EResult.OK: _log.Debug("Successfully logged in. Checking for any VAC or game bans..."); var banInfo = Titan.Instance.BanManager.GetBanInfoFor(_steamUser.SteamID.ConvertToUInt64()); if (banInfo != null && (banInfo.VacBanned || banInfo.GameBanCount > 0)) { _log.Warning("The account has a ban on record. " + "If the VAC/Game ban ban is from CS:GO, a {Mode} is not possible. " + "Proceeding with caution.", _reportInfo != null ? "report" :"commend"); Result = Result.AccountBanned; } _log.Debug("Registering that we're playing CS:GO..."); _steamFriends.SetPersonaState(EPersonaState.Online); var playGames = new ClientMsgProtobuf <CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed); playGames.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = 730 }); _steamClient.Send(playGames); Thread.Sleep(5000); _log.Debug("Successfully registered playing CS:GO. Sending client hello to CS:GO services."); var clientHello = new ClientGCMsgProtobuf <CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello); _gameCoordinator.Send(clientHello, 730); break; case EResult.AccountLoginDeniedNeedTwoFactor: _log.Information("Opening UI form to get the 2FA Steam Guard App Code..."); if (_sgAccount != null) { _log.Debug("A shared secret has been provided: automaticly generating it..."); _2FactorCode = _sgAccount.GenerateSteamGuardCode(); } else { Application.Instance.Invoke(() => Titan.Instance.UIManager.ShowForm( UIType.TwoFactorAuthentification, new TwoFactorAuthForm(Titan.Instance.UIManager, this, null))); while (string.IsNullOrEmpty(_2FactorCode)) { /* Wait until the Form inputted the 2FA code from the Steam Guard App */ } } _log.Information("Received 2FA Code: {Code}", _2FactorCode); break; case EResult.AccountLogonDenied: _log.Information("Opening UI form to get the Auth Token from EMail..."); Application.Instance.Invoke(() => Titan.Instance.UIManager.ShowForm(UIType.TwoFactorAuthentification, new TwoFactorAuthForm(Titan.Instance.UIManager, this, callback.EmailDomain))); while (string.IsNullOrEmpty(_authCode)) { /* Wait until the Form inputted the Auth code from the Email Steam sent */ } _log.Information("Received Auth Token: {Code}", _authCode); break; case EResult.ServiceUnavailable: _log.Error("Steam is currently offline. Please try again later."); Stop(); IsRunning = false; break; case EResult.RateLimitExceeded: _log.Debug("Steam Rate Limit has been reached. Please try it again in a few minutes..."); Stop(); IsRunning = false; Result = Result.RateLimit; break; default: _log.Error("Unable to logon to account: {Result}: {ExtendedResult}", callback.Result, callback.ExtendedResult); Stop(); IsRunning = false; break; } }