diff --git a/ARKBreedingStats/FileSync.cs b/ARKBreedingStats/FileSync.cs index 0024d79d..f4b0fa95 100644 --- a/ARKBreedingStats/FileSync.cs +++ b/ARKBreedingStats/FileSync.cs @@ -29,11 +29,12 @@ public FileSync(string fileName, Action callback) UpdateProperties(); } + /// + /// Update the FileSystemWatcher properties + /// public void ChangeFile(string newFileName) { _currentFile = newFileName; - - // Update the FileSystemWatcher properties UpdateProperties(); } diff --git a/ARKBreedingStats/Form1.collection.cs b/ARKBreedingStats/Form1.collection.cs index f3f54933..b4a82a36 100644 --- a/ARKBreedingStats/Form1.collection.cs +++ b/ARKBreedingStats/Form1.collection.cs @@ -67,11 +67,13 @@ private void NewCollection(bool resetCollection = false) serverMultipliers = oldMultipliers, ModList = new List() }; + _currentFileName = null; + _fileSync?.ChangeFile(_currentFileName); if (asaMode) { _creatureCollection.Game = Ark.Asa; - ReloadModValuesOfCollectionIfNeeded(true, false, false); + ReloadModValuesOfCollectionIfNeeded(true, false, false, false); } pedigree1.Clear(); @@ -84,8 +86,6 @@ private void NewCollection(bool resetCollection = false) UpdateCreatureListings(); creatureBoxListView.Clear(); Properties.Settings.Default.LastSaveFile = null; - _currentFileName = null; - _fileSync?.ChangeFile(_currentFileName); SetCollectionChanged(false); } @@ -877,6 +877,16 @@ private bool ImportExportGunFiles(string[] filePaths, out bool creatureAdded, ou + serverImportResult); SetMessageLabelText(resultText, importFailedCounter > 0 || multipliersImportSuccessful == false ? MessageBoxIcon.Error : MessageBoxIcon.Information, lastCreatureFilePath); + + if (lastAddedCreature != null) + { + tabControlMain.SelectedTab = tabPageLibrary; + if (listBoxSpeciesLib.SelectedItem != null && + listBoxSpeciesLib.SelectedItem != lastAddedCreature.Species) + listBoxSpeciesLib.SelectedItem = lastAddedCreature.Species; + SelectCreatureInLibrary(lastAddedCreature); + } + return creatureAlreadyExists; } diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index cd04422f..9a455043 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -1991,7 +1991,7 @@ private void OpenSettingsDialog(SettingsTabPages page = SettingsTabPages.Unknown { // ASA setting changed var loadAsa = gameSettingBefore != Ark.Asa; - ReloadModValuesOfCollectionIfNeeded(loadAsa, false, false); + ReloadModValuesOfCollectionIfNeeded(loadAsa, false, false, false); } ApplySettingsToValues(); @@ -2757,7 +2757,7 @@ private void loadAdditionalValuesToolStripMenuItem_Click(object sender, EventArg /// Loads mod value files according to the ModList of the library. /// /// If true the values are not reset to the default first. - private void ReloadModValuesOfCollectionIfNeeded(bool onlyAdd = false, bool showResult = true, bool applySettings = true) + private void ReloadModValuesOfCollectionIfNeeded(bool onlyAdd = false, bool showResult = true, bool applySettings = true, bool setCollectionChanged = true) { // if the mods for the library changed, // first check if all mod value files are available and load missing files if possible, @@ -2774,7 +2774,8 @@ private void ReloadModValuesOfCollectionIfNeeded(bool onlyAdd = false, bool show else UpdateAsaIndicator(); - SetCollectionChanged(true); + if (setCollectionChanged) + SetCollectionChanged(true); } } @@ -3226,11 +3227,17 @@ private void tsBtAddAsExtractionTest_Click(object sender, EventArgs e) private void copyToMultiplierTesterToolStripButton_Click(object sender, EventArgs e) { + bool fromExtractor = tabControlMain.SelectedTab == tabPageExtractor; + var tamed = fromExtractor ? rbTamedExtractor.Checked : rbTamedTester.Checked; + var bred = fromExtractor ? rbBredExtractor.Checked : rbBredTester.Checked; + double[] statValues = new double[Stats.StatsCount]; for (int s = 0; s < Stats.StatsCount; s++) - statValues[s] = _statIOs[s].Input; - - bool fromExtractor = tabControlMain.SelectedTab == tabPageExtractor; + { + statValues[s] = _statIOs[s].IsActive + ? _statIOs[s].Input + : StatValueCalculation.CalculateValue(speciesSelector1.SelectedSpecies, s, 0, 0, tamed || bred); + } var wildLevels = GetCurrentWildLevels(false); // the torpor level of the tester is only the sum of the recognized stats. Use the level of the extractor, if that value was recognized. @@ -3245,8 +3252,8 @@ private void copyToMultiplierTesterToolStripButton_Click(object sender, EventArg (double)(fromExtractor ? numericUpDownImprintingBonusExtractor.Value : numericUpDownImprintingBonusTester.Value) / 100, - fromExtractor ? rbTamedExtractor.Checked : rbTamedTester.Checked, - fromExtractor ? rbBredExtractor.Checked : rbBredTester.Checked, + tamed, + bred, speciesSelector1.SelectedSpecies); tabControlMain.SelectedTab = tabPageMultiplierTesting; } diff --git a/ARKBreedingStats/Form1.importExported.cs b/ARKBreedingStats/Form1.importExported.cs index 10a67891..76ec1ab5 100644 --- a/ARKBreedingStats/Form1.importExported.cs +++ b/ARKBreedingStats/Form1.importExported.cs @@ -244,9 +244,6 @@ private Creature ImportExportedAddIfPossible(string filePath) copiedNameToClipboard = true; } } - - SelectCreatureInLibrary(creature); - break; default: return null; } diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index f6d6e117..bfd1b27d 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // Revision // [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.58.0.0")] +[assembly: AssemblyFileVersion("0.58.1.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/Stats.cs b/ARKBreedingStats/Stats.cs index 4d8fbfc6..f7c289a1 100644 --- a/ARKBreedingStats/Stats.cs +++ b/ARKBreedingStats/Stats.cs @@ -9,7 +9,7 @@ public static class StatValueCalculation { //private const double ROUND_UP_DELTA = 0.0001; // remove for now. Rounding issues should be handled during extraction with value-ranges. - public static double CalculateValue(Species species, int stat, int levelWild, int levelDom, bool dom, double tamingEff, double imprintingBonus, bool roundToIngamePrecision = true) + public static double CalculateValue(Species species, int stat, int levelWild, int levelDom, bool dom, double tamingEff = 0, double imprintingBonus = 0, bool roundToIngamePrecision = true) { if (species == null) return 0; @@ -71,8 +71,8 @@ public static float DisplayedAberration(double displayedStatValue, int displayed // always consider at least an error of. When using only the float-precision often the stat-calculations increase the resulting error to be much larger. const float minValueError = 0.001f; - // the error can increase due to the stat-calculation. Assume a factor of 10 for now, values lower than 6 were too low. - const float calculationErrorFactor = 11; + // the error can increase due to the stat-calculation. Assume a factor of 10 for now, values lower than 6 were too low. ASA needs it set to at least 18, using 20 for now. + const float calculationErrorFactor = 20; return highPrecisionInput || displayedStatValue * (displayedDecimals == 3 ? 100 : 1) > 1e6 ? Math.Max(minValueError, ((float)displayedStatValue).FloatPrecision() * calculationErrorFactor) diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 79800d7c..f7a55470 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.58.0.0" + "version": "0.58.1.0" }, "SpeciesColorImages": { "Id": "SpeciesColorImages", diff --git a/ARKBreedingStats/json/values/_manifest.json b/ARKBreedingStats/json/values/_manifest.json index e0e605bb..ba0af954 100644 --- a/ARKBreedingStats/json/values/_manifest.json +++ b/ARKBreedingStats/json/values/_manifest.json @@ -30,7 +30,7 @@ "mod": { "id": "1139775728", "tag": "Confuciusornis", "title": "Confuciusornis" } }, "1169020368-Trex.json": { - "version": "357.11.1680434574", + "version": "358.17.1700597183", "mod": { "id": "1169020368", "tag": "Trex", "title": "Ark Creature Rebalance (AG Reborn)" } }, "1178308359-ShadDragon.json": { diff --git a/ARKBreedingStats/uiControls/StatIO.cs b/ARKBreedingStats/uiControls/StatIO.cs index 2be93465..30bdf75b 100644 --- a/ARKBreedingStats/uiControls/StatIO.cs +++ b/ARKBreedingStats/uiControls/StatIO.cs @@ -253,6 +253,7 @@ public bool IsActive Height = value ? 50 : 16; Enabled = value; } + get => Enabled; } public void Clear()