diff --git a/PKHeX.WinForms/Controls/PKM Editor/EditPK8.cs b/PKHeX.WinForms/Controls/PKM Editor/EditPK8.cs index 0e3dac9c6..d9303b3fb 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/EditPK8.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/EditPK8.cs @@ -84,5 +84,46 @@ namespace PKHeX.WinForms.Controls LoadPartyStats(pk8); UpdateStats(); } + + private PA8 PreparePA8() + { + if (Entity is not PA8 pk8) + throw new FormatException(nameof(Entity)); + + SaveMisc1(pk8); + SaveMisc2(pk8); + SaveMisc3(pk8); + SaveMisc4(pk8); + SaveMisc6(pk8); + SaveMisc8(pk8); + + // Toss in Party Stats + SavePartyStats(pk8); + + pk8.FixMoves(); + pk8.FixRelearn(); + if (ModifyPKM) + pk8.FixMemories(); + pk8.RefreshChecksum(); + return pk8; + } + + private void PopulateFieldsPA8() + { + if (Entity is not PA8 pk8) + throw new FormatException(nameof(Entity)); + + LoadMisc1(pk8); + LoadMisc2(pk8); + LoadMisc3(pk8); + LoadMisc4(pk8); + LoadMisc6(pk8); + LoadGVs(pk8); + SizeCP.LoadPKM(pk8); + LoadMisc8(pk8); + + LoadPartyStats(pk8); + UpdateStats(); + } } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs b/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs index e69648ace..716f26eb6 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/LoadSave.cs @@ -72,6 +72,7 @@ namespace PKHeX.WinForms.Controls private void LoadIVs(PKM pk) => Stats.LoadIVs(pk.IVs); private void LoadEVs(PKM pk) => Stats.LoadEVs(pk.EVs); private void LoadAVs(IAwakened pk) => Stats.LoadAVs(pk); + private void LoadGVs(IGanbaru pk) => Stats.LoadGVs(pk); private void LoadMoves(PKM pk) { @@ -434,5 +435,30 @@ namespace PKHeX.WinForms.Controls pk8.HT_Language = WinFormsUtil.GetIndex(CB_HTLanguage); pk8.BattleVersion = WinFormsUtil.GetIndex(CB_BattleVersion); } + + private void LoadMisc8(PA8 pk8) + { + CB_StatNature.SelectedValue = pk8.StatNature; + Stats.CB_DynamaxLevel.SelectedIndex = pk8.DynamaxLevel; + Stats.CHK_Gigantamax.Checked = pk8.CanGigantamax; + CB_HTLanguage.SelectedValue = pk8.HT_Language; + TB_HomeTracker.Text = pk8.Tracker.ToString("X16"); + CB_BattleVersion.SelectedValue = pk8.BattleVersion; + Stats.CHK_IsAlpha.Checked = pk8.IsAlpha; + Stats.CHK_IsNoble.Checked = pk8.IsNoble; + CB_AlphaMastered.SelectedValue = pk8.AlphaMove; + } + + private void SaveMisc8(PA8 pk8) + { + pk8.StatNature = WinFormsUtil.GetIndex(CB_StatNature); + pk8.DynamaxLevel = (byte)Math.Max(0, Stats.CB_DynamaxLevel.SelectedIndex); + pk8.CanGigantamax = Stats.CHK_Gigantamax.Checked; + pk8.HT_Language = WinFormsUtil.GetIndex(CB_HTLanguage); + pk8.BattleVersion = WinFormsUtil.GetIndex(CB_BattleVersion); + pk8.IsAlpha = Stats.CHK_IsAlpha.Checked; + pk8.IsNoble = Stats.CHK_IsNoble.Checked; + pk8.AlphaMove = WinFormsUtil.GetIndex(CB_AlphaMastered); + } } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs index c95d8e792..5d491ae89 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs @@ -67,7 +67,6 @@ this.Label_Form = new System.Windows.Forms.Label(); this.FLP_FormRight = new System.Windows.Forms.FlowLayoutPanel(); this.CB_Form = new System.Windows.Forms.ComboBox(); - this.FA_Form = new PKHeX.WinForms.Controls.FormArgument(); this.FLP_HeldItem = new System.Windows.Forms.FlowLayoutPanel(); this.Label_HeldItem = new System.Windows.Forms.Label(); this.CB_HeldItem = new System.Windows.Forms.ComboBox(); @@ -119,12 +118,9 @@ this.CHK_Shadow = new System.Windows.Forms.CheckBox(); this.FLP_ShinyLeaf = new System.Windows.Forms.FlowLayoutPanel(); this.L_ShinyLeaf = new System.Windows.Forms.Label(); - this.ShinyLeaf = new PKHeX.WinForms.Controls.ShinyLeaf(); this.FLP_CatchRate = new System.Windows.Forms.FlowLayoutPanel(); this.L_CatchRate = new System.Windows.Forms.Label(); - this.CR_PK1 = new PKHeX.WinForms.Controls.CatchRate(); this.FLP_SizeCP = new System.Windows.Forms.FlowLayoutPanel(); - this.SizeCP = new PKHeX.WinForms.Controls.SizeCP(); this.Tab_Met = new System.Windows.Forms.TabPage(); this.TB_HomeTracker = new System.Windows.Forms.TextBox(); this.L_HomeTracker = new System.Windows.Forms.Label(); @@ -165,10 +161,9 @@ this.L_MetTimeOfDay = new System.Windows.Forms.Label(); this.CB_MetTimeOfDay = new System.Windows.Forms.ComboBox(); this.Tab_Stats = new System.Windows.Forms.TabPage(); - this.Stats = new PKHeX.WinForms.Controls.StatEditor(); - this.Contest = new PKHeX.WinForms.Controls.ContestStat(); this.Tab_Attacks = new System.Windows.Forms.TabPage(); this.B_Records = new System.Windows.Forms.Button(); + this.B_MoveShop = new System.Windows.Forms.Button(); this.PB_WarnMove4 = new System.Windows.Forms.PictureBox(); this.PB_WarnMove3 = new System.Windows.Forms.PictureBox(); this.PB_WarnMove2 = new System.Windows.Forms.PictureBox(); @@ -225,7 +220,6 @@ this.TB_ExtraByte = new System.Windows.Forms.MaskedTextBox(); this.CB_ExtraBytes = new System.Windows.Forms.ComboBox(); this.GB_OT = new System.Windows.Forms.GroupBox(); - this.TID_Trainer = new PKHeX.WinForms.Controls.TrainerID(); this.Label_OTGender = new System.Windows.Forms.Label(); this.TB_OT = new System.Windows.Forms.TextBox(); this.Label_OT = new System.Windows.Forms.Label(); @@ -233,6 +227,16 @@ this.SpeciesIDTip = new System.Windows.Forms.ToolTip(this.components); this.NatureTip = new System.Windows.Forms.ToolTip(this.components); this.Tip3 = new System.Windows.Forms.ToolTip(this.components); + this.FLP_MoveFlags = new System.Windows.Forms.FlowLayoutPanel(); + this.FA_Form = new PKHeX.WinForms.Controls.FormArgument(); + this.ShinyLeaf = new PKHeX.WinForms.Controls.ShinyLeaf(); + this.CR_PK1 = new PKHeX.WinForms.Controls.CatchRate(); + this.SizeCP = new PKHeX.WinForms.Controls.SizeCP(); + this.Stats = new PKHeX.WinForms.Controls.StatEditor(); + this.Contest = new PKHeX.WinForms.Controls.ContestStat(); + this.TID_Trainer = new PKHeX.WinForms.Controls.TrainerID(); + this.CB_AlphaMastered = new System.Windows.Forms.ComboBox(); + this.L_AlphaMastered = new System.Windows.Forms.Label(); this.tabMain.SuspendLayout(); this.Tab_Main.SuspendLayout(); this.FLP_Main.SuspendLayout(); @@ -317,6 +321,7 @@ ((System.ComponentModel.ISupportInitialize)(this.PB_Mark4)).BeginInit(); this.GB_ExtraBytes.SuspendLayout(); this.GB_OT.SuspendLayout(); + this.FLP_MoveFlags.SuspendLayout(); this.SuspendLayout(); // // tabMain @@ -802,15 +807,6 @@ this.CB_Form.TabIndex = 12; this.CB_Form.SelectedIndexChanged += new System.EventHandler(this.UpdateForm); // - // FA_Form - // - this.FA_Form.Location = new System.Drawing.Point(123, 0); - this.FA_Form.Margin = new System.Windows.Forms.Padding(0); - this.FA_Form.Name = "FA_Form"; - this.FA_Form.Size = new System.Drawing.Size(75, 21); - this.FA_Form.TabIndex = 19; - this.FA_Form.ValueChanged += new System.EventHandler(this.UpdateFormArgument); - // // FLP_HeldItem // this.FLP_HeldItem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); @@ -1419,14 +1415,6 @@ this.L_ShinyLeaf.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.L_ShinyLeaf.Click += new System.EventHandler(this.ClickShinyLeaf); // - // ShinyLeaf - // - this.ShinyLeaf.Location = new System.Drawing.Point(98, 0); - this.ShinyLeaf.Margin = new System.Windows.Forms.Padding(0); - this.ShinyLeaf.Name = "ShinyLeaf"; - this.ShinyLeaf.Size = new System.Drawing.Size(140, 56); - this.ShinyLeaf.TabIndex = 116; - // // FLP_CatchRate // this.FLP_CatchRate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); @@ -1448,14 +1436,6 @@ this.L_CatchRate.Text = "Catch Rate:"; this.L_CatchRate.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // CR_PK1 - // - this.CR_PK1.Location = new System.Drawing.Point(110, 0); - this.CR_PK1.Margin = new System.Windows.Forms.Padding(0); - this.CR_PK1.Name = "CR_PK1"; - this.CR_PK1.Size = new System.Drawing.Size(162, 25); - this.CR_PK1.TabIndex = 10; - // // FLP_SizeCP // this.FLP_SizeCP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); @@ -1466,15 +1446,6 @@ this.FLP_SizeCP.Size = new System.Drawing.Size(272, 72); this.FLP_SizeCP.TabIndex = 21; // - // SizeCP - // - this.SizeCP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.SizeCP.Location = new System.Drawing.Point(50, 0); - this.SizeCP.Margin = new System.Windows.Forms.Padding(50, 0, 0, 0); - this.SizeCP.Name = "SizeCP"; - this.SizeCP.Size = new System.Drawing.Size(204, 68); - this.SizeCP.TabIndex = 0; - // // Tab_Met // this.Tab_Met.AllowDrop = true; @@ -1486,7 +1457,7 @@ this.Tab_Met.Location = new System.Drawing.Point(4, 22); this.Tab_Met.Name = "Tab_Met"; this.Tab_Met.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Met.Size = new System.Drawing.Size(192, 74); + this.Tab_Met.Size = new System.Drawing.Size(307, 539); this.Tab_Met.TabIndex = 1; this.Tab_Met.Text = "Met"; this.Tab_Met.UseVisualStyleBackColor = true; @@ -1930,42 +1901,17 @@ this.Tab_Stats.Location = new System.Drawing.Point(4, 22); this.Tab_Stats.Name = "Tab_Stats"; this.Tab_Stats.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Stats.Size = new System.Drawing.Size(192, 74); + this.Tab_Stats.Size = new System.Drawing.Size(307, 539); this.Tab_Stats.TabIndex = 2; this.Tab_Stats.Text = "Stats"; this.Tab_Stats.UseVisualStyleBackColor = true; // - // Stats - // - this.Stats.EVsFishy = System.Drawing.Color.LightYellow; - this.Stats.EVsInvalid = System.Drawing.Color.Red; - this.Stats.EVsMaxed = System.Drawing.Color.Honeydew; - this.Stats.Location = new System.Drawing.Point(0, 0); - this.Stats.Name = "Stats"; - this.Stats.Size = new System.Drawing.Size(270, 264); - this.Stats.StatDecreased = System.Drawing.Color.Blue; - this.Stats.StatHyperTrained = System.Drawing.Color.LightGreen; - this.Stats.StatIncreased = System.Drawing.Color.Red; - this.Stats.TabIndex = 1; - // - // Contest - // - this.Contest.CNT_Beauty = ((byte)(0)); - this.Contest.CNT_Cool = ((byte)(0)); - this.Contest.CNT_Cute = ((byte)(0)); - this.Contest.CNT_Sheen = ((byte)(0)); - this.Contest.CNT_Smart = ((byte)(0)); - this.Contest.CNT_Tough = ((byte)(0)); - this.Contest.Location = new System.Drawing.Point(21, 265); - this.Contest.Margin = new System.Windows.Forms.Padding(0); - this.Contest.Name = "Contest"; - this.Contest.Size = new System.Drawing.Size(230, 50); - this.Contest.TabIndex = 2; - // // Tab_Attacks // this.Tab_Attacks.AllowDrop = true; - this.Tab_Attacks.Controls.Add(this.B_Records); + this.Tab_Attacks.Controls.Add(this.L_AlphaMastered); + this.Tab_Attacks.Controls.Add(this.CB_AlphaMastered); + this.Tab_Attacks.Controls.Add(this.FLP_MoveFlags); this.Tab_Attacks.Controls.Add(this.PB_WarnMove4); this.Tab_Attacks.Controls.Add(this.PB_WarnMove3); this.Tab_Attacks.Controls.Add(this.PB_WarnMove2); @@ -1975,14 +1921,15 @@ this.Tab_Attacks.Location = new System.Drawing.Point(4, 22); this.Tab_Attacks.Name = "Tab_Attacks"; this.Tab_Attacks.Padding = new System.Windows.Forms.Padding(3); - this.Tab_Attacks.Size = new System.Drawing.Size(192, 74); + this.Tab_Attacks.Size = new System.Drawing.Size(307, 539); this.Tab_Attacks.TabIndex = 3; this.Tab_Attacks.Text = "Attacks"; this.Tab_Attacks.UseVisualStyleBackColor = true; // // B_Records // - this.B_Records.Location = new System.Drawing.Point(63, 284); + this.B_Records.Location = new System.Drawing.Point(1, 1); + this.B_Records.Margin = new System.Windows.Forms.Padding(1); this.B_Records.Name = "B_Records"; this.B_Records.Size = new System.Drawing.Size(144, 23); this.B_Records.TabIndex = 8; @@ -1990,6 +1937,17 @@ this.B_Records.UseVisualStyleBackColor = true; this.B_Records.Click += new System.EventHandler(this.B_Records_Click); // + // B_MoveShop + // + this.B_MoveShop.Location = new System.Drawing.Point(147, 1); + this.B_MoveShop.Margin = new System.Windows.Forms.Padding(1); + this.B_MoveShop.Name = "B_MoveShop"; + this.B_MoveShop.Size = new System.Drawing.Size(144, 23); + this.B_MoveShop.TabIndex = 9; + this.B_MoveShop.Text = "Move Shop"; + this.B_MoveShop.UseVisualStyleBackColor = true; + this.B_MoveShop.Click += new System.EventHandler(this.B_MoveShop_Click); + // // PB_WarnMove4 // this.PB_WarnMove4.Image = global::PKHeX.WinForms.Properties.Resources.warn; @@ -2375,7 +2333,7 @@ this.Tab_OTMisc.Location = new System.Drawing.Point(4, 22); this.Tab_OTMisc.Name = "Tab_OTMisc"; this.Tab_OTMisc.Padding = new System.Windows.Forms.Padding(3); - this.Tab_OTMisc.Size = new System.Drawing.Size(192, 74); + this.Tab_OTMisc.Size = new System.Drawing.Size(307, 539); this.Tab_OTMisc.TabIndex = 4; this.Tab_OTMisc.Text = "OT/Misc"; this.Tab_OTMisc.UseVisualStyleBackColor = true; @@ -2718,13 +2676,6 @@ this.GB_OT.TabStop = false; this.GB_OT.Text = "Trainer Information"; // - // TID_Trainer - // - this.TID_Trainer.Location = new System.Drawing.Point(13, 18); - this.TID_Trainer.Name = "TID_Trainer"; - this.TID_Trainer.Size = new System.Drawing.Size(178, 27); - this.TID_Trainer.TabIndex = 57; - // // Label_OTGender // this.Label_OTGender.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -2765,6 +2716,108 @@ this.Label_EncryptionConstant.Text = "Encryption Constant:"; this.Label_EncryptionConstant.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // FLP_MoveFlags + // + this.FLP_MoveFlags.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.FLP_MoveFlags.AutoSize = true; + this.FLP_MoveFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.FLP_MoveFlags.Controls.Add(this.B_Records); + this.FLP_MoveFlags.Controls.Add(this.B_MoveShop); + this.FLP_MoveFlags.Location = new System.Drawing.Point(8, 286); + this.FLP_MoveFlags.Name = "FLP_MoveFlags"; + this.FLP_MoveFlags.Size = new System.Drawing.Size(292, 25); + this.FLP_MoveFlags.TabIndex = 11; + this.FLP_MoveFlags.WrapContents = false; + // + // FA_Form + // + this.FA_Form.Location = new System.Drawing.Point(123, 0); + this.FA_Form.Margin = new System.Windows.Forms.Padding(0); + this.FA_Form.Name = "FA_Form"; + this.FA_Form.Size = new System.Drawing.Size(75, 21); + this.FA_Form.TabIndex = 19; + this.FA_Form.ValueChanged += new System.EventHandler(this.UpdateFormArgument); + // + // ShinyLeaf + // + this.ShinyLeaf.Location = new System.Drawing.Point(98, 0); + this.ShinyLeaf.Margin = new System.Windows.Forms.Padding(0); + this.ShinyLeaf.Name = "ShinyLeaf"; + this.ShinyLeaf.Size = new System.Drawing.Size(140, 56); + this.ShinyLeaf.TabIndex = 116; + // + // CR_PK1 + // + this.CR_PK1.Location = new System.Drawing.Point(110, 0); + this.CR_PK1.Margin = new System.Windows.Forms.Padding(0); + this.CR_PK1.Name = "CR_PK1"; + this.CR_PK1.Size = new System.Drawing.Size(162, 25); + this.CR_PK1.TabIndex = 10; + // + // SizeCP + // + this.SizeCP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.SizeCP.Location = new System.Drawing.Point(50, 0); + this.SizeCP.Margin = new System.Windows.Forms.Padding(50, 0, 0, 0); + this.SizeCP.Name = "SizeCP"; + this.SizeCP.Size = new System.Drawing.Size(204, 68); + this.SizeCP.TabIndex = 0; + // + // Stats + // + this.Stats.EVsFishy = System.Drawing.Color.LightYellow; + this.Stats.EVsInvalid = System.Drawing.Color.Red; + this.Stats.EVsMaxed = System.Drawing.Color.Honeydew; + this.Stats.Location = new System.Drawing.Point(0, 0); + this.Stats.Name = "Stats"; + this.Stats.Size = new System.Drawing.Size(270, 264); + this.Stats.StatDecreased = System.Drawing.Color.Blue; + this.Stats.StatHyperTrained = System.Drawing.Color.LightGreen; + this.Stats.StatIncreased = System.Drawing.Color.Red; + this.Stats.TabIndex = 1; + // + // Contest + // + this.Contest.CNT_Beauty = ((byte)(0)); + this.Contest.CNT_Cool = ((byte)(0)); + this.Contest.CNT_Cute = ((byte)(0)); + this.Contest.CNT_Sheen = ((byte)(0)); + this.Contest.CNT_Smart = ((byte)(0)); + this.Contest.CNT_Tough = ((byte)(0)); + this.Contest.Location = new System.Drawing.Point(21, 265); + this.Contest.Margin = new System.Windows.Forms.Padding(0); + this.Contest.Name = "Contest"; + this.Contest.Size = new System.Drawing.Size(230, 50); + this.Contest.TabIndex = 2; + // + // TID_Trainer + // + this.TID_Trainer.Location = new System.Drawing.Point(13, 18); + this.TID_Trainer.Name = "TID_Trainer"; + this.TID_Trainer.Size = new System.Drawing.Size(178, 27); + this.TID_Trainer.TabIndex = 57; + // + // CB_AlphaMastered + // + this.CB_AlphaMastered.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_AlphaMastered.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_AlphaMastered.FormattingEnabled = true; + this.CB_AlphaMastered.Location = new System.Drawing.Point(123, 317); + this.CB_AlphaMastered.Name = "CB_AlphaMastered"; + this.CB_AlphaMastered.Size = new System.Drawing.Size(124, 21); + this.CB_AlphaMastered.TabIndex = 20; + // + // L_AlphaMastered + // + this.L_AlphaMastered.Location = new System.Drawing.Point(8, 317); + this.L_AlphaMastered.Margin = new System.Windows.Forms.Padding(0); + this.L_AlphaMastered.Name = "L_AlphaMastered"; + this.L_AlphaMastered.Size = new System.Drawing.Size(112, 21); + this.L_AlphaMastered.TabIndex = 21; + this.L_AlphaMastered.Text = "Alpha Mastered:"; + this.L_AlphaMastered.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // // PKMEditor // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; @@ -2843,6 +2896,7 @@ this.FLP_TimeOfDay.ResumeLayout(false); this.Tab_Stats.ResumeLayout(false); this.Tab_Attacks.ResumeLayout(false); + this.Tab_Attacks.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_WarnMove4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_WarnMove3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_WarnMove2)).EndInit(); @@ -2876,6 +2930,7 @@ this.GB_ExtraBytes.PerformLayout(); this.GB_OT.ResumeLayout(false); this.GB_OT.PerformLayout(); + this.FLP_MoveFlags.ResumeLayout(false); this.ResumeLayout(false); } @@ -3086,5 +3141,9 @@ private System.Windows.Forms.ComboBox CB_BattleVersion; private System.Windows.Forms.PictureBox PB_BattleVersion; private FormArgument FA_Form; + private System.Windows.Forms.Button B_MoveShop; + private System.Windows.Forms.FlowLayoutPanel FLP_MoveFlags; + private System.Windows.Forms.Label L_AlphaMastered; + private System.Windows.Forms.ComboBox CB_AlphaMastered; } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index b0a2aeea0..f8d229928 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -52,6 +52,7 @@ namespace PKHeX.WinForms.Controls new(new[] {CB_Country, CB_SubRegion}, pk => pk is PK6 or PK7, Criteria), new(Relearn, pk => pk.Format >= 6, Criteria), new(new[] {CB_StatNature}, pk => pk.Format >= 8, Criteria), + new(new[] {CB_AlphaMastered}, pk => pk is PA8, Criteria), }; foreach (var c in WinFormsUtil.GetAllControlsOfType(this)) @@ -94,6 +95,7 @@ namespace PKHeX.WinForms.Controls CB_Nature, CB_StatNature, CB_Country, CB_SubRegion, CB_3DSReg, CB_Language, CB_Ball, CB_HeldItem, CB_Species, DEV_Ability, CB_GroundTile, CB_GameOrigin, CB_BattleVersion, CB_Ability, CB_MetLocation, CB_EggLocation, CB_Language, CB_HTLanguage, + CB_AlphaMastered, }; foreach (var cb in cbs.Concat(Moves.Concat(Relearn))) cb.InitializeBinding(); @@ -254,6 +256,7 @@ namespace PKHeX.WinForms.Controls 7 when pk is PK7 => (PopulateFieldsPK7, PreparePK7), 7 when pk is PB7 => (PopulateFieldsPB7, PreparePB7), 8 when pk is PK8 => (PopulateFieldsPK8, PreparePK8), + 8 when pk is PA8 => (PopulateFieldsPA8, PreparePA8), 8 when pk is PB8 => (PopulateFieldsPB8, PreparePB8), _ => throw new FormatException($"Unrecognized Type: {pk.GetType()}"), }; @@ -554,6 +557,8 @@ namespace PKHeX.WinForms.Controls return Properties.Resources.gen_8; if (pkm.BDSP) return Properties.Resources.gen_bs; + if (pkm.LA) + return Properties.Resources.gen_la; return null; } @@ -1706,6 +1711,8 @@ namespace PKHeX.WinForms.Controls Entity.RelearnMove3 = WinFormsUtil.GetIndex(CB_RelearnMove3); Entity.RelearnMove4 = WinFormsUtil.GetIndex(CB_RelearnMove4); } + if (Entity is PA8 pa8) + pa8.AlphaMove = WinFormsUtil.GetIndex(CB_AlphaMastered); UpdateLegality(skipMoveRepop: true); } @@ -1793,14 +1800,36 @@ namespace PKHeX.WinForms.Controls private void B_Records_Click(object sender, EventArgs e) { + if (Entity is not ITechRecord8 t) + return; + if (ModifierKeys == Keys.Shift) { - Entity.SetRecordFlags(Entity.Moves); + t.SetRecordFlags(Entity.Moves); UpdateLegality(); return; } - using var form = new TechRecordEditor(Entity); + using var form = new TechRecordEditor(t, Entity); + form.ShowDialog(); + UpdateLegality(); + } + + private void B_MoveShop_Click(object sender, EventArgs e) + { + if (Entity is not IMoveShop8Mastery m) + return; + + if (ModifierKeys == Keys.Shift) + { + m.ClearMoveShopFlags(); + m.SetMoveShopFlags(Entity.Moves); + m.SetMoveShopFlagsMastered(); + UpdateLegality(); + return; + } + + using var form = new MoveShopEditor(m, m, Entity); form.ShowDialog(); UpdateLegality(); } @@ -1833,8 +1862,10 @@ namespace PKHeX.WinForms.Controls BTN_Medals.Visible = gen is 6 or 7 && !pb7; FLP_Country.Visible = FLP_SubRegion.Visible = FLP_3DSRegion.Visible = t is IRegionOrigin; FLP_OriginalNature.Visible = gen >= 8; - B_Records.Visible = gen >= 8; + B_Records.Visible = t is ITechRecord8; + B_MoveShop.Visible = t is IMoveShop8Mastery; CB_HTLanguage.Visible = gen >= 8; + L_AlphaMastered.Visible = CB_AlphaMastered.Visible = t is PA8; ToggleInterface(Entity.Format); } @@ -1936,6 +1967,7 @@ namespace PKHeX.WinForms.Controls { // Recenter PKM SubEditors FLP_PKMEditors.Location = new Point((tabMain.TabPages[0].Width - FLP_PKMEditors.Width) / 2, FLP_PKMEditors.Location.Y); + FLP_MoveFlags.Location = new Point((tabMain.TabPages[0].Width - FLP_MoveFlags.Width) / 2, FLP_MoveFlags.Location.Y); } public void EnableDragDrop(DragEventHandler enter, DragEventHandler drop) @@ -2063,6 +2095,8 @@ namespace PKHeX.WinForms.Controls LegalMoveSource.ReloadMoves(source.Moves); foreach (var cb in Moves.Concat(Relearn)) SetIfDifferentCount(source.Moves, cb, force); + if (sav is SAV8LA) + SetIfDifferentCount(source.Moves, CB_AlphaMastered, force); } } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.Designer.cs b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.Designer.cs index 69e6389ba..9ec802ef9 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.Designer.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.Designer.cs @@ -97,7 +97,7 @@ this.L_Height.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.L_Height.Location = new System.Drawing.Point(3, 0); this.L_Height.Name = "L_Height"; - this.L_Height.Size = new System.Drawing.Size(57, 13); + this.L_Height.Size = new System.Drawing.Size(57, 20); this.L_Height.TabIndex = 1; this.L_Height.Text = "Height:"; this.L_Height.TextAlign = System.Drawing.ContentAlignment.MiddleRight; diff --git a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs index 468fe45c8..f86d52bd9 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/SizeCP.cs @@ -8,7 +8,8 @@ namespace PKHeX.WinForms.Controls public partial class SizeCP : UserControl { private IScaledSize? ss; - private PB7? pkm; + private IScaledSizeValue? sv; + private ICombatPower? pkm; private bool Loading; public SizeCP() @@ -22,8 +23,9 @@ namespace PKHeX.WinForms.Controls public void LoadPKM(PKM pk) { - pkm = pk as PB7; + pkm = pk as ICombatPower; ss = pk as IScaledSize; + sv = pk as IScaledSizeValue; if (ss == null) return; TryResetStats(); @@ -34,11 +36,18 @@ namespace PKHeX.WinForms.Controls if (!Initialized) return; - if (pkm != null && CHK_Auto.Checked) - pkm.ResetCalculatedValues(); + if (CHK_Auto.Checked) + ResetCalculatedStats(); LoadStoredValues(); } + private void ResetCalculatedStats() + { + sv?.ResetHeight(); + sv?.ResetWeight(); + pkm?.ResetCP(); + } + private void LoadStoredValues() { Loading = true; @@ -47,11 +56,14 @@ namespace PKHeX.WinForms.Controls NUD_HeightScalar.Value = ss.HeightScalar; NUD_WeightScalar.Value = ss.WeightScalar; } + if (sv != null) + { + TB_HeightAbs.Text = sv.HeightAbsolute.ToString(CultureInfo.InvariantCulture); + TB_WeightAbs.Text = sv.WeightAbsolute.ToString(CultureInfo.InvariantCulture); + } if (pkm != null) { MT_CP.Text = Math.Min(65535, pkm.Stat_CP).ToString(); - TB_HeightAbs.Text = pkm.HeightAbsolute.ToString(CultureInfo.InvariantCulture); - TB_WeightAbs.Text = pkm.WeightAbsolute.ToString(CultureInfo.InvariantCulture); } Loading = false; } @@ -61,13 +73,13 @@ namespace PKHeX.WinForms.Controls if (!CHK_Auto.Checked) return; - pkm?.ResetCalculatedValues(); + ResetCalculatedStats(); LoadStoredValues(); } private void MT_CP_TextChanged(object sender, EventArgs e) { - if (int.TryParse(MT_CP.Text, out var cp) && pkm != null) + if (pkm != null && int.TryParse(MT_CP.Text, out var cp)) pkm.Stat_CP = Math.Min(65535, cp); } @@ -79,10 +91,10 @@ namespace PKHeX.WinForms.Controls L_SizeH.Text = SizeClass[(int)PokeSizeUtil.GetSizeRating(ss.HeightScalar)]; } - if (!CHK_Auto.Checked || Loading || pkm == null) + if (!CHK_Auto.Checked || Loading || sv == null) return; - pkm.ResetHeight(); - TB_HeightAbs.Text = pkm.HeightAbsolute.ToString("F8"); + sv.ResetHeight(); + TB_HeightAbs.Text = sv.HeightAbsolute.ToString(CultureInfo.InvariantCulture); } private void NUD_WeightScalar_ValueChanged(object sender, EventArgs e) @@ -93,36 +105,39 @@ namespace PKHeX.WinForms.Controls L_SizeW.Text = SizeClass[(int)PokeSizeUtil.GetSizeRating(ss.WeightScalar)]; } - if (!CHK_Auto.Checked || Loading || pkm == null) + if (!CHK_Auto.Checked || Loading || sv == null) return; - pkm.ResetWeight(); - TB_WeightAbs.Text = pkm.WeightAbsolute.ToString("F8"); + sv.ResetWeight(); + TB_WeightAbs.Text = sv.WeightAbsolute.ToString(CultureInfo.InvariantCulture); } private void TB_HeightAbs_TextChanged(object sender, EventArgs e) { - if (pkm == null) + if (sv == null) return; if (CHK_Auto.Checked) - pkm.ResetHeight(); + sv.ResetHeight(); else if (float.TryParse(TB_HeightAbs.Text, out var result)) - pkm.HeightAbsolute = result; + sv.HeightAbsolute = result; } private void TB_WeightAbs_TextChanged(object sender, EventArgs e) { - if (pkm == null) + if (sv == null) return; if (CHK_Auto.Checked) - pkm.ResetWeight(); + sv.ResetWeight(); else if (float.TryParse(TB_WeightAbs.Text, out var result)) - pkm.WeightAbsolute = result; + sv.WeightAbsolute = result; } public void ToggleVisibility(PKM pk) { - var pb7 = pk is PB7; - FLP_CP.Visible = L_CP.Visible = TB_HeightAbs.Visible = TB_WeightAbs.Visible = pb7; + bool isCP = pk is PB7; + bool isAbsolute = pk is IScaledSizeValue; + MT_CP.Visible = L_CP.Visible = isCP; + TB_HeightAbs.Visible = TB_WeightAbs.Visible = isAbsolute; + FLP_CP.Visible = isCP || isAbsolute; // Auto checkbox } private void ClickScalarEntry(object sender, EventArgs e) diff --git a/PKHeX.WinForms/Controls/PKM Editor/StatEditor.Designer.cs b/PKHeX.WinForms/Controls/PKM Editor/StatEditor.Designer.cs index 8254e4a5e..4a6f118d7 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/StatEditor.Designer.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/StatEditor.Designer.cs @@ -38,6 +38,7 @@ this.Label_IVs = new System.Windows.Forms.Label(); this.Label_EVs = new System.Windows.Forms.Label(); this.Label_AVs = new System.Windows.Forms.Label(); + this.Label_GVs = new System.Windows.Forms.Label(); this.Label_Stats = new System.Windows.Forms.Label(); this.FLP_HP = new System.Windows.Forms.FlowLayoutPanel(); this.Label_HP = new System.Windows.Forms.Label(); @@ -46,6 +47,7 @@ this.TB_IVHP = new System.Windows.Forms.MaskedTextBox(); this.TB_EVHP = new System.Windows.Forms.MaskedTextBox(); this.TB_AVHP = new System.Windows.Forms.MaskedTextBox(); + this.TB_GVHP = new System.Windows.Forms.MaskedTextBox(); this.Stat_HP = new System.Windows.Forms.MaskedTextBox(); this.FLP_Atk = new System.Windows.Forms.FlowLayoutPanel(); this.Label_ATK = new System.Windows.Forms.Label(); @@ -54,6 +56,7 @@ this.TB_IVATK = new System.Windows.Forms.MaskedTextBox(); this.TB_EVATK = new System.Windows.Forms.MaskedTextBox(); this.TB_AVATK = new System.Windows.Forms.MaskedTextBox(); + this.TB_GVATK = new System.Windows.Forms.MaskedTextBox(); this.Stat_ATK = new System.Windows.Forms.MaskedTextBox(); this.FLP_Def = new System.Windows.Forms.FlowLayoutPanel(); this.Label_DEF = new System.Windows.Forms.Label(); @@ -62,6 +65,7 @@ this.TB_IVDEF = new System.Windows.Forms.MaskedTextBox(); this.TB_EVDEF = new System.Windows.Forms.MaskedTextBox(); this.TB_AVDEF = new System.Windows.Forms.MaskedTextBox(); + this.TB_GVDEF = new System.Windows.Forms.MaskedTextBox(); this.Stat_DEF = new System.Windows.Forms.MaskedTextBox(); this.FLP_SpA = new System.Windows.Forms.FlowLayoutPanel(); this.FLP_SpALeft = new System.Windows.Forms.FlowLayoutPanel(); @@ -72,6 +76,7 @@ this.TB_IVSPA = new System.Windows.Forms.MaskedTextBox(); this.TB_EVSPA = new System.Windows.Forms.MaskedTextBox(); this.TB_AVSPA = new System.Windows.Forms.MaskedTextBox(); + this.TB_GVSPA = new System.Windows.Forms.MaskedTextBox(); this.Stat_SPA = new System.Windows.Forms.MaskedTextBox(); this.FLP_SpD = new System.Windows.Forms.FlowLayoutPanel(); this.Label_SPD = new System.Windows.Forms.Label(); @@ -80,6 +85,7 @@ this.TB_IVSPD = new System.Windows.Forms.MaskedTextBox(); this.TB_EVSPD = new System.Windows.Forms.MaskedTextBox(); this.TB_AVSPD = new System.Windows.Forms.MaskedTextBox(); + this.TB_GVSPD = new System.Windows.Forms.MaskedTextBox(); this.Stat_SPD = new System.Windows.Forms.MaskedTextBox(); this.FLP_Spe = new System.Windows.Forms.FlowLayoutPanel(); this.Label_SPE = new System.Windows.Forms.Label(); @@ -88,6 +94,7 @@ this.TB_IVSPE = new System.Windows.Forms.MaskedTextBox(); this.TB_EVSPE = new System.Windows.Forms.MaskedTextBox(); this.TB_AVSPE = new System.Windows.Forms.MaskedTextBox(); + this.TB_GVSPE = new System.Windows.Forms.MaskedTextBox(); this.Stat_SPE = new System.Windows.Forms.MaskedTextBox(); this.FLP_StatsTotal = new System.Windows.Forms.FlowLayoutPanel(); this.Label_Total = new System.Windows.Forms.Label(); @@ -114,6 +121,9 @@ this.L_DynamaxLevel = new System.Windows.Forms.Label(); this.CB_DynamaxLevel = new System.Windows.Forms.ComboBox(); this.CHK_Gigantamax = new System.Windows.Forms.CheckBox(); + this.FLP_AlphaNoble = new System.Windows.Forms.FlowLayoutPanel(); + this.CHK_IsAlpha = new System.Windows.Forms.CheckBox(); + this.CHK_IsNoble = new System.Windows.Forms.CheckBox(); this.EVTip = new System.Windows.Forms.ToolTip(this.components); this.FLP_Stats.SuspendLayout(); this.FLP_StatHeader.SuspendLayout(); @@ -139,6 +149,7 @@ this.FLP_Characteristic.SuspendLayout(); this.PAN_BTN.SuspendLayout(); this.FLP_DynamaxLevel.SuspendLayout(); + this.FLP_AlphaNoble.SuspendLayout(); this.SuspendLayout(); // // FLP_Stats @@ -156,10 +167,11 @@ this.FLP_Stats.Controls.Add(this.FLP_Characteristic); this.FLP_Stats.Controls.Add(this.PAN_BTN); this.FLP_Stats.Controls.Add(this.FLP_DynamaxLevel); + this.FLP_Stats.Controls.Add(this.FLP_AlphaNoble); this.FLP_Stats.Dock = System.Windows.Forms.DockStyle.Fill; this.FLP_Stats.Location = new System.Drawing.Point(0, 0); this.FLP_Stats.Name = "FLP_Stats"; - this.FLP_Stats.Size = new System.Drawing.Size(270, 303); + this.FLP_Stats.Size = new System.Drawing.Size(312, 318); this.FLP_Stats.TabIndex = 106; // // FLP_StatHeader @@ -170,7 +182,7 @@ this.FLP_StatHeader.Location = new System.Drawing.Point(0, 0); this.FLP_StatHeader.Margin = new System.Windows.Forms.Padding(0); this.FLP_StatHeader.Name = "FLP_StatHeader"; - this.FLP_StatHeader.Size = new System.Drawing.Size(272, 22); + this.FLP_StatHeader.Size = new System.Drawing.Size(312, 22); this.FLP_StatHeader.TabIndex = 122; // // FLP_HackedStats @@ -203,11 +215,12 @@ this.FLP_StatsHeaderRight.Controls.Add(this.Label_IVs); this.FLP_StatsHeaderRight.Controls.Add(this.Label_EVs); this.FLP_StatsHeaderRight.Controls.Add(this.Label_AVs); + this.FLP_StatsHeaderRight.Controls.Add(this.Label_GVs); this.FLP_StatsHeaderRight.Controls.Add(this.Label_Stats); this.FLP_StatsHeaderRight.Location = new System.Drawing.Point(75, 0); this.FLP_StatsHeaderRight.Margin = new System.Windows.Forms.Padding(0); this.FLP_StatsHeaderRight.Name = "FLP_StatsHeaderRight"; - this.FLP_StatsHeaderRight.Size = new System.Drawing.Size(187, 21); + this.FLP_StatsHeaderRight.Size = new System.Drawing.Size(237, 21); this.FLP_StatsHeaderRight.TabIndex = 123; // // Label_Base @@ -250,9 +263,19 @@ this.Label_AVs.Text = "AVs"; this.Label_AVs.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // + // Label_GVs + // + this.Label_GVs.Location = new System.Drawing.Point(134, 0); + this.Label_GVs.Margin = new System.Windows.Forms.Padding(0); + this.Label_GVs.Name = "Label_GVs"; + this.Label_GVs.Size = new System.Drawing.Size(35, 21); + this.Label_GVs.TabIndex = 32; + this.Label_GVs.Text = "GVs"; + this.Label_GVs.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // Label_Stats // - this.Label_Stats.Location = new System.Drawing.Point(134, 0); + this.Label_Stats.Location = new System.Drawing.Point(169, 0); this.Label_Stats.Margin = new System.Windows.Forms.Padding(0); this.Label_Stats.Name = "Label_Stats"; this.Label_Stats.Size = new System.Drawing.Size(35, 21); @@ -268,7 +291,7 @@ this.FLP_HP.Location = new System.Drawing.Point(0, 22); this.FLP_HP.Margin = new System.Windows.Forms.Padding(0); this.FLP_HP.Name = "FLP_HP"; - this.FLP_HP.Size = new System.Drawing.Size(272, 21); + this.FLP_HP.Size = new System.Drawing.Size(312, 21); this.FLP_HP.TabIndex = 123; // // Label_HP @@ -289,11 +312,12 @@ this.FLP_HPRight.Controls.Add(this.TB_IVHP); this.FLP_HPRight.Controls.Add(this.TB_EVHP); this.FLP_HPRight.Controls.Add(this.TB_AVHP); + this.FLP_HPRight.Controls.Add(this.TB_GVHP); this.FLP_HPRight.Controls.Add(this.Stat_HP); this.FLP_HPRight.Location = new System.Drawing.Point(77, 0); this.FLP_HPRight.Margin = new System.Windows.Forms.Padding(0); this.FLP_HPRight.Name = "FLP_HPRight"; - this.FLP_HPRight.Size = new System.Drawing.Size(185, 21); + this.FLP_HPRight.Size = new System.Drawing.Size(217, 21); this.FLP_HPRight.TabIndex = 121; // // TB_BaseHP @@ -350,11 +374,24 @@ this.TB_AVHP.Click += new System.EventHandler(this.ClickAV); this.TB_AVHP.TextChanged += new System.EventHandler(this.UpdateAVs); // + // TB_GVHP + // + this.TB_GVHP.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_GVHP.Location = new System.Drawing.Point(131, 0); + this.TB_GVHP.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.TB_GVHP.Mask = "000"; + this.TB_GVHP.Name = "TB_GVHP"; + this.TB_GVHP.Size = new System.Drawing.Size(28, 20); + this.TB_GVHP.TabIndex = 48; + this.TB_GVHP.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_GVHP.Click += new System.EventHandler(this.ClickGV); + this.TB_GVHP.TextChanged += new System.EventHandler(this.UpdateGVs); + // // Stat_HP // this.Stat_HP.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Stat_HP.Enabled = false; - this.Stat_HP.Location = new System.Drawing.Point(131, 0); + this.Stat_HP.Location = new System.Drawing.Point(165, 0); this.Stat_HP.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.Stat_HP.Mask = "00000"; this.Stat_HP.Name = "Stat_HP"; @@ -372,7 +409,7 @@ this.FLP_Atk.Location = new System.Drawing.Point(0, 43); this.FLP_Atk.Margin = new System.Windows.Forms.Padding(0); this.FLP_Atk.Name = "FLP_Atk"; - this.FLP_Atk.Size = new System.Drawing.Size(272, 21); + this.FLP_Atk.Size = new System.Drawing.Size(312, 21); this.FLP_Atk.TabIndex = 124; // // Label_ATK @@ -393,11 +430,12 @@ this.FLP_AtkRight.Controls.Add(this.TB_IVATK); this.FLP_AtkRight.Controls.Add(this.TB_EVATK); this.FLP_AtkRight.Controls.Add(this.TB_AVATK); + this.FLP_AtkRight.Controls.Add(this.TB_GVATK); this.FLP_AtkRight.Controls.Add(this.Stat_ATK); this.FLP_AtkRight.Location = new System.Drawing.Point(77, 0); this.FLP_AtkRight.Margin = new System.Windows.Forms.Padding(0); this.FLP_AtkRight.Name = "FLP_AtkRight"; - this.FLP_AtkRight.Size = new System.Drawing.Size(185, 21); + this.FLP_AtkRight.Size = new System.Drawing.Size(217, 21); this.FLP_AtkRight.TabIndex = 123; // // TB_BaseATK @@ -454,11 +492,24 @@ this.TB_AVATK.Click += new System.EventHandler(this.ClickAV); this.TB_AVATK.TextChanged += new System.EventHandler(this.UpdateAVs); // + // TB_GVATK + // + this.TB_GVATK.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_GVATK.Location = new System.Drawing.Point(131, 0); + this.TB_GVATK.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.TB_GVATK.Mask = "000"; + this.TB_GVATK.Name = "TB_GVATK"; + this.TB_GVATK.Size = new System.Drawing.Size(28, 20); + this.TB_GVATK.TabIndex = 49; + this.TB_GVATK.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_GVATK.Click += new System.EventHandler(this.ClickGV); + this.TB_GVATK.TextChanged += new System.EventHandler(this.UpdateGVs); + // // Stat_ATK // this.Stat_ATK.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Stat_ATK.Enabled = false; - this.Stat_ATK.Location = new System.Drawing.Point(131, 0); + this.Stat_ATK.Location = new System.Drawing.Point(165, 0); this.Stat_ATK.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.Stat_ATK.Mask = "00000"; this.Stat_ATK.Name = "Stat_ATK"; @@ -476,7 +527,7 @@ this.FLP_Def.Location = new System.Drawing.Point(0, 64); this.FLP_Def.Margin = new System.Windows.Forms.Padding(0); this.FLP_Def.Name = "FLP_Def"; - this.FLP_Def.Size = new System.Drawing.Size(272, 21); + this.FLP_Def.Size = new System.Drawing.Size(312, 21); this.FLP_Def.TabIndex = 125; // // Label_DEF @@ -497,11 +548,12 @@ this.FLP_DefRight.Controls.Add(this.TB_IVDEF); this.FLP_DefRight.Controls.Add(this.TB_EVDEF); this.FLP_DefRight.Controls.Add(this.TB_AVDEF); + this.FLP_DefRight.Controls.Add(this.TB_GVDEF); this.FLP_DefRight.Controls.Add(this.Stat_DEF); this.FLP_DefRight.Location = new System.Drawing.Point(77, 0); this.FLP_DefRight.Margin = new System.Windows.Forms.Padding(0); this.FLP_DefRight.Name = "FLP_DefRight"; - this.FLP_DefRight.Size = new System.Drawing.Size(185, 21); + this.FLP_DefRight.Size = new System.Drawing.Size(217, 21); this.FLP_DefRight.TabIndex = 123; // // TB_BaseDEF @@ -558,11 +610,24 @@ this.TB_AVDEF.Click += new System.EventHandler(this.ClickAV); this.TB_AVDEF.TextChanged += new System.EventHandler(this.UpdateAVs); // + // TB_GVDEF + // + this.TB_GVDEF.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_GVDEF.Location = new System.Drawing.Point(131, 0); + this.TB_GVDEF.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.TB_GVDEF.Mask = "000"; + this.TB_GVDEF.Name = "TB_GVDEF"; + this.TB_GVDEF.Size = new System.Drawing.Size(28, 20); + this.TB_GVDEF.TabIndex = 50; + this.TB_GVDEF.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_GVDEF.Click += new System.EventHandler(this.ClickGV); + this.TB_GVDEF.TextChanged += new System.EventHandler(this.UpdateGVs); + // // Stat_DEF // this.Stat_DEF.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Stat_DEF.Enabled = false; - this.Stat_DEF.Location = new System.Drawing.Point(131, 0); + this.Stat_DEF.Location = new System.Drawing.Point(165, 0); this.Stat_DEF.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.Stat_DEF.Mask = "00000"; this.Stat_DEF.Name = "Stat_DEF"; @@ -580,7 +645,7 @@ this.FLP_SpA.Location = new System.Drawing.Point(0, 85); this.FLP_SpA.Margin = new System.Windows.Forms.Padding(0); this.FLP_SpA.Name = "FLP_SpA"; - this.FLP_SpA.Size = new System.Drawing.Size(272, 21); + this.FLP_SpA.Size = new System.Drawing.Size(312, 21); this.FLP_SpA.TabIndex = 126; // // FLP_SpALeft @@ -624,11 +689,12 @@ this.FLP_SpARight.Controls.Add(this.TB_IVSPA); this.FLP_SpARight.Controls.Add(this.TB_EVSPA); this.FLP_SpARight.Controls.Add(this.TB_AVSPA); + this.FLP_SpARight.Controls.Add(this.TB_GVSPA); this.FLP_SpARight.Controls.Add(this.Stat_SPA); this.FLP_SpARight.Location = new System.Drawing.Point(77, 0); this.FLP_SpARight.Margin = new System.Windows.Forms.Padding(0); this.FLP_SpARight.Name = "FLP_SpARight"; - this.FLP_SpARight.Size = new System.Drawing.Size(185, 21); + this.FLP_SpARight.Size = new System.Drawing.Size(217, 21); this.FLP_SpARight.TabIndex = 123; // // TB_BaseSPA @@ -685,11 +751,24 @@ this.TB_AVSPA.Click += new System.EventHandler(this.ClickAV); this.TB_AVSPA.TextChanged += new System.EventHandler(this.UpdateAVs); // + // TB_GVSPA + // + this.TB_GVSPA.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_GVSPA.Location = new System.Drawing.Point(131, 0); + this.TB_GVSPA.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.TB_GVSPA.Mask = "000"; + this.TB_GVSPA.Name = "TB_GVSPA"; + this.TB_GVSPA.Size = new System.Drawing.Size(28, 20); + this.TB_GVSPA.TabIndex = 51; + this.TB_GVSPA.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_GVSPA.Click += new System.EventHandler(this.ClickGV); + this.TB_GVSPA.TextChanged += new System.EventHandler(this.UpdateGVs); + // // Stat_SPA // this.Stat_SPA.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Stat_SPA.Enabled = false; - this.Stat_SPA.Location = new System.Drawing.Point(131, 0); + this.Stat_SPA.Location = new System.Drawing.Point(165, 0); this.Stat_SPA.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.Stat_SPA.Mask = "00000"; this.Stat_SPA.Name = "Stat_SPA"; @@ -707,7 +786,7 @@ this.FLP_SpD.Location = new System.Drawing.Point(0, 106); this.FLP_SpD.Margin = new System.Windows.Forms.Padding(0); this.FLP_SpD.Name = "FLP_SpD"; - this.FLP_SpD.Size = new System.Drawing.Size(272, 21); + this.FLP_SpD.Size = new System.Drawing.Size(312, 21); this.FLP_SpD.TabIndex = 127; // // Label_SPD @@ -728,11 +807,12 @@ this.FLP_SpDRight.Controls.Add(this.TB_IVSPD); this.FLP_SpDRight.Controls.Add(this.TB_EVSPD); this.FLP_SpDRight.Controls.Add(this.TB_AVSPD); + this.FLP_SpDRight.Controls.Add(this.TB_GVSPD); this.FLP_SpDRight.Controls.Add(this.Stat_SPD); this.FLP_SpDRight.Location = new System.Drawing.Point(77, 0); this.FLP_SpDRight.Margin = new System.Windows.Forms.Padding(0); this.FLP_SpDRight.Name = "FLP_SpDRight"; - this.FLP_SpDRight.Size = new System.Drawing.Size(185, 21); + this.FLP_SpDRight.Size = new System.Drawing.Size(217, 21); this.FLP_SpDRight.TabIndex = 123; // // TB_BaseSPD @@ -789,11 +869,24 @@ this.TB_AVSPD.Click += new System.EventHandler(this.ClickAV); this.TB_AVSPD.TextChanged += new System.EventHandler(this.UpdateAVs); // + // TB_GVSPD + // + this.TB_GVSPD.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_GVSPD.Location = new System.Drawing.Point(131, 0); + this.TB_GVSPD.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.TB_GVSPD.Mask = "000"; + this.TB_GVSPD.Name = "TB_GVSPD"; + this.TB_GVSPD.Size = new System.Drawing.Size(28, 20); + this.TB_GVSPD.TabIndex = 52; + this.TB_GVSPD.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_GVSPD.Click += new System.EventHandler(this.ClickGV); + this.TB_GVSPD.TextChanged += new System.EventHandler(this.UpdateGVs); + // // Stat_SPD // this.Stat_SPD.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Stat_SPD.Enabled = false; - this.Stat_SPD.Location = new System.Drawing.Point(131, 0); + this.Stat_SPD.Location = new System.Drawing.Point(165, 0); this.Stat_SPD.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.Stat_SPD.Mask = "00000"; this.Stat_SPD.Name = "Stat_SPD"; @@ -811,7 +904,7 @@ this.FLP_Spe.Location = new System.Drawing.Point(0, 127); this.FLP_Spe.Margin = new System.Windows.Forms.Padding(0); this.FLP_Spe.Name = "FLP_Spe"; - this.FLP_Spe.Size = new System.Drawing.Size(272, 21); + this.FLP_Spe.Size = new System.Drawing.Size(312, 21); this.FLP_Spe.TabIndex = 128; // // Label_SPE @@ -832,11 +925,12 @@ this.FLP_SpeRight.Controls.Add(this.TB_IVSPE); this.FLP_SpeRight.Controls.Add(this.TB_EVSPE); this.FLP_SpeRight.Controls.Add(this.TB_AVSPE); + this.FLP_SpeRight.Controls.Add(this.TB_GVSPE); this.FLP_SpeRight.Controls.Add(this.Stat_SPE); this.FLP_SpeRight.Location = new System.Drawing.Point(77, 0); this.FLP_SpeRight.Margin = new System.Windows.Forms.Padding(0); this.FLP_SpeRight.Name = "FLP_SpeRight"; - this.FLP_SpeRight.Size = new System.Drawing.Size(185, 21); + this.FLP_SpeRight.Size = new System.Drawing.Size(217, 21); this.FLP_SpeRight.TabIndex = 123; // // TB_BaseSPE @@ -893,11 +987,24 @@ this.TB_AVSPE.Click += new System.EventHandler(this.ClickAV); this.TB_AVSPE.TextChanged += new System.EventHandler(this.UpdateAVs); // + // TB_GVSPE + // + this.TB_GVSPE.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.TB_GVSPE.Location = new System.Drawing.Point(131, 0); + this.TB_GVSPE.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); + this.TB_GVSPE.Mask = "000"; + this.TB_GVSPE.Name = "TB_GVSPE"; + this.TB_GVSPE.Size = new System.Drawing.Size(28, 20); + this.TB_GVSPE.TabIndex = 53; + this.TB_GVSPE.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.TB_GVSPE.Click += new System.EventHandler(this.ClickGV); + this.TB_GVSPE.TextChanged += new System.EventHandler(this.UpdateGVs); + // // Stat_SPE // this.Stat_SPE.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Stat_SPE.Enabled = false; - this.Stat_SPE.Location = new System.Drawing.Point(131, 0); + this.Stat_SPE.Location = new System.Drawing.Point(165, 0); this.Stat_SPE.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.Stat_SPE.Mask = "00000"; this.Stat_SPE.Name = "Stat_SPE"; @@ -915,7 +1022,7 @@ this.FLP_StatsTotal.Location = new System.Drawing.Point(0, 148); this.FLP_StatsTotal.Margin = new System.Windows.Forms.Padding(0); this.FLP_StatsTotal.Name = "FLP_StatsTotal"; - this.FLP_StatsTotal.Size = new System.Drawing.Size(272, 21); + this.FLP_StatsTotal.Size = new System.Drawing.Size(312, 21); this.FLP_StatsTotal.TabIndex = 129; // // Label_Total @@ -1200,12 +1307,46 @@ this.CHK_Gigantamax.UseVisualStyleBackColor = true; this.CHK_Gigantamax.CheckedChanged += new System.EventHandler(this.CHK_Gigantamax_CheckedChanged); // + // FLP_AlphaNoble + // + this.FLP_AlphaNoble.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.FLP_AlphaNoble.Controls.Add(this.CHK_IsAlpha); + this.FLP_AlphaNoble.Controls.Add(this.CHK_IsNoble); + this.FLP_AlphaNoble.Location = new System.Drawing.Point(0, 285); + this.FLP_AlphaNoble.Margin = new System.Windows.Forms.Padding(0); + this.FLP_AlphaNoble.Name = "FLP_AlphaNoble"; + this.FLP_AlphaNoble.Size = new System.Drawing.Size(270, 21); + this.FLP_AlphaNoble.TabIndex = 134; + // + // CHK_IsAlpha + // + this.CHK_IsAlpha.AutoSize = true; + this.CHK_IsAlpha.Location = new System.Drawing.Point(55, 3); + this.CHK_IsAlpha.Margin = new System.Windows.Forms.Padding(95, 2, 3, 3); + this.CHK_IsAlpha.Name = "CHK_IsAlpha"; + this.CHK_IsAlpha.Size = new System.Drawing.Size(64, 17); + this.CHK_IsAlpha.TabIndex = 44; + this.CHK_IsAlpha.Text = "Alpha"; + this.CHK_IsAlpha.UseVisualStyleBackColor = true; + this.CHK_IsAlpha.CheckedChanged += new System.EventHandler(this.CHK_IsAlpha_CheckedChanged); + // + // CHK_IsNoble + // + this.CHK_IsNoble.AutoSize = true; + this.CHK_IsNoble.Location = new System.Drawing.Point(55, 3); + this.CHK_IsNoble.Margin = new System.Windows.Forms.Padding(3, 2, 3, 3); + this.CHK_IsNoble.Name = "CHK_IsNoble"; + this.CHK_IsNoble.Size = new System.Drawing.Size(64, 17); + this.CHK_IsNoble.TabIndex = 44; + this.CHK_IsNoble.Text = "Noble"; + this.CHK_IsNoble.UseVisualStyleBackColor = true; + // // StatEditor // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.Controls.Add(this.FLP_Stats); this.Name = "StatEditor"; - this.Size = new System.Drawing.Size(270, 303); + this.Size = new System.Drawing.Size(312, 318); this.FLP_Stats.ResumeLayout(false); this.FLP_StatHeader.ResumeLayout(false); this.FLP_HackedStats.ResumeLayout(false); @@ -1238,6 +1379,8 @@ this.PAN_BTN.ResumeLayout(false); this.FLP_DynamaxLevel.ResumeLayout(false); this.FLP_DynamaxLevel.PerformLayout(); + this.FLP_AlphaNoble.ResumeLayout(false); + this.FLP_AlphaNoble.PerformLayout(); this.ResumeLayout(false); } @@ -1330,5 +1473,15 @@ private System.Windows.Forms.Label L_DynamaxLevel; public System.Windows.Forms.ComboBox CB_DynamaxLevel; public System.Windows.Forms.CheckBox CHK_Gigantamax; + private System.Windows.Forms.Label Label_GVs; + private System.Windows.Forms.MaskedTextBox TB_GVHP; + private System.Windows.Forms.MaskedTextBox TB_GVATK; + private System.Windows.Forms.MaskedTextBox TB_GVDEF; + private System.Windows.Forms.MaskedTextBox TB_GVSPA; + private System.Windows.Forms.MaskedTextBox TB_GVSPD; + private System.Windows.Forms.MaskedTextBox TB_GVSPE; + private System.Windows.Forms.FlowLayoutPanel FLP_AlphaNoble; + public System.Windows.Forms.CheckBox CHK_IsAlpha; + public System.Windows.Forms.CheckBox CHK_IsNoble; } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/StatEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/StatEditor.cs index 432af171f..0cedb23f9 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/StatEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/StatEditor.cs @@ -15,6 +15,7 @@ namespace PKHeX.WinForms.Controls MT_IVs = new[] {TB_IVHP, TB_IVATK, TB_IVDEF, TB_IVSPE, TB_IVSPA, TB_IVSPD}; MT_EVs = new[] {TB_EVHP, TB_EVATK, TB_EVDEF, TB_EVSPE, TB_EVSPA, TB_EVSPD}; MT_AVs = new[] {TB_AVHP, TB_AVATK, TB_AVDEF, TB_AVSPE, TB_AVSPA, TB_AVSPD}; + MT_GVs = new[] {TB_GVHP, TB_GVATK, TB_GVDEF, TB_GVSPE, TB_GVSPA, TB_GVSPD}; MT_Stats = new[] {Stat_HP, Stat_ATK, Stat_DEF, Stat_SPE, Stat_SPA, Stat_SPD}; L_Stats = new[] {Label_HP, Label_ATK, Label_DEF, Label_SPE, Label_SPA, Label_SPD}; MT_Base = new[] {TB_BaseHP, TB_BaseATK, TB_BaseDEF, TB_BaseSPE, TB_BaseSPA, TB_BaseSPD}; @@ -49,7 +50,7 @@ namespace PKHeX.WinForms.Controls } private readonly Label[] L_Stats; - private readonly MaskedTextBox[] MT_EVs, MT_IVs, MT_AVs, MT_Stats, MT_Base; + private readonly MaskedTextBox[] MT_EVs, MT_IVs, MT_AVs, MT_GVs, MT_Stats, MT_Base; private PKM Entity => MainEditor.Entity; private bool ChangingFields @@ -119,6 +120,22 @@ namespace PKHeX.WinForms.Controls t.Text = 0.ToString(); } } + private void ClickGV(object sender, EventArgs e) + { + if (sender is not MaskedTextBox t || Entity is not IGanbaru g) + return; + + if ((ModifierKeys & Keys.Control) != 0) // Max + { + int index = Array.IndexOf(MT_GVs, t); + var max = g.GetMax(Entity, index).ToString(); + t.Text = t.Text == max ? 0.ToString() : max; + } + else if ((ModifierKeys & Keys.Alt) != 0) // Min + { + t.Text = 0.ToString(); + } + } public void UpdateIVs(object sender, EventArgs e) { @@ -133,6 +150,8 @@ namespace PKHeX.WinForms.Controls int index = Array.IndexOf(MT_IVs, m); Entity.SetIV(index, value); + if (Entity is IGanbaru g) + RefreshGanbaru(Entity, g, index); } RefreshDerivedValues(e); UpdateStats(); @@ -211,6 +230,27 @@ namespace PKHeX.WinForms.Controls UpdateStats(); } + private void UpdateGVs(object sender, EventArgs e) + { + if (Entity is not IGanbaru g) + return; + if (sender is MaskedTextBox m) + { + int value = Util.ToInt32(m.Text); + if (value > GanbaruExtensions.TrueMax) + { + m.Text = GanbaruExtensions.TrueMax.ToString(); + return; // recursive on text set + } + + int index = Array.IndexOf(MT_GVs, m); + g.SetGV(index, value); + RefreshGanbaru(Entity, g, index); + } + + UpdateStats(); + } + private void UpdateRandomEVs(object sender, EventArgs e) { var evs = ModifierKeys switch @@ -384,6 +424,15 @@ namespace PKHeX.WinForms.Controls _ => Entity.SetRandomIVs(), }; LoadIVs(IVs); + if (Entity is IGanbaru g) + { + Entity.SetIVs(IVs); + if (ModifierKeys == Keys.Control) + g.SetSuggestedGanbaruValues(Entity); + else if (ModifierKeys == Keys.Alt) + g.ClearGanbaruValues(); + LoadGVs(g); + } } private void UpdateRandomAVs(object sender, EventArgs e) @@ -498,6 +547,33 @@ namespace PKHeX.WinForms.Controls UpdateStats(); } + public void LoadGVs(IGanbaru a) + { + ChangingFields = true; + TB_GVHP.Text = a.GV_HP.ToString(); + TB_GVATK.Text = a.GV_ATK.ToString(); + TB_GVDEF.Text = a.GV_DEF.ToString(); + TB_GVSPE.Text = a.GV_SPE.ToString(); + TB_GVSPA.Text = a.GV_SPA.ToString(); + TB_GVSPD.Text = a.GV_SPD.ToString(); + ChangingFields = false; + for (int i = 0; i < 6; i++) + RefreshGanbaru(Entity, a, i); + UpdateStats(); + } + + private void RefreshGanbaru(PKM entity, IGanbaru ganbaru, int i) + { + int current = ganbaru.GetGV(i); + var max = ganbaru.GetMax(entity, i); + if (current > max) + MT_GVs[i].BackColor = EVsInvalid; + else if (current == max) + MT_GVs[i].BackColor = StatHyperTrained; + else + MT_GVs[i].ResetBackColor(); + } + public void ToggleInterface(PKM pk, int gen) { FLP_StatsTotal.Visible = gen >= 3; @@ -505,6 +581,7 @@ namespace PKHeX.WinForms.Controls FLP_HPType.Visible = gen <= 7; FLP_HPPower.Visible = gen <= 5; FLP_DynamaxLevel.Visible = gen >= 8; + FLP_AlphaNoble.Visible = pk is PA8; switch (gen) { @@ -541,6 +618,11 @@ namespace PKHeX.WinForms.Controls foreach (var mtb in MT_EVs) mtb.Visible = !showAV; + var showGV = pk is IGanbaru; + Label_GVs.Visible = showGV; + foreach (var mtb in MT_GVs) + mtb.Visible = showGV; + void SetEVMaskSize(Size s, string Mask) { foreach (var ctrl in MT_EVs) @@ -564,5 +646,11 @@ namespace PKHeX.WinForms.Controls if (!ChangingFields) ((PKMEditor) MainEditor).UpdateSprite(); } + + private void CHK_IsAlpha_CheckedChanged(object sender, EventArgs e) + { + if (!ChangingFields) + ((PKMEditor) MainEditor).UpdateSprite(); + } } } diff --git a/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs b/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs index e5ed3dd06..dd0cca2a6 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/BoxMenuStrip.cs @@ -79,6 +79,7 @@ namespace PKHeX.WinForms.Controls [BoxManipType.ModifyResetMoves] = Resources.date, [BoxManipType.ModifyRandomMoves] = Resources.wand, [BoxManipType.ModifyHyperTrain] = Resources.vallohi, + [BoxManipType.ModifyGanbaru] = Resources.vallohi, [BoxManipType.ModifyRemoveNicknames] = Resources.alphaAZ, [BoxManipType.ModifyRemoveItem] = Resources.gift, [BoxManipType.ModifyHeal] = Resources.heart, diff --git a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs index e2ed34808..4c39b7999 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/SAVEditor.cs @@ -544,6 +544,7 @@ namespace PKHeX.WinForms.Controls SAV7b b7 => new SAV_Trainer7GG(b7), SAV8SWSH swsh => new SAV_Trainer8(swsh), SAV8BS bs => new SAV_Trainer8b(bs), + SAV8LA la => new SAV_Trainer8a(la), _ => new SAV_SimpleTrainer(sav), }; @@ -593,7 +594,7 @@ namespace PKHeX.WinForms.Controls SAV7SM s => new SAV_Accessor(s, s.Blocks), SAV7USUM s => new SAV_Accessor(s, s.Blocks), SAV7b s => new SAV_Accessor(s, s.Blocks), - SAV8SWSH s => new SAV_BlockDump8(s), + ISCBlockArray s => new SAV_BlockDump8(s), _ => GetPropertyForm(sav), }; @@ -638,6 +639,7 @@ namespace PKHeX.WinForms.Controls SAV7b b7 => new SAV_PokedexGG(b7), SAV8SWSH swsh => new SAV_PokedexSWSH(swsh), SAV8BS bs => new SAV_PokedexBDSP(bs), + SAV8LA la => new SAV_PokedexLA(la), _ => (Form?)null, }; form?.ShowDialog(); diff --git a/PKHeX.WinForms/MainWindow/Main.Designer.cs b/PKHeX.WinForms/MainWindow/Main.Designer.cs index 22762122c..2c314d3e5 100644 --- a/PKHeX.WinForms/MainWindow/Main.Designer.cs +++ b/PKHeX.WinForms/MainWindow/Main.Designer.cs @@ -110,7 +110,7 @@ this.Menu_Open.Name = "Menu_Open"; this.Menu_Open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); this.Menu_Open.ShowShortcutKeys = false; - this.Menu_Open.Size = new System.Drawing.Size(180, 22); + this.Menu_Open.Size = new System.Drawing.Size(133, 22); this.Menu_Open.Text = "&Open..."; this.Menu_Open.Click += new System.EventHandler(this.MainMenuOpen); // @@ -120,7 +120,7 @@ this.Menu_Save.Name = "Menu_Save"; this.Menu_Save.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); this.Menu_Save.ShowShortcutKeys = false; - this.Menu_Save.Size = new System.Drawing.Size(180, 22); + this.Menu_Save.Size = new System.Drawing.Size(133, 22); this.Menu_Save.Text = "&Save PKM..."; this.Menu_Save.Click += new System.EventHandler(this.MainMenuSave); // @@ -130,7 +130,7 @@ this.Menu_ExportSAV.Name = "Menu_ExportSAV"; this.Menu_ExportSAV.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); this.Menu_ExportSAV.ShowShortcutKeys = false; - this.Menu_ExportSAV.Size = new System.Drawing.Size(180, 22); + this.Menu_ExportSAV.Size = new System.Drawing.Size(133, 22); this.Menu_ExportSAV.Text = "&Export SAV..."; this.Menu_ExportSAV.Click += new System.EventHandler(this.ClickExportSAV); // @@ -140,7 +140,7 @@ this.Menu_Exit.Name = "Menu_Exit"; this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q))); this.Menu_Exit.ShowShortcutKeys = false; - this.Menu_Exit.Size = new System.Drawing.Size(180, 22); + this.Menu_Exit.Size = new System.Drawing.Size(133, 22); this.Menu_Exit.Text = "&Quit"; this.Menu_Exit.Click += new System.EventHandler(this.MainMenuExit); // @@ -400,7 +400,7 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.C_SAV); - this.splitContainer1.Size = new System.Drawing.Size(761, 356); + this.splitContainer1.Size = new System.Drawing.Size(761, 378); this.splitContainer1.SplitterDistance = 310; this.splitContainer1.SplitterWidth = 2; this.splitContainer1.TabIndex = 105; @@ -414,7 +414,7 @@ this.PKME_Tabs.Location = new System.Drawing.Point(0, 0); this.PKME_Tabs.Margin = new System.Windows.Forms.Padding(5); this.PKME_Tabs.Name = "PKME_Tabs"; - this.PKME_Tabs.Size = new System.Drawing.Size(310, 356); + this.PKME_Tabs.Size = new System.Drawing.Size(310, 378); this.PKME_Tabs.TabIndex = 103; this.PKME_Tabs.Unicode = true; this.PKME_Tabs.LegalityChanged += new System.EventHandler(this.PKME_Tabs_LegalityChanged); @@ -432,7 +432,7 @@ this.C_SAV.Menu_Redo = null; this.C_SAV.Menu_Undo = null; this.C_SAV.Name = "C_SAV"; - this.C_SAV.Size = new System.Drawing.Size(449, 356); + this.C_SAV.Size = new System.Drawing.Size(449, 378); this.C_SAV.TabIndex = 104; this.C_SAV.ViewIndex = -1; this.C_SAV.RequestCloneData += new System.EventHandler(this.ClickClone); @@ -454,8 +454,8 @@ // splitContainer2.Panel2 // this.splitContainer2.Panel2.Controls.Add(this.splitContainer1); - this.splitContainer2.Size = new System.Drawing.Size(761, 382); - this.splitContainer2.SplitterDistance = 25; + this.splitContainer2.Size = new System.Drawing.Size(761, 405); + this.splitContainer2.SplitterDistance = 26; this.splitContainer2.SplitterWidth = 1; this.splitContainer2.TabIndex = 106; // @@ -489,7 +489,7 @@ this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(761, 382); + this.ClientSize = new System.Drawing.Size(761, 405); this.Controls.Add(this.dragout); this.Controls.Add(this.PB_Legal); this.Controls.Add(this.splitContainer2); diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 1e1af2f8e..02857d29a 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -333,6 +333,9 @@ namespace PKHeX.WinForms var sav = C_SAV.SAV; Task.Run(() => { + var dir = TrainerPath; + if (!Directory.Exists(dir)) + return; var files = Directory.EnumerateFiles(TrainerPath, "*.*", SearchOption.AllDirectories); var pkm = BoxUtil.GetPKMsFromPaths(files, sav.Generation); foreach (var f in pkm) @@ -1183,7 +1186,9 @@ namespace PKHeX.WinForms return; var path = sav.Metadata.FilePath!; - if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgFileLoadSaveDetectReload, path) == DialogResult.Yes) + var time = new FileInfo(path).CreationTime; + var timeStamp = time.ToString(CultureInfo.CurrentCulture); + if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MsgFileLoadSaveDetectReload, path, timeStamp) == DialogResult.Yes) LoadFile(sav, path); // load save } catch (Exception ex) diff --git a/PKHeX.WinForms/MainWindow/Main.resx b/PKHeX.WinForms/MainWindow/Main.resx index 98a1e281d..4054bfa9a 100644 --- a/PKHeX.WinForms/MainWindow/Main.resx +++ b/PKHeX.WinForms/MainWindow/Main.resx @@ -118,9 +118,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 107, 17 + + 17, 17 - - 132, 17 + + 56 \ No newline at end of file diff --git a/PKHeX.WinForms/PKHeX.WinForms.csproj b/PKHeX.WinForms/PKHeX.WinForms.csproj index 1f63bf966..ed71b2721 100644 --- a/PKHeX.WinForms/PKHeX.WinForms.csproj +++ b/PKHeX.WinForms/PKHeX.WinForms.csproj @@ -42,6 +42,15 @@ True Resources.resx + + Form + + + Form + + + UserControl + diff --git a/PKHeX.WinForms/Properties/PKHeXSettings.cs b/PKHeX.WinForms/Properties/PKHeXSettings.cs index f5321cf34..d2dcd4952 100644 --- a/PKHeX.WinForms/Properties/PKHeXSettings.cs +++ b/PKHeX.WinForms/Properties/PKHeXSettings.cs @@ -217,8 +217,8 @@ namespace PKHeX.WinForms [LocalizedDescription("Allow PKM file conversion paths that are not possible via official methods. Individual properties will be copied sequentially.")] public bool AllowIncompatibleConversion { get; set; } - [LocalizedDescription("Path to a dump of block hash-names. If file does not exist, only names defined within the program's code will be loaded.")] - public string PathBlockKeyListSWSH { get; set; } = "SCBlocks.txt"; + [LocalizedDescription("Folder path that contains dump(s) of block hash-names. If a specific dump file does not exist, only names defined within the program's code will be loaded.")] + public string PathBlockKeyList { get; set; } = string.Empty; [LocalizedDescription("Hide event variables below this event type value. Removes event values from the GUI that the user doesn't care to view.")] public NamedEventType HideEventTypeBelow { get; set; } diff --git a/PKHeX.WinForms/Properties/Resources.Designer.cs b/PKHeX.WinForms/Properties/Resources.Designer.cs index 22fd48228..21fc4296a 100644 --- a/PKHeX.WinForms/Properties/Resources.Designer.cs +++ b/PKHeX.WinForms/Properties/Resources.Designer.cs @@ -19,10 +19,10 @@ namespace PKHeX.WinForms.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public sealed class Resources { + public class Resources { private static global::System.Resources.ResourceManager resourceMan; @@ -214,13 +214,14 @@ namespace PKHeX.WinForms.Properties { /// Looks up a localized string similar to PKHeX - By Kaphotics ///http://projectpokemon.org/pkhex/ /// - ///21/10/01 - New Update: + ///22/01/01 - New Update: /// - Legality: - /// - - Added: Gen8 memory checks for unobtainable values. Thanks @Lusamine, @skadiv! - /// - - Changed: Ball legality rules updated for Gen7 starters to account for the new Gen8 raids. - /// - - Changed: Gen1 Tradeback handling reworked for less overhead. - /// - - Fixed more met locations for XD shadow encounters. Thanks @LegoFigure11! - /// - - Fixed: Gen4 Cute Charm PIDs correctly emit RNG frames for encounter matching purposes [rest of string was truncated]";. + /// - - Added: Hatch Counter legality checking. + /// - - Added: Contest Stat Sheen legality checking (roughly compared to amount of other contest stats gained). + /// - - Added: Munchlax encounter slots for DPPt and BDSP are now checked for Trainer ID legality. + /// - - Fixed: BDSP Gigantamax is now flagged illegal correctly. + /// - - Fixed: BDSP Meister Magikarp now recognized correctly. + /// - - Fixed: BDSP bred (egg) ball legali [rest of string was truncated]";. /// public static string changelog { get { @@ -448,6 +449,16 @@ namespace PKHeX.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap gen_la { + get { + object obj = ResourceManager.GetObject("gen_la", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -595,11 +606,11 @@ namespace PKHeX.WinForms.Properties { ///SAV_BlockDump8=Respaldo de bloques ///SAV_BoxLayout=Editor de fondos de Cajas ///SAV_BoxList=Visor de Almacenamiento - ///SAV_Capture7GG=Capture Record Editor + ///SAV_Capture7GG=Editor de Récord de Captura ///SAV_CGearSkin=Editor de la apariencia C-Gear ///SAV_Database=Base de Datos ///SAV_Encounters=Base de Datos - ///SAV_EventFlags [rest of string was truncated]";. + ///SAV_Even [rest of string was truncated]";. /// public static string lang_es { get { @@ -680,10 +691,10 @@ namespace PKHeX.WinForms.Properties { ///SAV_EventFlags=イベントフラグ ///SAV_EventReset1=イベントリセット ///SAV_EventWork=Event Flag Editor + ///SAV_FlagWork8b=Event Flag Editor ///SAV_FolderList=フォルダリスト ///SAV_GameSelect=ゲームバーション - ///SAV_HallOfFame=殿堂入りデータ - ///SAV_HallOfFa [rest of string was truncated]";. + ///SA [rest of string was truncated]";. /// public static string lang_ja { get { @@ -711,9 +722,9 @@ namespace PKHeX.WinForms.Properties { ///SAV_EventFlags=이벤트 플래그 편집 도구 ///SAV_EventReset1=이벤트 초기화 도구 ///SAV_EventWork=이벤트 플래그 편집 도구 + ///SAV_FlagWork8b=Event Flag Editor ///SAV_FolderList=폴더 목록 - ///SAV_GameSelect=게임 선택 - ///SAV_HallOfFame=전당등록 편 [rest of string was truncated]";. + ///SAV_GameS [rest of string was truncated]";. /// public static string lang_ko { get { @@ -741,14 +752,13 @@ namespace PKHeX.WinForms.Properties { ///SAV_EventFlags=事件旗标编辑 ///SAV_EventReset1=事件重置 ///SAV_EventWork=事件标志编辑器 + ///SAV_FlagWork8b=Event Flag Editor ///SAV_FolderList=文件夹列表 ///SAV_GameSelect=游戏选择 ///SAV_HallOfFame=名人堂 ///SAV_HallOfFame7=名人堂 ///SAV_HoneyTree=甜甜蜜树编辑 - ///SAV_Inventory=物品栏 - ///SAV_Link6=宝可梦连接工具 - ///SAV_MailBox= [rest of string was truncated]";. + ///SAV_Inventory=物品 [rest of string was truncated]";. /// public static string lang_zh { get { @@ -926,6 +936,16 @@ namespace PKHeX.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap research_bonus_points { + get { + object obj = ResourceManager.GetObject("research_bonus_points", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/PKHeX.WinForms/Properties/Resources.resx b/PKHeX.WinForms/Properties/Resources.resx index 60a2b3038..3baa3cec6 100644 --- a/PKHeX.WinForms/Properties/Resources.resx +++ b/PKHeX.WinForms/Properties/Resources.resx @@ -373,4 +373,10 @@ ..\Resources\img\Markings\gen_bs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\img\Markings\gen_la.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\img\Pokedex\research_bonus_points.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/PKHeX.WinForms/Resources/img/Markings/gen_la.png b/PKHeX.WinForms/Resources/img/Markings/gen_la.png new file mode 100644 index 000000000..756a39631 Binary files /dev/null and b/PKHeX.WinForms/Resources/img/Markings/gen_la.png differ diff --git a/PKHeX.WinForms/Resources/img/Pokedex/research_bonus_points.png b/PKHeX.WinForms/Resources/img/Pokedex/research_bonus_points.png new file mode 100644 index 000000000..4e8d6da9b Binary files /dev/null and b/PKHeX.WinForms/Resources/img/Pokedex/research_bonus_points.png differ diff --git a/PKHeX.WinForms/Subforms/KChart.cs b/PKHeX.WinForms/Subforms/KChart.cs index 4f108abba..991abff93 100644 --- a/PKHeX.WinForms/Subforms/KChart.cs +++ b/PKHeX.WinForms/Subforms/KChart.cs @@ -51,7 +51,7 @@ namespace PKHeX.WinForms row.CreateCells(DGV); int r = 0; - row.Cells[r++].Value = s.ToString("000") + (f > 0 ? "-"+f.ToString("00") :""); + row.Cells[r++].Value = s.ToString("000") + (f > 0 ? $"-{f:00}" : ""); row.Cells[r++].Value = SpriteUtil.GetSprite(s, f, 0, 0, 0, false, false, SAV.Generation); row.Cells[r++].Value = species[index]; row.Cells[r++].Value = GetIsNative(p, s); @@ -91,6 +91,7 @@ namespace PKHeX.WinForms { PersonalInfoSM => s > 721 || Legal.PastGenAlolanNatives.Contains(s), PersonalInfoSWSH ss => ss.IsInDex, + PersonalInfoBDSP bs => bs.IsInDex, _ => true, }; } diff --git a/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs b/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs index fa6e919ed..a6af2b940 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/MemoryAmie.cs @@ -70,8 +70,8 @@ namespace PKHeX.WinForms M_CT_Affection.Text = a.HT_Affection.ToString(); } - if (pkm is G8PKM pk8) - MT_Sociability.Text = Math.Min(byte.MaxValue, pk8.Sociability).ToString(); + if (pkm is ISociability s) + MT_Sociability.Text = Math.Min(byte.MaxValue, s.Sociability).ToString(); if (pkm is ITrainerMemories m) { diff --git a/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs index b93453cc4..400649411 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/RibbonEditor.cs @@ -26,7 +26,7 @@ namespace PKHeX.WinForms PopulateRibbons(); TLP_Ribbons.ResumeLayout(); - if (pk is G8PKM pk8) + if (pk is IRibbonSetAffixed affixed) { var names = Enum.GetNames(typeof(RibbonIndex)); var values = (RibbonIndex[])Enum.GetValues(typeof(RibbonIndex)); @@ -35,7 +35,7 @@ namespace PKHeX.WinForms ds.AddRange(items.ToArray()); CB_Affixed.InitializeBinding(); CB_Affixed.DataSource = ds; - CB_Affixed.SelectedValue = (int)pk8.AffixedRibbon; + CB_Affixed.SelectedValue = (int)affixed.AffixedRibbon; } else { @@ -161,8 +161,8 @@ namespace PKHeX.WinForms foreach (var rib in riblist) ReflectUtil.SetValue(pkm, rib.Name, rib.RibbonCount < 0 ? rib.HasRibbon : rib.RibbonCount); - if (pkm is G8PKM pk8) - pk8.AffixedRibbon = (sbyte)WinFormsUtil.GetIndex(CB_Affixed); + if (pkm is IRibbonSetAffixed affixed) + affixed.AffixedRibbon = (sbyte)WinFormsUtil.GetIndex(CB_Affixed); } private void B_All_Click(object sender, EventArgs e) @@ -186,8 +186,8 @@ namespace PKHeX.WinForms if (ModifierKeys == Keys.Shift) { RibbonApplicator.RemoveAllValidRibbons(pkm); - if (pkm is G8PKM pk8) - pk8.AffixedRibbon = -1; + if (pkm is IRibbonSetAffixed affixed) + affixed.AffixedRibbon = -1; Close(); return; } diff --git a/PKHeX.WinForms/Subforms/PKM Editors/TechRecordEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/TechRecordEditor.cs index 1f546f7c7..7866ed696 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/TechRecordEditor.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/TechRecordEditor.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Windows.Forms; using PKHeX.Core; @@ -7,11 +6,13 @@ namespace PKHeX.WinForms { public partial class TechRecordEditor : Form { - private readonly G8PKM pkm; + private readonly ITechRecord8 Entity; + private readonly PKM pkm; - public TechRecordEditor(PKM pk) + public TechRecordEditor(ITechRecord8 techRecord8, PKM pk) { - pkm = (G8PKM)pk; + Entity = techRecord8; + pkm = pk; InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); @@ -21,9 +22,11 @@ namespace PKHeX.WinForms private void PopulateRecords() { - var trs = Legal.TMHM_SWSH; var names = GameInfo.Strings.Move; - var lines = trs.Skip(100).Select((z, i) => $"{i:00} - {names[z]}").ToArray(); + var indexes = Entity.TechRecordPermitIndexes; + var lines = new string[indexes.Length]; + for (int i = 0; i < lines.Length; i++) + lines[i] = $"{i:00} - {names[i]}"; CLB_Flags.Items.AddRange(lines); } @@ -38,24 +41,24 @@ namespace PKHeX.WinForms private void LoadRecords() { for (int i = 0; i < PersonalInfoSWSH.CountTR; i++) - CLB_Flags.SetItemChecked(i, pkm.GetMoveRecordFlag(i)); + CLB_Flags.SetItemChecked(i, Entity.GetMoveRecordFlag(i)); } private void Save() { for (int i = 0; i < PersonalInfoSWSH.CountTR; i++) - pkm.SetMoveRecordFlag(i, CLB_Flags.GetItemChecked(i)); + Entity.SetMoveRecordFlag(i, CLB_Flags.GetItemChecked(i)); } private void B_All_Click(object sender, EventArgs e) { Save(); if (ModifierKeys == Keys.Shift) - pkm.SetRecordFlags(true); + Entity.SetRecordFlags(true); else if (ModifierKeys == Keys.Control) - pkm.SetRecordFlags(pkm.Moves); + Entity.SetRecordFlags(pkm.Moves); else - pkm.SetRecordFlags(); + Entity.SetRecordFlags(); LoadRecords(); Close(); } @@ -63,7 +66,7 @@ namespace PKHeX.WinForms private void B_None_Click(object sender, EventArgs e) { Save(); - pkm.ClearRecordFlags(); + Entity.ClearRecordFlags(); LoadRecords(); Close(); } diff --git a/PKHeX.WinForms/Subforms/SAV_Database.cs b/PKHeX.WinForms/Subforms/SAV_Database.cs index b6fb59a1f..fc330d1af 100644 --- a/PKHeX.WinForms/Subforms/SAV_Database.cs +++ b/PKHeX.WinForms/Subforms/SAV_Database.cs @@ -363,10 +363,13 @@ namespace PKHeX.WinForms { static bool IsPresentInGameSWSH(ISpeciesForm pk) => pk is PK8 || ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; static bool IsPresentInGameBDSP(ISpeciesForm pk) => pk is PB8;//|| ((PersonalInfoBDSP)PersonalTable.BDSP.GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; + static bool IsPresentInGamePLA (ISpeciesForm pk) => pk is PA8;//|| ((PersonalInfoLA)PersonalTable.LA.GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; if (SAV is SAV8SWSH) result.RemoveAll(z => !IsPresentInGameSWSH(z.Entity)); else if (SAV is SAV8BS) result.RemoveAll(z => !IsPresentInGameBDSP(z.Entity)); + else if (SAV is SAV8LA) + result.RemoveAll(z => !IsPresentInGamePLA(z.Entity)); } var sort = Main.Settings.EntityDb.InitialSortMode; diff --git a/PKHeX.WinForms/Subforms/SAV_Encounters.cs b/PKHeX.WinForms/Subforms/SAV_Encounters.cs index d1f12371f..530ed7702 100644 --- a/PKHeX.WinForms/Subforms/SAV_Encounters.cs +++ b/PKHeX.WinForms/Subforms/SAV_Encounters.cs @@ -234,12 +234,14 @@ namespace PKHeX.WinForms if (Main.Settings.EncounterDb.FilterUnavailableSpecies) { - static bool IsPresentInGameSWSH(ISpeciesForm pk) => pk is PK8 || ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; - static bool IsPresentInGameBDSP(ISpeciesForm pk) => pk is PB8 || ((PersonalInfoBDSP)PersonalTable.BDSP.GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; + static bool IsPresentInGameSWSH(ISpeciesForm pk) => ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; + static bool IsPresentInGameBDSP(ISpeciesForm pk) => ((PersonalInfoBDSP)PersonalTable.BDSP.GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; + static bool IsPresentInGameLA (ISpeciesForm pk) => ((PersonalInfoLA) PersonalTable.LA .GetFormEntry(pk.Species, pk.Form)).IsPresentInGame; results = SAV switch { SAV8SWSH => results.Where(IsPresentInGameSWSH), SAV8BS => results.Where(IsPresentInGameBDSP), + SAV8LA => results.Where(IsPresentInGameLA), _ => results.Where(z => z.Generation <= 7), }; } diff --git a/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs b/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs index 804180e21..38e0b8c49 100644 --- a/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs +++ b/PKHeX.WinForms/Subforms/SAV_MysteryGiftDB.cs @@ -216,6 +216,8 @@ namespace PKHeX.WinForms { db = SAV switch { + SAV8LA => db.Where(z => z is WA8), + SAV8BS => db.Where(z => z is WB8), SAV8SWSH => db.Where(z => ((PersonalInfoSWSH)PersonalTable.SWSH.GetFormEntry(z.Species, z.Form)).IsPresentInGame), SAV7b => db.Where(z => z is WB7), SAV7 => db.Where(z => z.Generation < 7 || z is WC7), diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.Designer.cs index 65635e807..94273d8e4 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen6/SAV_BoxLayout.Designer.cs @@ -83,7 +83,7 @@ // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(328, 255); + this.B_Save.Location = new System.Drawing.Point(367, 255); this.B_Save.Name = "B_Save"; this.B_Save.Size = new System.Drawing.Size(67, 23); this.B_Save.TabIndex = 9; @@ -94,7 +94,7 @@ // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(328, 284); + this.B_Cancel.Location = new System.Drawing.Point(367, 284); this.B_Cancel.Name = "B_Cancel"; this.B_Cancel.Size = new System.Drawing.Size(67, 23); this.B_Cancel.TabIndex = 10; @@ -109,7 +109,7 @@ this.CB_BG.FormattingEnabled = true; this.CB_BG.Location = new System.Drawing.Point(300, 34); this.CB_BG.Name = "CB_BG"; - this.CB_BG.Size = new System.Drawing.Size(98, 21); + this.CB_BG.Size = new System.Drawing.Size(137, 21); this.CB_BG.TabIndex = 13; this.CB_BG.SelectedIndexChanged += new System.EventHandler(this.ChangeBoxBackground); // @@ -121,7 +121,7 @@ this.PAN_BG.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.PAN_BG.Location = new System.Drawing.Point(126, 61); this.PAN_BG.Name = "PAN_BG"; - this.PAN_BG.Size = new System.Drawing.Size(272, 160); + this.PAN_BG.Size = new System.Drawing.Size(311, 160); this.PAN_BG.TabIndex = 14; // // FLP_Misc @@ -132,7 +132,7 @@ this.FLP_Misc.Controls.Add(this.FLP_Flags); this.FLP_Misc.Location = new System.Drawing.Point(129, 234); this.FLP_Misc.Name = "FLP_Misc"; - this.FLP_Misc.Size = new System.Drawing.Size(193, 73); + this.FLP_Misc.Size = new System.Drawing.Size(232, 73); this.FLP_Misc.TabIndex = 15; // // FLP_Unlocked @@ -141,7 +141,7 @@ this.FLP_Unlocked.Controls.Add(this.CB_Unlocked); this.FLP_Unlocked.Location = new System.Drawing.Point(3, 3); this.FLP_Unlocked.Name = "FLP_Unlocked"; - this.FLP_Unlocked.Size = new System.Drawing.Size(185, 25); + this.FLP_Unlocked.Size = new System.Drawing.Size(215, 25); this.FLP_Unlocked.TabIndex = 16; // // L_Unlocked @@ -168,7 +168,7 @@ this.FLP_Flags.Controls.Add(this.L_Flag); this.FLP_Flags.Location = new System.Drawing.Point(3, 34); this.FLP_Flags.Name = "FLP_Flags"; - this.FLP_Flags.Size = new System.Drawing.Size(185, 25); + this.FLP_Flags.Size = new System.Drawing.Size(215, 25); this.FLP_Flags.TabIndex = 17; // // L_Flag @@ -204,7 +204,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(409, 321); + this.ClientSize = new System.Drawing.Size(448, 321); this.Controls.Add(this.B_Down); this.Controls.Add(this.B_Up); this.Controls.Add(this.FLP_Misc); diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_HallOfFame7.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_HallOfFame7.Designer.cs index fbd8c120a..098547408 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_HallOfFame7.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_HallOfFame7.Designer.cs @@ -54,8 +54,8 @@ this.L_C2 = new System.Windows.Forms.Label(); this.CB_C1 = new System.Windows.Forms.ComboBox(); this.L_C1 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); + this.L_First = new System.Windows.Forms.Label(); + this.L_Current = new System.Windows.Forms.Label(); this.TB_EC = new System.Windows.Forms.TextBox(); this.L_EC = new System.Windows.Forms.Label(); this.SuspendLayout(); @@ -310,23 +310,23 @@ this.L_C1.Text = "PKM 1:"; this.L_C1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label1 + // L_First // - this.label1.Location = new System.Drawing.Point(65, 1); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(124, 23); - this.label1.TabIndex = 0; - this.label1.Text = "First"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.L_First.Location = new System.Drawing.Point(65, 1); + this.L_First.Name = "L_First"; + this.L_First.Size = new System.Drawing.Size(124, 23); + this.L_First.TabIndex = 0; + this.L_First.Text = "First"; + this.L_First.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // label2 + // L_Current // - this.label2.Location = new System.Drawing.Point(258, 1); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(124, 23); - this.label2.TabIndex = 0; - this.label2.Text = "Current"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.L_Current.Location = new System.Drawing.Point(258, 1); + this.L_Current.Name = "L_Current"; + this.L_Current.Size = new System.Drawing.Size(124, 23); + this.L_Current.TabIndex = 0; + this.L_Current.Text = "Current"; + this.L_Current.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // TB_EC // @@ -355,8 +355,8 @@ this.ClientSize = new System.Drawing.Size(394, 201); this.Controls.Add(this.TB_EC); this.Controls.Add(this.L_EC); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); + this.Controls.Add(this.L_Current); + this.Controls.Add(this.L_First); this.Controls.Add(this.CB_C6); this.Controls.Add(this.L_C6); this.Controls.Add(this.CB_C5); @@ -422,8 +422,8 @@ private System.Windows.Forms.Label L_C2; private System.Windows.Forms.ComboBox CB_C1; private System.Windows.Forms.Label L_C1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label L_First; + private System.Windows.Forms.Label L_Current; private System.Windows.Forms.TextBox TB_EC; private System.Windows.Forms.Label L_EC; } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_BlockDump8.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_BlockDump8.cs index 7d62b193e..3dd13345b 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_BlockDump8.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_BlockDump8.cs @@ -11,22 +11,22 @@ namespace PKHeX.WinForms { public partial class SAV_BlockDump8 : Form { - private readonly SAV8SWSH SAV; + private readonly ISCBlockArray SAV; private readonly SCBlockMetadata Metadata; private SCBlock CurrentBlock = null!; - public SAV_BlockDump8(SaveFile sav) + public SAV_BlockDump8(ISCBlockArray sav) { InitializeComponent(); WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage); - SAV = (SAV8SWSH)sav; + SAV = sav; PG_BlockView.Size = RTB_Hex.Size; // Get an external source of names if available. - var extra = GetExtraKeyNames(); - Metadata = new SCBlockMetadata(SAV.Blocks, extra, Main.Settings.Advanced.GetExclusionList8()); + var extra = GetExtraKeyNames(sav); + Metadata = new SCBlockMetadata(SAV.Accessor, extra, Main.Settings.Advanced.GetExclusionList8()); CB_Key.InitializeBinding(); CB_Key.DataSource = Metadata.GetSortedBlockKeyList().ToArray(); @@ -42,16 +42,24 @@ namespace PKHeX.WinForms CB_Key.SelectedIndex = 0; } - private static IEnumerable GetExtraKeyNames() + private static IEnumerable GetExtraKeyNames(ISCBlockArray obj) { - var extra = Main.Settings.Advanced.PathBlockKeyListSWSH; - return File.Exists(extra) ? File.ReadLines(extra) : Array.Empty(); + var extra = Main.Settings.Advanced.PathBlockKeyList; + if (extra.Length != 0 && !Directory.Exists(extra)) + return Array.Empty(); + + var file = Path.Combine(extra, obj.GetType().Name); + file = $"{file}.txt"; + if (!File.Exists(file)) + return Array.Empty(); + + return File.ReadLines(file); } private void CB_Key_SelectedIndexChanged(object sender, EventArgs e) { var key = (uint)WinFormsUtil.GetIndex(CB_Key); - CurrentBlock = SAV.Blocks.GetBlock(key); + CurrentBlock = SAV.Accessor.GetBlock(key); UpdateBlockSummaryControls(); if (CurrentBlock.Type.IsBoolean()) { @@ -158,7 +166,7 @@ namespace PKHeX.WinForms var path = sfd.FileName; - var blocks = SAV.Blocks.BlockInfo; + var blocks = SAV.Accessor.BlockInfo; var option = SCBlockExportOption.None; if (CHK_DataOnly.Checked) option |= SCBlockExportOption.DataOnly; @@ -205,15 +213,15 @@ namespace PKHeX.WinForms return; var s1 = SaveUtil.GetVariantSAV(p1); - if (s1 is not SAV8SWSH w1) + if (s1 is not ISCBlockArray w1) return; var s2 = SaveUtil.GetVariantSAV(p2); - if (s2 is not SAV8SWSH w2) + if (s2 is not ISCBlockArray w2) return; // Get an external source of names if available. - var extra = GetExtraKeyNames(); - var compare = new SCBlockCompare(w1.Blocks, w2.Blocks, extra); + var extra = GetExtraKeyNames(w1); + var compare = new SCBlockCompare(w1.Accessor, w2.Accessor, extra); richTextBox1.Lines = compare.Summary().ToArray(); } diff --git a/PKHeX.WinForms/Subforms/Save Editors/SAV_Inventory.cs b/PKHeX.WinForms/Subforms/Save Editors/SAV_Inventory.cs index 43fcdc80b..8d50fcb11 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/SAV_Inventory.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/SAV_Inventory.cs @@ -99,7 +99,9 @@ namespace PKHeX.WinForms var itemarr = Main.HaX ? itemlist : GetStringsForPouch(pouch.LegalItems); item.Items.AddRange(itemarr); - dgv.Rows.Add(pouch.Items.Length); + var items = pouch.Items; + if (items.Length != 0) + dgv.Rows.Add(items.Length); dgv.CancelEdit(); return dgv; diff --git a/PKHeX.WinForms/Subforms/Save Editors/SAV_SimplePokedex.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/SAV_SimplePokedex.Designer.cs index 31cc5ac4e..3003bc33d 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/SAV_SimplePokedex.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/SAV_SimplePokedex.Designer.cs @@ -34,7 +34,7 @@ this.B_CaughtAll = new System.Windows.Forms.Button(); this.B_SeenNone = new System.Windows.Forms.Button(); this.B_SeenAll = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); + this.Label_Caught = new System.Windows.Forms.Label(); this.CLB_Caught = new System.Windows.Forms.CheckedListBox(); this.Label_Seen = new System.Windows.Forms.Label(); this.CLB_Seen = new System.Windows.Forms.CheckedListBox(); @@ -100,14 +100,14 @@ this.B_SeenAll.UseVisualStyleBackColor = true; this.B_SeenAll.Click += new System.EventHandler(this.B_SeenAll_Click); // - // label2 + // Label_Caught // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(151, 13); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(44, 13); - this.label2.TabIndex = 13; - this.label2.Text = "Caught:"; + this.Label_Caught.AutoSize = true; + this.Label_Caught.Location = new System.Drawing.Point(151, 13); + this.Label_Caught.Name = "Label_Caught"; + this.Label_Caught.Size = new System.Drawing.Size(44, 13); + this.Label_Caught.TabIndex = 13; + this.Label_Caught.Text = "Caught:"; // // CLB_Caught // @@ -147,7 +147,7 @@ this.Controls.Add(this.B_CaughtAll); this.Controls.Add(this.B_SeenNone); this.Controls.Add(this.B_SeenAll); - this.Controls.Add(this.label2); + this.Controls.Add(this.Label_Caught); this.Controls.Add(this.CLB_Caught); this.Controls.Add(this.Label_Seen); this.Controls.Add(this.CLB_Seen); @@ -170,7 +170,7 @@ private System.Windows.Forms.Button B_CaughtAll; private System.Windows.Forms.Button B_SeenNone; private System.Windows.Forms.Button B_SeenAll; - private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label Label_Caught; private System.Windows.Forms.CheckedListBox CLB_Caught; private System.Windows.Forms.Label Label_Seen; private System.Windows.Forms.CheckedListBox CLB_Seen; diff --git a/PKHeX.WinForms/Util/WinFormsUtil.cs b/PKHeX.WinForms/Util/WinFormsUtil.cs index 5823971e8..eb99a50f5 100644 --- a/PKHeX.WinForms/Util/WinFormsUtil.cs +++ b/PKHeX.WinForms/Util/WinFormsUtil.cs @@ -440,9 +440,9 @@ namespace PKHeX.WinForms 7 => GameVersion.GG.Contains(origin) ? "Beluga Gift Record|*.wr7" + all : "Gen7 Mystery Gift|*.wc7;*.wc7full" + all, - 8 => GameVersion.BDSP.Contains(origin) - ? "BD/SP Gift|*.wb8" + all - : "Gen8 Mystery Gift|*.wc8" + all, + 8 when GameVersion.BDSP.Contains(origin) => "BD/SP Gift|*.wb8" + all, + 8 when GameVersion.PLA.Contains(origin) => "Legends: Arceus Gift|*.wa8" + all, + 8 => "Gen8 Mystery Gift|*.wc8" + all, _ => string.Empty, };