private static async void AddBot(int id, bool blueSide, int difficulty) { int champint = (id == 0 ? GetRandomChampInt() : id); champions champions = champions.GetChampion(champint); var champDTO = new ChampionDTO { Active = true, Banned = false, BotEnabled = true, ChampionId = champint, DisplayName = champions.displayName }; List<ChampionSkinDTO> skinlist = (from Dictionary<string, object> skins in champions.Skins select new ChampionSkinDTO { ChampionId = champint, SkinId = Convert.ToInt32(skins["id"]), SkinIndex = Convert.ToInt32(skins["num"]), StillObtainable = true }).ToList(); champDTO.ChampionSkins = skinlist; var par = new BotParticipant { Champion = champDTO, pickMode = 0, IsGameOwner = false, PickTurn = 0, IsMe = false, Badges = 0, TeamName = null, Team = 0, SummonerName = champions.displayName + " bot" }; if (blueSide) { par.teamId = "100"; par.SummonerInternalName = "bot_" + champions.name + "_100"; } else { par.teamId = "200"; par.SummonerInternalName = "bot_" + champions.name + "_200"; } switch (difficulty) { case 0: par.botSkillLevelName = "Beginner"; par.BotSkillLevel = difficulty; break; case 1: par.botSkillLevelName = "Intermediate"; par.BotSkillLevel = difficulty; break; case 2: par.botSkillLevelName = "Doom"; par.BotSkillLevel = difficulty; break; case 3: par.botSkillLevelName = "Intro"; par.BotSkillLevel = difficulty; break; } await RiotCalls.SelectBotChampion(champint, par); }
private BotControl RenderBot(BotParticipant BotPlayer) { var botPlayer = new BotControl(); champions champ = champions.GetChampion(BotPlayer.SummonerInternalName.Split('_')[1]); var Source = new System.Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "champion", champ.name + ".png")); botPlayer.Width = 400; botPlayer.Margin = new Thickness(0, 0, 0, 5); botPlayer.PlayerName.Content = BotPlayer.SummonerName; botPlayer.ProfileImage.Source = new BitmapImage(Source); botPlayer.blueSide = BotPlayer.SummonerInternalName.Split('_')[2] == "100"; botPlayer.difficulty = BotPlayer.BotSkillLevel; botPlayer.cmbSelectDificulty.Visibility = Client.isOwnerOfGame ? Visibility.Visible : Visibility.Hidden; botPlayer.cmbSelectDificulty.Items.Add("Beginner"); botPlayer.cmbSelectDificulty.Items.Add("Intermediate"); botPlayer.cmbSelectDificulty.Items.Add("Doom"); botPlayer.cmbSelectDificulty.Items.Add("Intro"); botPlayer.cmbSelectDificulty.SelectedIndex = BotPlayer.BotSkillLevel; foreach (int bot in bots) botPlayer.cmbSelectChamp.Items.Add(champions.GetChampion(bot).name); botPlayer.cmbSelectChamp.Visibility = Client.isOwnerOfGame ? Visibility.Visible : Visibility.Hidden; botPlayer.cmbSelectChamp.SelectedItem = champ.name; botPlayer.BanButton.Visibility = Client.isOwnerOfGame ? Visibility.Visible : Visibility.Hidden; botPlayer.BanButton.Tag = BotPlayer; botPlayer.BanButton.Click += KickAndBan_Click; botPlayer.cmbSelectChamp.SelectionChanged += async (a, b) => { champions c = champions.GetChampion((string)botPlayer.cmbSelectChamp.SelectedValue); await RiotCalls.RemoveBotChampion(champ.id, BotPlayer); AddBot(c.id, botPlayer.blueSide, botPlayer.difficulty); }; botPlayer.cmbSelectDificulty.SelectionChanged += async (a, b) => { champions c = champions.GetChampion((string)botPlayer.cmbSelectChamp.SelectedValue); await RiotCalls.RemoveBotChampion(champ.id, BotPlayer); AddBot(c.id, botPlayer.blueSide, botPlayer.cmbSelectDificulty.SelectedIndex); }; return botPlayer; }