Skip to content

Commit 006eb77

Browse files
committed
Merge branch 'dev'
2 parents 94314de + d1a6545 commit 006eb77

File tree

7 files changed

+55
-55
lines changed

7 files changed

+55
-55
lines changed

ARKBreedingStats/AboutBox1.cs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,26 @@ private void linkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
9292

9393
private string Contributors => @"Thanks for contributions, help and support to
9494
95-
* NakramR (coding, OCR, library, overlay)
96-
* Flachdachs (savefile extractor, installer-version, style, fixes)
97-
* coldino (ARK-data, support)
98-
* VolatilesPulse (ARK-data, support)
99-
* qowyn (savefile extractor, ARK-data)
100-
* aaron-williamson (file-syncing for cloud-services)
101-
* DelilahEve (updater)
102-
* DodoCooker (fixes, performance)
103-
* Warstone (Kibble recipes)
104-
* tsebring (naming-generator, fixes)
105-
* maxime-paquatte (custom timer sounds)
106-
* hallipr (FTP savefile import)
107-
* EmkioA (Cryopod import, listView tweaks)
108-
* dunger (fixes)
109-
* Myrmecoleon (extra species images)
110-
* Lunat1q (improved OCR)
111-
* ThatGamerBlue (species dividers in virtual listview)
112-
* Jaymei (ATLAS species data)
95+
* NakramR: coding, library, OCR, overlay
96+
* Flachdachs: save file extractor, installer-version, style
97+
* coldino: ARK-data, support
98+
* VolatilesPulse: ARK-data, support
99+
* qowyn: original save file extractor, ARK-data
100+
* alex4401: save file extractor format updates
101+
* Miragedmuk: save file extractor format updates
102+
* aaron-williamson: file-syncing for cloud-services
103+
* DelilahEve: auto updater
104+
* DodoCooker: performance for large libraries
105+
* Warstone: Kibble recipes
106+
* tsebring: naming-generator
107+
* maxime-paquatte: custom timer sounds
108+
* hallipr: FTP save file import
109+
* EmkioA: Cryopod import, listView tweaks
110+
* dunger: fixes
111+
* Myrmecoleon: extra species color region images
112+
* Lunat1q: improved OCR
113+
* ThatGamerBlue: species dividers in virtual listView
114+
* Jaymei: ATLAS species data
113115
114116
Translations:
115117
* French by Vykan and Yanuut

ARKBreedingStats/Form1.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -988,30 +988,26 @@ private void UpdateOwnerServerTagLists()
988988

989989
//// clear lists
990990
// owner
991-
var ownerList = new List<string>();
992-
var tribesList = new List<string>();
993-
var serverList = new List<string>();
991+
var ownerList = new HashSet<string>();
992+
var tribesList = new HashSet<string>();
993+
var serverList = new HashSet<string>();
994994

995995
//// check all creature for info
996996
var creaturesToCheck = _creatureCollection.creatures.Where(c => !c.flags.HasFlag(CreatureFlags.Placeholder))
997997
.ToArray();
998998
foreach (Creature c in creaturesToCheck)
999999
{
1000-
AddIfNotContains(ownerList, c.owner);
1001-
AddIfNotContains(tribesList, c.tribe);
1002-
AddIfNotContains(serverList, c.server);
1000+
AddIfNotEmpty(ownerList, c.owner);
1001+
AddIfNotEmpty(tribesList, c.tribe);
1002+
AddIfNotEmpty(serverList, c.server);
10031003

1004-
void AddIfNotContains(List<string> list, string name)
1004+
void AddIfNotEmpty(HashSet<string> list, string name)
10051005
{
1006-
if (!string.IsNullOrEmpty(name) && !list.Contains(name))
1006+
if (!string.IsNullOrEmpty(name))
10071007
list.Add(name);
10081008
}
10091009
}
10101010

1011-
ownerList.Sort();
1012-
tribesList.Sort();
1013-
serverList.Sort();
1014-
10151011
// owners
10161012
tribesControl1.AddPlayers(ownerList);
10171013

ARKBreedingStats/Form1.extractor.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,9 @@ private void SetCreatureValuesToExtractor(CreatureValues cv, bool setInfoInput =
10581058
// at this point, if the creatureValues has parent-ArkIds, make sure these parent-creatures exist
10591059
if (cv.Mother == null)
10601060
{
1061-
if (_creatureCollection.CreatureById(cv.motherGuid, cv.motherArkId, cv.Species, out Creature mother))
1061+
// placeholder creatures might have an Ark id of 0, so use the generated guid to find them reliably
1062+
var useGuid = cv.motherGuid != Guid.Empty ? cv.motherGuid : Utils.ConvertArkIdToGuid(cv.motherArkId);
1063+
if (_creatureCollection.CreatureById(useGuid, cv.motherArkId, out Creature mother))
10621064
{
10631065
cv.Mother = mother;
10641066
}
@@ -1070,7 +1072,8 @@ private void SetCreatureValuesToExtractor(CreatureValues cv, bool setInfoInput =
10701072
}
10711073
if (cv.Father == null)
10721074
{
1073-
if (_creatureCollection.CreatureById(cv.fatherGuid, cv.fatherArkId, cv.Species, out Creature father))
1075+
var useGuid = cv.fatherGuid != Guid.Empty ? cv.fatherGuid : Utils.ConvertArkIdToGuid(cv.fatherArkId);
1076+
if (_creatureCollection.CreatureById(useGuid, cv.fatherArkId, out Creature father))
10741077
{
10751078
cv.Father = father;
10761079
}

ARKBreedingStats/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("")]
1212
[assembly: AssemblyProduct("ARK Smart Breeding")]
13-
[assembly: AssemblyCopyright("Copyright © 2015 – 2021, main developer cadon")]
13+
[assembly: AssemblyCopyright("Copyright © 2015 – 2023, main developer cadon")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -30,6 +30,6 @@
3030
// Revision
3131
//
3232
[assembly: AssemblyVersion("1.0.0.0")]
33-
[assembly: AssemblyFileVersion("0.56.0.1")]
33+
[assembly: AssemblyFileVersion("0.56.1.0")]
3434
[assembly: NeutralResourcesLanguage("en")]
3535

ARKBreedingStats/TribesControl.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,15 @@ public void AddPlayer(string name = null)
275275
/// Add players if they aren't yet in the list.
276276
/// </summary>
277277
/// <param name="playerNames"></param>
278-
public void AddPlayers(List<string> playerNames)
278+
public void AddPlayers(HashSet<string> playerNames)
279279
{
280-
if (playerNames == null) return;
281-
280+
if (playerNames == null || !playerNames.Any()) return;
282281
var existingPlayers = players.Select(p => p.PlayerName).ToHashSet();
283-
var newPlayers = playerNames
284-
.Where(newPlayer => !string.IsNullOrEmpty(newPlayer) && !existingPlayers.Contains(newPlayer))
282+
playerNames.ExceptWith(existingPlayers);
283+
var newPlayersArray = playerNames.Where(newPlayer => !string.IsNullOrEmpty(newPlayer))
285284
.Select(p => new Player { PlayerName = p }).ToArray();
286-
if (!newPlayers.Any()) return;
287-
players.AddRange(newPlayers);
285+
if (!newPlayersArray.Any()) return;
286+
players.AddRange(newPlayersArray);
288287
UpdatePlayerList();
289288
}
290289

@@ -310,17 +309,16 @@ public void AddTribe(string name = null)
310309
/// <summary>
311310
/// Add tribes if they aren't yet in the list.
312311
/// </summary>
313-
/// <param name="playerNames"></param>
314-
public void AddTribes(List<string> tribeNames)
312+
/// <param name="tribeNames"></param>
313+
public void AddTribes(HashSet<string> tribeNames)
315314
{
316-
if (tribeNames == null) return;
317-
315+
if (tribeNames == null || !tribeNames.Any()) return;
318316
var existingTribes = tribes.Select(t => t.TribeName).ToHashSet();
319-
var newTribes = tribeNames
320-
.Where(newTribe => !string.IsNullOrEmpty(newTribe) && !existingTribes.Contains(newTribe))
317+
tribeNames.ExceptWith(existingTribes);
318+
var newTribesArray = tribeNames.Distinct().Where(newTribe => !string.IsNullOrEmpty(newTribe))
321319
.Select(t => new Tribe { TribeName = t }).ToArray();
322-
if (!newTribes.Any()) return;
323-
tribes.AddRange(newTribes);
320+
if (!newTribesArray.Any()) return;
321+
tribes.AddRange(newTribesArray);
324322
UpdateTribeList();
325323
}
326324

ARKBreedingStats/_manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"ARK Smart Breeding": {
55
"Id": "ARK Smart Breeding",
66
"Category": "main",
7-
"version": "0.56.0.1"
7+
"version": "0.56.1.0"
88
},
99
"SpeciesColorImages": {
1010
"Id": "SpeciesColorImages",

ARKBreedingStats/library/CreatureCollection.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,17 @@ public bool ArkIdAlreadyExist(long arkID, Creature concerningCreature, out Creat
388388
return exists;
389389
}
390390

391-
public bool CreatureById(Guid guid, long arkId, Species species, out Creature foundCreature)
391+
/// <summary>
392+
/// Returns a creature based on the guid or ArkId.
393+
/// </summary>
394+
public bool CreatureById(Guid guid, long arkId, out Creature foundCreature)
392395
{
393396
foundCreature = null;
394397
if (guid == Guid.Empty && arkId == 0) return false;
395398

396-
var creaturesToCheck = creatures.Where(c => c.Species == species).ToArray();
397-
398399
if (guid != Guid.Empty)
399400
{
400-
foreach (var c in creaturesToCheck)
401+
foreach (var c in creatures)
401402
{
402403
if (c.guid == guid)
403404
{
@@ -409,7 +410,7 @@ public bool CreatureById(Guid guid, long arkId, Species species, out Creature fo
409410

410411
if (arkId != 0)
411412
{
412-
foreach (var c in creaturesToCheck)
413+
foreach (var c in creatures)
413414
{
414415
if (c.ArkIdImported && c.ArkId == arkId)
415416
{

0 commit comments

Comments
 (0)