public void GetChampions_Test() { var champs = api.GetChampions(Region.euw, ChampionData.all); Assert.IsNotNull(champs.Champions); Assert.IsTrue(champs.Champions.Count > 0); }
public async Task Run(string[] args) { System.IO.StreamReader file = new System.IO.StreamReader("token.txt"); string riotToken = file.ReadLine(); string discordToken = file.ReadLine(); api = RiotApi.GetInstance(riotToken); staticApi = StaticRiotApi.GetInstance(riotToken); client = new DiscordClient(new DiscordConfig() { Token = discordToken, TokenType = TokenType.Bot, DiscordBranch = Branch.Canary, LogLevel = LogLevel.Debug, UseInternalLogHandler = true, AutoReconnect = true }); client.UseCommands(new CommandConfig() { Prefix = "$", SelfBot = false }); CreateCommands(client); await client.Connect(); champions = staticApi.GetChampions(Region.na, ChampionData.info).Champions.Values.ToList <ChampionStatic>(); spells = staticApi.GetSummonerSpells(Region.eune, SummonerSpellData.basic).SummonerSpells.Values.ToList <SummonerSpellStatic>(); Console.ReadLine(); }
internal RealmStaticData(StaticRiotApi riotStaticApi, Realm realm, Region region) { Realm = realm; Version = new RiotVersion(Realm.V); Region = region; Champions = riotStaticApi.GetChampions(region, ChampionData.all); Items = riotStaticApi.GetItems(region, ItemData.all); SummonerSpells = riotStaticApi.GetSummonerSpells(region, SummonerSpellData.all); }
public int GetChampionId(string name) { foreach (var champ in sApi.GetChampions(Region.euw).Champions) { if (champ.Value.Name.ToLower() == name.ToLower()) { return(champ.Value.Id); } } throw new ChampionNotFoundException(); }
public IActionResult Nuevo() { var clave = _claves.DameClave(); HttpContext.Session.SetString("Clave", clave); var modo = Enum.GetNames(typeof(Queue)).ToList(); // var modo = Gamemode(); var idioma = Enum.GetNames(typeof(Language)).ToList(); var server = Enum.GetNames(typeof(Region)).ToList(); var lista_idiomas = new List <string>(); foreach (var i in idioma) { var rep = i.Replace("_", "-"); try { var idiomanombre = new CultureInfo(rep).DisplayName; lista_idiomas.Add(idiomanombre); } catch (Exception) { } } var posicion = Enum.GetNames(typeof(TagStatic)).ToList(); // var Campeones = staticApi.GetChampions(Region.euw, ChampionData.image, Language.es_ES).Champions.ToList(); ViewBag.Campeones = new SelectList(_staticApi.GetChampions(Region.euw, ChampionData.image, Language.es_ES).Champions, "Value", "Key").ToList().OrderBy(o => o.Text); ViewBag.Modo = new SelectList(modo); ViewBag.IdiomaC = new SelectList(lista_idiomas); ViewBag.PosicionC = new SelectList(posicion); ViewBag.ServerC = new SelectList(server); ViewBag.Palabro = clave; return(View(new Entrada())); }
public void ScrapeStatic(object arg) { Mongo.Champions.Drop(); var champions = _staticApi.GetChampions(Region.euw).Champions; foreach (var champion in champions.Keys) { Mongo.Champions.Save(new Champion { Name = champions[champion].Name, ChampionId = champions[champion].Id }); } }
/// <summary> /// Fetches a Champion from the static RiotAPI. /// </summary> /// <param name="region">The region where the information should be fetched from.</param> /// <param name="championName">The name of the champion.</param> /// <returns></returns> private ChampionStatic GetChampion(Region region, string championName) { if ("tf".Equals(championName.ToLower())) { championName = "Twisted Fate"; } else if ("asol".Equals(championName.ToLower())) { championName = "Aurelion Sol"; } var champions = staticApi.GetChampions(region, ChampionData.all).Champions.Values; foreach (var champ in champions) { if (champ.Name.ToLower().Contains(championName.ToLower())) { return(champ); } } return(null); }
public static void UpdateAllData() { var champions = STATIC_API.GetChampions(NA); champions.Keys.SaveAs(CHAMPS_PATH + "ID-Name Dictionary.txt"); foreach (var champion in champions.Champions.Values) { champion.Image.AddPath("Champions"); champion.Passive.Image.AddPath(@"Champions\Abilities"); for (int i = 0; i < 4; ++i) { var spell = champion.Spells[i]; spell.Image.AddPath(@"Champions\Abilities"); var altCount = spell.Altimages.Count; for (int j = 0; j < altCount; ++j) { spell.Altimages[j].AddPath(@"Champions\Abilities"); } } champion.SaveAs(CHAMPS_PATH + champion.Name + ".txt"); } champions = null; UpdateItems(); var maps = STATIC_API.GetMaps(NA); for (int i = 0; i < maps.Count; ++i) { maps[i].Image.AddPath("Maps"); } maps.SaveAs(MAIN_PATH + "Maps.txt"); /*List<ReforgedRunePathStatic> runePaths = null; * for (int i = 0; i < runePaths.Count; ++i) * { * var runePath = runePaths[i]; * runePath.icon = @"Runes\" + Path.GetFileName(runePath.icon); * string pathDir = RUNES_PATH + runePath.key; * Directory.CreateDirectory(pathDir); * pathDir += @"\"; * string iconPath = @"Runes\" + runePath.key + @"\"; * * for (int j = 0; j < runePath.slots.Count; ++j) * { * var slot = runePath.slots[j]; * var slotDirName = "Slot " + (j + 1).ToString(); * string slotDir = pathDir + slotDirName; * Directory.CreateDirectory(slotDir); * slotDir += @"\"; * slotDirName += @"\"; * * foreach (var rune in slot.runes) * { * rune.icon = iconPath + slotDirName + Path.GetFileName(rune.icon); * rune.SaveAs(slotDir + rune.key + ".txt"); * } * } * * runePath.slots = null; * runePath.SaveAs(pathDir + "PathInfo.txt"); * }*/ }