Code cleanup

Removing the majority of Public usage of methods within the main cs form
This commit is contained in:
Kurt
2014-12-23 23:29:57 -08:00
parent 60b264d9b0
commit 4d53c00668
7 changed files with 176 additions and 200 deletions

View File

@@ -19,9 +19,11 @@ public partial class CodeGenerator : Form
PKX.SaveGames.SaveStruct SaveGame = new PKX.SaveGames.SaveStruct(null);
Form1 m_parent;
public CodeGenerator(Form1 frm1)
byte[] tabdata = null;
public CodeGenerator(Form1 frm1, byte[] formdata)
{
m_parent = frm1;
tabdata = formdata;
InitializeComponent();
this.CenterToParent();
RTB_Code.Clear();
@@ -39,9 +41,9 @@ private bool loaddata()
{
if (CB_Source.SelectedIndex == 0)
{
if (m_parent.verifiedpkx())
if (tabdata != null)
{
byte[] pkx = m_parent.preparepkx(m_parent.buff);
byte[] pkx = tabdata;
newdata = new byte[232];
Array.Copy(PKX.encryptArray(pkx), newdata, 232);
}

View File

@@ -2253,7 +2253,7 @@ public void InitializeComponent()
this.BTN_History.TabIndex = 15;
this.BTN_History.Text = "Memories/Amie";
this.BTN_History.UseVisualStyleBackColor = true;
this.BTN_History.Click += new System.EventHandler(this.openhistory);
this.BTN_History.Click += new System.EventHandler(this.openHistory);
//
// BTN_Ribbons
//
@@ -2263,7 +2263,7 @@ public void InitializeComponent()
this.BTN_Ribbons.TabIndex = 14;
this.BTN_Ribbons.Text = "Ribbons/Medals";
this.BTN_Ribbons.UseVisualStyleBackColor = true;
this.BTN_Ribbons.Click += new System.EventHandler(this.openribbons);
this.BTN_Ribbons.Click += new System.EventHandler(this.openRibbons);
//
// GB_Markings
//
@@ -2787,7 +2787,7 @@ public void InitializeComponent()
this.bpkx30.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx30.TabIndex = 59;
this.bpkx30.TabStop = false;
this.bpkx30.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx30.Click += new System.EventHandler(this.clickSlot);
this.bpkx30.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx30.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx30.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2801,7 +2801,7 @@ public void InitializeComponent()
this.bpkx29.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx29.TabIndex = 58;
this.bpkx29.TabStop = false;
this.bpkx29.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx29.Click += new System.EventHandler(this.clickSlot);
this.bpkx29.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx29.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx29.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2815,7 +2815,7 @@ public void InitializeComponent()
this.bpkx28.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx28.TabIndex = 57;
this.bpkx28.TabStop = false;
this.bpkx28.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx28.Click += new System.EventHandler(this.clickSlot);
this.bpkx28.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx28.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx28.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2829,7 +2829,7 @@ public void InitializeComponent()
this.bpkx27.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx27.TabIndex = 56;
this.bpkx27.TabStop = false;
this.bpkx27.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx27.Click += new System.EventHandler(this.clickSlot);
this.bpkx27.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx27.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx27.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2843,7 +2843,7 @@ public void InitializeComponent()
this.bpkx26.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx26.TabIndex = 55;
this.bpkx26.TabStop = false;
this.bpkx26.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx26.Click += new System.EventHandler(this.clickSlot);
this.bpkx26.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx26.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx26.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2857,7 +2857,7 @@ public void InitializeComponent()
this.bpkx25.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx25.TabIndex = 54;
this.bpkx25.TabStop = false;
this.bpkx25.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx25.Click += new System.EventHandler(this.clickSlot);
this.bpkx25.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx25.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx25.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2871,7 +2871,7 @@ public void InitializeComponent()
this.bpkx24.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx24.TabIndex = 53;
this.bpkx24.TabStop = false;
this.bpkx24.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx24.Click += new System.EventHandler(this.clickSlot);
this.bpkx24.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx24.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx24.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2885,7 +2885,7 @@ public void InitializeComponent()
this.bpkx23.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx23.TabIndex = 52;
this.bpkx23.TabStop = false;
this.bpkx23.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx23.Click += new System.EventHandler(this.clickSlot);
this.bpkx23.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx23.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx23.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2899,7 +2899,7 @@ public void InitializeComponent()
this.bpkx22.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx22.TabIndex = 51;
this.bpkx22.TabStop = false;
this.bpkx22.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx22.Click += new System.EventHandler(this.clickSlot);
this.bpkx22.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx22.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx22.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2913,7 +2913,7 @@ public void InitializeComponent()
this.bpkx21.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx21.TabIndex = 50;
this.bpkx21.TabStop = false;
this.bpkx21.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx21.Click += new System.EventHandler(this.clickSlot);
this.bpkx21.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx21.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx21.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2927,7 +2927,7 @@ public void InitializeComponent()
this.bpkx20.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx20.TabIndex = 49;
this.bpkx20.TabStop = false;
this.bpkx20.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx20.Click += new System.EventHandler(this.clickSlot);
this.bpkx20.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx20.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx20.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2941,7 +2941,7 @@ public void InitializeComponent()
this.bpkx19.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx19.TabIndex = 48;
this.bpkx19.TabStop = false;
this.bpkx19.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx19.Click += new System.EventHandler(this.clickSlot);
this.bpkx19.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx19.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx19.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2955,7 +2955,7 @@ public void InitializeComponent()
this.bpkx18.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx18.TabIndex = 47;
this.bpkx18.TabStop = false;
this.bpkx18.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx18.Click += new System.EventHandler(this.clickSlot);
this.bpkx18.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx18.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx18.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2969,7 +2969,7 @@ public void InitializeComponent()
this.bpkx17.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx17.TabIndex = 46;
this.bpkx17.TabStop = false;
this.bpkx17.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx17.Click += new System.EventHandler(this.clickSlot);
this.bpkx17.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx17.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx17.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2983,7 +2983,7 @@ public void InitializeComponent()
this.bpkx16.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx16.TabIndex = 45;
this.bpkx16.TabStop = false;
this.bpkx16.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx16.Click += new System.EventHandler(this.clickSlot);
this.bpkx16.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx16.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx16.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -2997,7 +2997,7 @@ public void InitializeComponent()
this.bpkx15.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx15.TabIndex = 44;
this.bpkx15.TabStop = false;
this.bpkx15.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx15.Click += new System.EventHandler(this.clickSlot);
this.bpkx15.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx15.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx15.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3011,7 +3011,7 @@ public void InitializeComponent()
this.bpkx14.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx14.TabIndex = 43;
this.bpkx14.TabStop = false;
this.bpkx14.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx14.Click += new System.EventHandler(this.clickSlot);
this.bpkx14.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx14.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx14.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3025,7 +3025,7 @@ public void InitializeComponent()
this.bpkx13.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx13.TabIndex = 42;
this.bpkx13.TabStop = false;
this.bpkx13.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx13.Click += new System.EventHandler(this.clickSlot);
this.bpkx13.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx13.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx13.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3039,7 +3039,7 @@ public void InitializeComponent()
this.bpkx12.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx12.TabIndex = 41;
this.bpkx12.TabStop = false;
this.bpkx12.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx12.Click += new System.EventHandler(this.clickSlot);
this.bpkx12.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx12.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx12.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3053,7 +3053,7 @@ public void InitializeComponent()
this.bpkx11.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx11.TabIndex = 40;
this.bpkx11.TabStop = false;
this.bpkx11.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx11.Click += new System.EventHandler(this.clickSlot);
this.bpkx11.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx11.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx11.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3067,7 +3067,7 @@ public void InitializeComponent()
this.bpkx10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx10.TabIndex = 39;
this.bpkx10.TabStop = false;
this.bpkx10.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx10.Click += new System.EventHandler(this.clickSlot);
this.bpkx10.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx10.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx10.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3081,7 +3081,7 @@ public void InitializeComponent()
this.bpkx9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx9.TabIndex = 38;
this.bpkx9.TabStop = false;
this.bpkx9.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx9.Click += new System.EventHandler(this.clickSlot);
this.bpkx9.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx9.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx9.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3095,7 +3095,7 @@ public void InitializeComponent()
this.bpkx8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx8.TabIndex = 37;
this.bpkx8.TabStop = false;
this.bpkx8.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx8.Click += new System.EventHandler(this.clickSlot);
this.bpkx8.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx8.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx8.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3109,7 +3109,7 @@ public void InitializeComponent()
this.bpkx7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx7.TabIndex = 36;
this.bpkx7.TabStop = false;
this.bpkx7.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx7.Click += new System.EventHandler(this.clickSlot);
this.bpkx7.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx7.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx7.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3123,7 +3123,7 @@ public void InitializeComponent()
this.bpkx6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx6.TabIndex = 35;
this.bpkx6.TabStop = false;
this.bpkx6.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx6.Click += new System.EventHandler(this.clickSlot);
this.bpkx6.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx6.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3137,7 +3137,7 @@ public void InitializeComponent()
this.bpkx5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx5.TabIndex = 34;
this.bpkx5.TabStop = false;
this.bpkx5.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx5.Click += new System.EventHandler(this.clickSlot);
this.bpkx5.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx5.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3151,7 +3151,7 @@ public void InitializeComponent()
this.bpkx4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx4.TabIndex = 33;
this.bpkx4.TabStop = false;
this.bpkx4.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx4.Click += new System.EventHandler(this.clickSlot);
this.bpkx4.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx4.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3165,7 +3165,7 @@ public void InitializeComponent()
this.bpkx3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx3.TabIndex = 32;
this.bpkx3.TabStop = false;
this.bpkx3.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx3.Click += new System.EventHandler(this.clickSlot);
this.bpkx3.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx3.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3179,7 +3179,7 @@ public void InitializeComponent()
this.bpkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx2.TabIndex = 31;
this.bpkx2.TabStop = false;
this.bpkx2.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx2.Click += new System.EventHandler(this.clickSlot);
this.bpkx2.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx2.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3193,7 +3193,7 @@ public void InitializeComponent()
this.bpkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.bpkx1.TabIndex = 30;
this.bpkx1.TabStop = false;
this.bpkx1.Click += new System.EventHandler(this.slotModifier_Click);
this.bpkx1.Click += new System.EventHandler(this.clickSlot);
this.bpkx1.DragDrop += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragDrop);
this.bpkx1.DragEnter += new System.Windows.Forms.DragEventHandler(this.pbBoxSlot_DragEnter);
this.bpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
@@ -3300,7 +3300,7 @@ public void InitializeComponent()
this.bbpkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.bbpkx1.TabIndex = 8;
this.bbpkx1.TabStop = false;
this.bbpkx1.Click += new System.EventHandler(this.slotModifier_Click);
this.bbpkx1.Click += new System.EventHandler(this.clickSlot);
this.bbpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// bbpkx2
@@ -3311,7 +3311,7 @@ public void InitializeComponent()
this.bbpkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.bbpkx2.TabIndex = 9;
this.bbpkx2.TabStop = false;
this.bbpkx2.Click += new System.EventHandler(this.slotModifier_Click);
this.bbpkx2.Click += new System.EventHandler(this.clickSlot);
this.bbpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// bbpkx3
@@ -3322,7 +3322,7 @@ public void InitializeComponent()
this.bbpkx3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.bbpkx3.TabIndex = 10;
this.bbpkx3.TabStop = false;
this.bbpkx3.Click += new System.EventHandler(this.slotModifier_Click);
this.bbpkx3.Click += new System.EventHandler(this.clickSlot);
this.bbpkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// bbpkx4
@@ -3333,7 +3333,7 @@ public void InitializeComponent()
this.bbpkx4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.bbpkx4.TabIndex = 11;
this.bbpkx4.TabStop = false;
this.bbpkx4.Click += new System.EventHandler(this.slotModifier_Click);
this.bbpkx4.Click += new System.EventHandler(this.clickSlot);
this.bbpkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// bbpkx5
@@ -3344,7 +3344,7 @@ public void InitializeComponent()
this.bbpkx5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.bbpkx5.TabIndex = 12;
this.bbpkx5.TabStop = false;
this.bbpkx5.Click += new System.EventHandler(this.slotModifier_Click);
this.bbpkx5.Click += new System.EventHandler(this.clickSlot);
this.bbpkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// bbpkx6
@@ -3355,7 +3355,7 @@ public void InitializeComponent()
this.bbpkx6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.bbpkx6.TabIndex = 13;
this.bbpkx6.TabStop = false;
this.bbpkx6.Click += new System.EventHandler(this.slotModifier_Click);
this.bbpkx6.Click += new System.EventHandler(this.clickSlot);
this.bbpkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// L_ReadOnlyPBB
@@ -3409,7 +3409,7 @@ public void InitializeComponent()
this.ppkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.ppkx1.TabIndex = 2;
this.ppkx1.TabStop = false;
this.ppkx1.Click += new System.EventHandler(this.slotModifier_Click);
this.ppkx1.Click += new System.EventHandler(this.clickSlot);
this.ppkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// ppkx2
@@ -3420,7 +3420,7 @@ public void InitializeComponent()
this.ppkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.ppkx2.TabIndex = 3;
this.ppkx2.TabStop = false;
this.ppkx2.Click += new System.EventHandler(this.slotModifier_Click);
this.ppkx2.Click += new System.EventHandler(this.clickSlot);
this.ppkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// ppkx3
@@ -3431,7 +3431,7 @@ public void InitializeComponent()
this.ppkx3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.ppkx3.TabIndex = 4;
this.ppkx3.TabStop = false;
this.ppkx3.Click += new System.EventHandler(this.slotModifier_Click);
this.ppkx3.Click += new System.EventHandler(this.clickSlot);
this.ppkx3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// ppkx4
@@ -3442,7 +3442,7 @@ public void InitializeComponent()
this.ppkx4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.ppkx4.TabIndex = 5;
this.ppkx4.TabStop = false;
this.ppkx4.Click += new System.EventHandler(this.slotModifier_Click);
this.ppkx4.Click += new System.EventHandler(this.clickSlot);
this.ppkx4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// ppkx5
@@ -3453,7 +3453,7 @@ public void InitializeComponent()
this.ppkx5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.ppkx5.TabIndex = 6;
this.ppkx5.TabStop = false;
this.ppkx5.Click += new System.EventHandler(this.slotModifier_Click);
this.ppkx5.Click += new System.EventHandler(this.clickSlot);
this.ppkx5.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// ppkx6
@@ -3464,7 +3464,7 @@ public void InitializeComponent()
this.ppkx6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.ppkx6.TabIndex = 7;
this.ppkx6.TabStop = false;
this.ppkx6.Click += new System.EventHandler(this.slotModifier_Click);
this.ppkx6.Click += new System.EventHandler(this.clickSlot);
this.ppkx6.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// Tab_Other
@@ -3593,7 +3593,7 @@ public void InitializeComponent()
this.dcpkx2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.dcpkx2.TabIndex = 11;
this.dcpkx2.TabStop = false;
this.dcpkx2.Click += new System.EventHandler(this.slotModifier_Click);
this.dcpkx2.Click += new System.EventHandler(this.clickSlot);
this.dcpkx2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// dcpkx1
@@ -3605,7 +3605,7 @@ public void InitializeComponent()
this.dcpkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.dcpkx1.TabIndex = 10;
this.dcpkx1.TabStop = false;
this.dcpkx1.Click += new System.EventHandler(this.slotModifier_Click);
this.dcpkx1.Click += new System.EventHandler(this.clickSlot);
this.dcpkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// DayCare_HasEgg
@@ -3638,7 +3638,7 @@ public void InitializeComponent()
this.gtspkx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.gtspkx.TabIndex = 23;
this.gtspkx.TabStop = false;
this.gtspkx.Click += new System.EventHandler(this.slotModifier_Click);
this.gtspkx.Click += new System.EventHandler(this.clickSlot);
this.gtspkx.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// GB_Fused
@@ -3660,7 +3660,7 @@ public void InitializeComponent()
this.fusedpkx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.fusedpkx.TabIndex = 24;
this.fusedpkx.TabStop = false;
this.fusedpkx.Click += new System.EventHandler(this.slotModifier_Click);
this.fusedpkx.Click += new System.EventHandler(this.clickSlot);
this.fusedpkx.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// L_ReadOnlyOther
@@ -3694,7 +3694,7 @@ public void InitializeComponent()
this.subepkx1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.subepkx1.TabIndex = 18;
this.subepkx1.TabStop = false;
this.subepkx1.Click += new System.EventHandler(this.slotModifier_Click);
this.subepkx1.Click += new System.EventHandler(this.clickSlot);
this.subepkx1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbBoxSlot_MouseDown);
//
// subepkx2

View File

@@ -189,6 +189,7 @@ public Form1()
public string SDFLoc = null;
public static bool HaX = false;
public static bool specialChars = false; // Open Form Tracking
public static Color defaultControlWhite;
public static Color defaultControlText;
public static int colorizedbox = 32;
@@ -271,7 +272,7 @@ private void mainMenuOpen(object sender, EventArgs e)
}
private void mainMenuSave(object sender, EventArgs e)
{
if (!verifiedpkx()) { return; }
if (!verifiedPKX()) { return; }
SavePKX.FileName = TB_Nickname.Text + " - " + TB_PID.Text;
DialogResult result = SavePKX.ShowDialog();
if (result == DialogResult.OK) // Test result.
@@ -327,7 +328,9 @@ private void mainMenuWiden(object sender, EventArgs e)
private void mainMenuCodeGen(object sender, EventArgs e)
{
// Open Code Generator
CodeGenerator CodeGen = new PKHeX.CodeGenerator(this);
byte[] formdata = null;
if (verifiedPKX()) formdata = preparepkx(buff);
CodeGenerator CodeGen = new PKHeX.CodeGenerator(this, formdata);
CodeGen.ShowDialog();
byte[] data = CodeGen.returnArray;
if (data != null)
@@ -741,7 +744,7 @@ private void InitializeFields()
CB_PPu1.SelectedIndex = CB_PPu2.SelectedIndex = CB_PPu3.SelectedIndex = CB_PPu4.SelectedIndex = 0;
CB_Ball.SelectedIndex = 0;
CB_Country.SelectedIndex = 0;
updateAbilityList(TB_AbilityNumber, Util.getIndex(CB_Species), CB_Ability, CB_Form);
setAbilityList(TB_AbilityNumber, Util.getIndex(CB_Species), CB_Ability, CB_Form);
}
}
private void InitializeLanguage()
@@ -917,13 +920,22 @@ private void populateFields(byte[] buff)
nicknamestr = Regex.Replace(nicknamestr, "\uE08F", "\u2640");
nicknamestr = Regex.Replace(nicknamestr, "\uE08E", "\u2642");
}
populateMarkings(markings);
// Set Markings
CHK_Circle.Checked = ((markings >> 0) & 1) == 1;
CHK_Triangle.Checked = ((markings >> 1) & 1) == 1;
CHK_Square.Checked = ((markings >> 2) & 1) == 1;
CHK_Heart.Checked = ((markings >> 3) & 1) == 1;
CHK_Star.Checked = ((markings >> 4) & 1) == 1;
CHK_Diamond.Checked = ((markings >> 5) & 1) == 1;
// Set Generic Identification Data
TB_PID.Text = PID.ToString("X8");
CB_Species.SelectedValue = species;
CB_HeldItem.SelectedValue = helditem;
updateAbilityList(TB_AbilityNumber, species, CB_Ability, CB_Form);
setAbilityList(TB_AbilityNumber, species, CB_Ability, CB_Form);
TB_AbilityNumber.Text = abilitynum.ToString();
CB_Ability.SelectedIndex = (abilitynum < 6) ? abilitynum >> 1 : 0; // error handling
CB_Ability.SelectedIndex = (abilitynum < 6) ? abilitynum >> 1 : 0; // with some simple error handling
CB_Nature.SelectedValue = nature;
TB_EXP.Text = exp.ToString();
@@ -956,12 +968,9 @@ private void populateFields(byte[] buff)
CB_EncounterType.SelectedValue = encountertype;
CB_Ball.SelectedValue = ball;
if (met_month == 0)
{ met_month = 1; }
if (met_day == 0)
{ met_day = 1; }
try
{ CAL_MetDate.Value = new DateTime(met_year + 2000, met_month, met_day); }
if (met_month == 0) { met_month = 1; }
if (met_day == 0) { met_day = 1; }
try { CAL_MetDate.Value = new DateTime(met_year + 2000, met_month, met_day); }
catch { CAL_MetDate.Value = new DateTime(2000, 1, 1); }
if (eggloc != 0)
@@ -971,16 +980,14 @@ private void populateFields(byte[] buff)
GB_EggConditions.Enabled = true;
CB_EggLocation.SelectedValue = eggloc;
try
{ CAL_EggDate.Value = new DateTime(egg_year + 2000, egg_month, egg_day); }
try { CAL_EggDate.Value = new DateTime(egg_year + 2000, egg_month, egg_day); }
catch { CAL_MetDate.Value = new DateTime(2000, 1, 1); }
}
else { CHK_AsEgg.Checked = GB_EggConditions.Enabled = false; CB_EggLocation.SelectedValue = 0; }
CB_MetLocation.SelectedValue = metloc;
if (notOTG) Label_CTGender.Text = gendersymbols[1];
else Label_CTGender.Text = gendersymbols[0];
Label_CTGender.Text = (notOTG) ? gendersymbols[1] : gendersymbols[0];
if (TB_OTt2.Text == "") Label_CTGender.Text = "";
TB_MetLevel.Text = metlevel.ToString();
@@ -1071,40 +1078,28 @@ private void populateFields(byte[] buff)
}
getQuickFiller(dragout);
}
private void populateMarkings(int markings)
// General Use Functions shared by other Forms
public void setCountrySubRegion(object sender, string type)
{
int m1 = ((markings) & 1);
int m2 = ((markings >> 1) & 1);
int m3 = ((markings >> 2) & 1);
int m4 = ((markings >> 3) & 1);
int m5 = ((markings >> 4) & 1);
int m6 = ((markings >> 5) & 1);
ComboBox CB = sender as ComboBox;
int index = Util.getIndex(CB);
// fix for Korean / Chinese being swapped
string cl = curlanguage + "";
cl = (cl == "zh") ? "ko" : (cl == "ko") ? "zh" : cl;
CHK_Circle.Checked = Convert.ToBoolean(m1);
CHK_Triangle.Checked = Convert.ToBoolean(m2);
CHK_Square.Checked = Convert.ToBoolean(m3);
CHK_Heart.Checked = Convert.ToBoolean(m4);
CHK_Star.Checked = Convert.ToBoolean(m5);
CHK_Diamond.Checked = Convert.ToBoolean(m6);
}
// PKX Data Calculation Functions //
private void setIsShiny()
{
bool isShiny = PKX.getIsShiny(Util.getHEXval(TB_PID),Util.ToUInt32(TB_TID.Text),Util.ToUInt32(TB_SID.Text));
// Set the Controls
BTN_Shinytize.Visible = BTN_Shinytize.Enabled = !isShiny;
Label_IsShiny.Visible = isShiny;
CB.DataSource = Util.getCBList(type, cl);
CB.DisplayMember = "Text";
CB.ValueMember = "Value";
// Refresh Markings (for Shiny Star if applicable)
setMarkings();
if (index > 0 && index <= CB.Items.Count)
CB.SelectedValue = index;
}
public void setForms(int species, ComboBox cb)
{
// Form Tables
//
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(species);
var form_list = new[] { new { Text = "", Value = 0}, };
var form_list = new[] { new { Text = "", Value = 0 }, };
if (MonData.AltFormCount == 0)
{
cb.DataSource = form_list;
@@ -1272,7 +1267,7 @@ public void setForms(int species, ComboBox cb)
new { Text = forms[899], Value = 7 }, // La Reine
new { Text = forms[900], Value = 8 }, // Kabuki
new { Text = forms[901], Value = 9 }, // Pharaoh
};
};
var form_aegislash = new[] {
new { Text = forms[681], Value = 0 }, // Shield
new { Text = forms[903], Value = 1 }, // Blade
@@ -1343,7 +1338,7 @@ public void setForms(int species, ComboBox cb)
// ORAS
015, 018, 080, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 384, 428, 475, 531, 719,
};
if (Array.IndexOf(mspec,species) > -1)
if (Array.IndexOf(mspec, species) > -1)
{
cb.DataSource = form_mega;
cb.Enabled = true; // Mega Form Selection
@@ -1394,6 +1389,37 @@ public void setForms(int species, ComboBox cb)
cb.DataSource = form_list;
cb.Enabled = true;
}
public void setAbilityList(MaskedTextBox tb_abil, int species, ComboBox cb_abil, ComboBox cb_forme)
{
if (!init && tb_abil.Text == "")
return;
int newabil = Convert.ToInt16(tb_abil.Text) >> 1;
int form = cb_forme.SelectedIndex;
byte[] abils = PKX.getAbilities(species, form);
// Build Ability List
List<string> ability_list = new List<string>();
ability_list.Add(abilitylist[abils[0]] + " (1)");
ability_list.Add(abilitylist[abils[1]] + " (2)");
ability_list.Add(abilitylist[abils[2]] + " (H)");
cb_abil.DataSource = ability_list;
if (newabil < 3) cb_abil.SelectedIndex = newabil;
else cb_abil.SelectedIndex = 0;
}
// PKX Data Calculation Functions //
private void setIsShiny()
{
bool isShiny = PKX.getIsShiny(Util.getHEXval(TB_PID),Util.ToUInt32(TB_TID.Text),Util.ToUInt32(TB_SID.Text));
// Set the Controls
BTN_Shinytize.Visible = BTN_Shinytize.Enabled = !isShiny;
Label_IsShiny.Visible = isShiny;
// Refresh Markings (for Shiny Star if applicable)
setMarkings();
}
private void setMarkings()
{
PictureBox[] pba = { PB_Mark1, PB_Mark2, PB_Mark3, PB_Mark4, PB_Mark5, PB_Mark6 };
@@ -1406,7 +1432,7 @@ private void setMarkings()
int gameindex = Util.getIndex(CB_GameOrigin);
PB_MarkPentagon.Image = Util.ChangeOpacity(PB_MarkPentagon.InitialImage, (float)(Convert.ToUInt16(gameindex == 24 || gameindex == 25 || gameindex == 26 || gameindex == 27)) * 0.9 + 0.1);
}
// Label Shortcut Tweaks
// Clicked Label Shortcuts
private void clickFriendship(object sender, EventArgs e)
{
if (ModifierKeys == Keys.Control) // prompt to reset
@@ -1519,26 +1545,6 @@ private void clickTRGender(object sender, EventArgs e)
lbl.Text = (PKX.getGender(lbl.Text) == 0) ? gendersymbols[1] : gendersymbols[0];
}
// Prompted Updates of PKX Functions //
public void setCountrySubRegion(object sender, string type)
{
ComboBox CB = sender as ComboBox;
int index = Util.getIndex(CB);
// fix for Korean / Chinese being swapped
string cl = curlanguage + "";
cl = (cl == "zh") ? "ko" : (cl == "ko") ? "zh" : cl;
CB.DataSource = Util.getCBList(type, cl);
CB.DisplayMember = "Text";
CB.ValueMember = "Value";
if (index > 0 && index <= CB.Items.Count)
CB.SelectedValue = index;
}
private void updateCountry(object sender, EventArgs e)
{
if (Util.getIndex(sender as ComboBox) > 0)
setCountrySubRegion(CB_SubRegion, "sr_" + Util.getIndex(sender as ComboBox).ToString("000"));
}
private bool changingEXPLevel = false;
private void updateEXPLevel(object sender, EventArgs e)
{
@@ -1744,7 +1750,7 @@ private void updateForm(object sender, EventArgs e)
{
updateStats();
// Repopulate Abilities if Species Form has different abilities
updateAbilityList(TB_AbilityNumber, Util.getIndex(CB_Species), CB_Ability, CB_Form);
setAbilityList(TB_AbilityNumber, Util.getIndex(CB_Species), CB_Ability, CB_Form);
// Gender Forms
if (PKX.getGender(CB_Form.Text) < 2)
@@ -1781,6 +1787,11 @@ private void updatePKRSdays(object sender, EventArgs e)
else CHK_Cured.Checked = true;
}
}
private void updateCountry(object sender, EventArgs e)
{
if (Util.getIndex(sender as ComboBox) > 0)
setCountrySubRegion(CB_SubRegion, "sr_" + Util.getIndex(sender as ComboBox).ToString("000"));
}
private void updateSpecies(object sender, EventArgs e)
{
// Change Species Prompted
@@ -1811,7 +1822,7 @@ private void updateSpecies(object sender, EventArgs e)
genderflag = ((Util.getHEXval(TB_PID) & 0xFF) <= gt) ? 1 : 0;
Label_Gender.Text = gendersymbols[genderflag];
updateAbilityList(TB_AbilityNumber, Util.getIndex(CB_Species), CB_Ability, CB_Form);
setAbilityList(TB_AbilityNumber, Util.getIndex(CB_Species), CB_Ability, CB_Form);
updateForm(null, null);
// If species changes and no nickname, set the new name == speciesName.
@@ -1822,27 +1833,10 @@ private void updateOriginGame(object sender, EventArgs e)
{
int gameorigin = Util.getIndex(CB_GameOrigin);
if ((gameorigin <= 12) && (gameorigin >= 7))
if (gameorigin < 24 && origintrack != "Past")
{
// Game Originates In Gen 4; Enable Encounter Type
CB_EncounterType.Enabled = true;
Label_EncounterType.Enabled = true;
}
else
{
CB_EncounterType.Enabled = false;
Label_EncounterType.Enabled = false;
CB_EncounterType.SelectedIndex = 0;
}
updateLocations(gameorigin);
setMarkings();
setIsShiny();
}
private void updateLocations(int gameorigin)
{
if (gameorigin < 24 && origintrack != "Past") // Load Past Gen Locations
{
#region BW2 Met Locations
// Load Past Gen Locations
#region B2W2 Met Locations
{
// Build up our met list
var met_list = Util.getCBList(metBW2_00000, new int[] { 0 });
@@ -1869,7 +1863,8 @@ private void updateLocations(int gameorigin)
}
else if (gameorigin > 23 && (origintrack != "XY"))
{
#region XY Met Locations
// Load X/Y/OR/AS locations
#region ORAS Met Locations
{
// Build up our met list
var met_list = Util.getCBList(metXY_00000, new int[] { 0 });
@@ -1892,7 +1887,8 @@ private void updateLocations(int gameorigin)
#endregion
}
if (((gameorigin < 10 && gameorigin > 6) || (gameorigin == 15)) && origintrack != "Gen4")
{ // Egg Met Locations for Gen 4 are unaltered when transferred to Gen 5. Need a new table if Gen 4 Origin.
{
// Load Gen 4 egg locations if Gen 4 Origin.
#region HGSS Met Locations
// Allowed Met Locations
int[] metlocs = { 0, 2000, 2002, 3001 };
@@ -1914,9 +1910,13 @@ private void updateLocations(int gameorigin)
#endregion
}
// Visibility logic for Gen 4 encounter type; only show for Gen 4 Pokemon.
CB_EncounterType.Visible = Label_EncounterType.Visible = !(gameorigin > 12 || gameorigin < 7);
// If not Gen 4, set Encounter Type to 0 after it set !visible.
if (gameorigin > 12 || gameorigin < 7)
CB_EncounterType.SelectedValue = 0;
setMarkings(); // Set/Remove KB marking
}
private void updateExtraByteValue(object sender, EventArgs e)
{
@@ -1964,12 +1964,11 @@ private void updateNickname(object sender, EventArgs e)
}
}
}
public bool specialChars = false; // Open Form Tracking
private void updateNicknameClick(object sender, MouseEventArgs e)
{
// Special Character Form
if (e.Button == MouseButtons.Right && !specialChars)
(new f2_Text(TB_Nickname, this)).Show();
(new f2_Text(TB_Nickname)).Show();
}
private void updateNotOT(object sender, EventArgs e)
{
@@ -2194,41 +2193,22 @@ private void updateStats()
}
}
}
public void updateAbilityList(MaskedTextBox tb_abil, int species, ComboBox cb_abil, ComboBox cb_forme)
{
if (!init && tb_abil.Text == "")
return;
int newabil = Convert.ToInt16(tb_abil.Text) >> 1;
int form = cb_forme.SelectedIndex;
byte[] abils = PKX.getAbilities(species, form);
// Build Ability List
List<string> ability_list = new List<string>();
ability_list.Add(abilitylist[abils[0]] + " (1)");
ability_list.Add(abilitylist[abils[1]] + " (2)");
ability_list.Add(abilitylist[abils[2]] + " (H)");
cb_abil.DataSource = ability_list;
if (newabil < 3) cb_abil.SelectedIndex = newabil;
else cb_abil.SelectedIndex = 0;
}
// Secondary Windows for Ribbons/Amie/Memories
private void openribbons(object sender, EventArgs e)
private void openRibbons(object sender, EventArgs e)
{
new RibbMedal(this).ShowDialog();
}
private void openhistory(object sender, EventArgs e)
private void openHistory(object sender, EventArgs e)
{
new MemoryAmie(this).ShowDialog();
}
// Open/Save Array Manipulation //
public bool verifiedpkx()
private bool verifiedPKX()
{
if (ModifierKeys == (Keys.Control | Keys.Shift | Keys.Alt))
return true; // Override
// Make sure the PKX Fields are filled out properly (color check)
#region ComboBoxes
#region ComboBoxes to verify they are set.
ComboBox[] cba = {
CB_Species, CB_Nature, CB_HeldItem, CB_Ability, // Main Tab
CB_MetLocation, CB_EggLocation, CB_Ball, // Met Tab
@@ -2262,7 +2242,7 @@ public bool verifiedpkx()
invalid:
{ System.Media.SystemSounds.Exclamation.Play(); return false; }
}
public byte[] preparepkx(byte[] buff, bool click = true)
private byte[] preparepkx(byte[] buff, bool click = true)
{
if (click)
tabMain.Select(); // hack to make sure comboboxes are set (users scrolling through and immediately setting causes this)
@@ -2544,7 +2524,7 @@ private void tabMain_DragDrop(object sender, DragEventArgs e)
// Decrypted Export
private void dragout_MouseDown(object sender, MouseEventArgs e)
{
if (!verifiedpkx()) { return; }
if (!verifiedPKX()) { return; }
{
// Create Temp File to Drag
string basepath = System.Windows.Forms.Application.StartupPath;
@@ -3209,6 +3189,17 @@ private void clickBoxLeft(object sender, EventArgs e)
C_BoxSelect.SelectedIndex--;
else C_BoxSelect.SelectedIndex = 30;
}
private void clickSlot(object sender, EventArgs e)
{
if (ModifierKeys == (Keys.Control | Keys.Alt))
clickClone(sender, e);
else if (ModifierKeys == Keys.Control)
clickView(sender, e);
else if (ModifierKeys == Keys.Shift)
clickSet(sender, e);
else if (ModifierKeys == Keys.Alt)
clickDelete(sender, e);
}
private void clickView(object sender, EventArgs e)
{
int slot = getSlot(sender);
@@ -3270,7 +3261,7 @@ private void clickView(object sender, EventArgs e)
}
private void clickSet(object sender, EventArgs e)
{
if (!verifiedpkx()) { return; }
if (!verifiedPKX()) { return; }
int slot = getSlot(sender);
if (slot == 30 && (CB_Species.SelectedIndex == 0 || CHK_IsEgg.Checked)) { Util.Alert("Can't have empty/egg first slot."); return; }
int offset = getPKXOffset(slot);
@@ -3339,7 +3330,7 @@ private void clickDelete(object sender, EventArgs e)
private void clickClone(object sender, EventArgs e)
{
if (getSlot(sender) > 30) return; // only perform action if cloning to boxes
if (!verifiedpkx()) { return; } // don't copy garbage to the box
if (!verifiedPKX()) { return; } // don't copy garbage to the box
byte[] pkxdata;
int box = C_BoxSelect.SelectedIndex + 1; // get box we're cloning to
@@ -3364,6 +3355,7 @@ private void clickClone(object sender, EventArgs e)
savedited = true;
}
// Generic Subfunctions //
private void setPokedex(byte[] pkxdata)
{
if (savindex > 1) return;
@@ -3374,7 +3366,7 @@ private void setPokedex(byte[] pkxdata)
uint pid = BitConverter.ToUInt32(pkxdata, 0x18);
ushort TID = BitConverter.ToUInt16(pkxdata, 0xC);
ushort SID = BitConverter.ToUInt16(pkxdata, 0xE);
int shiny = Convert.ToInt16(Convert.ToBoolean((PKX.getPSV(pid) ^ PKX.getTSV(TID,SID)) < 16));
int shiny = Convert.ToInt16(Convert.ToBoolean((PKX.getPSV(pid) ^ PKX.getTSV(TID, SID)) < 16));
int dexoff = savindex * 0x7F000 + SaveGame.PokeDex; // Same offset for XY-ORAS
int langoff = 0x3C8; if (savegame_oras) langoff = 0x400; // Not the same offset for language bools
int shiftoff = (shiny * 0x60 * 2) + (gender * 0x60) + 0x60;
@@ -3390,7 +3382,7 @@ private void setPokedex(byte[] pkxdata)
// Set the Language
if (lang < 0) lang = 1;
savefile[dexoff + langoff + ((species - 1) * 7 + lang) / 8] |= (byte)(1 << ((((species - 1) * 7) + lang) % 8));
savefile[dexoff + langoff + ((species - 1) * 7 + lang) / 8] |= (byte)(1 << ((((species - 1) * 7) + lang) % 8));
}
private byte setParty()
{
@@ -3402,7 +3394,7 @@ private byte setParty()
byte[] data = new byte[0x104];
Array.Copy(savefile, offset + i * 0x104, data, 0, 0x104);
byte[] decdata = PKX.decryptArray(data);
int species = BitConverter.ToInt16(decdata,8);
int species = BitConverter.ToInt16(decdata, 8);
if ((species != 0) && (species < 722))
{
Array.Copy(data, 0, savefile, offset + (partymembers) * 0x104, 0x104);
@@ -3444,18 +3436,6 @@ private byte setParty()
return partymembers;
}
private void slotModifier_Click(object sender, EventArgs e)
{
if (ModifierKeys == (Keys.Control | Keys.Alt))
clickClone(sender, e);
else if (ModifierKeys == Keys.Control)
clickView(sender, e);
else if (ModifierKeys == Keys.Shift)
clickSet(sender, e);
else if (ModifierKeys == Keys.Alt)
clickDelete(sender, e);
}
// Subfunctions //
private int getPKXOffset(int slot)
{
int offset = SaveGame.Box + C_BoxSelect.SelectedIndex * (0xE8 * 30) + slot * 0xE8;
@@ -3505,7 +3485,7 @@ private int getSlot(object sender)
int slot = Array.IndexOf(pba, sourceControl.Name);
return slot;
}
public void setPKXBoxes()
private void setPKXBoxes()
{
int boxoffset = SaveGame.Box + 0x7F000 * savindex + C_BoxSelect.SelectedIndex * (0xE8 * 30);
@@ -3588,7 +3568,7 @@ public void setPKXBoxes()
if (colorizedslot < 32)
pba[colorizedslot].BackgroundImage = (colorizedbox == C_BoxSelect.SelectedIndex) ? colorizedcolor : null;
}
public void setBoxNames()
private void setBoxNames()
{
int selectedbox = C_BoxSelect.SelectedIndex; // precache selected box
// Build ComboBox Dropdown Items
@@ -4241,7 +4221,7 @@ private void B_JPEG_Click(object sender, EventArgs e)
File.WriteAllBytes(path, jpeg);
}
}
// Save Folder Related
private void clickSaveFileName(object sender, EventArgs e)
{
// Get latest SaveDataFiler save location
@@ -4296,7 +4276,7 @@ private void clickSwitchSAV(object sender, EventArgs e)
private void pbBoxSlot_MouseDown(object sender, MouseEventArgs e)
{
if (ModifierKeys == Keys.Control || ModifierKeys == Keys.Alt || ModifierKeys == Keys.Shift || ModifierKeys == (Keys.Control | Keys.Alt))
{ slotModifier_Click(sender, (EventArgs)e); return; }
{ clickSlot(sender, (EventArgs)e); return; }
PictureBox pb = (PictureBox)(sender);
if (pb.Image == null)
return;

View File

@@ -11,11 +11,9 @@ namespace PKHeX
{
public partial class f2_Text : Form
{
Form1 m_parent;
public f2_Text(TextBox TB_NN, Form1 frm1)
public f2_Text(TextBox TB_NN)
{
m_parent = frm1;
m_parent.specialChars = true;
Form1.specialChars = true;
this.Hide();
InitializeComponent();
Util.TranslateInterface(this, Form1.curlanguage);
@@ -53,7 +51,7 @@ private void onClick(object sender, EventArgs e)
}
private void onClosed(object sender, FormClosedEventArgs e)
{
m_parent.specialChars = false;
Form1.specialChars = false;
}
}
}

View File

@@ -86,8 +86,6 @@ private void B_Save_Click(object sender, EventArgs e)
{
Array.Copy(sav, m_parent.savefile, 0x100000);
m_parent.savedited = true;
m_parent.setBoxNames();
m_parent.setPKXBoxes();
Close();
}

View File

@@ -437,7 +437,7 @@ private void loadFavPKM()
CB_Form.SelectedIndex = form;
// Set Ability
m_parent.updateAbilityList(MT_AbilNo, spec, CB_Ability, CB_Form);
m_parent.setAbilityList(MT_AbilNo, spec, CB_Ability, CB_Form);
}
private void updateSpecies(object sender, EventArgs e)
@@ -461,11 +461,11 @@ private void updateSpecies(object sender, EventArgs e)
genderflag = 0;
setGenderLabel();
m_parent.updateAbilityList(MT_AbilNo, Util.getIndex(CB_Species), CB_Ability, CB_Form);
m_parent.setAbilityList(MT_AbilNo, Util.getIndex(CB_Species), CB_Ability, CB_Form);
}
private void updateForm(object sender, EventArgs e)
{
m_parent.updateAbilityList(MT_AbilNo, Util.getIndex(CB_Species), CB_Ability, CB_Form);
m_parent.setAbilityList(MT_AbilNo, Util.getIndex(CB_Species), CB_Ability, CB_Form);
// If form has a single gender, account for it.
if (PKX.getGender(CB_Form.Text) < 2)

View File

@@ -222,8 +222,6 @@ private void B_Save_Click(object sender, EventArgs e)
Array.Copy(sav, m_parent.savefile, 0x100000);
m_parent.savedited = true;
m_parent.setBoxNames();
m_parent.setPKXBoxes();
Close();
}