Skip to content

Commit baa0f7b

Browse files
committed
Merge branch 'dev'
2 parents a82c13c + 0629dd0 commit baa0f7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2269
-1933
lines changed

ARKBreedingStats/ARKBreedingStats.csproj

+21-6
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@
110110
<Compile Include="Pedigree\PedigreeCreation.cs" />
111111
<Compile Include="Pedigree\IPedigreeCreature.cs" />
112112
<Compile Include="species\ArkColors.cs" />
113+
<Compile Include="uiControls\ArkVersionDialog.cs">
114+
<SubType>Form</SubType>
115+
</Compile>
116+
<Compile Include="uiControls\ColorPickerWindow.cs">
117+
<SubType>Form</SubType>
118+
</Compile>
119+
<Compile Include="uiControls\ColorPickerWindow.Designer.cs">
120+
<DependentUpon>ColorPickerWindow.cs</DependentUpon>
121+
</Compile>
113122
<Compile Include="uiControls\CreatureAnalysis.cs">
114123
<SubType>UserControl</SubType>
115124
</Compile>
@@ -132,6 +141,9 @@
132141
<SubType>Component</SubType>
133142
</Compile>
134143
<Compile Include="uiControls\LibraryInfo.cs" />
144+
<Compile Include="uiControls\LibraryInfoControl.cs">
145+
<SubType>UserControl</SubType>
146+
</Compile>
135147
<Compile Include="uiControls\PopupMessage.cs">
136148
<SubType>Form</SubType>
137149
</Compile>
@@ -518,11 +530,11 @@
518530
<Compile Include="uiControls\MultiSetter.Designer.cs">
519531
<DependentUpon>MultiSetter.cs</DependentUpon>
520532
</Compile>
521-
<Compile Include="uiControls\MyColorPicker.cs">
522-
<SubType>Form</SubType>
533+
<Compile Include="uiControls\ColorPickerControl.cs">
534+
<SubType>UserControl</SubType>
523535
</Compile>
524-
<Compile Include="uiControls\MyColorPicker.Designer.cs">
525-
<DependentUpon>MyColorPicker.cs</DependentUpon>
536+
<Compile Include="uiControls\ColorPickerControl.Designer.cs">
537+
<DependentUpon>ColorPickerControl.cs</DependentUpon>
526538
</Compile>
527539
<Compile Include="uiControls\ParentComboBox.cs">
528540
<SubType>Component</SubType>
@@ -702,6 +714,9 @@
702714
<EmbeddedResource Include="ocr\PatternMatching\RecognitionTrainingForm.resx">
703715
<DependentUpon>RecognitionTrainingForm.cs</DependentUpon>
704716
</EmbeddedResource>
717+
<EmbeddedResource Include="uiControls\ColorPickerWindow.resx">
718+
<DependentUpon>ColorPickerWindow.cs</DependentUpon>
719+
</EmbeddedResource>
705720
<EmbeddedResource Include="uiControls\CreatureAnalysis.resx">
706721
<DependentUpon>CreatureAnalysis.cs</DependentUpon>
707722
</EmbeddedResource>
@@ -928,8 +943,8 @@
928943
<EmbeddedResource Include="uiControls\MultiSetter.resx">
929944
<DependentUpon>MultiSetter.cs</DependentUpon>
930945
</EmbeddedResource>
931-
<EmbeddedResource Include="uiControls\MyColorPicker.resx">
932-
<DependentUpon>MyColorPicker.cs</DependentUpon>
946+
<EmbeddedResource Include="uiControls\ColorPickerControl.resx">
947+
<DependentUpon>ColorPickerControl.cs</DependentUpon>
933948
</EmbeddedResource>
934949
<EmbeddedResource Include="Pedigree\PedigreeControl.resx">
935950
<DependentUpon>PedigreeControl.cs</DependentUpon>

ARKBreedingStats/App.config

+5-5
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,6 @@
502502
<setting name="AskSaveSettingsOnClose" serializeAs="String">
503503
<value>True</value>
504504
</setting>
505-
<setting name="KeepMultipliersForNewLibrary" serializeAs="String">
506-
<value>True</value>
507-
</setting>
508505
<setting name="ExportServerToken" serializeAs="String">
509506
<value />
510507
</setting>
@@ -517,8 +514,11 @@
517514
<setting name="LibraryDisplayZeroMutationLevels" serializeAs="String">
518515
<value>False</value>
519516
</setting>
520-
<setting name="CustomStatWeightsOddEven" serializeAs="String">
521-
<value />
517+
<setting name="KeepMultipliersForNewLibrary" serializeAs="String">
518+
<value>True</value>
519+
</setting>
520+
<setting name="DisplayPopupForServerToken" serializeAs="String">
521+
<value>True</value>
522522
</setting>
523523
</ARKBreedingStats.Properties.Settings>
524524
</userSettings>

ARKBreedingStats/Ark.cs

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace ARKBreedingStats
1+
using ARKBreedingStats.values;
2+
3+
namespace ARKBreedingStats
24
{
35
/// <summary>
46
/// Constants of the game Ark.
@@ -103,14 +105,18 @@ public static class Ark
103105
public const byte UndefinedColorIdAsa = 255;
104106

105107
/// <summary>
106-
/// When choosing a random color for a mutation, ARK can erroneously select an undefined color. Usually this is color id 227 (one too high to be defined).
108+
/// When choosing a random color for a mutation, ARK can erroneously select an undefined color. 227 for ASE, 255 for ASA.
107109
/// </summary>
108110
public static byte UndefinedColorId = UndefinedColorIdAse;
109111

110112
/// <summary>
111113
/// Sets the undefined color id to the one of ASE or ASA.
112114
/// </summary>
113-
public static void SetUndefinedColorId(bool asa) => UndefinedColorId = asa ? UndefinedColorIdAsa : UndefinedColorIdAse;
115+
public static void SetUndefinedColorId(bool asa)
116+
{
117+
UndefinedColorId = asa ? UndefinedColorIdAsa : UndefinedColorIdAse;
118+
Values.V.Colors.SetUndefinedColorId(UndefinedColorId);
119+
}
114120

115121
/// <summary>
116122
/// Number of possible color regions for all species.
@@ -126,14 +132,19 @@ public static class Ark
126132

127133
public enum Game
128134
{
135+
Unknown,
129136
/// <summary>
130137
/// ARK: Survival Evolved (2015)
131138
/// </summary>
132-
ASE,
139+
Ase,
133140
/// <summary>
134141
/// ARK: Survival Ascended (2023)
135142
/// </summary>
136-
ASA
143+
Asa,
144+
/// <summary>
145+
/// Use the same version that was already loaded
146+
/// </summary>
147+
SameAsBefore
137148
}
138149

139150
/// <summary>

ARKBreedingStats/BreedingPlanning/BreedingPlan.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,17 @@ public void DetermineBestBreeding(Creature chosenCreature = null, bool forceUpda
196196
}
197197
else
198198
{
199+
var includeWithCooldown = cbBPIncludeCooldowneds.Checked;
200+
var ignoreBreedingCooldown = _currentSpecies?.noGender == true; // for hermaphrodites only one partner needs to be not on cooldown
199201
Creatures = CreatureCollection.creatures
200202
.Where(c => c.speciesBlueprint == _currentSpecies.blueprintPath
201203
&& !c.flags.HasFlag(CreatureFlags.Neutered)
202204
&& !c.flags.HasFlag(CreatureFlags.Placeholder)
203205
&& (c.Status == CreatureStatus.Available
204206
|| (c.Status == CreatureStatus.Cryopod && cbBPIncludeCryoCreatures.Checked))
205-
&& (cbBPIncludeCooldowneds.Checked
206-
|| !(c.cooldownUntil > DateTime.Now
207-
|| c.growingUntil > DateTime.Now
208-
)
207+
&& (includeWithCooldown
208+
|| !(c.growingUntil > DateTime.Now
209+
|| (!ignoreBreedingCooldown && c.cooldownUntil > DateTime.Now))
209210
)
210211
)
211212
.ToList();
@@ -414,7 +415,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
414415
bestPossLevels, _statWeights, _bestLevels, _breedingMode,
415416
considerChosenCreature, considerMutationLimit, (int)nudBPMutationLimit.Value,
416417
ref creaturesMutationsFilteredOut, levelLimitWithOutDomLevels, CbDontSuggestOverLimitOffspring.Checked,
417-
cbBPOnlyOneSuggestionForFemales.Checked, _statOddEvens);
418+
cbBPOnlyOneSuggestionForFemales.Checked, _statOddEvens, !cbBPIncludeCooldowneds.Checked && _currentSpecies.noGender);
418419

419420
double minScore = _breedingPairs.LastOrDefault()?.BreedingScore.OneNumber ?? 0;
420421
var displayScoreOffset = (minScore < 0 ? -minScore : 0) + .5; // don't display negative scores, could be confusing

ARKBreedingStats/BreedingPlanning/BreedingScore.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ public static class BreedingScore
3030
/// <param name="downGradeOffspringWithLevelHigherThanLimit">Downgrade score if level is higher than limit.</param>
3131
/// <param name="onlyBestSuggestionForFemale">Only the pairing with the highest score is kept for each female. Is not used if species has no sex or sex is ignored in breeding planner.</param>
3232
/// <param name="anyOddEven">Array for each stat if the higher level should be considered for score: 0: consider any level, 1: consider only if odd, 2: consider only if even.</param>
33+
/// <param name="checkIfAtLeastOnePartnerIsNotOnCooldown">For hermaphrodites only one partner needs to be not on cooldown. If creatures of a hermaphrodite species are passed and at least one needs to be not on cooldown, set this to true.</param>
3334
/// <returns></returns>
3435
public static List<BreedingPair> CalculateBreedingScores(Creature[] females, Creature[] males, Species species,
3536
short[] bestPossLevels, double[] statWeights, int[] bestLevelsOfSpecies, BreedingMode breedingMode,
3637
bool considerChosenCreature, bool considerMutationLimit, int mutationLimit,
3738
ref bool creaturesMutationsFilteredOut, int offspringLevelLimit = 0, bool downGradeOffspringWithLevelHigherThanLimit = false,
38-
bool onlyBestSuggestionForFemale = false, StatValueEvenOdd[] anyOddEven = null)
39+
bool onlyBestSuggestionForFemale = false, StatValueEvenOdd[] anyOddEven = null, bool checkIfAtLeastOnePartnerIsNotOnCooldown = false)
3940
{
4041
var breedingPairs = new List<BreedingPair>();
4142
var ignoreSex = Properties.Settings.Default.IgnoreSexInBreedingPlan || species.noGender;
@@ -48,6 +49,8 @@ public static List<BreedingPair> CalculateBreedingScores(Creature[] females, Cre
4849
customIgnoreTopStatsEvenOdd[s] = anyOddEven != null && statWeights[s] > 0;
4950
}
5051

52+
var now = DateTime.Now;
53+
5154
for (int fi = 0; fi < females.Length; fi++)
5255
{
5356
var female = females[fi];
@@ -73,6 +76,15 @@ public static List<BreedingPair> CalculateBreedingScores(Creature[] females, Cre
7376
continue;
7477
}
7578

79+
// if species is hermaphrodite, only one partner needs to be not on cooldown
80+
if (checkIfAtLeastOnePartnerIsNotOnCooldown
81+
&& female.cooldownUntil > now
82+
&& male.cooldownUntil > now
83+
)
84+
{
85+
continue;
86+
}
87+
7688
double t = 0;
7789
int offspringPotentialTopStatCount = 0;
7890
double offspringExpectedTopStatCount = 0; // a guaranteed top stat counts 1, otherwise the inheritance probability of the top stat is counted

ARKBreedingStats/CreatureInfoInput.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ public bool TribeLock
696696
}
697697

698698
/// <summary>
699-
/// If set to true, it's assumed the creature is already existing.
699+
/// If not null it's assumed the creature is already existing in the library.
700700
/// </summary>
701701
public Creature AlreadyExistingCreature
702702
{
@@ -709,6 +709,7 @@ public Creature AlreadyExistingCreature
709709
_alreadyExistingCreature = value;
710710
SetAdd2LibColor(btAdd2Library.Enabled);
711711
}
712+
get => _alreadyExistingCreature;
712713
}
713714

714715
/// <summary>

ARKBreedingStats/FileService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public static bool LoadJsonFile<T>(string filePath, out T data, out string error
118118
if (data != null)
119119
return true;
120120

121-
errorMessage = $"File\n{Path.GetFullPath(filePath)}\n contains no readable data.";
121+
errorMessage = $"File\n{Path.GetFullPath(filePath)}\ncontains no readable data.";
122122
return false;
123123
}
124124
}

0 commit comments

Comments
 (0)