Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Sep 17, 2023
2 parents 94314de + d1a6545 commit 006eb77
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 55 deletions.
38 changes: 20 additions & 18 deletions ARKBreedingStats/AboutBox1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -988,30 +988,26 @@ private void UpdateOwnerServerTagLists()

//// clear lists
// owner
var ownerList = new List<string>();
var tribesList = new List<string>();
var serverList = new List<string>();
var ownerList = new HashSet<string>();
var tribesList = new HashSet<string>();
var serverList = new HashSet<string>();

//// 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<string> list, string name)
void AddIfNotEmpty(HashSet<string> 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);

Expand Down
7 changes: 5 additions & 2 deletions ARKBreedingStats/Form1.extractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("")]

Expand All @@ -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")]

28 changes: 13 additions & 15 deletions ARKBreedingStats/TribesControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,15 @@ public void AddPlayer(string name = null)
/// Add players if they aren't yet in the list.
/// </summary>
/// <param name="playerNames"></param>
public void AddPlayers(List<string> playerNames)
public void AddPlayers(HashSet<string> 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();
}

Expand All @@ -310,17 +309,16 @@ public void AddTribe(string name = null)
/// <summary>
/// Add tribes if they aren't yet in the list.
/// </summary>
/// <param name="playerNames"></param>
public void AddTribes(List<string> tribeNames)
/// <param name="tribeNames"></param>
public void AddTribes(HashSet<string> 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();
}

Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 6 additions & 5 deletions ARKBreedingStats/library/CreatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
/// <summary>
/// Returns a creature based on the guid or ArkId.
/// </summary>
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)
{
Expand All @@ -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)
{
Expand Down

0 comments on commit 006eb77

Please sign in to comment.