public MyChampion(ChampionStatic champion) { ChampId = champion.Id; Name = champion.Name; ImageId = champion.Image.Full; Passive = champion.Passive.Description; //Spells = spells; BaseArmor = champion.Stats.Armor; Mp5PerLevel = champion.Stats.MpRegenPerLevel; BaseMp5 = champion.Stats.MpRegen; MpPerLevel = champion.Stats.MpPerLevel; BaseMp = champion.Stats.Mp; BaseMoveSpeed = champion.Stats.MoveSpeed; Hp5PerLevel = champion.Stats.HpRegenPerLevel; BaseHp5 = champion.Stats.HpRegen; HpPerLevel = champion.Stats.HpPerLevel; BaseHp = champion.Stats.Hp; CritPerLevel = champion.Stats.CritPerLevel; BaseCrit = champion.Stats.Crit; AttackSpeedPerLevel = champion.Stats.AttackSpeedPerLevel; AttackSpeedOffset = champion.Stats.AttackSpeedOffset; AttackRange = champion.Stats.AttackRange; ADPerLevel = champion.Stats.AttackDamagePerLevel; BaseAD = champion.Stats.AttackDamage; ArmorPerLevel = champion.Stats.ArmorPerLevel; BaseMR = champion.Stats.SpellBlock; MRPerLevel = champion.Stats.SpellBlockPerLevel; ResourceType = champion.Partype; }
public void SetChampionImage() { string championName = AppConstants.championsData.keys[game.championId.ToString()]; ChampionStatic champion = AppConstants.championsData.data[championName]; ChampionImage = AppConstants.SetImageSource(new Uri(AppConstants.ChampionIconUrl() + champion.image.full)); }
public async void RetrieveStaticChampionsTest() { ChampionListStatic champions = await creepScore.RetrieveChampionsData(CreepScore.Region.NA, StaticDataConstants.ChampData.All); ChampionStatic karma = null; int karmaKey = -1; foreach (KeyValuePair <string, string> champion in champions.keys) { if (champion.Value == "Karma") { karmaKey = int.Parse(champion.Key); } } foreach (KeyValuePair <string, ChampionStatic> champion in champions.data) { if (champion.Key == "Karma") { karma = champion.Value; break; } } Assert.NotNull(karma); Assert.NotEqual(-1, karmaKey); Assert.Equal("Mage", karma.tags[0]); Assert.Equal(525, karma.stats.attackRange); Assert.Equal(7, karma.info.defense); Assert.Equal(43, karma.id); }
/// <summary> /// Fetches tips to play a specific champion from Riot API. /// </summary> /// <param name="e">The command event which was executed.</param> /// <returns>A message in the channel with information regarding the ways to play the champion.</returns> public async Task GetChampionTips(CommandEventArgs e) { var input = Utils.ReturnInputParameterStringArray(e); string championname = input[0].ToLower(); try { ChampionStatic champ = GetChampion(Region.na, championname); string output = String.Format("Tips for playing **{0}**:", champ.Name); output += "```" + "\n"; foreach (string tip in champ.AllyTips) { output += tip + "\n"; } output += "```"; await e.Channel.SendMessage(output); } catch (RiotSharpException ex) { Console.WriteLine(String.Format("Get champion tips - {0}", ex.Message)); } catch (IndexOutOfRangeException) { await Utils.InproperCommandUsageMessage(e, "counter", "counter <CHAMPIONNAME>"); } catch (NullReferenceException) { await e.Channel.SendMessage("Champion not found."); } }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { List <string> keys = AppConstants.championsData.data.Keys.ToList(); int randomChamp = random.Next(0, keys.Count); featuredChamp = AppConstants.championsData.data[keys[randomChamp]]; featuredChampRealName = keys[randomChamp]; previousHeight = heroSection.Height; }
internal static ChampionListStatic RunStatCorrections(ChampionListStatic champions, string version) { //Load xml file with all Champion corrections XmlDocument xdcDocument = new XmlDocument(); string result = string.Empty; using (Stream stream = typeof(ChampionDataCorrections).Assembly.GetManifestResourceStream("LeagueBuildStats.Classes.Champions" + ".ChampionCorrectionList.xml")) { using (StreamReader sr = new StreamReader(stream)) { result = sr.ReadToEnd(); } } xdcDocument.LoadXml(result); XmlElement xelRoot = xdcDocument.DocumentElement; XmlNodeList xnlNodes = xelRoot.SelectNodes("/XML/CorrectionList[@Version]"); //Loop through each Champion Correction List Node foreach (XmlNode xndNode in xnlNodes) { string xmlVersion = xndNode.Attributes["Version"].Value; //If the Version Attribute is Greater or Equal than use this Correction List Node if (CheckIfVersionIsGreaterEqual(version, xmlVersion)) { //Loop through each Ability Correction Node foreach (XmlNode champNode in xndNode) { //Execute the updates if (champNode.Name != "#comment") { try { //<Ability champion="Thresh" button="e" buttonNum="2" key="f1" coeff=""(num of souls)"" link=""/> string champion = champNode.Attributes["champion"].Value; string label = champNode.Attributes["label"].Value; string button = champNode.Attributes["button"].Value; string buttonNum = champNode.Attributes["buttonNum"].Value; string key = champNode.Attributes["key"].Value; string coeff = champNode.Attributes["coeff"].Value; string link = champNode.Attributes["link"].Value; if (label == "stats") { ChampionStatic championStatic = (champions.Champions[champion]); championStatic.Stats.AttackSpeedOffset = Convert.ToDouble(coeff); //TODO: currently this only works with AttackSpeedOffset } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } } } return(champions); }
public ChampionsGridViewBinding(Uri image, int imageWidth, int imageHeight, string dataName, ChampionStatic champion) { this.champion = champion; this.Image = image; this.ImageWidth = imageWidth; this.ImageHeight = imageHeight; this.dataName = dataName; this.Name = champion.name; }
public void championControl_MouseClick(ChampionStatic thischampCtrl) { //Update Labels lblInfoName.Text = thischampCtrl.Name; lblInfoDesc.Text = thischampCtrl.Title; lblInfoPrimary.Text = thischampCtrl.Tags.Count > 0 ? thischampCtrl.Tags[0].ToString() : ""; lblInfoSecondary.Text = thischampCtrl.Tags.Count > 1 ? "Secondary: " + thischampCtrl.Tags[1].ToString() : ""; //Champion Image string file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getChampionsFromServer.version, thischampCtrl.Image.Sprite); string dir = string.Format(@"{0}\Data\Champions\Images", PublicStaticVariables.thisAppDataDir); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } Image tempImage = Image.FromFile(file); picboxInfoChamp.Image = CommonMethods.cropImage(tempImage, new Rectangle(thischampCtrl.Image.X, thischampCtrl.Image.Y, thischampCtrl.Image.Width, thischampCtrl.Image.Height)); //Passive Image file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getChampionsFromServer.version, thischampCtrl.Passive.Image.Sprite); tempImage = Image.FromFile(file); picBoxInfoPassive.Image = CommonMethods.cropImage(tempImage, new Rectangle(thischampCtrl.Passive.Image.X, thischampCtrl.Passive.Image.Y, thischampCtrl.Passive.Image.Width, thischampCtrl.Passive.Image.Height)); GenerateTooltip(thischampCtrl.Passive, tipInfoPassive); //Ability0 Image file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getChampionsFromServer.version, thischampCtrl.Spells[0].Image.Sprite); tempImage = Image.FromFile(file); picBoxInfoAbil0.Image = CommonMethods.cropImage(tempImage, new Rectangle(thischampCtrl.Spells[0].Image.X, thischampCtrl.Spells[0].Image.Y, thischampCtrl.Spells[0].Image.Width, thischampCtrl.Spells[0].Image.Height)); GenerateTooltip(thischampCtrl.Spells[0], tipInfoSpell0); //Ability1 Image file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getChampionsFromServer.version, thischampCtrl.Spells[1].Image.Sprite); tempImage = Image.FromFile(file); picBoxInfoAbil1.Image = CommonMethods.cropImage(tempImage, new Rectangle(thischampCtrl.Spells[1].Image.X, thischampCtrl.Spells[1].Image.Y, thischampCtrl.Spells[1].Image.Width, thischampCtrl.Spells[1].Image.Height)); GenerateTooltip(thischampCtrl.Spells[1], tipInfoSpell1); //Ability2 Image file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getChampionsFromServer.version, thischampCtrl.Spells[2].Image.Sprite); tempImage = Image.FromFile(file); picBoxInfoAbil2.Image = CommonMethods.cropImage(tempImage, new Rectangle(thischampCtrl.Spells[2].Image.X, thischampCtrl.Spells[2].Image.Y, thischampCtrl.Spells[2].Image.Width, thischampCtrl.Spells[2].Image.Height)); GenerateTooltip(thischampCtrl.Spells[2], tipInfoSpell2); //Ability3 Image file = string.Format(@"{0}\Data\Champions\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getChampionsFromServer.version, thischampCtrl.Spells[3].Image.Sprite); tempImage = Image.FromFile(file); picBoxInfoAbil3.Image = CommonMethods.cropImage(tempImage, new Rectangle(thischampCtrl.Spells[3].Image.X, thischampCtrl.Spells[3].Image.Y, thischampCtrl.Spells[3].Image.Width, thischampCtrl.Spells[3].Image.Height)); GenerateTooltip(thischampCtrl.Spells[3], tipInfoSpell3); //Update Stat Bars ResizeStatBars(thischampCtrl.Info.Attack, thischampCtrl.Info.Defense, thischampCtrl.Info.Magic, thischampCtrl.Info.Difficulty); }
public ChampionPage(ChampionStatic champion) { InitializeComponent(); ChampionViewModel.Champion = champion; HideScriptErrors(WebBrowser, true); BrowserBackCommand = new RelayCommand(x => WebBrowser.GoBack(), x => WebBrowser.CanGoBack); BrowserForwardCommand = new RelayCommand(x => WebBrowser.GoForward(), x => WebBrowser.CanGoForward); WebBrowser.Navigated += WebBrowser_Navigated; if (Variables.FirstRun) { ShowBuggyDialog(); } }
public async Task <IHttpActionResult> Get(int SummonerId) { List <MatchModel> listmodel = new List <MatchModel>(); MatchDetail detail = null; MatchModel model = null; ChampionStatic champ = null; try { MatchList match = await WebApiApplication.api.GetMatchListAsync(RiotSharp.Region.br, SummonerId, null, null, null, null, null, 0, 20); foreach (MatchReference item in match.Matches) { //Find Match Details based on Summoner Id detail = await WebApiApplication.api.GetMatchAsync(RiotSharp.Region.br, item.MatchID); if (detail == null || detail.Participants == null) { continue; } model = detail.ParticipantIdentities.Where(x => x.Player.SummonerId == SummonerId) .Join(detail.Participants, b => b.ParticipantId, a => a.ParticipantId, (b, a) => new MatchModel { IsWinner = a.Stats.Winner ? "VITÓRIA" : "DERROTA", KdaPlayer = $" {a.Stats.Kills}/{a.Stats.Deaths}/{a.Stats.Assists}" }).FirstOrDefault(); //Find Champion Details champ = await WebApiApplication.staticapi.GetChampionAsync(RiotSharp.Region.br, (int)item.ChampionID); model.Champion = new ChampionModel { ChampionId = champ.Id, ChampionName = champ.Name, ChampionIcon = ReturnUrlIcon(champ.Name) }; listmodel.Add(model); //Clean objects to new Insert at List detail = null; model = null; champ = null; } return(Ok(listmodel)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async void RetrieveStaticChampionsNoneTest() { ChampionListStatic champions = await creepScore.RetrieveChampionsData(CreepScore.Region.NA, StaticDataConstants.ChampData.None); ChampionStatic karma = null; foreach (KeyValuePair <string, ChampionStatic> champion in champions.data) { if (champion.Key == "Karma") { karma = champion.Value; break; } } Assert.Equal("the Enlightened One", karma.title); }
} // name of spell2 // constructor takes in champion object, 2 spell objects, and a string for the static api verson public SummonerGroup(ChampionStatic champion, SummonerSpellStatic spell1, SummonerSpellStatic spell2, string staticVersion) { // set the champion name by taking the champion object's name and making it lower case // and taking out any non letter characters (LINQ usage) this.champName = new string(champion.Name.ToLower().Where(c => Char.IsLetter(c)).ToArray()); // name of the champion image file name from champion object string champImgName = champion.Image.Full; // the teleoprt (tp) spell has a variable cooldown based on live champion level // that can't be accessed in real time, so I took an average based on average game time and average level at half game time float avgTpCd = 324; // spell name from spell1 object, made lower for comparability this.spell1Name = spell1.Name.ToLower(); // spell1 image name from spell1 object string spell1ImgName = spell1.Image.Full; // if spell is teleport, make it the approximate teleport cooldown, otherwise just use spell object cooldwon value float spell1Cd = spell1.Cooldowns[0]; if (spell1Cd == 0) { spell1Cd = avgTpCd; } this.spell1Cd = spell1Cd; // spell2 name and image names from spell2 object this.spell2Name = spell2.Name.ToLower(); string spell2ImgName = spell2.Image.Full; // if spell is teleport, make it the approximate teleport cooldown, otherwise just use spell object cooldwon value float spell2Cd = spell2.Cooldowns[0]; if (spell2Cd == 0) { spell2Cd = avgTpCd; } this.spell2Cd = spell2Cd; // get the ImageSource objects for the champion and spell icons using a // static api url link using our variables that gets converted into a bitmapimage this.champIcon = new BitmapImage(new Uri($@"http://ddragon.leagueoflegends.com/cdn/{staticVersion}/img/champion/{champImgName}")); this.spell1 = new BitmapImage(new Uri($@"http://ddragon.leagueoflegends.com/cdn/{staticVersion}/img/spell/{spell1ImgName}")); this.spell2 = new BitmapImage(new Uri($@"http://ddragon.leagueoflegends.com/cdn/{staticVersion}/img/spell/{spell2ImgName}")); }
public ScrollView LoadLore(ChampionStatic champion) { var loreView = new ScrollView(); if (!DependencyService.Get <ISaveAndLoad>().FileExists("haveyou")) { var adView = new AdMobView { WidthRequest = 320, HeightRequest = 50 }; loreView = new ScrollView { Content = new StackLayout { Children = { adView, new HtmlLabel { Text = champion.Lore } } } }; } else { loreView = new ScrollView { Content = new StackLayout { Children = { new HtmlLabel { Text = champion.Lore } } } }; } return(loreView); }
public ScrollView LoadTips(ChampionStatic champion) { var tipsView = new ScrollView(); var stack = new StackLayout(); if (!DependencyService.Get <ISaveAndLoad>().FileExists("haveyou")) { var adView = new AdMobView { WidthRequest = 320, HeightRequest = 50 }; stack.Children.Add(adView); } stack.Children.Add(new HtmlLabel { Text = "<u>Ally Tips</u>", FontSize = 20 }); for (int i = 0; i < champion.AllyTips.Count; i++) { stack.Children.Add(new HtmlLabel { Text = champion.AllyTips[i] + "\n\n" }); } stack.Children.Add(new HtmlLabel { Text = "<u>Enemy Tips</u>", FontSize = 20 }); for (int i = 0; i < champion.EnemyTips.Count; i++) { stack.Children.Add(new HtmlLabel { Text = champion.EnemyTips[i] + "\n\n" }); } tipsView.Content = stack; return(tipsView); }
public void UpdateStatsTab() { //todo: implement level and map selection int level = Convert.ToInt16((string)btnChampLevel.Tag); try { //Get stats from items StatsStatic statsStatic = new StatsStatic(); statsStatic = GetItemsStats(statsStatic); statsStatic = GetRunesStats(statsStatic); statsStatic = GetMasteryStats(statsStatic); ChampionStatic champ1 = new ChampionStatic(); ChampionStatsStatic sStatic = new ChampionStatsStatic(); if (form1.mainTopBar.champion1.Value != null) { champ1 = form1.mainTopBar.champion1.Value; } else { champ1.Stats = sStatic; } //Offence Variables////////////////////////////////////////////////// double dAttackDamage = champ1.Stats.AttackDamage + ((level - 1) * champ1.Stats.AttackDamagePerLevel) + statsStatic.FlatPhysicalDamageMod; double dAttackSpeedBase = 0.625 / (1 + champ1.Stats.AttackSpeedOffset); double dAttackPerLevelBonuses = (level - 1) * champ1.Stats.AttackSpeedPerLevel / 100; double dAttackBonuses = 1 + statsStatic.PercentAttackSpeedMod + dAttackPerLevelBonuses; double dAttackSpeed = dAttackSpeedBase * dAttackBonuses; if (dAttackSpeed >= 2.5) { dAttackSpeed = 2.5; } double dArmorPen1 = statsStatic.RFlatArmorPenetrationMod + (level - 1) * statsStatic.RFlatArmorPenetrationModPerLevel; double dArmorPen2 = statsStatic.RPercentArmorPenetrationMod + (level - 1) * statsStatic.RPercentArmorPenetrationModPerLevel; double dCritChance = champ1.Stats.Crit + (level - 1) * champ1.Stats.CritPerLevel + statsStatic.FlatCritChanceMod + (level - 1) * statsStatic.RFlatCritChanceModPerLevel; if (dCritChance >= 1) { dCritChance = 1; } double dCritDamage = 2 + statsStatic.FlatCritDamageMod + (level - 1) * statsStatic.RFlatCritDamageModPerLevel; double dDamageIfCrit = dAttackDamage * (dCritDamage); double dAbilityPower = (statsStatic.FlatMagicDamageMod + (level - 1) * statsStatic.RFlatMagicDamageModPerLevel); double dMagicPen1 = statsStatic.RFlatMagicPenetrationMod + (level - 1) * statsStatic.RFlatMagicPenetrationModPerLevel; double dMagicPen2 = statsStatic.RPercentMagicPenetrationMod + (level - 1) * statsStatic.RPercentMagicPenetrationModPerLevel; double dDamageBonus1 = statsStatic.FlatMagicDamageOnHit + statsStatic.FlatMagicDamageFromPercentAbility * dAbilityPower; double dDamageBonus2 = statsStatic.PercentIncreasedDamageMod; if (champ1.Stats.AttackRange < 300) { dDamageBonus2 += statsStatic.PercentIncreasedDamageModMelee; } else { dDamageBonus2 += statsStatic.PercentIncreasedDamageModRanged; } double dAverageAttackDamageWithCrit = (dAttackDamage * ((100 - dCritChance * 100) / 100)) + ((dDamageIfCrit) * (dCritChance)); double dDPS = (dAverageAttackDamageWithCrit + dDamageBonus1) * dAttackSpeed; Color HighlightColor = Color.Aqua; //Defence Variables////////////////////////////////////////////////// double dHealth = champ1.Stats.Hp + (level - 1) * champ1.Stats.HpPerLevel + statsStatic.FlatHPPoolMod + (level - 1) * statsStatic.RFlatHPModPerLevel; double dHealthRegenBase = (champ1.Stats.HpRegen + (level - 1) * champ1.Stats.HpRegenPerLevel); double dHealthRegen1 = dHealthRegenBase + dHealthRegenBase * (statsStatic.PercentHPRegenMod) + (statsStatic.FlatHPRegenMod) + (level - 1) * (statsStatic.RFlatHPRegenModPerLevel); double dHealthRegen2 = dHealthRegen1 == 0.0 ? 0 : (dHealthRegen1 / dHealthRegenBase); double dArmor = champ1.Stats.Armor + (level - 1) * champ1.Stats.ArmorPerLevel + statsStatic.FlatArmorMod + (level - 1) * statsStatic.RFlatArmorModPerLevel; double dMagicResist = statsStatic.FlatSpellBlockMod + (level - 1) * statsStatic.RFlatSpellBlockModPerLevel; double dTenacity = statsStatic.PercentTenacityMod; //(1 - (1 - 0.35)*(1 - 0.25)*(1 - 0.15)) * 100; //todo there is no tenacity stat double dDamabeReduction = 0.0 + statsStatic.FlatBlockMod; //todo there is no damamge reduction stat double dSlowResist = statsStatic.PercentSlowReistance; double dEffPhysicalHealth = dHealth * (100 + dArmor) / (100 * (1 - (dDamabeReduction / 100))); double dEffMagicalHealth = dHealth * (100 + dMagicResist) / (100 * (1 - (dDamabeReduction / 100))); double dEffHealth = (dEffPhysicalHealth + dEffMagicalHealth) / 2; //Utility Variables////////////////////////////////////////////////// double dCooldownReduction = statsStatic.RPercentCooldownMod + (level - 1) * statsStatic.RPercentCooldownModPerLevel; if (dCooldownReduction >= 0.40) { dCooldownReduction = 0.40; } double dMovementBase = champ1.Stats.MoveSpeed; double dMovementSpeed = (dMovementBase + statsStatic.FlatMovementSpeedMod + (level - 1) * statsStatic.RFlatMovementSpeedModPerLevel) * (1 + statsStatic.PercentMovementSpeedMod); //(Base Movement Speed + Flat Movement Bonuses) × (1 + Additional Percentage Movement Bonuses) × (1 + First Multiplicative Percentage Movement Bonus) × .... //× (1 + Last Multiplicative Percentage Movement Bonus) × (1 - Slow Ratio × Slow Resist Ratio) double dLifeSteal = statsStatic.PercentLifeStealMod; double dSpellVamp = statsStatic.PercentSpellVampMod; double dAttackRange = champ1.Stats.AttackRange; double dGoldPer10 = 16.0 + statsStatic.RFlatGoldPer10Mod; double dExperienceGain = (1 + statsStatic.PercentEXPBonus); double dRevivalSpeed = (1 + statsStatic.RPercentTimeDeadMod); double dManaenergy = champ1.Stats.Mp + (level - 1) * champ1.Stats.MpPerLevel + statsStatic.FlatMPPoolMod; double dBaseManaRegen = (champ1.Stats.MpRegen + (level - 1) * champ1.Stats.MpRegenPerLevel); double dManaEnergyRegen1 = 0.0; double dManaEnergyRegen2 = 0; if (champ1.Partype == ParTypeStatic.Mana) { lblTextManaEnergy.Text = "Mana:"; lblTextManaEnergyRegen.Text = "Mana Regen per 5:"; dManaenergy += statsStatic.FlatEnergyPoolMod; dManaEnergyRegen1 = dBaseManaRegen + dBaseManaRegen * (statsStatic.PercentMPRegenMod) + (statsStatic.FlatMPRegenMod) + (level - 1) * (statsStatic.RFlatMPRegenModPerLevel); dManaEnergyRegen2 = dManaEnergyRegen1 == 0.0 ? 0 : ((dManaEnergyRegen1 / dBaseManaRegen)); } else if (champ1.Partype == ParTypeStatic.Energy) { lblTextManaEnergy.Text = "Energy:"; lblTextManaEnergyRegen.Text = "Energy Regen per 5:"; dManaenergy += statsStatic.FlatEnergyPoolMod; dManaEnergyRegen1 = dBaseManaRegen + (statsStatic.FlatEnergyRegenMod) + (level - 1) * (statsStatic.RFlatEnergyRegenModPerLevel); dManaEnergyRegen2 = dManaEnergyRegen1 == 0.0 ? 0 : ((dManaEnergyRegen1 / dBaseManaRegen)); } else { lblTextManaEnergy.Text = "Mana:"; lblTextManaEnergyRegen.Text = "Mana Regen per 5:"; dManaenergy = 0.0; dManaEnergyRegen1 = 0.0; dManaEnergyRegen2 = 0.0; } dAttackDamage += statsStatic.PercentManaAsBonusAttack * dManaenergy; dAbilityPower += statsStatic.PercentManaAsBonusAbility * dManaenergy; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Offence Text Boxes// lblCtrlAttackDamage.Text = Math.Round(dAttackDamage, MidpointRounding.AwayFromZero).ToString(); //if (dAttackDamage != champ1.Stats.AttackDamage + ((level - 1) * champ1.Stats.AttackDamagePerLevel)) { lblCtrlAttackDamage.ForeColor = HighlightColor; } else { lblCtrlAttackDamage.ForeColor = Color.White; } lblCtrlAttackSpeed.Text = Math.Round(dAttackSpeed, 3, MidpointRounding.AwayFromZero).ToString(); lblCtrlArmorPen1.Text = Math.Round(dArmorPen1, MidpointRounding.AwayFromZero).ToString(); lblCtrlArmorPen2.Text = Math.Round(dArmorPen2 * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlCritChance.Text = Math.Round(dCritChance * 100, 1, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlCritDmg.Text = Math.Round(dCritDamage * 100, 1, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlDamageIfCrit.Text = Math.Round(dDamageIfCrit, MidpointRounding.AwayFromZero).ToString(); lblCtrlAbilityPower.Text = Math.Round(dAbilityPower, MidpointRounding.AwayFromZero).ToString(); lblCtrlMagicPen1.Text = Math.Round(dMagicPen1, MidpointRounding.AwayFromZero).ToString(); lblCtrlMagicPen2.Text = Math.Round(dMagicPen2 * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlDmgBonus1.Text = Math.Round(dDamageBonus1, MidpointRounding.AwayFromZero).ToString(); lblCtrlDmgBonus2.Text = Math.Round(dDamageBonus2 * 100, 1, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlAveAttackDPS.Text = Math.Round(dDPS, MidpointRounding.AwayFromZero).ToString(); //Defence Text Boxes// lblCtrlHealth.Text = Math.Round(dHealth, MidpointRounding.AwayFromZero).ToString(); lblCtrlHealthRegen1.Text = Math.Round(dHealthRegen1, 1, MidpointRounding.AwayFromZero).ToString() + ""; lblCtrlHealthRegen2.Text = Math.Round(dHealthRegen2 * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlArmor.Text = Math.Round(dArmor, MidpointRounding.AwayFromZero).ToString(); lblCtrlMagicResist.Text = Math.Round(dMagicResist, MidpointRounding.AwayFromZero).ToString(); lblCtrlTenacity.Text = Math.Round(dTenacity * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlDmgReduction.Text = Math.Round(dDamabeReduction, 1, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlSlowResist.Text = Math.Round(dSlowResist * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlEffPhysHealth.Text = Math.Round(dEffPhysicalHealth, MidpointRounding.AwayFromZero).ToString(); lblCtrlEffMagHealth.Text = Math.Round(dEffMagicalHealth, MidpointRounding.AwayFromZero).ToString(); lblCtrlEffHealth.Text = Math.Round(dEffHealth, MidpointRounding.AwayFromZero).ToString(); //Utility Text Boxes// lblCtrlCooldownReduction.Text = Math.Round(dCooldownReduction * 100, 1, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlMovement.Text = Math.Round(dMovementSpeed, MidpointRounding.AwayFromZero).ToString(); lblCtrlLifeSteal.Text = Math.Round(dLifeSteal * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlSpellVamp.Text = Math.Round(dSpellVamp * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlAutoAttackRange.Text = Math.Round(dAttackRange, MidpointRounding.AwayFromZero).ToString(); lblCtrlGoldPer10.Text = Math.Round(dGoldPer10, 2, MidpointRounding.AwayFromZero).ToString(); lblCtrlExperienceGain.Text = Math.Round(dExperienceGain * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlRevivalSpeed.Text = Math.Round(dRevivalSpeed * 100, MidpointRounding.AwayFromZero).ToString() + "%"; lblCtrlManaEnergy.Text = Math.Round(dManaenergy, MidpointRounding.AwayFromZero).ToString(); lblCtrlManaEnergyRegen1.Text = Math.Round(dManaEnergyRegen1, 1, MidpointRounding.AwayFromZero).ToString(); lblCtrlManaEnergyRegen2.Text = Math.Round(dManaEnergyRegen2 * 100, MidpointRounding.AwayFromZero).ToString() + "%"; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public ListView LoadAbilities(ChampionStatic champion) { var abilityListView = new ListView { HasUnevenRows = true }; if (!DependencyService.Get <ISaveAndLoad>().FileExists("haveyou")) { var adView = new AdMobView { WidthRequest = 320, HeightRequest = 50 }; abilityListView.Header = adView; } var abilityTemplate = new DataTemplate(typeof(AbilityCell)); var abilityList = new List <abilityView>(); if (champion.Id != 420) { var stringId = champion.Id.ToString(); if (champion.Id == 2 || champion.Id == 3 || champion.Id == 4 || champion.Id == 8) { abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/passive/{1}", App.appVersion, champion.Passive.Image.Full), Video = string.Format("https://lolstatic-a.akamaihd.net/champion-abilities/videos/mp4/000{0}_01.mp4", champion.Id) }); abilityList.Add(new abilityView { Name = champion.Spells[0].Name, Description = champion.Spells[0].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[0].Image.Full), Video = string.Format("https://lolstatic-a.akamaihd.net/champion-abilities/videos/mp4/000{0}_0{1}.mp4", champion.Id, 1) }); abilityList.Add(new abilityView { Name = champion.Spells[1].Name, Description = champion.Spells[1].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[1].Image.Full), Video = string.Format("https://lolstatic-a.akamaihd.net/champion-abilities/videos/mp4/000{0}_0{1}.mp4", champion.Id, 2) }); abilityList.Add(new abilityView { Name = champion.Spells[2].Name, Description = champion.Spells[2].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[2].Image.Full), Video = string.Format("https://lolstatic-a.akamaihd.net/champion-abilities/videos/mp4/000{0}_0{1}.mp4", champion.Id, 3) }); abilityList.Add(new abilityView { Name = champion.Spells[3].Name, Description = champion.Spells[3].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[3].Image.Full), Video = string.Format("https://lolstatic-a.akamaihd.net/champion-abilities/videos/mp4/000{0}_0{1}.mp4", champion.Id, 4) }); } else if (champion.Id == 240 || champion.Id == 164) { abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/passive/{1}", App.appVersion, champion.Passive.Image.Full), Video = "No Video" }); abilityList.Add(new abilityView { Name = champion.Spells[0].Name, Description = champion.Spells[0].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[0].Image.Full), Video = "No Video" }); abilityList.Add(new abilityView { Name = champion.Spells[1].Name, Description = champion.Spells[1].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[1].Image.Full), Video = "No Video" }); abilityList.Add(new abilityView { Name = champion.Spells[2].Name, Description = champion.Spells[2].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[2].Image.Full), Video = "No Video" }); abilityList.Add(new abilityView { Name = champion.Spells[3].Name, Description = champion.Spells[3].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[3].Image.Full), Video = "No Video" }); } else if (champion.Id == 12 || champion.Id == 36 || champion.Id == 9 || champion.Id == 120 || champion.Id == 126 || champion.Id == 85 || champion.Id == 82 || champion.Id == 25 || champion.Id == 78 || champion.Id == 33 || champion.Id == 102 || champion.Id == 27 || champion.Id == 134 || champion.Id == 91 || champion.Id == 77 || champion.Id == 45 || champion.Id == 106 || champion.Id == 62) { abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = champion.Passive.Image.Full, Video = "No Video" }); for (int i = 0; i < champion.Spells.Count; i++) { switch (stringId.Length) { case 1: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/000{0}_0{1}.mp4", champion.Id, i + 2) }); break; case 2: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/00{0}_0{1}.mp4", champion.Id, i + 2) }); break; case 3: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/0{0}_0{1}.mp4", champion.Id, i + 2) }); break; case 4: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/{0}_0{1}.mp4", champion.Id, i + 2) }); break; } } } else { switch (stringId.Length) { case 1: abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/passive/{1}", App.appVersion, champion.Passive.Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/000{0}_01.mp4", champion.Id) }); break; case 2: abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/passive/{1}", App.appVersion, champion.Passive.Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/00{0}_01.mp4", champion.Id) }); break; case 3: abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/passive/{1}", App.appVersion, champion.Passive.Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/0{0}_01.mp4", champion.Id) }); break; case 4: abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/passive/{1}", App.appVersion, champion.Passive.Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/{0}_01.mp4", champion.Id) }); break; } for (int i = 0; i < champion.Spells.Count; i++) { switch (stringId.Length) { case 1: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/000{0}_0{1}.mp4", champion.Id, i + 2) }); break; case 2: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/00{0}_0{1}.mp4", champion.Id, i + 2) }); break; case 3: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/0{0}_0{1}.mp4", champion.Id, i + 2) }); break; case 4: abilityList.Add(new abilityView { Name = champion.Spells[i].Name, Description = champion.Spells[i].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[i].Image.Full), Video = string.Format("http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/{0}_0{1}.mp4", champion.Id, i + 2) }); break; } } } } else { abilityList.Add(new abilityView { Name = champion.Passive.Name, Description = champion.Passive.Description, Image = champion.Passive.Image.Full, Video = "http://news.cdn.leagueoflegends.com/public/images/pages/illaoi-reveal/videos/Illaoi_P.mp4" }); abilityList.Add(new abilityView { Name = champion.Spells[0].Name, Description = champion.Spells[0].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[0].Image.Full), Video = "http://news.cdn.leagueoflegends.com/public/images/pages/illaoi-reveal/videos/Illaoi_Q.mp4" }); abilityList.Add(new abilityView { Name = champion.Spells[1].Name, Description = champion.Spells[1].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[1].Image.Full), Video = "http://news.cdn.leagueoflegends.com/public/images/pages/illaoi-reveal/videos/Illaoi_W.mp4" }); abilityList.Add(new abilityView { Name = champion.Spells[2].Name, Description = champion.Spells[2].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[2].Image.Full), Video = "http://news.cdn.leagueoflegends.com/public/images/pages/illaoi-reveal/videos/Illaoi_E.mp4" }); abilityList.Add(new abilityView { Name = champion.Spells[3].Name, Description = champion.Spells[3].Description, Image = string.Format("http://ddragon.leagueoflegends.com/cdn/{0}/img/spell/{1}", App.appVersion, champion.Spells[3].Image.Full), Video = "http://news.cdn.leagueoflegends.com/public/images/pages/illaoi-reveal/videos/Illaoi_R.mp4" }); } abilityListView.ItemTemplate = abilityTemplate; abilityListView.ItemsSource = abilityList; abilityListView.ItemTapped += (sender, e) => { abilityListView.IsEnabled = false; var myListView = (ListView)sender; var myItem = (abilityView)myListView.SelectedItem; if (myItem.Video == "No Video") { UserDialogs.Instance.AlertAsync("Sadly, the ability " + myItem.Name + " doesn't have a video associated with it.", "Unable To Load", "Okay"); abilityListView.IsEnabled = true; return; } var webview = new WebView { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Source = new UrlWebViewSource { Url = myItem.Video } }; var contentPage = new ContentPage { Content = webview, Title = myItem.Name }; abilityListView.IsEnabled = true; Navigation.PushAsync(contentPage); }; return(abilityListView); }
public ChampionStaticWrapper(ChampionStatic champion, Language language, ChampionData championData) { ChampionStatic = champion; Language = language; ChampionData = championData; }
/// <summary> /// Fetches a specific champion's info from Riot API. /// </summary> /// <param name="e">The command event which was executed.</param> /// <returns>A message in the channel with information regarding the requested champion.</returns> public async Task GetChampionStats(CommandEventArgs e) { var input = Utils.ReturnInputParameterStringArray(e); string championname = input[0].ToLower(); try { ChampionStatic champ = GetChampion(Region.na, championname); string output = String.Format("Riot's ratings for **{0}**, *{1}*", champ.Name, champ.Title) + "\n \n"; //Riot Ratings output += "*Tags:* "; foreach (var tag in champ.Tags) { output += tag + " "; } output += "\n \n"; output += "*Attack*".PadRight(15); for (int i = 0; i < champ.Info.Attack; i++) { output += ":crossed_swords: "; } output += "\n"; output += "*Defence*".PadRight(15); for (int i = 0; i < champ.Info.Defense; i++) { output += ":shield: "; } output += "\n"; output += "*Magic*".PadRight(15); for (int i = 0; i < champ.Info.Defense; i++) { output += ":sparkles: "; } output += "\n"; output += "*Difficulty*".PadRight(15); for (int i = 0; i < champ.Info.Difficulty; i++) { output += ":star: "; } output += "\n"; //Stats output += "\n **Base Stats**"; output += "```" + "\n"; //Health output += String.Format("Health: {0} (+{1} Health/5s)", champ.Stats.Hp.ToString(System.Globalization.CultureInfo.InvariantCulture), champ.Stats.HpRegen.ToString(System.Globalization.CultureInfo.InvariantCulture)).PadRight(40) + String.Format(" - Growth/Level: {0} (+{1} Health/5s)", champ.Stats.HpPerLevel.ToString(System.Globalization.CultureInfo.InvariantCulture), champ.Stats.HpRegenPerLevel.ToString(System.Globalization.CultureInfo.InvariantCulture)) + "\n"; //Resource output += String.Format("{0}: {1} (+{2} {0}/5s)", champ.Partype, champ.Stats.Mp.ToString(System.Globalization.CultureInfo.InvariantCulture), champ.Stats.MpRegen.ToString(System.Globalization.CultureInfo.InvariantCulture)).PadRight(40) + String.Format(" - Growth/Level: {0} (+{1} {2}/5s)", champ.Stats.MpPerLevel.ToString(System.Globalization.CultureInfo.InvariantCulture), champ.Stats.MpRegenPerLevel.ToString(System.Globalization.CultureInfo.InvariantCulture), champ.Partype) + "\n"; output += "\n"; //Defences output += String.Format("Armor: {0}", champ.Stats.Armor).PadRight(40) + String.Format(" - Growth/Level: {0}", champ.Stats.ArmorPerLevel.ToString(System.Globalization.CultureInfo.InvariantCulture)) + "\n"; output += String.Format("Magic Resist: {0}", champ.Stats.SpellBlock).PadRight(40) + String.Format(" - Growth/Level: {0}", champ.Stats.SpellBlockPerLevel.ToString(System.Globalization.CultureInfo.InvariantCulture)) + "\n"; output += "\n"; //Attack output += String.Format("Attack Damage: {0}", champ.Stats.AttackDamage).PadRight(40) + String.Format(" - Growth/Level: {0}", champ.Stats.AttackDamagePerLevel) + "\n"; output += String.Format("Attack Speed: {0}", champ.Stats.AttackSpeedOffset).PadRight(40) + String.Format(" - Growth/Level: {0}", champ.Stats.AttackSpeedPerLevel) + "\n"; output += "\n"; output += String.Format("Attack Range: {0}", champ.Stats.AttackRange) + "\n"; output += String.Format("Movement Speed: {0}", champ.Stats.MoveSpeed) + "\n"; output += "```"; output += String.Format("**Passive**: *{0}* - {1}", champ.Passive.Name, champ.Passive.SanitizedDescription); await e.Channel.SendMessage(output); } catch (RiotSharpException ex) { Console.WriteLine(String.Format("Get champion stats - {0}", ex.Message)); } catch (IndexOutOfRangeException) { await Utils.InproperCommandUsageMessage(e, "champion", "champion <REGION> <CHAMPIONNAME>"); } catch (NullReferenceException) { await e.Channel.SendMessage("Champion not found."); } }
public ChampionListElement(ChampionStatic champion) { Champion = champion; ChampionName = champion.Name; }
public ChampionViewModel(ChampionStatic champion) { Champion = champion; }
public async void RetrieveStaticChampionTest() { ChampionStatic karma = await creepScore.RetrieveChampionData(CreepScore.Region.NA, 43, StaticDataConstants.ChampData.None); Assert.Equal("the Enlightened One", karma.title); }
public ChampionStatic GetChampion(string name) { ChampionStatic Champion = _api.StaticData.Champions.GetByKeyAsync(name, "10.20.1").Result; return(Champion); }
public ChampionStaticWrapper(ChampionStatic champion, Language language, string version) { ChampionStatic = champion; Language = language; Version = version; }
public ChampionPage(ChampionStatic champion) { NavigationPage.SetHasNavigationBar(this, true); memeTest = new FilterControl { Items = new List <string> { "Lore", "Tips", "Abilities" } }; memeTest.SelectedIndex = 0; Title = champion.Name; skins = new ObservableCollection <Skins>(); for (int i = 0; i < champion.Skins.Count; i++) { skins.Add(new Skins { ImageUrl = string.Format(skinString, champion.Key, champion.Skins[i].Num), Name = champion.Skins[i].Name }); if (skins[i].Name == "default") { skins[i].Name = "Default"; } } var images = new List <Image>(); for (int i = 0; i < skins.Count; i++) { images.Add(new Image { Source = skins[i].ImageUrl }); } SliderView slider = new SliderView(images[0], 200, 400) { BackgroundColor = Color.Gray, TransitionLength = 200, StyleId = "SliderView", MinimumSwipeDistance = 50 }; for (int i = 1; i < images.Count; i++) { slider.Children.Add(images[i]); } var filterViewChange = new ContentView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; filterViewChange.Content = LoadLore(champion); memeTest.SelectedIndexChanged += (sender, e) => { switch (memeTest.SelectedIndex) { case 0: filterViewChange.Content = LoadLore(champion); break; case 1: filterViewChange.Content = LoadTips(champion); break; case 2: filterViewChange.Content = LoadAbilities(champion); break; } }; var stackLayout = new StackLayout(); filterViewChange.HeightRequest = 440; stackLayout.Children.Add(slider); stackLayout.Children.Add(memeTest); stackLayout.Children.Add(filterViewChange); Content = stackLayout; }
/// <summary> /// Gets information from ranked games on a certain champion for a summoner. /// </summary> /// <param name="e">The command event which was executed.</param> /// <returns>A message in the channel with stats regarding the requested summoner in the region on the specified champion.</returns> public async Task GetRankedChampStats(CommandEventArgs e) { Summoner summoner = null; try { var input = Utils.ReturnInputParameterStringArray(e); string regionString = input[0]; string championName = input[1]; string summonerName = ""; if (input.Length == 3) { summonerName = input[2]; } else { summonerName = input[2]; for (int i = 3; i < input.Length; i++) { summonerName = String.Format("{0} {1}", summonerName, input[i]); } } Region region = GetRegion(regionString); ChampionStatic champ = GetChampion(region, championName); if (champ == null) { throw new ChampionNotFoundException("Champion not found."); } summoner = GetSummoner(regionString, summonerName); string output = String.Format("Ranked statistics for **{0}** on **{1}** \n ```", summoner.Name, champ.Name); List <RiotSharp.StatsEndpoint.ChampionStats> champStats = await api.GetStatsRankedAsync(region, summoner.Id); foreach (RiotSharp.StatsEndpoint.ChampionStats stat in champStats) { if (stat.ChampionId == champ.Id) { decimal avgKills = (decimal)stat.Stats.TotalChampionKills / stat.Stats.TotalSessionsPlayed; decimal avgDeaths = (decimal)stat.Stats.TotalDeathsPerSession / stat.Stats.TotalSessionsPlayed; decimal avgAssists = (decimal)stat.Stats.TotalAssists / stat.Stats.TotalSessionsPlayed; decimal avgWinrate = (decimal)stat.Stats.TotalSessionsWon / stat.Stats.TotalSessionsPlayed * 100; int avgDmgDealt = stat.Stats.TotalDamageDealt / stat.Stats.TotalSessionsPlayed; int avgDmgTaken = stat.Stats.TotalDamageTaken / stat.Stats.TotalSessionsPlayed; int avgPhysDmg = stat.Stats.TotalPhysicalDamageDealt / stat.Stats.TotalSessionsPlayed; int avgMagicDmg = stat.Stats.TotalMagicDamageDealt / stat.Stats.TotalSessionsPlayed; int avgMinionKills = stat.Stats.TotalMinionKills / stat.Stats.TotalSessionsPlayed; int avgGoldGained = stat.Stats.TotalGoldEarned / stat.Stats.TotalSessionsPlayed; output += "Kills - Deaths - Assists" + "\n" + String.Format("{0} - {1} - {2} \n", decimal.Round(avgKills, 2).ToString(System.Globalization.CultureInfo.InvariantCulture).PadRight(5), decimal.Round(avgDeaths, 2).ToString(System.Globalization.CultureInfo.InvariantCulture).PadRight(5), decimal.Round(avgAssists, 2).ToString(System.Globalization.CultureInfo.InvariantCulture)) + String.Format("Creep Score: {0} - Gold: {1} \n", avgMinionKills, avgGoldGained) + "\n" + "Multikills" + "\n" + String.Format("{0} Double Kills. \n", stat.Stats.TotalDoubleKills) + String.Format("{0} Triple Kills. \n", stat.Stats.TotalTripleKills) + String.Format("{0} Quadra Kills. \n", stat.Stats.TotalQuadraKills) + String.Format("{0} Penta Kills. \n", stat.Stats.TotalPentaKills) + "\n" + String.Format("{0} Games Played - {1} Wins - {2} Losses ({3}% Winrate.) \n", stat.Stats.TotalSessionsPlayed, stat.Stats.TotalSessionsWon, stat.Stats.TotalSessionsLost, decimal.Round(avgWinrate, 2).ToString(System.Globalization.CultureInfo.InvariantCulture)) + "\n" + "Average Damage" + "\n" + String.Format("Dealt Per Game: {0} - Taken Per Game: {1} \n", avgDmgDealt, avgDmgTaken) + String.Format("Physical Damage: {0} - Magic Damage: {1} \n", avgPhysDmg, avgMagicDmg) + "\n" + "" + String.Format("Total Turrets kills: {0} - Minion Slaughtered: {1} - Total Gold Earned: {2}", stat.Stats.TotalTurretsKilled, stat.Stats.TotalMinionKills, stat.Stats.TotalGoldEarned); break; } } output += "```"; await e.Channel.SendMessage(output); } catch (IndexOutOfRangeException) { await Utils.InproperCommandUsageMessage(e, "rankedstats", "rankedstats <REGION> <CHAMPION> <SUMMONER>"); } catch (RiotSharpException ex) { Console.WriteLine(String.Format("Get ranked champ stats - {0}", ex.Message)); await e.Channel.SendMessage(String.Format("{0} hasn't played any ranked this season.", summoner.Name)); } catch (Exception ex) when(ex is SummonerNotFoundException || ex is RegionNotFoundException || ex is ChampionNotFoundException) { Console.WriteLine(String.Format("Get ranked champ stats - {0}", ex.Message)); await e.Channel.SendMessage(ex.Message); } }
public static string RetornarIconeCampeao(string versao, ChampionStatic campeao) { return($"//ddragon.leagueoflegends.com/cdn/{versao}/img/champion/{campeao.Image.Full}"); }