public RibbonEditor(PKM pk) { pkm = pk; InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); riblist = RibbonInfo.GetRibbonInfo(pkm); int vertScrollWidth = SystemInformation.VerticalScrollBarWidth; TLP_Ribbons.Padding = FLP_Ribbons.Padding = new Padding(0, 0, vertScrollWidth, 0); // Updating a Control display with autosized elements on every row addition is cpu intensive. Disable layout updates while populating. TLP_Ribbons.SuspendLayout(); FLP_Ribbons.Scroll += WinFormsUtil.PanelScroll; TLP_Ribbons.Scroll += WinFormsUtil.PanelScroll; PopulateRibbons(); TLP_Ribbons.ResumeLayout(); if (pk is PK8 pk8) { var names = Enum.GetNames(typeof(RibbonIndex)); var values = (RibbonIndex[])Enum.GetValues(typeof(RibbonIndex)); var items = names.Select((z, i) => new ComboItem(RibbonStrings.GetName("Ribbon" + z), (int)values[i])).OrderBy(z => z.Text); var ds = new List <ComboItem> { new(GameInfo.GetStrings(Main.CurrentLanguage).Move[0], -1) }; ds.AddRange(items.ToArray()); CB_Affixed.InitializeBinding(); CB_Affixed.DataSource = ds; CB_Affixed.SelectedValue = (int)pk8.AffixedRibbon; } else { CB_Affixed.Visible = false; } }
public static void ClearAllRibbon(this PKM pkm) { IEnumerable <RibbonInfo> riblist = RibbonInfo.GetRibbonInfo(pkm); foreach (var rib in riblist) { ReflectUtil.SetValue(pkm, rib.Name, rib.RibbonCount < 0 ? false : (object)0); } }
public RibbonEditor(PKM pk) { pkm = pk; InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); riblist = RibbonInfo.GetRibbonInfo(pkm); int vertScrollWidth = SystemInformation.VerticalScrollBarWidth; TLP_Ribbons.Padding = FLP_Ribbons.Padding = new Padding(0, 0, vertScrollWidth, 0); // Updating a Control display with autosized elements on every row addition is cpu intensive. Disable layout updates while populating. TLP_Ribbons.SuspendLayout(); FLP_Ribbons.Scroll += WinFormsUtil.PanelScroll; TLP_Ribbons.Scroll += WinFormsUtil.PanelScroll; PopulateRibbons(); TLP_Ribbons.ResumeLayout(); }
public PokemonSummary(PKM pkm, GameStrings strings) : base(pkm, strings) { Ribbons = new List <string>(); foreach (var ribbon in RibbonInfo.GetRibbonInfo(pkm)) { if (ribbon.HasRibbon) { Ribbons.Add(RibbonStrings.GetName(ribbon.Name)); } } Moves = new List <Move> { new Move() { Move_Name = Move1, Move_Type = MoveType.MT[pkm.Move1].Type, Move_PP = Move1_PP, Move_PP_Up = Move1_PPUp }, new Move() { Move_Name = Move2, Move_Type = MoveType.MT[pkm.Move2].Type, Move_PP = Move2_PP, Move_PP_Up = Move2_PPUp }, new Move() { Move_Name = Move3, Move_Type = MoveType.MT[pkm.Move3].Type, Move_PP = Move3_PP, Move_PP_Up = Move3_PPUp }, new Move() { Move_Name = Move4, Move_Type = MoveType.MT[pkm.Move4].Type, Move_PP = Move4_PP, Move_PP_Up = Move4_PPUp } }; Stats = new List <Stat> { new Stat() { Stat_Name = "HP", Stat_IV = HP_IV, Stat_EV = HP_EV, Stat_Total = HP }, new Stat() { Stat_Name = "Attack", Stat_IV = ATK_IV, Stat_EV = ATK_EV, Stat_Total = ATK }, new Stat() { Stat_Name = "Defense", Stat_IV = DEF_IV, Stat_EV = DEF_EV, Stat_Total = DEF }, new Stat() { Stat_Name = "Speed", Stat_IV = SPE_IV, Stat_EV = SPE_EV, Stat_Total = SPE }, new Stat() { Stat_Name = "Special Attack", Stat_IV = SPA_IV, Stat_EV = SPA_EV, Stat_Total = SPA }, new Stat() { Stat_Name = "Special Defense", Stat_IV = SPD_IV, Stat_EV = SPD_EV, Stat_Total = SPD }, }; Generation = Utils.GetGeneration(pkm); Form = Utils.GetForm(pkm, pkm.Form); HeldItemSpriteURL = ""; HT = pkm.HT_Name; DexNumber = pkm.Species; Size = pkm.SIZE_STORED; ItemNum = pkm.HeldItem; var LC = new LegalityAnalysis(pkm); IllegalReasons = LC.Report(); IsLegal = LC.Valid; QR = Utils.GenerateQR(QRMessageUtil.GetMessage(pkm)); Base64 = System.Convert.ToBase64String(pkm.DecryptedBoxData); SpeciesSpriteURL = Helpers.Sprite.getFormURL(DexNumber, Generation, Form, IsShiny, Gender, Species); }
private static List <string> GetAllRibbonNames(PKM pk) => RibbonInfo.GetRibbonInfo(pk).Select(z => z.Name).ToList();