public static string FullGeneralPlayerInfo(CMsgGCPlayerInfo.PlayerInfo player, CMsgGCPlayerInfoRequest.PlayerInfo currentPlayer) { string returnString = ""; if (player.team_name != "") { returnString = player.team_name + "."; } if (player.name.Equals("") || player.name.Equals(" ")) { returnString = returnString + "No Name Found"; } else { returnString = returnString + player.name; } if (player.is_pro) { returnString = returnString + ", ProAccount: Yes"; } else { returnString = returnString + ", ProAccount: No"; } returnString = returnString + ", Account: steamcommunity.com/profiles/" + ConvertSteamId64(currentPlayer.account_id).ToString() + " DotaBuff: dotabuff.com/players/" + (currentPlayer.account_id).ToString() + "¯\\_(ツ)_/¯"; return(returnString); }
public static void NextAction(Response response, object obj) { List <Channel> currentRequests = channels; foreach (Channel channel in channels) { if ((DateTime.Now - channel.TimeAdded) > TimeSpan.FromSeconds(30)) { RemoveWhenFinished(channel); } } RemoveFinishedRoutes(); if (response == Response.SourceTv) { if (DateTime.Now - sourceTvGames.LastAddedTime > TimeSpan.FromSeconds(15)) { sourceTvGames.SourceTvGames = new List <CSourceTVGameSmall>(); } sourceTvGames.SourceTvGames.AddRange((List <CSourceTVGameSmall>)obj); sourceTvGames.LastAddedTime = DateTime.Now; } else if (channels.Count != 0) { try { foreach (Channel channel in channels) { switch (channel.EndRoute) { case Routes.NotablePlayers: switch (response) { case Response.PlayerInfo: var players = (ClientGCMsgProtobuf <CMsgGCPlayerInfo>)obj; if (channel.Pros.PlayerInfoRequest.Exists(p => p.account_id == channel.SteamId32)) { channel.ChannelResponse(DotaModule.SmallPlayerInfos( players, channel.Pros)); } RemoveWhenFinished(channel); break; default: SteamBotModule.CallPlayerInfo( SteamBot.gameCoordinator, DotaModule.SourceTvProPlayers( sourceTvGames.SourceTvGames, channel.SteamId32)); break; } break; case Routes.PlayerInfo: switch (response) { case Response.PlayerInfo: var players = (ClientGCMsgProtobuf <CMsgGCPlayerInfo>)obj; int playerPosition = DotaModule.FindPlayerPosition(channel.PlayerColor); if (players.Body.player_infos.Count == 1) { playerPosition = 0; } if (playerPosition == 10) { channel.ChannelResponse("twitchname or color not found"); } else { var player = DotaModule.PlayerInfo( players, channel.PlayerColor); if (player.account_id != channel.SteamId32) { player = new CMsgGCPlayerInfo.PlayerInfo(); } if (channel.Pros.PlayerInfoRequest.Count != 0) { channel.SteamId32 = channel.Pros.PlayerInfoRequest[playerPosition].account_id; channel.PlayerInfo = DotaModule.FullGeneralPlayerInfo(player, channel.Pros.PlayerInfoRequest[playerPosition]); SteamBotModule.CallProfileCard( SteamBot.gameCoordinator, channel.Pros.PlayerInfoRequest[playerPosition].account_id); } } break; case Response.ProfileCard: var Profile = (ClientGCMsgProtobuf <CMsgDOTAProfileCard>)obj; if (Profile.Body.account_id == channel.SteamId32) { channel.ChannelResponse( channel.PlayerInfo + " " + DotaModule.ProfileCardRank(Profile) + ApiModule.OpenDotaAPIAvgMMR(Profile.Body.account_id.ToString())); RemoveWhenFinished(channel); } break; default: break; } break; case Routes.PlayerRank: switch (response) { case Response.PlayerInfo: var players = (ClientGCMsgProtobuf <CMsgGCPlayerInfo>)obj; if (players.Body.player_infos.Exists(p => p.account_id == channel.SteamId32)) { var player = DotaModule.PlayerInfo( players, channel.PlayerColor); if (player == null) { channel.ChannelResponse("color not found"); } else { channel.SteamId32 = player.account_id; SteamBotModule.CallProfileCard( SteamBot.gameCoordinator, player.account_id); } } break; case Response.ProfileCard: var Profile = (ClientGCMsgProtobuf <CMsgDOTAProfileCard>)obj; if (Profile.Body.account_id == channel.SteamId32) { if (channel.PlayerColor != "") { channel.ChannelResponse( channel.PlayerInfo + " " + DotaModule.ProfileCardRank(Profile) + ApiModule.OpenDotaAPIAvgMMR(Profile.Body.account_id.ToString())); RemoveWhenFinished(channel); } else { channel.ChannelResponse( DotaModule.ProfileCardRank(Profile) + ApiModule.OpenDotaAPIAvgMMR(Profile.Body.account_id.ToString())); RemoveWhenFinished(channel); } } break; default: break; } break; } } RemoveFinishedRoutes(); System.Threading.Thread.Sleep(100); actionProgress.ActionCompleted = true; } catch { } } }