Modifying Met Locations update Legality analysis

This commit is contained in:
Kaphotics
2016-02-27 18:10:02 -08:00
parent 37ad88a4ce
commit e024d7824b
2 changed files with 69 additions and 53 deletions

View File

@@ -155,6 +155,9 @@ public void InitializeComponent()
this.PB_WarnMove2 = new System.Windows.Forms.PictureBox();
this.PB_WarnMove1 = new System.Windows.Forms.PictureBox();
this.GB_RelearnMoves = new System.Windows.Forms.GroupBox();
this.PB_WarnRelearn4 = new System.Windows.Forms.PictureBox();
this.PB_WarnRelearn3 = new System.Windows.Forms.PictureBox();
this.PB_WarnRelearn2 = new System.Windows.Forms.PictureBox();
this.PB_WarnRelearn1 = new System.Windows.Forms.PictureBox();
this.CB_RelearnMove4 = new System.Windows.Forms.ComboBox();
this.CB_RelearnMove3 = new System.Windows.Forms.ComboBox();
@@ -357,9 +360,6 @@ public void InitializeComponent()
this.B_OpenSuperTraining = new System.Windows.Forms.Button();
this.dragout = new System.Windows.Forms.PictureBox();
this.L_QR = new System.Windows.Forms.Label();
this.PB_WarnRelearn2 = new System.Windows.Forms.PictureBox();
this.PB_WarnRelearn3 = new System.Windows.Forms.PictureBox();
this.PB_WarnRelearn4 = new System.Windows.Forms.PictureBox();
this.tabMain.SuspendLayout();
this.Tab_Main.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).BeginInit();
@@ -372,6 +372,9 @@ public void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.PB_WarnMove2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnMove1)).BeginInit();
this.GB_RelearnMoves.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn1)).BeginInit();
this.GB_CurrentMoves.SuspendLayout();
this.Tab_OTMisc.SuspendLayout();
@@ -455,9 +458,6 @@ public void InitializeComponent()
this.Tab_SAV.SuspendLayout();
this.GB_SAVtools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dragout)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn4)).BeginInit();
this.SuspendLayout();
//
// tabMain
@@ -1102,7 +1102,7 @@ public void InitializeComponent()
this.CB_EggLocation.Name = "CB_EggLocation";
this.CB_EggLocation.Size = new System.Drawing.Size(122, 21);
this.CB_EggLocation.TabIndex = 10;
this.CB_EggLocation.SelectedIndexChanged += new System.EventHandler(this.validateComboBox2);
this.CB_EggLocation.SelectedIndexChanged += new System.EventHandler(this.validateLocation);
this.CB_EggLocation.KeyDown += new System.Windows.Forms.KeyEventHandler(this.removedropCB);
this.CB_EggLocation.Validating += new System.ComponentModel.CancelEventHandler(this.validateComboBox);
//
@@ -1210,7 +1210,7 @@ public void InitializeComponent()
this.CB_MetLocation.Name = "CB_MetLocation";
this.CB_MetLocation.Size = new System.Drawing.Size(122, 21);
this.CB_MetLocation.TabIndex = 2;
this.CB_MetLocation.SelectedIndexChanged += new System.EventHandler(this.validateComboBox2);
this.CB_MetLocation.SelectedIndexChanged += new System.EventHandler(this.validateLocation);
this.CB_MetLocation.KeyDown += new System.Windows.Forms.KeyEventHandler(this.removedropCB);
this.CB_MetLocation.Validating += new System.ComponentModel.CancelEventHandler(this.validateComboBox);
//
@@ -1944,6 +1944,36 @@ public void InitializeComponent()
this.GB_RelearnMoves.TabStop = false;
this.GB_RelearnMoves.Text = "Relearn Moves";
//
// PB_WarnRelearn4
//
this.PB_WarnRelearn4.Image = global::PKHeX.Properties.Resources.warn;
this.PB_WarnRelearn4.Location = new System.Drawing.Point(22, 93);
this.PB_WarnRelearn4.Name = "PB_WarnRelearn4";
this.PB_WarnRelearn4.Size = new System.Drawing.Size(16, 16);
this.PB_WarnRelearn4.TabIndex = 19;
this.PB_WarnRelearn4.TabStop = false;
this.PB_WarnRelearn4.Visible = false;
//
// PB_WarnRelearn3
//
this.PB_WarnRelearn3.Image = global::PKHeX.Properties.Resources.warn;
this.PB_WarnRelearn3.Location = new System.Drawing.Point(22, 71);
this.PB_WarnRelearn3.Name = "PB_WarnRelearn3";
this.PB_WarnRelearn3.Size = new System.Drawing.Size(16, 16);
this.PB_WarnRelearn3.TabIndex = 18;
this.PB_WarnRelearn3.TabStop = false;
this.PB_WarnRelearn3.Visible = false;
//
// PB_WarnRelearn2
//
this.PB_WarnRelearn2.Image = global::PKHeX.Properties.Resources.warn;
this.PB_WarnRelearn2.Location = new System.Drawing.Point(22, 49);
this.PB_WarnRelearn2.Name = "PB_WarnRelearn2";
this.PB_WarnRelearn2.Size = new System.Drawing.Size(16, 16);
this.PB_WarnRelearn2.TabIndex = 17;
this.PB_WarnRelearn2.TabStop = false;
this.PB_WarnRelearn2.Visible = false;
//
// PB_WarnRelearn1
//
this.PB_WarnRelearn1.Image = global::PKHeX.Properties.Resources.warn;
@@ -4333,36 +4363,6 @@ public void InitializeComponent()
this.L_QR.Visible = false;
this.L_QR.Click += new System.EventHandler(this.clickQR);
//
// PB_WarnRelearn2
//
this.PB_WarnRelearn2.Image = global::PKHeX.Properties.Resources.warn;
this.PB_WarnRelearn2.Location = new System.Drawing.Point(22, 49);
this.PB_WarnRelearn2.Name = "PB_WarnRelearn2";
this.PB_WarnRelearn2.Size = new System.Drawing.Size(16, 16);
this.PB_WarnRelearn2.TabIndex = 17;
this.PB_WarnRelearn2.TabStop = false;
this.PB_WarnRelearn2.Visible = false;
//
// PB_WarnRelearn3
//
this.PB_WarnRelearn3.Image = global::PKHeX.Properties.Resources.warn;
this.PB_WarnRelearn3.Location = new System.Drawing.Point(22, 71);
this.PB_WarnRelearn3.Name = "PB_WarnRelearn3";
this.PB_WarnRelearn3.Size = new System.Drawing.Size(16, 16);
this.PB_WarnRelearn3.TabIndex = 18;
this.PB_WarnRelearn3.TabStop = false;
this.PB_WarnRelearn3.Visible = false;
//
// PB_WarnRelearn4
//
this.PB_WarnRelearn4.Image = global::PKHeX.Properties.Resources.warn;
this.PB_WarnRelearn4.Location = new System.Drawing.Point(22, 93);
this.PB_WarnRelearn4.Name = "PB_WarnRelearn4";
this.PB_WarnRelearn4.Size = new System.Drawing.Size(16, 16);
this.PB_WarnRelearn4.TabIndex = 19;
this.PB_WarnRelearn4.TabStop = false;
this.PB_WarnRelearn4.Visible = false;
//
// Main
//
this.AllowDrop = true;
@@ -4400,6 +4400,9 @@ public void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.PB_WarnMove2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnMove1)).EndInit();
this.GB_RelearnMoves.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn1)).EndInit();
this.GB_CurrentMoves.ResumeLayout(false);
this.GB_CurrentMoves.PerformLayout();
@@ -4497,9 +4500,6 @@ public void InitializeComponent()
this.Tab_SAV.PerformLayout();
this.GB_SAVtools.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dragout)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_WarnRelearn4)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View File

@@ -1182,7 +1182,7 @@ public void populateFields(PK6 pk, bool focus = true)
clickGT(pk6.CurrentHandler == 1 ? GB_nOT : GB_OT, null);
fieldsLoaded = true;
updateValidMoves();
updateLegality();
}
// General Use Functions shared by other Forms //
internal static void setCountrySubRegion(ComboBox CB, string type)
@@ -1452,7 +1452,7 @@ private void updateEXPLevel(object sender, EventArgs e)
}
changingFields = false;
updateStats();
updateValidMoves();
updateLegality();
}
private void updateHPType(object sender, EventArgs e)
{
@@ -1771,7 +1771,7 @@ private void updateSpecies(object sender, EventArgs e)
if (!CHK_Nicknamed.Checked)
updateNickname(sender, e);
updateValidMoves();
updateLegality();
}
private void updateOriginGame(object sender, EventArgs e)
{
@@ -1857,9 +1857,7 @@ private void updateOriginGame(object sender, EventArgs e)
if (!fieldsLoaded)
return;
pk6.Version = Version;
pk6.Met_Location = Util.getIndex(CB_MetLocation);
pk6.Egg_Location = Util.getIndex(CB_EggLocation);
updateValidMoves();
updateLegality();
}
private void updateExtraByteValue(object sender, EventArgs e)
{
@@ -1988,7 +1986,7 @@ private void updateMetAsEgg(object sender, EventArgs e)
CAL_EggDate.Value = new DateTime(2000, 01, 01);
CB_EggLocation.SelectedValue = 0;
updateValidMoves();
updateLegality();
}
private void updateShinyPID(object sender, EventArgs e)
{
@@ -2037,7 +2035,8 @@ private void update_ID(object sender, EventArgs e)
updateIVs(null, null); // If the PID is changed, PID%6 (Characteristic) might be changed.
TB_PID.Select(60, 0); // position cursor at end of field
}
private void validateComboBox(object sender, EventArgs e)
private void validateComboBox(object sender)
{
if (!(sender is ComboBox))
return;
@@ -2045,8 +2044,15 @@ private void validateComboBox(object sender, EventArgs e)
ComboBox cb = (ComboBox)sender;
cb.SelectionLength = 0;
cb.BackColor = cb.SelectedValue == null ? Color.DarkSalmon : defaultControlWhite;
}
private void validateComboBox(object sender, EventArgs e)
{
if (!(sender is ComboBox))
return;
if (fieldsInitialized)
validateComboBox(sender);
if (fieldsLoaded)
getQuickFiller(dragout);
}
private void validateComboBox2(object sender, EventArgs e)
@@ -2062,8 +2068,8 @@ private void validateMove(object sender, EventArgs e)
if (!fieldsLoaded)
return;
validateComboBox(sender, e);
validateComboBox(sender);
int[] relearnMoves =
{
Util.getIndex(CB_RelearnMove1), Util.getIndex(CB_RelearnMove2),
@@ -2094,11 +2100,21 @@ private void validateMove(object sender, EventArgs e)
validateMove(c, e);
}
}
private void validateLocation(object sender, EventArgs e)
{
validateComboBox(sender);
if (!fieldsLoaded)
return;
pk6.Met_Location = Util.getIndex(CB_MetLocation);
pk6.Egg_Location = Util.getIndex(CB_EggLocation);
updateLegality();
}
private void removedropCB(object sender, KeyEventArgs e)
{
((ComboBox)sender).DroppedDown = false;
}
private void updateValidMoves()
private void updateLegality()
{
if (!fieldsLoaded)
return;