public static Champion Mapper(MySqlDataReader r) { var c = new Champion(); c.Id = r.GetInt32("Id"); c.Name = r.GetString("Name"); c.Title = r.GetString("Title"); c.Stat = new Stat(); c.Stat.Mana = r.GetDouble("Mana"); c.Stat.ManaPerLv = r.GetDouble("ManaPerLevel"); c.Stat.MagicResist = r.GetDouble("MagicResist"); c.Stat.MagicResistPerLv = r.GetDouble("MagicResistPerLevel"); return c; }
public static IList<Champion> getChampionData() { dynamic dynObject; var urlRequest = string.Format("https://global.api.pvp.net/api/lol/static-data/{0}/v1.2/champion?champData=all&api_key={1}", region, apikey); var request = RequestHelper.CreateRequest(urlRequest); using (WebResponse response = request.GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream())) { string data = reader.ReadToEnd(); dynObject = JsonConvert.DeserializeObject(data); } } var champions = new List<Champion>(); foreach (var obj in dynObject.data) { try { var champion = new Champion(); champion.Id = obj.Value.id; champion.Name = obj.Value.name; champion.Title = obj.Value.title; champion.Stat = new Stat(obj.Value.stats); champion.Spells = new List<ChampionSpell>(); foreach (var spell in obj.Value.spells) { champion.Spells.Add(new ChampionSpell(spell)); } champions.Add(champion); } catch { } } return champions; }
public static double GetTotalAP(Item i, int minute, Champion c) { switch (i.Name) { case "Rod of Ages": return i.ItemStats.AP + i.ItemStats.ApPerStack * (minute > 25 ? i.ItemStats.TotalStacks : i.ItemStats.TotalStacks/2); case "Mejai's Soulstealer": return i.ItemStats.AP + i.ItemStats.ApPerStack * (i.ItemStats.TotalStacks /2); case "Archangel's Staff": return i.ItemStats.AP + (0.03* (i.ItemStats.Mana + i.ItemStats.ManaPerStack * i.ItemStats.TotalManaStacks + c.Stat.Mana + c.Stat.ManaPerLv*9) ); case "Seraph's Embrace": return i.ItemStats.AP + (0.03 * (i.ItemStats.Mana + i.ItemStats.ManaPerStack * i.ItemStats.TotalManaStacks + c.Stat.Mana + c.Stat.ManaPerLv*9)); } return i.ItemStats.AP; }