From 76c9c9b4d82689ce6fe7cea242b2f98f02e4356c Mon Sep 17 00:00:00 2001 From: cadon Date: Thu, 29 Feb 2024 00:34:31 +0100 Subject: [PATCH 1/2] fix top stat status calculation when importing different species --- ARKBreedingStats/Form1.cs | 2 +- ARKBreedingStats/Form1.library.cs | 24 ++++++++++++++++++------ ARKBreedingStats/Form1.tester.cs | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 48d3b712..5f8cdfba 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -984,7 +984,7 @@ private void UpdateCreatureListings(Species species = null, bool keepCurrentlySe } UpdateOwnerServerTagLists(); - CalculateTopStats(creatures); + CalculateTopStats(creatures, species); UpdateSpeciesLists(_creatureCollection.creatures, keepCurrentlySelectedSpecies); FilterLibRecalculate(); UpdateStatusBar(); diff --git a/ARKBreedingStats/Form1.library.cs b/ARKBreedingStats/Form1.library.cs index 35ce940d..514142f5 100644 --- a/ARKBreedingStats/Form1.library.cs +++ b/ARKBreedingStats/Form1.library.cs @@ -277,12 +277,24 @@ private static void ApplySpeciesObjectsToCollection(CreatureCollection cc) /// Calculates the top-stats in each species, sets the top-stat-flags in the creatures /// /// creatures to consider - private void CalculateTopStats(List creatures) + /// If not null, it's assumed only creatures of this species are recalculated + private void CalculateTopStats(List creatures, Species onlySpecies = null) { - _highestSpeciesLevels.Clear(); - _lowestSpeciesLevels.Clear(); - _highestSpeciesMutationLevels.Clear(); - _lowestSpeciesMutationLevels.Clear(); + if (onlySpecies == null) + { + // if all creatures are recalculated, clear all + _highestSpeciesLevels.Clear(); + _lowestSpeciesLevels.Clear(); + _highestSpeciesMutationLevels.Clear(); + _lowestSpeciesMutationLevels.Clear(); + } + else + { + _highestSpeciesLevels.Remove(onlySpecies); + _lowestSpeciesLevels.Remove(onlySpecies); + _highestSpeciesMutationLevels.Remove(onlySpecies); + _lowestSpeciesMutationLevels.Remove(onlySpecies); + } var filteredCreaturesHash = Properties.Settings.Default.useFiltersInTopStatCalculation ? new HashSet(ApplyLibraryFilterSettings(creatures)) : null; @@ -929,7 +941,7 @@ private void UpdateDisplayedCreatureValues(Creature cr, bool creatureStatusChang // if creatureStatus (available/dead) changed, recalculate topStats (dead creatures are not considered there) if (creatureStatusChanged) { - CalculateTopStats(_creatureCollection.creatures.Where(c => c.Species == cr.Species).ToList()); + CalculateTopStats(_creatureCollection.creatures.Where(c => c.Species == cr.Species).ToList(), cr.Species); FilterLibRecalculate(); UpdateStatusBar(); } diff --git a/ARKBreedingStats/Form1.tester.cs b/ARKBreedingStats/Form1.tester.cs index b8f3457e..570fa0e7 100644 --- a/ARKBreedingStats/Form1.tester.cs +++ b/ARKBreedingStats/Form1.tester.cs @@ -216,7 +216,7 @@ private void creatureInfoInputTester_Save2Library_Clicked(CreatureInfoInput send creatureInfoInputTester.SetCreatureData(_creatureTesterEdit); if (wildChanged) - CalculateTopStats(_creatureCollection.creatures.Where(c => c.Species == _creatureTesterEdit.Species).ToList()); + CalculateTopStats(_creatureCollection.creatures.Where(c => c.Species == _creatureTesterEdit.Species).ToList(), _creatureTesterEdit.Species); UpdateDisplayedCreatureValues(_creatureTesterEdit, statusChanged, true); if (parentsChanged) From 91780df0daf113a02d68a48b79357f2e2523c36e Mon Sep 17 00:00:00 2001 From: cadon Date: Thu, 29 Feb 2024 00:35:57 +0100 Subject: [PATCH 2/2] ver --- ARKBreedingStats/Properties/AssemblyInfo.cs | 2 +- ARKBreedingStats/_manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index 442ba60b..5de95bc6 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.60.2.0")] +[assembly: AssemblyFileVersion("0.60.2.1")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 2b72bbfc..36d0b6c4 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.60.2.0" + "version": "0.60.2.1" }, "SpeciesColorImages": { "Id": "SpeciesColorImages",