private void showSumOfChosenLevels()
{
// this displays the sum of the chosen levels. This is the last step before a creature-extraction is considered as valid or not valid.
// The speedlevel is not chosen, but calculated from the other chosen levels, and must not be included in the sum, except all the other levels are determined uniquely!
int sumW = 0, sumD = 0;
bool valid = true, inbound = true, allUnique = true;
for (int s = 0; s < 7; s++)
{
if (Extraction.E.results[s].Count > Extraction.E.chosenResults[s])
{
sumW += statIOs[s].LevelWild;
sumD += statIOs[s].LevelDom;
if (Extraction.E.results[s].Count != 1) { allUnique = false; }
}
else
{
valid = false;
break;
}
}
if (valid)
{
sumW -= (allUnique ? 0 : statIOs[6].LevelWild);
labelSumWild.Text = sumW.ToString();
labelSumDom.Text = sumD.ToString();
if (sumW <= Extraction.E.levelWildFromTorporRange[1]) { labelSumWild.ForeColor = SystemColors.ControlText; }
else
{
labelSumWild.ForeColor = Color.Red;
inbound = false;
}
if (sumD <= Extraction.E.levelDomFromTorporAndTotalRange[1] && sumD >= Extraction.E.levelDomFromTorporAndTotalRange[0]) { labelSumDom.ForeColor = SystemColors.ControlText; }
else
{
labelSumDom.ForeColor = Color.Red;
inbound = false;
}
}
else
{
labelSumWild.Text = "n/a";
labelSumDom.Text = "n/a";
}
if (inbound)
{
panelSums.BackColor = SystemColors.Control;
}
else
{
panelSums.BackColor = Color.FromArgb(255, 200, 200);
}
bool allValid = valid && inbound && Extraction.E.validResults;
if (allValid)
{
creatureInfoInputExtractor.parentListValid = false;
}
creatureInfoInputExtractor.ButtonEnabled = allValid;
}