Skip to content

Commit

Permalink
cretaure sex flag fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Feb 28, 2024
1 parent 052d184 commit 07b5b30
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
2 changes: 2 additions & 0 deletions ARKBreedingStats/Form1.extractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,8 @@ private Creature GetCreatureFromInput(bool fromExtractor, Species species, int?
creature.ArkIdImported = Utils.IsArkIdImported(creature.ArkId, creature.guid);
creature.InitializeArkInGame();

creature.InitializeFlags();

// parent guids
if (motherArkId != 0)
creature.motherGuid = Utils.ConvertArkIdToGuid(motherArkId);
Expand Down
39 changes: 24 additions & 15 deletions ARKBreedingStats/Form1.library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1411,25 +1411,34 @@ private void FilterLib(bool selectFirstIfNothingIsSelected = false)

if (_creaturesPreFiltered == null)
{
filteredList = from creature in _creatureCollection.creatures
where creature.Species != null && !creature.flags.HasFlag(CreatureFlags.Placeholder)
select creature;

// if only one species should be shown adjust headers if the selected species has custom statNames
Dictionary<string, string> customStatNames = null;
if (listBoxSpeciesLib.SelectedItem is Species selectedSpecies)
if (!_creatureCollection.creatures.Any())
{
filteredList = filteredList.Where(c => c.Species == selectedSpecies);
customStatNames = selectedSpecies.statNames;
_creaturesPreFiltered = Array.Empty<Creature>();
}

for (int s = 0; s < Stats.StatsCount; s++)
else
{
listViewLibrary.Columns[ColumnIndexFirstStat + s].Text = Utils.StatName(s, true, customStatNames);
listViewLibrary.Columns[ColumnIndexFirstStat + Stats.StatsCount + s].Text = Utils.StatName(s, true, customStatNames) + "M";
}
filteredList = from creature in _creatureCollection.creatures
where creature.Species != null && !creature.flags.HasFlag(CreatureFlags.Placeholder)
select creature;

// if only one species should be shown adjust headers if the selected species has custom statNames
Dictionary<string, string> customStatNames = null;
if (listBoxSpeciesLib.SelectedItem is Species selectedSpecies)
{
filteredList = filteredList.Where(c => c.Species == selectedSpecies);
customStatNames = selectedSpecies.statNames;
}

for (int s = 0; s < Stats.StatsCount; s++)
{
listViewLibrary.Columns[ColumnIndexFirstStat + s].Text =
Utils.StatName(s, true, customStatNames);
listViewLibrary.Columns[ColumnIndexFirstStat + Stats.StatsCount + s].Text =
Utils.StatName(s, true, customStatNames) + "M";
}

_creaturesPreFiltered = ApplyLibraryFilterSettings(filteredList).ToArray();
_creaturesPreFiltered = ApplyLibraryFilterSettings(filteredList).ToArray();
}
}

filteredList = _creaturesPreFiltered;
Expand Down

0 comments on commit 07b5b30

Please sign in to comment.