void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { if (callback == null) { return; } Console.WriteLine(string.Format("OnGCMessage code : {0}", callback.EMsg)); var messageMap = new Dictionary <uint, Action <IPacketGCMsg> > { { ( uint )EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { ( uint )ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello, OnMatchmakingClientHello }, //{ (uint)EMsg.ClientMMSJoinLobbyResponse, OnJoinLobbyResponse }, //{ (uint)EMsg.ClientMMSCreateLobbyResponse, OnCreateLobbyResponse } }; Action <IPacketGCMsg> func; if (!messageMap.TryGetValue(callback.EMsg, out func)) { return; } func(callback.Message); }
static void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { Console.WriteLine("EMSG: " + callback.EMsg.ToString()); switch (callback.EMsg) { case 4004: // GC Welcome new ClientGCMsgProtobuf <CMsgClientWelcome>(callback.Message); Console.WriteLine("> GC sagt hallo."); JoiningTheLobby(); break; case 6604: new ClientGCMsgProtobuf <CMsgClientMMSJoinLobby>(callback.Message); Console.WriteLine("> Hello world."); break; case 9110: Console.WriteLine($"EMSG Response{callback.Message}"); break; } }
private void EventOnGCMessage(SteamGameCoordinator.MessageCallback callback) { var messageMap = new Dictionary <uint, Action <IPacketGCMsg> > { { ( uint )EGCBaseClientMsg.k_EMsgGCClientWelcome, EventOnClientWelcome }, { ( uint )EDOTAGCMsg.k_EMsgGCMatchDetailsResponse, EventOnMatchDetailsResponse }, { ( uint )ESOMsg.k_ESOMsg_CacheSubscribed, EventVoidMessage }, { ( uint )ESOMsg.k_ESOMsg_CacheUnsubscribed, EventOnCacheUnsubscribed }, { ( uint )ESOMsg.k_ESOMsg_UpdateMultiple, EventOnUpdateMultiple }, { ( uint )EDOTAGCMsg.k_EMsgGCJoinChatChannelResponse, EventOnChatChannelJoin }, { ( uint )EDOTAGCMsg.k_EMsgGCChatMessage, EventOnChatMessage }, { ( uint )EDOTAGCMsg.k_EMsgGCReadyUpStatus, EventOnReadyUpStatus }, { ( uint )EDOTAGCMsg.k_EMsgDOTAGetPlayerMatchHistoryResponse, EventOnPlayerMatchHistoryResponse }, { ( uint )EDOTAGCMsg.k_EMsgGCOtherJoinedChannel, EventVoidMessage }, { ( uint )EDOTAGCMsg.k_EMsgGCOtherLeftChannel, EventVoidMessage }, { ( uint )EGCBaseClientMsg.k_EMsgGCClientConnectionStatus, EventOnClientConnectionStatus } }; Action <IPacketGCMsg> func; if (!messageMap.TryGetValue(callback.EMsg, out func)) { _logger.Info("Unhandled message: " + callback.EMsg); return; } try { func(callback.Message); } catch (Exception e) { _logger.Error(String.Format("Error while handling message {0}", callback.EMsg), e); } }
private void OnGameCoordinatorMessage(SteamGameCoordinator.MessageCallback callback) { Action <uint, IPacketGCMsg> callbackFunction; if (MessageMap.TryGetValue(callback.EMsg, out callbackFunction)) { callbackFunction(callback.AppID, callback.Message); } }
void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { Log.WriteDebug("GCManager", "Got {0} GC message {1}", callback.AppID, GetEMsgName(callback.EMsg)); var matchingCallbacks = callbacks .Where(call => call.EMsg == callback.EMsg); foreach (var call in matchingCallbacks) { call.Run(callback.Message, callback.AppID); } }
private void onMessage(SteamGameCoordinator.MessageCallback callback) { Console.Error.WriteLine("Received message: {0}", callback.EMsg); Dictionary <uint, Action <IPacketGCMsg> > msgMap = new Dictionary <uint, Action <IPacketGCMsg> >(); msgMap[(uint)EGCBaseClientMsg.k_EMsgGCClientWelcome] = onWelcomeReceived; msgMap[(uint)EDOTAGCMsg.k_EMsgGCMatchDetailsResponse] = onMatchDetailsReceived; if (msgMap.ContainsKey(callback.EMsg)) { msgMap[callback.EMsg](callback.Message); } }
// called when a gamecoordinator (GC) message arrives // these kinds of messages are designed to be game-specific // in this case, we'll be handling dota's GC messages private void OnGcMessage(SteamGameCoordinator.MessageCallback callback) { Action <IPacketGCMsg> func; if (!_messageMap.TryGetValue(callback.EMsg, out func)) { // this will happen when we recieve some GC messages that we're not handling // this is okay because we're handling every essential message, and the rest can be ignored Console.WriteLine("Received unhandled message: " + callback.EMsg); return; } func(callback.Message); }
public override void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { var map = new Dictionary <uint, Action <IPacketGCMsg> > { { (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse, OnReportResponse }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientCommendPlayerQueryResponse, OnCommendResponse }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchList, OnLiveGameRequestResponse } }; if (map.TryGetValue(callback.EMsg, out var func)) { func(callback.Message); } }
private void OnGCMessage(SteamGameCoordinator.MessageCallback obj) { logger.Info($"Game Coordinator message {obj.EMsg} callback is obtained."); var messageMap = new Dictionary <uint, Action <IPacketGCMsg> > { { ( uint )EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { ( uint )ESOMsg.k_ESOMsg_UpdateMultiple, OnUpdateMultiple } }; if (!messageMap.TryGetValue(obj.EMsg, out var func)) { return; } func(obj.Message); }
void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { var messageMap = new Dictionary <uint, Action <IPacketGCMsg> > { { ( uint )EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { ( uint )EDOTAGCMsg.k_EMsgGCMatchDetailsResponse, OnMatchDetails }, }; Action <IPacketGCMsg> func; if (!messageMap.TryGetValue(callback.EMsg, out func)) { return; } func(callback.Message); }
// called when a gamecoordinator (GC) message arrives // these kinds of messages are designed to be game-specific // in this case, we'll be handling dota's GC messages void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { // setup our dispatch table for messages // this makes the code cleaner and easier to maintain var messageMap = new Dictionary <uint, Action <IPacketGCMsg> > { { ( uint )EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, // {(uint) EDOTAGCMsg.k_EMsgGCPracticeLobbyJoinResponse, HandlePracticeLobbyJoinResponse}, //{(uint) EDOTAGCMsg.k_EMsgGCPracticeLobbyListResponse, HandlePracticeLobbyListResponse}, //{(uint) ESOMsg.k_ESOMsg_UpdateMultiple, HandleUpdateMultiple}, //{(uint) ESOMsg.k_ESOMsg_CacheSubscribed, HandleCacheSubscribed}, //{(uint) ESOMsg.k_ESOMsg_CacheUnsubscribed, HandleCacheUnsubscribed}, //{(uint) ESOMsg.k_ESOMsg_Destroy, HandleCacheDestroy}, //{(uint) EGCBaseClientMsg.k_EMsgGCPingRequest, HandlePingRequest}, //{(uint) EDOTAGCMsg.k_EMsgGCJoinChatChannelResponse, HandleJoinChatChannelResponse}, //{(uint) EDOTAGCMsg.k_EMsgGCRequestChatChannelListResponse, HandleChatChannelListResponse}, //{(uint) EDOTAGCMsg.k_EMsgGCChatMessage, HandleChatMessage}, //{(uint) EDOTAGCMsg.k_EMsgGCOtherJoinedChannel, HandleOtherJoinedChannel}, //{(uint) EDOTAGCMsg.k_EMsgGCOtherLeftChannel, HandleOtherLeftChannel}, //{(uint) EDOTAGCMsg.k_EMsgGCPopup, HandlePopup}, //{(uint) EDOTAGCMsg.k_EMsgDOTALiveLeagueGameUpdate, HandleLiveLeageGameUpdate}, //{(uint) EGCBaseMsg.k_EMsgGCInvitationCreated, HandleInvitationCreated}, //{(uint) EDOTAGCMsg.k_EMsgGCMatchDetailsResponse, HandleMatchDetailsResponse}, //{(uint) EGCBaseClientMsg.k_EMsgGCClientConnectionStatus, HandleConnectionStatus}, //{(uint) EDOTAGCMsg.k_EMsgGCProTeamListResponse, HandleProTeamList}, //{(uint) EDOTAGCMsg.k_EMsgGCFantasyLeagueInfo, HandleFantasyLeagueInfo}, //{(uint) EDOTAGCMsg.k_EMsgGCPlayerInfo, HandlePlayerInfo}, //{(uint) EDOTAGCMsg.k_EMsgGCProfileResponse, HandleProfileResponse}, //{(uint) EDOTAGCMsg.k_EMsgGCGuildSetAccountRoleResponse, HandleGuildAccountRoleResponse}, //{(uint) EDOTAGCMsg.k_EMsgGCGuildInviteAccountResponse, HandleGuildInviteAccountResponse}, //{(uint) EDOTAGCMsg.k_EMsgGCGuildCancelInviteResponse, HandleGuildCancelInviteResponse}, //{(uint) EDOTAGCMsg.k_EMsgGCGuildData, HandleGuildData}, //{(uint) EDOTAGCMsg.k_EMsgClientToGCGetProfileCardResponse, HandleProfileCardResponse} }; Action <IPacketGCMsg> func; if (!messageMap.TryGetValue(callback.EMsg, out func)) { // this will happen when we recieve some GC messages that we're not handling // this is okay because we're handling every essential message, and the rest can be ignored return; } func(callback.Message); }
static void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { if (callback.EMsg == 6604) { string test = null; var JoinResp = new ClientGCMsgProtobuf <CMsgClientMMSJoinLobbyResponse>(callback.Message); EResult result = (EResult)JoinResp.Body.chat_room_enter_response; EResult app_id = (EResult)JoinResp.Body.app_id; EResult flags = (EResult)JoinResp.Body.lobby_flags; EResult type = (EResult)JoinResp.Body.lobby_type; EResult max_members = (EResult)JoinResp.Body.max_members; //EResult id_lobby = (EResult)JoinResp.Body.steam_id_lobby; <- Geht nicht weil EResult 32bit ist und nicht 64bit EResult owner = (EResult)JoinResp.Body.steam_id_owner; var id_lobby = JoinResp.Body.steam_id_lobby; // Das geht aber :) test = test + ($"Join Response: {result}") + Environment.NewLine; test = test + ($"app_id: {app_id}") + Environment.NewLine; test = test + ($"Flags: {flags}") + Environment.NewLine; test = test + ($"Type: {type}") + Environment.NewLine; test = test + ($"Max Members: {max_members}") + Environment.NewLine; test = test + ($"id_lobby: {id_lobby}") + Environment.NewLine; test = test + ($"Owner: {owner}") + Environment.NewLine; test = test + ($"FULL BODY: {JoinResp.Body.ToString()}") + Environment.NewLine; File.WriteAllText("6604.txt", test); } // setup our dispatch table for messages // this makes the code cleaner and easier to maintain var messageMap = new Dictionary <uint, Action <IPacketGCMsg> > { { ( uint )EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { ( uint )ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello, OnMatchmakingClientHello }, { ( uint )ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse, OnReportResponse }, { ( uint )ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchList, OnRecentMatchesResponse }, //{ ( uint )EDOTAGCMsg.k_EMsgGCMatchDetailsResponse, OnMatchDetails }, }; Action <IPacketGCMsg> func; if (!messageMap.TryGetValue(callback.EMsg, out func)) { // this will happen when we recieve some GC messages that we're not handling // this is okay because we're handling every essential message, and the rest can be ignored return; } func(callback.Message); }
static void OnMessageCall(SteamGameCoordinator.MessageCallback callback) { if (callback.EMsg == 4004) { statusteam = "Подключен к Стиму!"; var resp = new ClientGCMsgProtobuf <CMsgClientWelcome>(callback.Message); } else if (callback.EMsg == 6614) { var responseChat = new ClientGCMsgProtobuf <CMsgClientMMSLobbyChatMsg>(callback.Message); chat = chat + System.Text.Encoding.UTF8.GetString(StringToByteArray(getBetween(BitConverter.ToString(responseChat.Body.lobby_message).Replace("-", string.Empty), "6E616D65", "000B"))) + Environment.NewLine; File.WriteAllText("text.txt", BitConverter.ToString(responseChat.Body.lobby_message).Replace("-", string.Empty)); } else if (callback.EMsg == 4004) { var resp = new ClientGCMsgProtobuf <CMsgClientWelcome>(callback.Message); } }
public abstract void AddFreeLicense(uint appID = TF2_APPID); // For TF2 //////////////////////////////////////////////////// // GAME COORDINATOR //////////////////////////////////////////////////// public void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { var map = new Dictionary <uint, Action <IPacketGCMsg> > { { (uint)SteamKit2.GC.CSGO.Internal.EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { (uint)SteamKit2.GC.TF2.Internal.EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse, OnReportResponse }, { (uint)SteamKit2.GC.TF2.Internal.EGCItemMsg.k_EMsgGC_ReportAbuseResponse, OnReportResponse }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello, OnMatchmakingHelloResponse }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientCommendPlayerQueryResponse, OnCommendResponse }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchList, OnLiveGameRequestResponse } }; if (map.TryGetValue(callback.EMsg, out var func)) { func(callback.Message); } }
static void OnMessageCall(SteamGameCoordinator.MessageCallback callback) { Console.WriteLine("DEBUG: MessageCallback " + callback.EMsg); if (callback.EMsg == 4004) { new ClientGCMsgProtobuf <CMsgClientWelcome>(callback.Message); Console.WriteLine("GameCoordinator is welcoming us!"); _handler.JoinLobby(); // Time to join the Lobby //CMsgClientMMSSendLobbyChatMsg send = new CMsgClientMMSSendLobbyChatMsg() //{ // app_id = 730, // steam_id_target = 0, // steam_id_lobby = lobbyid, // lobby_message = //}; } else if (callback.EMsg == 6614) { var responseChat = new ClientGCMsgProtobuf <CMsgClientMMSLobbyChatMsg>(callback.Message); byte[] message = responseChat.Body.lobby_message; Console.WriteLine("CHAT: " + System.Text.Encoding.UTF8.GetString(message)); } else if (callback.EMsg == 6604) { // We joined the Lobby! var responseJoin = new ClientGCMsgProtobuf <CMsgClientMMSJoinLobbyResponse>(callback.Message); ulong steamid_owner = responseJoin.Body.steam_id_owner; Console.WriteLine("We joined the Lobby.\nSteamID of the Owner: " + steamid_owner); } else if (callback.EMsg == 9110) { var re = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingClient2GCHello>(callback.Message); Console.WriteLine("k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello in (9110)."); } else { Console.WriteLine("We got response. From " + callback.EMsg); } }
public static void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { IPacketGCMsg m = callback.Message; switch ((EDOTAGCMsg)callback.EMsg) { case EDOTAGCMsg.k_EMsgClientToGCGetProfileCardResponse: var profileCard = new ClientGCMsgProtobuf <CMsgDOTAProfileCard>(m); SubmitNextAction(Response.ProfileCard, profileCard); break; case EDOTAGCMsg.k_EMsgClientToGCTopFriendMatchesRequest: var friendMatches = new ClientGCMsgProtobuf <CMsgGCToClientTopFriendMatchesResponse>(m); break; case EDOTAGCMsg.k_EMsgGCToClientFindTopSourceTVGamesResponse: var sourceTvGames = new ClientGCMsgProtobuf <SteamKit2.GC.Dota.Internal.CMsgGCToClientFindTopSourceTVGamesResponse>(m); SubmitNextAction(Response.SourceTv, sourceTvGames.Body.game_list); break; case EDOTAGCMsg.k_EMsgGCPlayerInfo: var players = new ClientGCMsgProtobuf <CMsgGCPlayerInfo>(m); SubmitNextAction(Response.PlayerInfo, players); break; case EDOTAGCMsg.k_EMsgClientToGCMatchesMinimalResponse: var game = new ClientGCMsgProtobuf <CMsgClientToGCMatchesMinimalResponse>(m); break; case (EDOTAGCMsg)24: //spectateFriend = new ClientGCMsgProtobuf<CMsgSpectateFriendGameResponse>(m); SteamBot.OnSpectateFriendResponse(m); break; case (EDOTAGCMsg)4004: SteamBot.OnClientWelcome(m); break; default: break; } }
// called when a gamecoordinator (GC) message arrives // these kinds of messages are designed to be game-specific // in this case, we'll be handling dota's GC messages void OnGCMessage( SteamGameCoordinator.MessageCallback callback ) { // setup our dispatch table for messages // this makes the code cleaner and easier to maintain var messageMap = new Dictionary<uint, Action<IPacketGCMsg>> { { ( uint )EGCBaseMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { ( uint )EDOTAGCMsg.k_EMsgGCMatchDetailsResponse, OnMatchDetails }, }; Action<IPacketGCMsg> func; if ( !messageMap.TryGetValue( callback.EMsg, out func ) ) { // this will happen when we recieve some GC messages that we're not handling // this is okay because we're handling every essential message, and the rest can be ignored return; } func( callback.Message ); }
private void OnGameCoordinatorMessage(SteamGameCoordinator.MessageCallback callback) { Action <IPacketGCMsg> callbackFunction; if (GCMessageMap.TryGetValue(callback.EMsg, out callbackFunction)) { callbackFunction(callback.Message); } else { Log.WriteDebug(Name, "Unhandled GC message - EMsg: {0} ({1})", callback.EMsg, GetEMsgDisplayString((int)callback.EMsg)); } // If we hear from GC, but it's not hello, keep bugging it if (!Timer.Enabled && LastStatus == GCConnectionStatus.GCConnectionStatus_NO_SESSION) { Timer.Interval = TimeSpan.FromSeconds(60).TotalMilliseconds; Timer.Start(); } }
// Game coordinator private void OnGCMessage(SteamGameCoordinator.MessageCallback obj) { var map = new Dictionary <uint, Action <IPacketGCMsg> > { { (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome }, { (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello, OnMatchmakingHelloResponse }, //{ (uint) ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayersProfile, OnPlayersProfile }, }; if (map.TryGetValue(obj.EMsg, out var func)) { func(obj.Message); } else if (obj.EMsg != 9194) { Logger.Log($"Unhandled GC message: {obj.EMsg}"); } }
} // Weiß noch nicht ganz für was das ist, Steam ist gerade down (23.12.16 19:18) // Nein ich bin kein retard. weiß nur nicht ob das für, wenn wir adden oder wenn uns einer added?! static void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { Console.WriteLine("EMSG: " + callback.EMsg.ToString()); switch (callback.EMsg) { case 4004: // GC Welcome new ClientGCMsgProtobuf <CMsgClientWelcome>(callback.Message); Console.WriteLine("> GC sagt hallo."); JoiningTheLobby(); break; case 6604: // GC Join Lobby new ClientGCMsgProtobuf <CMsgClientMMSJoinLobby>(callback.Message); Console.WriteLine("> Joined a lobby"); break; case 9110: Console.WriteLine($"EMSG Response{callback.Message}"); break; } } // Wird gecalled wenn wir mit dem game coordinator kommunizieren
//////////////////////////////////////////////////// // GAME COORDINATOR //////////////////////////////////////////////////// public abstract void OnGCMessage(SteamGameCoordinator.MessageCallback callback);
private void OnMessageCall(SteamGameCoordinator.MessageCallback callback) { Console.WriteLine(callback.EMsg.ToString()); switch (callback.EMsg) { case (uint)EGCBaseClientMsg.k_EMsgGCClientHello: case (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome: { sw.Stop(); var ClientHello = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingGC2ClientHello>((uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello); SteamGameCoordinator.Send(ClientHello, 730); break; } case (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: { var details = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingGC2ClientHello>(callback.Message); if (details.Body.vac_banned == 0) { var penalty_seconds = Math.Abs(details.Body.penalty_seconds); if (penalty_seconds > 0 && !AcknowledgedPenalty) { AcknowledgedPenalty = true; Console.WriteLine("k_EMsgGCCStrike15_v2_AcknowledgePenalty"); var AcknowledgePenalty = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_AcknowledgePenalty>((uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_AcknowledgePenalty); AcknowledgePenalty.Body.acknowledged = 1; SteamGameCoordinator.Send(AcknowledgePenalty, 730); Thread.Sleep(SLEEP); var ClientHello = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingGC2ClientHello>((uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello); SteamGameCoordinator.Send(ClientHello, 730); return; } if (details.Body.penalty_reason == 18) { steamUser.LogOff(); return; } if (details.Body.penalty_reason == 10) { Console.WriteLine($"{username}: global cooldown"); steamUser.LogOff(); return; } if (details.Body.ranking == null || penalty_seconds > 0) { Console.WriteLine($"{username}: penalty_seconds > 0"); Console.WriteLine($"{username}: penalty_reason = {details.Body.penalty_reason}"); Thread.Sleep(SLEEP); var ClientHello = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingGC2ClientHello>((uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello); SteamGameCoordinator.Send(ClientHello, 730); return; } var extra = extraData(steamid); DataAccess.AddAccounts(extra.public_name, username, password, (int)details.Body.ranking.wins, details.Body.player_level, extra.profile_link, extra.profile_pic); Debug.WriteLine("Account added to database"); accounts.Add(new AccountDetails() { public_name = extra.public_name, profile_url = extra.profile_link, profile_img_url = extra.profile_pic, login = $"{username}:{password}", steam64id = steamid, penalty_reason = (int)details.Body.penalty_reason, penalty_seconds = (int)details.Body.penalty_seconds, wins = (int)details.Body.ranking.wins, rank = details.Body.player_level }); } steamUser.LogOff(); break; } default: break; } }
public void OnMessage(SteamGameCoordinator.MessageCallback callback) { if ((uint)EGCBaseClientMsg.k_EMsgGCClientWelcome == callback.EMsg) { var pb = new ClientGCMsgProtobuf <CMsgClientWelcome>(callback.Message); if (ClientVersion != pb.Body.version) { log.WarnFormat( "Version mismatch, Clara ver {0} but GC ver {1}", ClientVersion, pb.Body.version); ClientVersion = pb.Body.version; } log.DebugFormat("Welcomed to version {0}", pb.Body.version); foreach (var cache in pb.Body.outofdate_subscribed_caches) { foreach (var obj in cache.objects) { // TODO: Multiple objects??? Set(cache.owner_soid.id, obj.type_id, obj.object_data[0]); } } using (var stream = new MemoryStream(pb.Body.game_data)) { Account = Serializer.Deserialize <CSODOTAGameAccountClient>(stream); } } else if (callback.EMsg == (uint)EDOTAGCMsg.k_EMsgGCJoinChatChannelResponse) { var pb = new ClientGCMsgProtobuf <CMsgDOTAJoinChatChannelResponse>(callback.Message); Channels[pb.Body.channel_name] = pb.Body.channel_id; } else if ((uint)EDOTAGCMsg.k_EMsgGCWatchGameResponse == callback.EMsg) { var pb = new ClientGCMsgProtobuf <CMsgWatchGameResponse>(callback.Message); WatchResponse = pb.Body; } else if ((uint)ESOMsg.k_ESOMsg_Create == callback.EMsg) { var pb = new ClientGCMsgProtobuf <CMsgSOSingleObject>(callback.Message); Set(pb.Body.owner_soid.id, pb.Body.type_id, pb.Body.object_data); } else if ((uint)ESOMsg.k_ESOMsg_Update == callback.EMsg) { var pb = new ClientGCMsgProtobuf <CMsgSOSingleObject>(callback.Message); Set(pb.Body.owner_soid.id, pb.Body.type_id, pb.Body.object_data); } else if ((uint)ESOMsg.k_ESOMsg_UpdateMultiple == callback.EMsg) { var pb = new ClientGCMsgProtobuf <CMsgSOMultipleObjects>(callback.Message); foreach (var obj in pb.Body.objects_modified) { Set(pb.Body.owner_soid.id, obj.type_id, obj.object_data); } } else if ((uint)ESOMsg.k_ESOMsg_CacheUnsubscribed == callback.EMsg) { var pb = new ClientGCMsgProtobuf <CMsgSOCacheUnsubscribed>(callback.Message); Objects.Remove(pb.Body.owner_soid.id); Active = Active.Where(pair => pair.Value != pb.Body.owner_soid.id) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); } }
private void OnMessage(SteamGameCoordinator.MessageCallback callback) { CSODOTALobby was = Client.Lobby; Client.OnMessage(callback); CSODOTALobby now = Client.Lobby; if (callback.EMsg == (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome) { var pb = new ClientGCMsgProtobuf <CMsgClientWelcome>(callback.Message); HandleWelcome(pb); } else if (callback.EMsg == (uint)EDOTAGCMsg.k_EMsgGCJoinChatChannelResponse) { Machine.Trigger(Event.JOINED_CHAT); } else if ((uint)EDOTAGCMsg.k_EMsgGCWatchGameResponse == callback.EMsg) { var pb = new ClientGCMsgProtobuf <CMsgWatchGameResponse>(callback.Message); HandleWatchResponse(pb); } else if (was == null && now != null) // Probably due to Create { Machine.Trigger(Event.CREATED_LOBBY); } else if (was != null && now == null) // Probably due to CacheUnsubsribed. { Machine.Trigger(Event.LEFT_LOBBY); } else if (was != null && now != null) { if (was.members.Count < now.members.Count) { Machine.Trigger(Event.PLAYER_JOINED); } else if (was.members.Count > now.members.Count && now.members.Count == 1) { Machine.Trigger(Event.EMPTIED); } if (was.state != now.state) { if (now.state == CSODOTALobby.State.RUN) { Machine.Trigger(Event.SERVER_RUNNING); } } if (was.game_state != now.game_state) { if (now.game_state == DOTA_GameState.DOTA_GAMERULES_STATE_WAIT_FOR_PLAYERS_TO_LOAD) { Machine.Trigger(Event.SERVER_WAITING_FOR_PLAYERS); } } int valid = now.members.Count((member) => member.team == DOTA_GC_TEAM.DOTA_GC_TEAM_BAD_GUYS || member.team == DOTA_GC_TEAM.DOTA_GC_TEAM_GOOD_GUYS); if (valid >= 2) { Machine.Trigger(Event.LOBBY_READY); } else { Machine.Trigger(Event.LOBBY_NOT_READY); } } }
protected void OnGCMessage(SteamGameCoordinator.MessageCallback callback) { if (!LoggedIn) { return; } var msg = callback.Message; switch (callback.EMsg) { case (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome: { var response = new ClientGCMsgProtobuf <CMsgClientWelcome>(msg); Logger.Info(PREFIX + "Connected to CS:GO " + response.Body.location.country + " server."); steamGameCoordinator.Send(new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingClient2GCHello>((uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello), APPID_CSGO); } break; case (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: { var response = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchmakingGC2ClientHello>(msg); if (response.Body.penalty_reasonSpecified) { LoggedIn = false; switch (response.Body.penalty_reason) { case 10: Disabled = true; Logger.Error(PREFIX + "Account has been convicted by Overwatch as majorly disruptive."); return; case 11: Disabled = true; Logger.Error(PREFIX + "Account has been convicted by Overwatch as minorly disruptive."); return; case 14: Disabled = true; Logger.Error(PREFIX + "Account is permanently untrusted."); return; default: if (response.Body.penalty_secondsSpecified) { Logger.Warning(PREFIX + "Account has received a Matchmaking cooldown.Retrying in " + response.Body.penalty_seconds + " seconds."); steamClient.Disconnect(); AddDelayedAction(response.Body.penalty_seconds, () => Connect()); return; } Disabled = true; Logger.Error(PREFIX + "Account has been permanently banned from CS:GO."); return; } } else if (response.Body.vac_bannedSpecified && response.Body.vac_banned == 2 && !response.Body.penalty_secondsSpecified) { LoggedIn = false; Disabled = true; Logger.Error(PREFIX + "Account has been banned by VAC."); return; } GameInitalized = true; } break; case (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse: { var response = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_ClientReportResponse>(msg); ReportInfo report; lock (actionQueue) { report = actionQueue.Count == 0 ? null : actionQueue.Peek() as ReportInfo; if (report == null) { // IDK why we'll get a ClientReportResponse instead of ClientCommendPlayerQueryResponse // CSGO things bro ;D var commend = actionQueue.Count == 0 ? null : actionQueue.Peek() as CommendInfo; if (commend == null) { Logger.Warning(PREFIX + "Something wrong happened,maybe we just failed a report and recieved it's response."); break; } if (response.Body.account_idSpecified && commend.SteamID.AccountID != response.Body.account_id) { Logger.Warning(PREFIX + "Something wrong happened,maybe we just failed a commend and recieved it's response."); break; } actionQueue.Dequeue(); MedusaWebServer.addLog(new Dictionary <string, object>() { { "type", "commend" }, { "username", Username }, { "steamid", commend.SteamID.ConvertToUInt64().ToString() }, { "flags", commend.Flags }, { "time", Utils.Time() }, }); FailActionCounter = -1; ProcessingAction = false; Logger.Info(PREFIX + "Successfully commended " + commend.SteamID.ConvertToUInt64() + "."); break; } if (response.Body.account_idSpecified && report.SteamID.AccountID != response.Body.account_id) { Logger.Warning(PREFIX + "Something wrong happened,maybe we just failed a report and recieved it's response(1)."); break; } actionQueue.Dequeue(); } MedusaWebServer.addLog(new Dictionary <string, object>() { { "type", "report" }, { "username", Username }, { "steamid", report.SteamID.ConvertToUInt64().ToString() }, { "matchid", report.MatchID.ToString() }, { "reportid", response.Body.confirmation_id.ToString() }, { "time", Utils.Time() }, }); FailActionCounter = -1; ProcessingAction = false; Logger.Info(PREFIX + "Successfully reported " + report.SteamID.ConvertToUInt64() + ",Confirmation ID:" + response.Body.confirmation_id); } break; case (uint)ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchList: { GetLiveGameInfo getLiveGame; lock (actionQueue) { getLiveGame = actionQueue.Count == 0 ? null : actionQueue.Peek() as GetLiveGameInfo; if (getLiveGame == null) { Logger.Warning(PREFIX + "Something wrong happened,maybe we just failed a GetLiveGame and recieved it's response."); break; } actionQueue.Dequeue(); } var response = new ClientGCMsgProtobuf <CMsgGCCStrike15_v2_MatchList>(msg); var matches = new List <Dictionary <string, object> >(); response.Body.matches.ForEach((match) => { if (match.matchidSpecified) { var data = new Dictionary <string, object>() { { "id", match.matchid }, { "map", match.watchablematchinfo.game_map }, { "status", new Dictionary <string, object>() } }; int i = 0; match.roundstats_legacy.reservation.account_ids.ForEach((id) => { ((Dictionary <string, object>)data["status"])[(id + 76561197960265728ul).ToString()] = new Dictionary <string, int>() { { "kill", match.roundstats_legacy.kills[i] }, { "assist", match.roundstats_legacy.assists[i] }, { "death", match.roundstats_legacy.deaths[i] }, { "score", match.roundstats_legacy.scores[i] }, { "mvp", match.roundstats_legacy.mvps[i] } }; i++; }); matches.Add(data); } }); MedusaWebServer.addLog(new Dictionary <string, object>() { { "type", "matches" }, { "username", Username }, { "steamid", getLiveGame.SteamID.ConvertToUInt64().ToString() }, { "matches", matches }, { "time", Utils.Time() }, }); FailActionCounter = -1; ProcessingAction = false; Logger.Info(PREFIX + "Match info of " + getLiveGame.SteamID.ConvertToUInt64() + " recieved,there's " + matches.Count + " match(es)."); } break; } }