Disable super training flags on format!=6

Closes #752
This commit is contained in:
Kurt 2017-01-26 08:45:23 -08:00
parent 37b3e58979
commit 08adb4c2cb
3 changed files with 18 additions and 9 deletions

View file

@ -155,7 +155,6 @@
// CHK_SecretComplete // CHK_SecretComplete
// //
this.CHK_SecretComplete.AutoSize = true; this.CHK_SecretComplete.AutoSize = true;
this.CHK_SecretComplete.Enabled = false;
this.CHK_SecretComplete.Location = new System.Drawing.Point(3, 17); this.CHK_SecretComplete.Location = new System.Drawing.Point(3, 17);
this.CHK_SecretComplete.Name = "CHK_SecretComplete"; this.CHK_SecretComplete.Name = "CHK_SecretComplete";
this.CHK_SecretComplete.Size = new System.Drawing.Size(145, 17); this.CHK_SecretComplete.Size = new System.Drawing.Size(145, 17);

View file

@ -27,8 +27,6 @@ namespace PKHeX.WinForms
CHK_SecretUnlocked.Checked = pkm.SecretSuperTrainingUnlocked; CHK_SecretUnlocked.Checked = pkm.SecretSuperTrainingUnlocked;
CHK_SecretComplete.Checked = pkm.SecretSuperTrainingComplete; CHK_SecretComplete.Checked = pkm.SecretSuperTrainingComplete;
if (!CHK_SecretUnlocked.Checked) // force update to disable checkboxes
CHK_Secret_CheckedChanged(null, null);
if (pkm is PK6) if (pkm is PK6)
{ {
@ -40,10 +38,14 @@ namespace PKHeX.WinForms
PK6 pk6 = (PK6) pkm; PK6 pk6 = (PK6) pkm;
CB_Bag.SelectedIndex = pk6.TrainingBag; CB_Bag.SelectedIndex = pk6.TrainingBag;
NUD_BagHits.Value = pk6.TrainingBagHits; NUD_BagHits.Value = pk6.TrainingBagHits;
if (!CHK_SecretUnlocked.Checked) // force update to disable checkboxes
CHK_Secret_CheckedChanged(null, null);
} }
else else
{ {
L_Bag.Visible = CB_Bag.Visible = L_Hits.Visible = NUD_BagHits.Visible = false; L_Bag.Visible = CB_Bag.Visible = L_Hits.Visible = NUD_BagHits.Visible = false;
CHK_SecretUnlocked.Visible = CHK_SecretComplete.Visible = false;
} }
} }
@ -139,16 +141,22 @@ namespace PKHeX.WinForms
if (CHK_SecretUnlocked.Checked) // only give dist if Secret is Unlocked (None -> All -> All*) if (CHK_SecretUnlocked.Checked) // only give dist if Secret is Unlocked (None -> All -> All*)
foreach (var c in TLP_DistSuperTrain.Controls.OfType<CheckBox>()) foreach (var c in TLP_DistSuperTrain.Controls.OfType<CheckBox>())
c.Checked = true; c.Checked = true;
CHK_SecretUnlocked.Checked = true; if (pkm is PK6)
CHK_SecretComplete.Checked = true; {
CHK_SecretUnlocked.Checked = true;
CHK_SecretComplete.Checked = true;
}
foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>()) foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>())
c.Checked = true; c.Checked = true;
} }
private void B_None_Click(object sender, EventArgs e) private void B_None_Click(object sender, EventArgs e)
{ {
CHK_SecretUnlocked.Checked = false; if (pkm is PK6)
CHK_SecretComplete.Checked = false; {
CHK_SecretUnlocked.Checked = false;
CHK_SecretComplete.Checked = false;
}
foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>()) foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>())
c.Checked = false; c.Checked = false;
foreach (var c in TLP_DistSuperTrain.Controls.OfType<CheckBox>()) foreach (var c in TLP_DistSuperTrain.Controls.OfType<CheckBox>())
@ -156,6 +164,8 @@ namespace PKHeX.WinForms
} }
private void CHK_Secret_CheckedChanged(object sender, EventArgs e) private void CHK_Secret_CheckedChanged(object sender, EventArgs e)
{ {
if (!(pkm is PK6))
return;
CHK_SecretComplete.Checked &= CHK_SecretUnlocked.Checked; CHK_SecretComplete.Checked &= CHK_SecretUnlocked.Checked;
CHK_SecretComplete.Enabled = CHK_SecretUnlocked.Checked; CHK_SecretComplete.Enabled = CHK_SecretUnlocked.Checked;
foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>().Where(chk => Convert.ToInt16(chk.Name[14]+"") >= 4)) foreach (var c in TLP_SuperTrain.Controls.OfType<CheckBox>().Where(chk => Convert.ToInt16(chk.Name[14]+"") >= 4))

View file

@ -517,7 +517,7 @@ namespace PKHeX.Core
if (pkm.IsEgg && TrainCount > 0) if (pkm.IsEgg && TrainCount > 0)
{ AddLine(Severity.Invalid, "Super Training missions on Egg.", CheckIdentifier.Training); } { AddLine(Severity.Invalid, "Super Training missions on Egg.", CheckIdentifier.Training); }
else if (TrainCount > 0 && pkm.GenNumber != 6) else if (TrainCount > 0 && pkm.GenNumber != 6)
{ AddLine(Severity.Invalid, "Distribution Super Training missions are not available in game.", CheckIdentifier.Training); } { AddLine(Severity.Invalid, "Super Training missions are not available in game.", CheckIdentifier.Training); }
else else
{ {
if (pkm.Format >= 7) if (pkm.Format >= 7)