mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 13:58:33 +00:00
Unbreak clearing dex
add sound notification that the mass-edit is finished. refactor slightly for clearer routines
This commit is contained in:
parent
025b8da52c
commit
407f3f06d4
1 changed files with 58 additions and 31 deletions
|
@ -380,11 +380,41 @@ namespace PKHeX.WinForms
|
||||||
if (lang > 5) lang -= 1;
|
if (lang > 5) lang -= 1;
|
||||||
lang -= 1;
|
lang -= 1;
|
||||||
|
|
||||||
|
if (sender == mnuSeenAll || sender == mnuCaughtAll || sender == mnuComplete)
|
||||||
|
SetAll(sender, USUM, lang);
|
||||||
|
else
|
||||||
|
ClearAll(sender);
|
||||||
|
|
||||||
|
SetEntry();
|
||||||
|
// Turn off zh2 Petilil
|
||||||
|
Dex.LanguageFlags[548 * 9 + 8] = false;
|
||||||
|
GetEntry();
|
||||||
|
allModifying = false;
|
||||||
|
LB_Forms.Enabled = LB_Forms.Visible = true;
|
||||||
|
LB_Species.SelectedIndex = 0;
|
||||||
|
System.Media.SystemSounds.Asterisk.Play();
|
||||||
|
}
|
||||||
|
private void ClearAll(object sender)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < LB_Species.Items.Count; i++)
|
||||||
|
{
|
||||||
|
LB_Species.SelectedIndex = i;
|
||||||
|
foreach (CheckBox chk in CL)
|
||||||
|
chk.Checked = false;
|
||||||
|
CHK_P1.Checked = false; // not caught
|
||||||
|
if (sender == mnuCaughtNone)
|
||||||
|
continue;
|
||||||
|
// remove seen/displayed
|
||||||
|
CHK_P2.Checked = CHK_P4.Checked = CHK_P3.Checked = CHK_P5.Checked = false;
|
||||||
|
CHK_P6.Checked = CHK_P7.Checked = CHK_P8.Checked = CHK_P9.Checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void SetAll(object sender, bool USUM, int lang)
|
||||||
|
{
|
||||||
for (int i = 0; i < SAV.MaxSpeciesID; i++)
|
for (int i = 0; i < SAV.MaxSpeciesID; i++)
|
||||||
{
|
{
|
||||||
int spec = i + 1;
|
int spec = i + 1;
|
||||||
var gt = GetBaseSpeciesGender(i);
|
var gt = GetBaseSpeciesGender(i);
|
||||||
var c = SAV.Personal[spec].FormeCount;
|
|
||||||
|
|
||||||
// Set base species flags
|
// Set base species flags
|
||||||
LB_Species.SelectedIndex = i;
|
LB_Species.SelectedIndex = i;
|
||||||
|
@ -392,43 +422,40 @@ namespace PKHeX.WinForms
|
||||||
SetCaught(sender, gt, lang, false);
|
SetCaught(sender, gt, lang, false);
|
||||||
|
|
||||||
// Set forme flags
|
// Set forme flags
|
||||||
for (int j = 1; j < c; j++)
|
var entries = GetAllFormEntries(spec, USUM).Where(z => z >= SAV.MaxSpeciesID).Distinct();
|
||||||
|
foreach (var f in entries)
|
||||||
{
|
{
|
||||||
int start = j;
|
LB_Species.SelectedIndex = f;
|
||||||
int end = j;
|
SetSeen(sender, gt, true);
|
||||||
if (SAV7.SanitizeFormsToIterate(spec, out int s, out int n, j, USUM))
|
SetCaught(sender, gt, lang, true);
|
||||||
{
|
}
|
||||||
start = s;
|
}
|
||||||
end = n;
|
}
|
||||||
}
|
private IEnumerable<int> GetAllFormEntries(int spec, bool USUM)
|
||||||
for (int f = start; f <= end; f++)
|
{
|
||||||
{
|
var fc = SAV.Personal[spec].FormeCount;
|
||||||
if (f == 0)
|
for (int j = 1; j < fc; j++)
|
||||||
continue; // already set
|
{
|
||||||
int x = SAV.USUM ? SaveUtil.GetDexFormIndexUSUM(spec, c, f) : SaveUtil.GetDexFormIndexSM(spec, c, f);
|
int start = j;
|
||||||
if (x < 0)
|
int end = j;
|
||||||
continue;
|
if (SAV7.SanitizeFormsToIterate(spec, out int s, out int n, j, USUM))
|
||||||
bool isForm = f != 0;
|
{
|
||||||
LB_Species.SelectedIndex = SAV.MaxSpeciesID - 1 + x;
|
start = s;
|
||||||
SetSeen(sender, gt, isForm);
|
end = n;
|
||||||
SetCaught(sender, gt, lang, isForm);
|
}
|
||||||
}
|
start = Math.Max(1, start);
|
||||||
|
for (int f = start; f <= end; f++)
|
||||||
|
{
|
||||||
|
int x = SAV.USUM ? SaveUtil.GetDexFormIndexUSUM(spec, fc, f) : SaveUtil.GetDexFormIndexSM(spec, fc, f);
|
||||||
|
if (x >= 0)
|
||||||
|
yield return SAV.MaxSpeciesID - 1 + x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEntry();
|
|
||||||
// Turn off zh2 Petilil
|
|
||||||
Dex.LanguageFlags[548*9 + 8] = false;
|
|
||||||
GetEntry();
|
|
||||||
allModifying = false;
|
|
||||||
LB_Forms.Enabled = LB_Forms.Visible = true;
|
|
||||||
LB_Species.SelectedIndex = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetCaught(object sender, int gt, int lang, bool isForm)
|
private void SetCaught(object sender, int gt, int lang, bool isForm)
|
||||||
{
|
{
|
||||||
foreach (CheckBox t in new[] {CHK_P1})
|
CHK_P1.Checked = mnuCaughtNone != sender;
|
||||||
t.Checked = mnuCaughtNone != sender;
|
|
||||||
for (int j = 0; j < CL.Length; j++)
|
for (int j = 0; j < CL.Length; j++)
|
||||||
CL[j].Checked = CL[j].Enabled && (sender == mnuComplete || (mnuCaughtNone != sender && j == lang));
|
CL[j].Checked = CL[j].Enabled && (sender == mnuComplete || (mnuCaughtNone != sender && j == lang));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue