internal static async Task <RecommendedDto> CreateRecommendedDto(string version, int?seed) { Dictionary <string, string> summonerSpellList = new Dictionary <string, string>() { { "SummonerBarrier", "Barrier" }, { "SummonerBoost", "Cleanse" }, { "SummonerClairvoyance", "Clairvoyance" }, { "SummonerDot", "Ignite" }, { "SummonerExhaust", "Exhaust" }, { "SummonerFlash", "Flash" }, { "SummonerHaste", "Ghost" }, { "SummonerHeal", "Heal" }, { "SummonerMana", "Clarity" }, { "SummonerSmite", "Smite" }, { "SummonerTeleport", "Teleport" } }; RecommendedDto recommendedDto = new RecommendedDto(); BraveChampion braveChampion = await BraveChampion.Create(version, seed); if (!braveChampion.Success) { recommendedDto.Success = false; } else { recommendedDto.title = string.Format("BRAVEREST: Max {0} 1st ({1} + {2}) - {3}/{4}/{5} Masteries", braveChampion.Skill.Letter, braveChampion.SummonerSpells[0].Name, braveChampion.SummonerSpells[1].Name, braveChampion.MasterySummary.Offense, braveChampion.MasterySummary.Defense, braveChampion.MasterySummary.Utility); recommendedDto.type = "custom"; recommendedDto.map = "SR"; recommendedDto.mode = "CLASSIC"; recommendedDto.priority = true; recommendedDto.sortrank = 0; recommendedDto.ChampionKey = braveChampion.Key; recommendedDto.Version = braveChampion.Version; recommendedDto.Seed = braveChampion.Seed; recommendedDto.blocks = new List <BlockDto>(); int itemIndex = 1; //Add special blocks for those who haven't selected the proper summoner spells foreach (KeyValuePair <string, string> summonerSpell in summonerSpellList) { if (braveChampion.SummonerSpells[0].Key != summonerSpell.Key && braveChampion.SummonerSpells[1].Key != summonerSpell.Key) { BlockDto newBlock = new BlockDto(); newBlock.type = "Cowards choose " + summonerSpell.Value + ". BOO I say... BOOOO!"; newBlock.recMath = true; newBlock.minSummonerLevel = -1; newBlock.maxSummonerLevel = -1; newBlock.showIfSummonerSpell = summonerSpell.Key; newBlock.hideIfSummonerSpell = ""; newBlock.items = new List <BlockItemDto>(); newBlock.items.Add(new BlockItemDto() { id = "1001", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1331", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1332", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1333", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1334", count = 1 }); recommendedDto.blocks.Add(newBlock); } } //Now add the real blocks foreach (SelectedItem item in braveChampion.Items) { BlockDto newBlock = new BlockDto(); switch (itemIndex) { case 1: newBlock.type = "I'm a little brave (Buy 1st)"; break; case 2: newBlock.type = "I'm braver than most (Buy 2nd)"; break; case 3: newBlock.type = "Have you seen the size of these?! (Buy 3rd)"; break; case 4: newBlock.type = "I'm not a troll, I'm your master! (Buy 4th)"; break; case 5: newBlock.type = "Even Teemo trembles in my presence... (Buy 5th)"; break; case 6: newBlock.type = "I'M THE BRAVEREST!!1 (Buy Last and bust a seam)"; break; default: break; } newBlock.recMath = true; newBlock.minSummonerLevel = -1; newBlock.maxSummonerLevel = -1; //Only show block if our supposed Brave Champion selected a summoner spell they were supposed to newBlock.showIfSummonerSpell = item.JungleItem ? "SummonerSmite" : braveChampion.SummonerSpells[0].Key; newBlock.hideIfSummonerSpell = ""; newBlock.items = new List <BlockItemDto>(); if (item.From != null) { foreach (int childItem in item.From) { newBlock.items.Add(new BlockItemDto() { id = childItem.ToString(), count = 1 }); } } newBlock.items.Add(new BlockItemDto() { id = item.Id.ToString(), count = 1 }); recommendedDto.blocks.Add(newBlock); itemIndex++; } recommendedDto.Success = true; } return(recommendedDto); }
internal static async Task<RecommendedDto> CreateRecommendedDto(string version, int? seed) { Dictionary<string, string> summonerSpellList = new Dictionary<string, string>() { {"SummonerBarrier", "Barrier"}, {"SummonerBoost", "Cleanse"}, {"SummonerClairvoyance", "Clairvoyance"}, {"SummonerDot", "Ignite"}, {"SummonerExhaust", "Exhaust"}, {"SummonerFlash", "Flash"}, {"SummonerHaste", "Ghost"}, {"SummonerHeal", "Heal"}, {"SummonerMana", "Clarity"}, {"SummonerSmite", "Smite"}, {"SummonerTeleport", "Teleport"} }; RecommendedDto recommendedDto = new RecommendedDto(); BraveChampion braveChampion = await BraveChampion.Create(version, seed); if (!braveChampion.Success) { recommendedDto.Success = false; } else { recommendedDto.title = string.Format("BRAVEREST: Max {0} 1st ({1} + {2}) - {3}/{4}/{5} Masteries", braveChampion.Skill.Letter, braveChampion.SummonerSpells[0].Name, braveChampion.SummonerSpells[1].Name, braveChampion.MasterySummary.Offense, braveChampion.MasterySummary.Defense, braveChampion.MasterySummary.Utility); recommendedDto.type = "custom"; recommendedDto.map = "SR"; recommendedDto.mode = "CLASSIC"; recommendedDto.priority = true; recommendedDto.sortrank = 0; recommendedDto.ChampionKey = braveChampion.Key; recommendedDto.Version = braveChampion.Version; recommendedDto.Seed = braveChampion.Seed; recommendedDto.blocks = new List<BlockDto>(); int itemIndex = 1; //Add special blocks for those who haven't selected the proper summoner spells foreach (KeyValuePair<string, string> summonerSpell in summonerSpellList) { if (braveChampion.SummonerSpells[0].Key != summonerSpell.Key && braveChampion.SummonerSpells[1].Key != summonerSpell.Key) { BlockDto newBlock = new BlockDto(); newBlock.type = "Cowards choose " + summonerSpell.Value + ". BOO I say... BOOOO!"; newBlock.recMath = true; newBlock.minSummonerLevel = -1; newBlock.maxSummonerLevel = -1; newBlock.showIfSummonerSpell = summonerSpell.Key; newBlock.hideIfSummonerSpell = ""; newBlock.items = new List<BlockItemDto>(); newBlock.items.Add(new BlockItemDto() { id = "1001", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1331", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1332", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1333", count = 1 }); newBlock.items.Add(new BlockItemDto() { id = "1334", count = 1 }); recommendedDto.blocks.Add(newBlock); } } //Now add the real blocks foreach (SelectedItem item in braveChampion.Items) { BlockDto newBlock = new BlockDto(); switch (itemIndex) { case 1: newBlock.type = "I'm a little brave (Buy 1st)"; break; case 2: newBlock.type = "I'm braver than most (Buy 2nd)"; break; case 3: newBlock.type = "Have you seen the size of these?! (Buy 3rd)"; break; case 4: newBlock.type = "I'm not a troll, I'm your master! (Buy 4th)"; break; case 5: newBlock.type = "Even Teemo trembles in my presence... (Buy 5th)"; break; case 6: newBlock.type = "I'M THE BRAVEREST!!1 (Buy Last and bust a seam)"; break; default: break; } newBlock.recMath = true; newBlock.minSummonerLevel = -1; newBlock.maxSummonerLevel = -1; //Only show block if our supposed Brave Champion selected a summoner spell they were supposed to newBlock.showIfSummonerSpell = item.JungleItem ? "SummonerSmite" : braveChampion.SummonerSpells[0].Key; newBlock.hideIfSummonerSpell = ""; newBlock.items = new List<BlockItemDto>(); if (item.From != null) { foreach (int childItem in item.From) { newBlock.items.Add(new BlockItemDto() { id = childItem.ToString(), count = 1 }); } } newBlock.items.Add(new BlockItemDto() { id = item.Id.ToString(), count = 1 }); recommendedDto.blocks.Add(newBlock); itemIndex++; } recommendedDto.Success = true; } return recommendedDto; }