Skip to content

Commit

Permalink
fixed tab-order in the creature-info-input. fixed check for existing …
Browse files Browse the repository at this point in the history
…Guid. fixed not saving ARK-ID.
  • Loading branch information
cadaei committed Aug 23, 2018
1 parent 9dea9a4 commit 00bb9e9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 47 deletions.
14 changes: 2 additions & 12 deletions ARKBreedingStats/CreatureCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ public bool mergeCreatureList(List<Creature> creaturesToMerge, bool update = fal
/// </summary>
/// <param name="guid">Guid to check</param>
/// <returns>True if there is a creature with the given Guid</returns>
public bool GUIDAlreadyExist(Guid guid, out Creature creature)
public bool GUIDAlreadyExist(Guid guid, Creature concerningCreature, out Creature creature)
{
creature = null;
bool exists = false;
foreach (var c in creatures)
{
if (c.guid == guid)
if (c.guid == guid && c != concerningCreature)
{
creature = c;
exists = true;
Expand All @@ -201,15 +201,5 @@ public bool GUIDAlreadyExist(Guid guid, out Creature creature)
}
return exists;
}

/// <summary>
/// Checks if a creature with the Guid created from an ARKID exists
/// </summary>
/// <param name="arkId">ARKID to check</param>
/// <returns></returns>
public bool GuidOfARKIDExists(long arkId, out Creature creature)
{
return GUIDAlreadyExist(Utils.ConvertIdToGuid(arkId), out creature);
}
}
}
62 changes: 31 additions & 31 deletions ARKBreedingStats/CreatureInfoInput.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ private void add2Lib(bool fromExtractor = true)
};

Guid newGuid = Utils.ConvertIdToGuid(input.ARKID);
if (input.ARKID != 0 && creatureCollection.GUIDAlreadyExist(newGuid, out Creature guidCreature))
if (input.ARKID != 0 && creatureCollection.GUIDAlreadyExist(newGuid, creature, out Creature guidCreature))
{
MessageBox.Show("The entered ARK-ID results in a Guid that is already existing in this library (" + guidCreature.species + " (lvl " + guidCreature.level.ToString() + ")" + ": " + guidCreature.name + ").\nUsually that means there is already a creature in this library with this ARK-ID.\nYou have to choose a different ARK-ID or delete the other creature first.", "ARK-ID already existing",
MessageBoxButtons.OK,
Expand All @@ -1240,6 +1240,9 @@ private void add2Lib(bool fromExtractor = true)
creature.guid = input.CreatureGuid;
else
creature.guid = Guid.NewGuid();

creature.ARKID = input.ARKID;

// if parent creatures don't exist in the library but they have a known id, save these for if they are imported later
if (creature.Mother == null && input.motherId != Guid.Empty) creature.motherGuid = input.motherId;
if (creature.Father == null && input.fatherId != Guid.Empty) creature.fatherGuid = input.fatherId;
Expand Down Expand Up @@ -3973,7 +3976,7 @@ private void creatureInfoInputTester_Save2Library_Clicked(CreatureInfoInput send

// check if the ARKID was changed to an id that results in a Guid that is already existing
Guid newGuid = Utils.ConvertIdToGuid(creatureInfoInputTester.ARKID);
if (creatureInfoInputTester.ARKID != 0 && creatureCollection.GUIDAlreadyExist(newGuid, out Creature guidCreature))
if (creatureInfoInputTester.ARKID != 0 && creatureCollection.GUIDAlreadyExist(newGuid, creatureTesterEdit, out Creature guidCreature))
{
MessageBox.Show("The entered ARK-ID results in a Guid that is already existing in this library (" + guidCreature.species + " (lvl " + guidCreature.level.ToString() + ")" + ": " + guidCreature.name + ").\nUsually that means there is already a creature in this library with this ARK-ID.\nYou have to choose a different ARK-ID or delete the other creature first.", "ARK-ID already existing",
MessageBoxButtons.OK,
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.28.9")]
[assembly: AssemblyFileVersion("0.28.9.1")]
[assembly: NeutralResourcesLanguage("en")]

2 changes: 1 addition & 1 deletion ARKBreedingStats/ver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
282.102.1,0.28.9
282.102.1,0.28.9.1

0 comments on commit 00bb9e9

Please sign in to comment.