Misc tweaks

Gen1 VC mew OT name set
Gen1 Japanese stadium language get
Tab control edge case index redraw
Home Tracker & EC control ordering now grouped by flowlayout panel
This commit is contained in:
Kurt 2024-03-10 21:28:50 -05:00
parent c432c56ca5
commit 8e32ab5008
6 changed files with 147 additions and 45 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}
}

View file

@ -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)

View file

@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View file

@ -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;