private StatsStatic GetRunesStats(StatsStatic statsStatic) { foreach (Control c in form1.runesTab.RuneBackgroundContainer.Controls) { if (c.Name.Contains("picBoxRuneSlot")) { try { PictureBox p = c as PictureBox; if (p.Tag != null) { try { RuneStatic itemPreped = (RuneStatic)p.Tag; Type myType = typeof(StatsStatic); System.Reflection.PropertyInfo[] properties = myType.GetProperties(); foreach (System.Reflection.PropertyInfo property in properties) { Double statValue = (Double)itemPreped.Stats.GetType().GetProperty(property.Name).GetValue(itemPreped.Stats); if (statValue != 0.0) { Double newValue = (Double)statsStatic.GetType().GetProperty(property.Name).GetValue(statsStatic); if (property.Name == "PercentSlowReistance" || property.Name == "PercentTenacityMod" || property.Name == "RPercentArmorPenetrationMod" || property.Name == "RFlatMagicPenetrationMod") { newValue = (1 - (1 - statValue) * (1 - newValue)); } else { newValue += statValue; } statsStatic.GetType().GetProperty(property.Name).SetValue(statsStatic, newValue); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } return(statsStatic); }
//RuneStatic thisRune = getRunesFromServer.runes.Runes.FirstOrDefault(o => o.Value.Id.ToString() == hoveredID).Value; //toolTipForm.updateRuneTip("Tier " + thisRune.Metadata.Tier, thisRune.Name, thisRune.Description, thisRune.Metadata.Type); private void UpdateToolTip(RuneStatic thisRune) { //Prepare color of title string titleColor = "Black"; switch (thisRune.Metadata.Type) { case "red": titleColor = "Red"; break; case "yellow": titleColor = "#FBB117"; break; case "blue": titleColor = "Blue"; break; case "black": titleColor = "Purple"; break; } //Compile Description string tipDesc = string.Format(@" <div style='max-width:300px;'> <p style='color:Black; font-family:Tahoma; font-size:10pt; text-smoothing-mode:AntiAlias; max-width:300px;'> Tier: {0}<br/> <span style='color:{1}; font-weight:bold; font-size:11pt;'>{2}</span> <br/> {3}<br/> </p></div>" , thisRune.Metadata.Tier, titleColor, thisRune.Name, thisRune.Description); tipInfo.ToolTipTextFormatted = tipDesc.Replace("<br>", "<br/>"); }
public async void RetrieveRuneDataTest() { RuneStatic lifeSteal = await creepScore.RetrieveRuneData(CreepScore.Region.NA, 5412, StaticDataConstants.RuneListData.None); Assert.Equal("Greater Quintessence of Life Steal", lifeSteal.name); }
public RuneStaticWrapper(RuneStatic rune, Language language, RuneData runeData) { RuneStatic = rune; Language = language; RuneData = runeData; }
private void navBarItemNew_LinkClicked(object sender, NavBarLinkEventArgs e) { try { string group = e.Link.Group.Caption; string runeID = e.Link.ItemName; RuneStatic thisRune = getRunesFromServer.runes.Runes.FirstOrDefault(o => o.Value.Id.ToString() == runeID).Value; //Black (Quints) utilize the Full image rather than the sprite string file; Image imageRune; if (thisRune.Metadata.Type == "black") { file = string.Format(@"{0}\Data\Runes\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getRunesFromServer.version, thisRune.Image.Full); imageRune = Image.FromFile(file); } else { file = string.Format(@"{0}\Data\Runes\Images\{1}\{2}", PublicStaticVariables.thisAppDataDir, getRunesFromServer.version, thisRune.Image.Sprite); imageRune = Image.FromFile(file); imageRune = CommonMethods.cropImage(imageRune, new Rectangle(thisRune.Image.X, thisRune.Image.Y, thisRune.Image.Width, thisRune.Image.Height)); } if (thisRune.Metadata.Type == "red") { for (int i = 1; i <= 9; i++) { PictureBox p = picBoxRuneBackground.Controls.Find("picBoxRuneSlot" + i, true)[0] as PictureBox; if (p.Image == null) { p.Image = imageRune; p.Tag = thisRune; //add to statistics runeStatistics.AddOrRemoveStatistics(((RuneStatic)p.Tag).Stats, true); i = 100; } } } else if (thisRune.Metadata.Type == "yellow") { for (int i = 10; i <= 18; i++) { PictureBox p = picBoxRuneBackground.Controls.Find("picBoxRuneSlot" + i, true)[0] as PictureBox; if (p.Image == null) { p.Image = imageRune; p.Tag = thisRune; //add to statistics runeStatistics.AddOrRemoveStatistics(((RuneStatic)p.Tag).Stats, true); i = 100; } } } else if (thisRune.Metadata.Type == "blue") { for (int i = 19; i <= 27; i++) { PictureBox p = picBoxRuneBackground.Controls.Find("picBoxRuneSlot" + i, true)[0] as PictureBox; if (p.Image == null) { p.Image = imageRune; p.Tag = thisRune; //add to statistics runeStatistics.AddOrRemoveStatistics(((RuneStatic)p.Tag).Stats, true); i = 100; } } } else if (thisRune.Metadata.Type == "black") { for (int i = 28; i <= 30; i++) { PictureBox p = picBoxRuneBackground.Controls.Find("picBoxRuneSlot" + i, true)[0] as PictureBox; if (p.Image == null) { p.Image = imageRune; p.Tag = thisRune; //add to statistics runeStatistics.AddOrRemoveStatistics(((RuneStatic)p.Tag).Stats, true); i = 100; } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void LoadRunePage(RunePage page) { runeInfoCollection.Clear(); runeValues.Clear(); runePageNameTextBlock.Text = page.name; string numberPart = "[\\+|-][\\d\\W]+"; for (int i = 1; i <= 30; i++) { int runeId = 0; foreach (RuneSlot runeSlot in page.slots) { if (runeSlot.runeSlotId == i) { runeId = runeSlot.runeId; break; } } RuneStatic rune = AppConstants.runesData.data[runeId.ToString()]; string runeDescriptionModified = ""; if (rune.sanitizedDescription.Contains('(')) { int index = rune.sanitizedDescription.IndexOf('('); runeDescriptionModified = rune.sanitizedDescription.Substring(0, index); } else { runeDescriptionModified = rune.sanitizedDescription; } string runeData = Regex.Match(runeDescriptionModified, numberPart).ToString(); string runeInfo = AppConstants.ToRegularCase(runeDescriptionModified.Substring(runeData.Length)); List <double> nonNullRuneValues = new List <double>(); //foreach (double? value in rune.stats.values) //{ // if (value != null) // { // nonNullRuneValues.Add((double)value); // } //} if (nonNullRuneValues.Count == 1) { if (!runeValues.ContainsKey(runeInfo)) { RunePageInfoListViewBinding binding = new RunePageInfoListViewBinding(runeInfo, nonNullRuneValues[0], runeData.Contains('%'), runeData.Contains('+'), runeInfo.Contains("Per Level")); runeValues.Add(runeInfo, binding); } else { runeValues[runeInfo].AddToValue(nonNullRuneValues[0]); } } else if (nonNullRuneValues.Count == 2) { if (!runeValues.ContainsKey("armor penetration")) { RunePageInfoListViewBinding binding = new RunePageInfoListViewBinding("armor penetration", nonNullRuneValues[0], runeData.Contains('%'), runeData.Contains('+'), runeInfo.Contains("Per Level")); runeValues.Add("armor penetration", binding); } else { runeValues["armor penetration"].AddToValue(nonNullRuneValues[0]); } if (!runeValues.ContainsKey("magic penetration")) { RunePageInfoListViewBinding binding = new RunePageInfoListViewBinding("magic penetration", nonNullRuneValues[1], runeData.Contains('%'), runeData.Contains('+'), runeInfo.Contains("Per Level")); runeValues.Add("magic penetration", binding); } else { runeValues["magic penetration"].AddToValue(nonNullRuneValues[1]); } } runeImages[i - 1].Source = AppConstants.SetImageSource(new Uri(AppConstants.RuneIconUrl() + rune.image.full)); ToolTip toolTip = new ToolTip(); toolTip.Content = rune.name + "\n" + rune.sanitizedDescription; ToolTipService.SetToolTip(runeImages[i - 1], toolTip); } foreach (KeyValuePair <string, RunePageInfoListViewBinding> binding in runeValues) { if (binding.Value.plus) { binding.Value.RuneValue = "+"; } if (binding.Value.isPercent) { binding.Value.value *= 100; binding.Value.RuneValue += binding.Value.value.ToString() + "%"; } else { binding.Value.RuneValue += binding.Value.value.ToString("0.###"); } if (binding.Value.perLevel) { binding.Value.RuneValue += " (" + binding.Value.value * 18 + " @ lvl 18)"; } runeInfoCollection.Add(binding.Value); } }