diff --git a/ARKBreedingStats/AboutBox1.cs b/ARKBreedingStats/AboutBox1.cs index 5fe699e3..2fef6cd9 100644 --- a/ARKBreedingStats/AboutBox1.cs +++ b/ARKBreedingStats/AboutBox1.cs @@ -92,24 +92,26 @@ private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs private string Contributors => @"Thanks for contributions, help and support to -* NakramR (coding, OCR, library, overlay) -* Flachdachs (savefile extractor, installer-version, style, fixes) -* coldino (ARK-data, support) -* VolatilesPulse (ARK-data, support) -* qowyn (savefile extractor, ARK-data) -* aaron-williamson (file-syncing for cloud-services) -* DelilahEve (updater) -* DodoCooker (fixes, performance) -* Warstone (Kibble recipes) -* tsebring (naming-generator, fixes) -* maxime-paquatte (custom timer sounds) -* hallipr (FTP savefile import) -* EmkioA (Cryopod import, listView tweaks) -* dunger (fixes) -* Myrmecoleon (extra species images) -* Lunat1q (improved OCR) -* ThatGamerBlue (species dividers in virtual listview) -* Jaymei (ATLAS species data) +* NakramR: coding, library, OCR, overlay +* Flachdachs: save file extractor, installer-version, style +* coldino: ARK-data, support +* VolatilesPulse: ARK-data, support +* qowyn: original save file extractor, ARK-data +* alex4401: save file extractor format updates +* Miragedmuk: save file extractor format updates +* aaron-williamson: file-syncing for cloud-services +* DelilahEve: auto updater +* DodoCooker: performance for large libraries +* Warstone: Kibble recipes +* tsebring: naming-generator +* maxime-paquatte: custom timer sounds +* hallipr: FTP save file import +* EmkioA: Cryopod import, listView tweaks +* dunger: fixes +* Myrmecoleon: extra species color region images +* Lunat1q: improved OCR +* ThatGamerBlue: species dividers in virtual listView +* Jaymei: ATLAS species data Translations: * French by Vykan and Yanuut diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 04e21e5a..96be6f63 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -988,30 +988,26 @@ private void UpdateOwnerServerTagLists() //// clear lists // owner - var ownerList = new List(); - var tribesList = new List(); - var serverList = new List(); + var ownerList = new HashSet(); + var tribesList = new HashSet(); + var serverList = new HashSet(); //// check all creature for info var creaturesToCheck = _creatureCollection.creatures.Where(c => !c.flags.HasFlag(CreatureFlags.Placeholder)) .ToArray(); foreach (Creature c in creaturesToCheck) { - AddIfNotContains(ownerList, c.owner); - AddIfNotContains(tribesList, c.tribe); - AddIfNotContains(serverList, c.server); + AddIfNotEmpty(ownerList, c.owner); + AddIfNotEmpty(tribesList, c.tribe); + AddIfNotEmpty(serverList, c.server); - void AddIfNotContains(List list, string name) + void AddIfNotEmpty(HashSet list, string name) { - if (!string.IsNullOrEmpty(name) && !list.Contains(name)) + if (!string.IsNullOrEmpty(name)) list.Add(name); } } - ownerList.Sort(); - tribesList.Sort(); - serverList.Sort(); - // owners tribesControl1.AddPlayers(ownerList); diff --git a/ARKBreedingStats/Form1.extractor.cs b/ARKBreedingStats/Form1.extractor.cs index 4b0df599..e3a32368 100644 --- a/ARKBreedingStats/Form1.extractor.cs +++ b/ARKBreedingStats/Form1.extractor.cs @@ -1058,7 +1058,9 @@ private void SetCreatureValuesToExtractor(CreatureValues cv, bool setInfoInput = // at this point, if the creatureValues has parent-ArkIds, make sure these parent-creatures exist if (cv.Mother == null) { - if (_creatureCollection.CreatureById(cv.motherGuid, cv.motherArkId, cv.Species, out Creature mother)) + // placeholder creatures might have an Ark id of 0, so use the generated guid to find them reliably + var useGuid = cv.motherGuid != Guid.Empty ? cv.motherGuid : Utils.ConvertArkIdToGuid(cv.motherArkId); + if (_creatureCollection.CreatureById(useGuid, cv.motherArkId, out Creature mother)) { cv.Mother = mother; } @@ -1070,7 +1072,8 @@ private void SetCreatureValuesToExtractor(CreatureValues cv, bool setInfoInput = } if (cv.Father == null) { - if (_creatureCollection.CreatureById(cv.fatherGuid, cv.fatherArkId, cv.Species, out Creature father)) + var useGuid = cv.fatherGuid != Guid.Empty ? cv.fatherGuid : Utils.ConvertArkIdToGuid(cv.fatherArkId); + if (_creatureCollection.CreatureById(useGuid, cv.fatherArkId, out Creature father)) { cv.Father = father; } diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index 62537ce8..8a380389 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ARK Smart Breeding")] -[assembly: AssemblyCopyright("Copyright © 2015 – 2021, main developer cadon")] +[assembly: AssemblyCopyright("Copyright © 2015 – 2023, main developer cadon")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -30,6 +30,6 @@ // Revision // [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.56.0.1")] +[assembly: AssemblyFileVersion("0.56.1.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/TribesControl.cs b/ARKBreedingStats/TribesControl.cs index 14105b19..643436b4 100644 --- a/ARKBreedingStats/TribesControl.cs +++ b/ARKBreedingStats/TribesControl.cs @@ -275,16 +275,15 @@ public void AddPlayer(string name = null) /// Add players if they aren't yet in the list. /// /// - public void AddPlayers(List playerNames) + public void AddPlayers(HashSet playerNames) { - if (playerNames == null) return; - + if (playerNames == null || !playerNames.Any()) return; var existingPlayers = players.Select(p => p.PlayerName).ToHashSet(); - var newPlayers = playerNames - .Where(newPlayer => !string.IsNullOrEmpty(newPlayer) && !existingPlayers.Contains(newPlayer)) + playerNames.ExceptWith(existingPlayers); + var newPlayersArray = playerNames.Where(newPlayer => !string.IsNullOrEmpty(newPlayer)) .Select(p => new Player { PlayerName = p }).ToArray(); - if (!newPlayers.Any()) return; - players.AddRange(newPlayers); + if (!newPlayersArray.Any()) return; + players.AddRange(newPlayersArray); UpdatePlayerList(); } @@ -310,17 +309,16 @@ public void AddTribe(string name = null) /// /// Add tribes if they aren't yet in the list. /// - /// - public void AddTribes(List tribeNames) + /// + public void AddTribes(HashSet tribeNames) { - if (tribeNames == null) return; - + if (tribeNames == null || !tribeNames.Any()) return; var existingTribes = tribes.Select(t => t.TribeName).ToHashSet(); - var newTribes = tribeNames - .Where(newTribe => !string.IsNullOrEmpty(newTribe) && !existingTribes.Contains(newTribe)) + tribeNames.ExceptWith(existingTribes); + var newTribesArray = tribeNames.Distinct().Where(newTribe => !string.IsNullOrEmpty(newTribe)) .Select(t => new Tribe { TribeName = t }).ToArray(); - if (!newTribes.Any()) return; - tribes.AddRange(newTribes); + if (!newTribesArray.Any()) return; + tribes.AddRange(newTribesArray); UpdateTribeList(); } diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 9b371275..d2eb766f 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.56.0.1" + "version": "0.56.1.0" }, "SpeciesColorImages": { "Id": "SpeciesColorImages", diff --git a/ARKBreedingStats/library/CreatureCollection.cs b/ARKBreedingStats/library/CreatureCollection.cs index 3ad4490b..8711b0a2 100644 --- a/ARKBreedingStats/library/CreatureCollection.cs +++ b/ARKBreedingStats/library/CreatureCollection.cs @@ -388,16 +388,17 @@ public bool ArkIdAlreadyExist(long arkID, Creature concerningCreature, out Creat return exists; } - public bool CreatureById(Guid guid, long arkId, Species species, out Creature foundCreature) + /// + /// Returns a creature based on the guid or ArkId. + /// + public bool CreatureById(Guid guid, long arkId, out Creature foundCreature) { foundCreature = null; if (guid == Guid.Empty && arkId == 0) return false; - var creaturesToCheck = creatures.Where(c => c.Species == species).ToArray(); - if (guid != Guid.Empty) { - foreach (var c in creaturesToCheck) + foreach (var c in creatures) { if (c.guid == guid) { @@ -409,7 +410,7 @@ public bool CreatureById(Guid guid, long arkId, Species species, out Creature fo if (arkId != 0) { - foreach (var c in creaturesToCheck) + foreach (var c in creatures) { if (c.ArkIdImported && c.ArkId == arkId) {