diff --git a/ARKBreedingStats/CreatureInfoInput.cs b/ARKBreedingStats/CreatureInfoInput.cs index 1a8b2815..0f8e6b70 100644 --- a/ARKBreedingStats/CreatureInfoInput.cs +++ b/ARKBreedingStats/CreatureInfoInput.cs @@ -32,6 +32,7 @@ public partial class CreatureInfoInput : UserControl public CreatureInfoInput() { InitializeComponent(); + speciesIndex = -1; parentComboBoxMother.naLabel = " - Mother n/a"; parentComboBoxMother.Items.Add(" - Mother n/a"); parentComboBoxFather.naLabel = " - Father n/a"; @@ -171,7 +172,7 @@ private void groupBox1_Enter(object sender, EventArgs e) private void dhmInputGrown_TextChanged(object sender, EventArgs e) { - if (updateMaturation) + if (updateMaturation && speciesIndex >= 0 && Values.V.species[speciesIndex] != null) { updateMaturation = false; numericUpDownWeight.Value = Values.V.species[speciesIndex].breeding != null && Values.V.species[speciesIndex].breeding.maturationTimeAdjusted > 0 ? @@ -263,7 +264,7 @@ public int SpeciesIndex set { speciesIndex = value; - bool breedingPossible = Values.V.species[speciesIndex].breeding != null; + bool breedingPossible = Values.V.species.Count > value && Values.V.species[speciesIndex].breeding != null; dhmInputCooldown.Visible = breedingPossible; dhmInputGrown.Visible = breedingPossible; diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 6d43ad4c..d46541c3 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -120,9 +120,7 @@ private void Form1_Load(object sender, EventArgs e) for (int i = 0; i < custWs.Length; i++) { if (i < custWd.Length) - { custW.Add(custWs[i], custWd[i]); - } } } statWeighting1.CustomWeightings = custW; @@ -156,7 +154,7 @@ private void Form1_Load(object sender, EventArgs e) if (Utils.precision(s) == 3) { statIOs[s].Percent = true; testingIOs[s].Percent = true; } statIOs[s].statIndex = s; testingIOs[s].statIndex = s; - testingIOs[s].LevelChanged += new LevelChangedEventHandler(this.statIOUpdateValue); + testingIOs[s].LevelChanged += new LevelChangedEventHandler(this.testingStatIOValueUpdate); testingIOs[s].InputType = StatIOInputType.LevelsInputType; statIOs[s].InputValueChanged += new InputValueChangedEventHandler(this.statIOQuickWildLevelCheck); considerStatHighlight[s] = ((Properties.Settings.Default.consideredStats & (1 << s)) > 0); @@ -372,6 +370,7 @@ private bool extractLevels() this.checkBoxJustTamed.BackColor = Color.LightSalmon; panelWildTamedBred.BackColor = Color.LightSalmon; extractionFailed(); + ResumeLayout(); return false; } @@ -426,6 +425,7 @@ private bool extractLevels() if (!Extraction.E.validResults) { extractionFailed(); + ResumeLayout(); return false; } if (nonUniqueStats) @@ -1002,13 +1002,26 @@ private void assignCollectionClasses() timerList1.TimerListEntries = creatureCollection.timerListEntries; } - private void applyMultipliersToValues() + private void applySettingsToValues() { + // apply multipliers Values.V.applyMultipliersToStats(creatureCollection.multipliers); Values.V.applyMultipliersToBreedingTimes(creatureCollection.breedingMultipliers); Values.V.imprintingMultiplier = creatureCollection.imprintingMultiplier; Values.V.tamingSpeedMultiplier = creatureCollection.tamingSpeedMultiplier; Values.V.tamingFoodRateMultiplier = creatureCollection.tamingFoodRateMultiplier; + + // apply level settings + creatureBoxListView.BarMaxLevel = creatureCollection.maxChartLevel; + for (int s = 0; s < 8; s++) + { + statIOs[s].barMaxLevel = creatureCollection.maxChartLevel; + testingIOs[s].barMaxLevel = creatureCollection.maxChartLevel; + } + breedingPlan1.maxWildLevels = creatureCollection.maxWildLevel; + radarChart1.initializeVariables(creatureCollection.maxChartLevel); + statPotentials1.levelDomMax = creatureCollection.maxDomLevel; + statPotentials1.levelGraphMax = creatureCollection.maxChartLevel; } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) @@ -1136,7 +1149,7 @@ private void loadCollectionFile(string fileName, bool keepCurrentCreatures = fal creatureCollection.multipliers = Values.V.getOfficialMultipliers(); } - applyMultipliersToValues(); + applySettingsToValues(); assignCollectionClasses(); bool creatureWasAdded = false; @@ -1158,8 +1171,6 @@ private void loadCollectionFile(string fileName, bool keepCurrentCreatures = fal setCollectionChanged(creatureWasAdded); // setCollectionChanged only if there really were creatures added from the old library to the just opened one // creatures loaded. - applyLevelSettings(); - lastAutoSaveBackup = DateTime.Now.AddMinutes(-10); // calculate creature values @@ -1509,7 +1520,7 @@ private void checkForUpdates(bool silentCheck = false) { if (Values.V.loadValues()) { - applyMultipliersToValues(); + applySettingsToValues(); updateSpeciesComboboxes(); MessageBox.Show("Download and update of new creature-stats successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); updateStatusBar(); @@ -1564,7 +1575,7 @@ private void newCollection() creatureCollection.multipliers = oldMultipliers; pedigree1.Clear(); breedingPlan1.Clear(); - applyMultipliersToValues(); + applySettingsToValues(); assignCollectionClasses(); updateCreatureListings(); @@ -1622,7 +1633,8 @@ private void Form1_FormClosed(object sender, FormClosedEventArgs e) Properties.Settings.Default.customStatWeightNames = custWs.ToArray(); // save last selected species in combobox - Properties.Settings.Default.lastSpecies = comboBoxSpeciesExtractor.SelectedItem.ToString(); + if (comboBoxSpeciesExtractor.SelectedIndex >= 0) + Properties.Settings.Default.lastSpecies = comboBoxSpeciesExtractor.SelectedItem.ToString(); // save settings for next session Properties.Settings.Default.Save(); @@ -2202,9 +2214,9 @@ private void updateAllTesterValues() { if (s == 6) updateTorporInTester = true; - statIOUpdateValue(testingIOs[s]); + testingStatIOsRecalculateValue(testingIOs[s]); } - statIOUpdateValue(testingIOs[7]); + testingStatIOsRecalculateValue(testingIOs[7]); } private void NumericUpDownTestingTE_ValueChanged(object sender, EventArgs e) @@ -2255,10 +2267,9 @@ private void checkBoxQuickWildCheck_CheckedChanged(object sender, EventArgs e) /// Updates the values in the testing-statIOs /// /// - private void statIOUpdateValue(StatIO sIo) + private void testingStatIOValueUpdate(StatIO sIo) { - sIo.BreedingValue = Stats.calculateValue(cbbStatTestingSpecies.SelectedIndex, sIo.statIndex, sIo.LevelWild, 0, true, 1, 0); - sIo.Input = Stats.calculateValue(cbbStatTestingSpecies.SelectedIndex, sIo.statIndex, sIo.LevelWild, sIo.LevelDom, (radioButtonTesterTamed.Checked || radioButtonTesterBred.Checked), (radioButtonTesterBred.Checked ? 1 : (double)NumericUpDownTestingTE.Value / 100), (radioButtonTesterBred.Checked ? (double)numericUpDownImprintingBonusTester.Value / 100 : 0)); + testingStatIOsRecalculateValue(sIo); // update Torpor-level if changed value is not from torpor-StatIO if (updateTorporInTester && sIo != statTestingTorpor) @@ -2289,6 +2300,12 @@ private void statIOUpdateValue(StatIO sIo) statPotentials1.setLevels(levelsWild, false); } + private void testingStatIOsRecalculateValue(StatIO sIo) + { + sIo.BreedingValue = Stats.calculateValue(cbbStatTestingSpecies.SelectedIndex, sIo.statIndex, sIo.LevelWild, 0, true, 1, 0); + sIo.Input = Stats.calculateValue(cbbStatTestingSpecies.SelectedIndex, sIo.statIndex, sIo.LevelWild, sIo.LevelDom, (radioButtonTesterTamed.Checked || radioButtonTesterBred.Checked), (radioButtonTesterBred.Checked ? 1 : (double)NumericUpDownTestingTE.Value / 100), (radioButtonTesterBred.Checked ? (double)numericUpDownImprintingBonusTester.Value / 100 : 0)); + } + private void onlinehelpToolStripMenuItem_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("https://github.com/cadon/ARKStatsExtractor/wiki/manual"); @@ -2781,32 +2798,17 @@ private void settingsToolStripMenuItem_Click(object sender, EventArgs e) Settings settingsfrm = new Settings(creatureCollection); if (settingsfrm.ShowDialog() == DialogResult.OK) { - applyMultipliersToValues(); + applySettingsToValues(); autoSave = Properties.Settings.Default.autosave; autoSaveMinutes = Properties.Settings.Default.autosaveMinutes; creatureBoxListView.maxDomLevel = creatureCollection.maxDomLevel; breedingPlan1.maxSuggestions = creatureCollection.maxBreedingSuggestions; fileSync.changeFile(currentFileName); // only to trigger the update, filename is not changed - applyLevelSettings(); setCollectionChanged(true); } } - private void applyLevelSettings() - { - creatureBoxListView.BarMaxLevel = creatureCollection.maxChartLevel; - for (int s = 0; s < 8; s++) - { - statIOs[s].barMaxLevel = creatureCollection.maxChartLevel; - testingIOs[s].barMaxLevel = creatureCollection.maxChartLevel; - } - breedingPlan1.maxWildLevels = creatureCollection.maxWildLevel; - radarChart1.initializeVariables(creatureCollection.maxChartLevel); - statPotentials1.levelDomMax = creatureCollection.maxDomLevel; - statPotentials1.levelGraphMax = creatureCollection.maxChartLevel; - } - /// /// Display the wild-levels, assuming it's a wild creature. Used for quick checking /// @@ -3136,7 +3138,7 @@ private void toolStripButtonCopy2Tester_Click_1(object sender, EventArgs e) { testingIOs[s].LevelWild = statIOs[s].LevelWild; testingIOs[s].LevelDom = statIOs[s].LevelDom; - statIOUpdateValue(testingIOs[s]); + testingStatIOValueUpdate(testingIOs[s]); } tabControlMain.SelectedTab = tabPageStatTesting; setTesterInfoInputCreature(); @@ -3334,7 +3336,7 @@ private bool loadAdditionalValues(string file, bool showResult = false) { if (Values.V.loadAdditionalValues(file, showResult)) { - applyMultipliersToValues(); + applySettingsToValues(); updateSpeciesComboboxes(); creatureCollection.additionalValues = Path.GetFileName(file); updateStatusBar(); diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index 502de4ce..c66fc35f 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.21.0")] +[assembly: AssemblyFileVersion("0.21.1")] diff --git a/ARKBreedingStats/StatWeighting.cs b/ARKBreedingStats/StatWeighting.cs index 53c54113..3e736ba2 100644 --- a/ARKBreedingStats/StatWeighting.cs +++ b/ARKBreedingStats/StatWeighting.cs @@ -151,23 +151,26 @@ public Dictionary CustomWeightings get { return customWeightings; } set { - customWeightings = value; - // clear custom presets - for (int i = contextMenuStrip1.Items.Count - 4; i > 1; i--) + if (value != null) { - contextMenuStrip1.Items.RemoveAt(i); - } - deletePresetToolStripMenuItem.DropDownItems.Clear(); + customWeightings = value; + // clear custom presets + for (int i = contextMenuStrip1.Items.Count - 4; i > 1; i--) + { + contextMenuStrip1.Items.RemoveAt(i); + } + deletePresetToolStripMenuItem.DropDownItems.Clear(); - foreach (KeyValuePair e in customWeightings) - { - ToolStripMenuItem ti = new ToolStripMenuItem(e.Key); - ti.Click += new System.EventHandler(this.ToolStripMenuItemCustom_Click); - contextMenuStrip1.Items.Insert(contextMenuStrip1.Items.Count - 3, ti); - // delete entry - ti = new ToolStripMenuItem(e.Key); - ti.Click += new System.EventHandler(this.ToolStripMenuItemDelete_Click); - deletePresetToolStripMenuItem.DropDownItems.Add(ti); + foreach (KeyValuePair e in customWeightings) + { + ToolStripMenuItem ti = new ToolStripMenuItem(e.Key); + ti.Click += new System.EventHandler(this.ToolStripMenuItemCustom_Click); + contextMenuStrip1.Items.Insert(contextMenuStrip1.Items.Count - 3, ti); + // delete entry + ti = new ToolStripMenuItem(e.Key); + ti.Click += new System.EventHandler(this.ToolStripMenuItemDelete_Click); + deletePresetToolStripMenuItem.DropDownItems.Add(ti); + } } } } diff --git a/ARKBreedingStats/ver.txt b/ARKBreedingStats/ver.txt index f64ece55..34df6743 100644 --- a/ARKBreedingStats/ver.txt +++ b/ARKBreedingStats/ver.txt @@ -1 +1 @@ -2540000,0.21.0 \ No newline at end of file +2540000,0.21.1 \ No newline at end of file