diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterGift1.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterGift1.cs index 2f0f462d3..f8ca9efa2 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterGift1.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen1/EncounterGift1.cs @@ -116,6 +116,7 @@ public sealed record EncounterGift1 : IEncounterable, IEncounterMatch, IEncounte CatchRate = Trainer switch { + Stadium when lang == Japanese && Species == (ushort)Core.Species.Psyduck => 167, // can't give a Gorgeous box Stadium => 168, // be nice and give a Gorgeous Box _ => pi.CatchRate, }, @@ -129,7 +130,6 @@ public sealed record EncounterGift1 : IEncounterable, IEncounterMatch, IEncounte OriginalTrainerName = Trainer switch { - Recipient => EncounterUtil.GetTrainerName(tr, (int)lang), Stadium => lang switch { Japanese => StadiumJPN, @@ -140,8 +140,9 @@ public sealed record EncounterGift1 : IEncounterable, IEncounterMatch, IEncounte Spanish => StadiumSPA, _ => StadiumENG, // shouldn't hit here }, + VirtualConsoleMew => lang == Japanese ? VirtualConsoleMewJPN : VirtualConsoleMewINT, EuropeTour => FirstTourOT, // YOSHIRA - _ => string.Empty, + _ => EncounterUtil.GetTrainerName(tr, (int)lang), }, }; @@ -155,7 +156,10 @@ public sealed record EncounterGift1 : IEncounterable, IEncounterMatch, IEncounte if (Language == LanguageRestriction.Japanese) return Japanese; - if (request is not (English or French or Italian or German or Spanish)) + if (Language == LanguageRestriction.International && request is not (English or French or Italian or German or Spanish)) + return English; + + if (request is Hacked or UNUSED_6 or >= Korean) return English; return request; } @@ -219,11 +223,11 @@ public sealed record EncounterGift1 : IEncounterable, IEncounterMatch, IEncounte _ => true, }; - private bool IsTrainerIDValid(ITrainerID16 pk) => Trainer switch + private bool IsTrainerIDValid(PKM pk) => Trainer switch { Recipient => true, VirtualConsoleMew => pk.TID16 == TrainerIDVirtualConsoleMew, - Stadium => pk.TID16 == (Language == LanguageRestriction.Japanese ? TrainerIDStadiumJPN : TrainerIDStadiumINT), + Stadium => pk.TID16 == (pk.Japanese ? TrainerIDStadiumJPN : TrainerIDStadiumINT), _ => true, }; @@ -262,16 +266,20 @@ public sealed record EncounterGift1 : IEncounterable, IEncounterMatch, IEncounte { if (pk is not PK1 pk1) return false; - return !IsCatchRateValid(pk1.CatchRate); + return !IsCatchRateValid(pk1.CatchRate, pk.Japanese); } - private bool IsCatchRateValid(byte rate) + private bool IsCatchRateValid(byte rate, bool jp) { if (ParseSettings.AllowGen1Tradeback && PK1.IsCatchRateHeldItem(rate)) return true; if (Version == GameVersion.Stadium) + { + if (jp && Species == (ushort)Core.Species.Psyduck) + return rate == 167; return rate is 167 or 168; + } var pi = PersonalTable.RB[Species]; return pi.CatchRate == rate; diff --git a/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterGift2.cs b/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterGift2.cs index 9c0e95561..ecfa49f0c 100644 --- a/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterGift2.cs +++ b/PKHeX.Core/Legality/Encounters/Templates/Gen2/EncounterGift2.cs @@ -156,11 +156,13 @@ public sealed record EncounterGift2 return Japanese; if (Language == LanguageRestriction.English) return English; - - if (request is not (English or French or Italian or German or Spanish)) - request = English; - if (request == English && Language == LanguageRestriction.InternationalNotEnglish) + if (Language == LanguageRestriction.International && request is not (English or French or Italian or German or Spanish)) + return English; + if (Language == LanguageRestriction.InternationalNotEnglish && request is not (French or Italian or German or Spanish)) return French; + + if (request is Hacked or UNUSED_6 or >= Korean) + return English; return request; } diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs index f7f135234..3d25dbf4d 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.Designer.cs @@ -232,11 +232,13 @@ namespace PKHeX.WinForms.Controls L_ExtraBytes = new System.Windows.Forms.Label(); CB_ExtraBytes = new System.Windows.Forms.ComboBox(); TB_ExtraByte = new System.Windows.Forms.MaskedTextBox(); + FLP_HomeTracker = new System.Windows.Forms.FlowLayoutPanel(); L_HomeTracker = new System.Windows.Forms.Label(); TB_HomeTracker = new System.Windows.Forms.TextBox(); + FLP_EncryptionConstant = new System.Windows.Forms.FlowLayoutPanel(); Label_EncryptionConstant = new System.Windows.Forms.Label(); - TB_EC = new System.Windows.Forms.TextBox(); BTN_RerollEC = new System.Windows.Forms.Button(); + TB_EC = new System.Windows.Forms.TextBox(); TC_Editor = new VerticalTabControlEntityEditor(); Tab_Main = new System.Windows.Forms.TabPage(); Tab_Met = new System.Windows.Forms.TabPage(); @@ -331,6 +333,8 @@ namespace PKHeX.WinForms.Controls FLP_HT.SuspendLayout(); FLP_HTLanguage.SuspendLayout(); FLP_ExtraBytes.SuspendLayout(); + FLP_HomeTracker.SuspendLayout(); + FLP_EncryptionConstant.SuspendLayout(); TC_Editor.SuspendLayout(); SuspendLayout(); // @@ -506,8 +510,8 @@ namespace PKHeX.WinForms.Controls // // UC_Gender // - UC_Gender.AccessibleDescription = "Entity Gender Pane"; - UC_Gender.AccessibleName = "Entity Gender Pane"; + UC_Gender.AccessibleDescription = "Entity Gender Pane (0) (0)"; + UC_Gender.AccessibleName = "Entity Gender Pane (0) (0)"; UC_Gender.AccessibleRole = System.Windows.Forms.AccessibleRole.Graphic; UC_Gender.AllowClick = false; UC_Gender.BackgroundImage = (System.Drawing.Image)resources.GetObject("UC_Gender.BackgroundImage"); @@ -628,7 +632,6 @@ namespace PKHeX.WinForms.Controls TB_Nickname.Name = "TB_Nickname"; TB_Nickname.Size = new System.Drawing.Size(144, 23); TB_Nickname.TabIndex = 5; - TB_Nickname.TextChanged += UpdateIsNicknamed; TB_Nickname.TextChanged += RefreshFontWarningButton; TB_Nickname.MouseDown += UpdateNicknameClick; // @@ -2439,11 +2442,8 @@ namespace PKHeX.WinForms.Controls FLP_OTMisc.Controls.Add(FLP_HT); FLP_OTMisc.Controls.Add(FLP_HTLanguage); FLP_OTMisc.Controls.Add(FLP_ExtraBytes); - FLP_OTMisc.Controls.Add(L_HomeTracker); - FLP_OTMisc.Controls.Add(TB_HomeTracker); - FLP_OTMisc.Controls.Add(Label_EncryptionConstant); - FLP_OTMisc.Controls.Add(TB_EC); - FLP_OTMisc.Controls.Add(BTN_RerollEC); + FLP_OTMisc.Controls.Add(FLP_HomeTracker); + FLP_OTMisc.Controls.Add(FLP_EncryptionConstant); FLP_OTMisc.Dock = System.Windows.Forms.DockStyle.Fill; FLP_OTMisc.Location = new System.Drawing.Point(0, 0); FLP_OTMisc.Name = "FLP_OTMisc"; @@ -2506,8 +2506,8 @@ namespace PKHeX.WinForms.Controls // // UC_OTGender // - UC_OTGender.AccessibleDescription = "Trainer Gender Pane"; - UC_OTGender.AccessibleName = "Trainer Gender Pane"; + UC_OTGender.AccessibleDescription = "Trainer Gender Pane (0) (0)"; + UC_OTGender.AccessibleName = "Trainer Gender Pane (0) (0)"; UC_OTGender.AccessibleRole = System.Windows.Forms.AccessibleRole.Graphic; UC_OTGender.AllowClick = true; UC_OTGender.BackgroundImage = (System.Drawing.Image)resources.GetObject("UC_OTGender.BackgroundImage"); @@ -2714,8 +2714,8 @@ namespace PKHeX.WinForms.Controls // // UC_HTGender // - UC_HTGender.AccessibleDescription = "Handling Trainer Gender Pane"; - UC_HTGender.AccessibleName = "Handling Trainer Gender Pane"; + UC_HTGender.AccessibleDescription = "Handling Trainer Gender Pane (0) (0)"; + UC_HTGender.AccessibleName = "Handling Trainer Gender Pane (0) (0)"; UC_HTGender.AccessibleRole = System.Windows.Forms.AccessibleRole.Graphic; UC_HTGender.AllowClick = true; UC_HTGender.BackgroundImage = (System.Drawing.Image)resources.GetObject("UC_HTGender.BackgroundImage"); @@ -2802,9 +2802,20 @@ namespace PKHeX.WinForms.Controls TB_ExtraByte.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; TB_ExtraByte.Validated += UpdateExtraByteValue; // + // FLP_HomeTracker + // + FLP_HomeTracker.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + FLP_HomeTracker.Controls.Add(L_HomeTracker); + FLP_HomeTracker.Controls.Add(TB_HomeTracker); + FLP_HomeTracker.Location = new System.Drawing.Point(0, 336); + FLP_HomeTracker.Margin = new System.Windows.Forms.Padding(0); + FLP_HomeTracker.Name = "FLP_HomeTracker"; + FLP_HomeTracker.Size = new System.Drawing.Size(272, 24); + FLP_HomeTracker.TabIndex = 49; + // // L_HomeTracker // - L_HomeTracker.Location = new System.Drawing.Point(0, 336); + L_HomeTracker.Location = new System.Drawing.Point(0, 0); L_HomeTracker.Margin = new System.Windows.Forms.Padding(0); L_HomeTracker.Name = "L_HomeTracker"; L_HomeTracker.Size = new System.Drawing.Size(128, 24); @@ -2816,7 +2827,7 @@ namespace PKHeX.WinForms.Controls // TB_HomeTracker.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; TB_HomeTracker.Font = new System.Drawing.Font("Courier New", 8.25F); - TB_HomeTracker.Location = new System.Drawing.Point(128, 338); + TB_HomeTracker.Location = new System.Drawing.Point(128, 2); TB_HomeTracker.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0); TB_HomeTracker.MaxLength = 16; TB_HomeTracker.Name = "TB_HomeTracker"; @@ -2825,9 +2836,21 @@ namespace PKHeX.WinForms.Controls TB_HomeTracker.TabIndex = 31; TB_HomeTracker.Validated += Update_ID64; // + // FLP_EncryptionConstant + // + FLP_EncryptionConstant.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + FLP_EncryptionConstant.Controls.Add(Label_EncryptionConstant); + FLP_EncryptionConstant.Controls.Add(BTN_RerollEC); + FLP_EncryptionConstant.Controls.Add(TB_EC); + FLP_EncryptionConstant.Location = new System.Drawing.Point(0, 360); + FLP_EncryptionConstant.Margin = new System.Windows.Forms.Padding(0); + FLP_EncryptionConstant.Name = "FLP_EncryptionConstant"; + FLP_EncryptionConstant.Size = new System.Drawing.Size(272, 24); + FLP_EncryptionConstant.TabIndex = 50; + // // Label_EncryptionConstant // - Label_EncryptionConstant.Location = new System.Drawing.Point(0, 360); + Label_EncryptionConstant.Location = new System.Drawing.Point(0, 0); Label_EncryptionConstant.Margin = new System.Windows.Forms.Padding(0); Label_EncryptionConstant.Name = "Label_EncryptionConstant"; Label_EncryptionConstant.Size = new System.Drawing.Size(128, 24); @@ -2835,23 +2858,10 @@ namespace PKHeX.WinForms.Controls Label_EncryptionConstant.Text = "Encryption Constant:"; Label_EncryptionConstant.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // TB_EC - // - TB_EC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - TB_EC.Font = new System.Drawing.Font("Courier New", 8.25F); - TB_EC.Location = new System.Drawing.Point(128, 362); - TB_EC.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0); - TB_EC.MaxLength = 8; - TB_EC.Name = "TB_EC"; - TB_EC.PlaceholderText = "12345678"; - TB_EC.Size = new System.Drawing.Size(64, 20); - TB_EC.TabIndex = 33; - TB_EC.Validated += Update_ID; - // // BTN_RerollEC // BTN_RerollEC.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F); - BTN_RerollEC.Location = new System.Drawing.Point(192, 360); + BTN_RerollEC.Location = new System.Drawing.Point(128, 0); BTN_RerollEC.Margin = new System.Windows.Forms.Padding(0); BTN_RerollEC.Name = "BTN_RerollEC"; BTN_RerollEC.Size = new System.Drawing.Size(56, 24); @@ -2860,6 +2870,19 @@ namespace PKHeX.WinForms.Controls BTN_RerollEC.UseVisualStyleBackColor = true; BTN_RerollEC.Click += UpdateRandomEC; // + // TB_EC + // + TB_EC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + TB_EC.Font = new System.Drawing.Font("Courier New", 8.25F); + TB_EC.Location = new System.Drawing.Point(184, 2); + TB_EC.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0); + TB_EC.MaxLength = 8; + TB_EC.Name = "TB_EC"; + TB_EC.PlaceholderText = "12345678"; + TB_EC.Size = new System.Drawing.Size(64, 20); + TB_EC.TabIndex = 33; + TB_EC.Validated += Update_ID; + // // TC_Editor // TC_Editor.Alignment = System.Windows.Forms.TabAlignment.Right; @@ -3045,7 +3068,6 @@ namespace PKHeX.WinForms.Controls ((System.ComponentModel.ISupportInitialize)PB_BattleVersion).EndInit(); Hidden_OTMisc.ResumeLayout(false); FLP_OTMisc.ResumeLayout(false); - FLP_OTMisc.PerformLayout(); FLP_OT.ResumeLayout(false); FLP_OT.PerformLayout(); FLP_Country.ResumeLayout(false); @@ -3057,6 +3079,10 @@ namespace PKHeX.WinForms.Controls FLP_HTLanguage.ResumeLayout(false); FLP_ExtraBytes.ResumeLayout(false); FLP_ExtraBytes.PerformLayout(); + FLP_HomeTracker.ResumeLayout(false); + FLP_HomeTracker.PerformLayout(); + FLP_EncryptionConstant.ResumeLayout(false); + FLP_EncryptionConstant.PerformLayout(); TC_Editor.ResumeLayout(false); ResumeLayout(false); } @@ -3278,5 +3304,7 @@ namespace PKHeX.WinForms.Controls private global::System.Windows.Forms.PictureBox PB_Affixed; private System.Windows.Forms.Button BTN_NicknameWarn; private System.Windows.Forms.Button BTN_OTNameWarn; + private System.Windows.Forms.FlowLayoutPanel FLP_HomeTracker; + private System.Windows.Forms.FlowLayoutPanel FLP_EncryptionConstant; } } diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs index 6cda265b3..9c44771b0 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.cs @@ -1938,9 +1938,9 @@ public sealed partial class PKMEditor : UserControl, IMainEditor private void ToggleSecrets(bool hidden, byte format) { - Label_EncryptionConstant.Visible = BTN_RerollEC.Visible = TB_EC.Visible = format >= 6 && !hidden; + FLP_EncryptionConstant.Visible = format >= 6 && !hidden; BTN_RerollPID.Visible = Label_PID.Visible = TB_PID.Visible = format >= 3 && !hidden; - TB_HomeTracker.Visible = L_HomeTracker.Visible = format >= 8 && !hidden; + FLP_HomeTracker.Visible = format >= 8 && !hidden; } private void ToggleInterface(byte format) diff --git a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.resx b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.resx index d2a094ee9..6765bcea6 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.resx +++ b/PKHeX.WinForms/Controls/PKM Editor/PKMEditor.resx @@ -1,4 +1,64 @@ - + + + diff --git a/PKHeX.WinForms/Controls/PKM Editor/VerticalTabControl.cs b/PKHeX.WinForms/Controls/PKM Editor/VerticalTabControl.cs index 658cb9197..5e785d048 100644 --- a/PKHeX.WinForms/Controls/PKM Editor/VerticalTabControl.cs +++ b/PKHeX.WinForms/Controls/PKM Editor/VerticalTabControl.cs @@ -19,6 +19,8 @@ public class VerticalTabControl : TabControl protected override void OnDrawItem(DrawItemEventArgs e) { var index = e.Index; + if ((uint)index >= TabPages.Count) + return; var bounds = GetTabRect(index); var graphics = e.Graphics; @@ -69,6 +71,8 @@ public sealed class VerticalTabControlEntityEditor : VerticalTabControl protected override void OnDrawItem(DrawItemEventArgs e) { var index = e.Index; + if ((uint)index >= TabPages.Count) + return; var bounds = GetTabRect(index); var graphics = e.Graphics;