Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Jul 6, 2024
2 parents 36c5fd3 + f768b50 commit 558062d
Show file tree
Hide file tree
Showing 84 changed files with 6,754 additions and 3,424 deletions.
53 changes: 51 additions & 2 deletions ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="importExportGun\ExportGunCreatureFile.cs" />
<Compile Include="importExportGun\ExportGunFileExtensions.cs" />
<Compile Include="importExportGun\ExportGunServerFile.cs" />
<Compile Include="importExportGun\ImportExportGun.cs" />
<Compile Include="importExportGun\ReadExportFile.cs" />
Expand All @@ -103,8 +104,15 @@
</Compile>
<Compile Include="library\CreatureSpawnCommand.cs" />
<Compile Include="library\DummyCreatures.cs" />
<Compile Include="StatsOptions\StatOptionsBase.cs" />
<Compile Include="StatsOptions\LevelGraphRepresentation.cs" />
<Compile Include="library\LevelStatusFlags.cs" />
<Compile Include="StatsOptions\StatLevelColors.cs" />
<Compile Include="StatsOptions\StatsOptions.cs" />
<Compile Include="StatsOptions\StatsOptionsSettings.cs" />
<Compile Include="library\TopLevels.cs" />
<Compile Include="multiplierTesting\CalculateMultipliers.cs" />
<Compile Include="multiplierTesting\SpeciesStatsExtractor.cs" />
<Compile Include="multiplierTesting\TaTmSolver.cs" />
<Compile Include="NamePatterns\NameList.cs" />
<Compile Include="NamePatterns\NamePatternEntry.cs">
Expand All @@ -115,6 +123,7 @@
<Compile Include="Pedigree\PedigreeCreation.cs" />
<Compile Include="Pedigree\IPedigreeCreature.cs" />
<Compile Include="species\ArkColors.cs" />
<Compile Include="species\Troodonism.cs" />
<Compile Include="uiControls\ArkVersionDialog.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -136,6 +145,12 @@
<Compile Include="uiControls\Hatching.Designer.cs">
<DependentUpon>Hatching.cs</DependentUpon>
</Compile>
<Compile Include="StatsOptions\HueControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="StatsOptions\HueControl.Designer.cs">
<DependentUpon>HueControl.cs</DependentUpon>
</Compile>
<Compile Include="uiControls\LibraryFilterTemplates.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -152,12 +167,33 @@
<Compile Include="uiControls\PopupMessage.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="uiControls\ScrollForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="uiControls\ScrollForm.Designer.cs">
<DependentUpon>ScrollForm.cs</DependentUpon>
</Compile>
<Compile Include="StatsOptions\StatLevelGraphOptionsControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="StatsOptions\StatLevelGraphOptionsControl.Designer.cs">
<DependentUpon>StatLevelGraphOptionsControl.cs</DependentUpon>
</Compile>
<Compile Include="StatsOptions\LevelGraphOptionsControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="uiControls\StatSelector.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="uiControls\StatSelector.Designer.cs">
<DependentUpon>StatSelector.cs</DependentUpon>
</Compile>
<Compile Include="StatsOptions\StatsOptionsWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StatsOptions\StatsOptionsWindow.Designer.cs">
<DependentUpon>StatsOptionsWindow.cs</DependentUpon>
</Compile>
<Compile Include="Updater\AsbManifest.cs" />
<Compile Include="Updater\AsbModule.cs" />
<Compile Include="duplicates\MergingDuplicates.cs" />
Expand Down Expand Up @@ -369,7 +405,7 @@
<Compile Include="CreatureInfoInput.Designer.cs">
<DependentUpon>CreatureInfoInput.cs</DependentUpon>
</Compile>
<Compile Include="species\CreatureStat.cs" />
<Compile Include="species\SpeciesStat.cs" />
<Compile Include="species\Kibble.cs" />
<Compile Include="Kibbles.cs" />
<Compile Include="library\CreatureValues.cs" />
Expand Down Expand Up @@ -661,6 +697,7 @@
<Compile Include="utils\Convert32.cs" />
<Compile Include="utils\Debouncer.cs" />
<Compile Include="utils\ArkInstallationPath.cs" />
<Compile Include="utils\ExceptionMessages.cs" />
<Compile Include="utils\ExtensionMethods.cs" />
<Compile Include="utils\CreatureListSorter.cs" />
<Compile Include="utils\MessageBoxes.cs" />
Expand Down Expand Up @@ -728,15 +765,27 @@
<EmbeddedResource Include="uiControls\Hatching.resx">
<DependentUpon>Hatching.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="StatsOptions\HueControl.resx">
<DependentUpon>HueControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uiControls\LibraryFilterTemplates.resx">
<DependentUpon>LibraryFilterTemplates.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uiControls\ParentInheritance.resx">
<DependentUpon>ParentInheritance.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uiControls\ScrollForm.resx">
<DependentUpon>ScrollForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="StatsOptions\StatLevelGraphOptionsControl.resx">
<DependentUpon>StatLevelGraphOptionsControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uiControls\StatSelector.resx">
<DependentUpon>StatSelector.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="StatsOptions\StatsOptionsWindow.resx">
<DependentUpon>StatsOptionsWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uiControls\VariantSelector.resx">
<DependentUpon>VariantSelector.cs</DependentUpon>
</EmbeddedResource>
Expand Down Expand Up @@ -1002,7 +1051,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentFTP">
<Version>49.0.2</Version>
<Version>50.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<Version>3.3.4</Version>
Expand Down
19 changes: 11 additions & 8 deletions ARKBreedingStats/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -408,17 +408,11 @@
<setting name="InfoGraphicShowRegionNamesIfNoImage" serializeAs="String">
<value>False</value>
</setting>
<setting name="ChartHueMin" serializeAs="String">
<value>0</value>
</setting>
<setting name="ChartHueMax" serializeAs="String">
<value>120</value>
</setting>
<setting name="ChartHueEvenMin" serializeAs="String">
<value>120</value>
<value>0</value>
</setting>
<setting name="ChartHueEvenMax" serializeAs="String">
<value>200</value>
<value>120</value>
</setting>
<setting name="ChartHueOddMin" serializeAs="String">
<value>240</value>
Expand Down Expand Up @@ -538,6 +532,15 @@
<setting name="MoveMutationLevelsOnExtractionIfUnique" serializeAs="String">
<value>True</value>
</setting>
<setting name="TesterLinkWildMutatedLevels" serializeAs="String">
<value>True</value>
</setting>
<setting name="DisplayWarningAboutTooLongNameGenerated" serializeAs="String">
<value>False</value>
</setting>
<setting name="LevelColorWindowRectangle" serializeAs="String">
<value>200, 200, 1000, 650</value>
</setting>
</ARKBreedingStats.Properties.Settings>
</userSettings>
</configuration>
47 changes: 30 additions & 17 deletions ARKBreedingStats/Ark.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ARKBreedingStats.values;
using System;

namespace ARKBreedingStats
{
Expand Down Expand Up @@ -155,6 +156,26 @@ public enum Game
/// Collection indicator for ARK: Survival Ascended, also the mod tag id for the ASA values.
/// </summary>
public const string Asa = "ASA";

/// <summary>
/// The default cuddle interval is 8 hours.
/// </summary>
private const int DefaultCuddleIntervalInSeconds = 8 * 60 * 60;

/// <summary>
/// Returns the imprinting gain per cuddle, dependent on the maturation time and the cuddle interval multiplier.
/// </summary>
/// <param name="maturationTime">Maturation time in seconds</param>
public static double ImprintingGainPerCuddle(double maturationTime)
{
var multipliers = Values.V.currentServerMultipliers;
// this is assumed to be the used formula
var maxPossibleCuddles = maturationTime / (DefaultCuddleIntervalInSeconds * multipliers.BabyImprintAmountMultiplier);
var denominator = maxPossibleCuddles - 0.25;
if (denominator < 0) return 0;
if (denominator < multipliers.BabyCuddleIntervalMultiplier) return 1;
return Math.Min(1, multipliers.BabyCuddleIntervalMultiplier / denominator);
}
}

/// <summary>
Expand All @@ -168,35 +189,27 @@ public static class Stats
public const int StatsCount = 12;

public const int Health = 0;
/// <summary>
/// Stamina, or Charge Capacity for glow species
/// </summary>
public const int Stamina = 1;
public const int Torpidity = 2;
/// <summary>
/// Oxygen, or Charge Regeneration for glow species
/// </summary>
public const int Oxygen = 3;
public const int Food = 4;
public const int Water = 5;
public const int Temperature = 6;
public const int Weight = 7;
/// <summary>
/// MeleeDamageMultiplier, or Charge Emission Range for glow species
/// </summary>
public const int MeleeDamageMultiplier = 8;
public const int SpeedMultiplier = 9;
public const int TemperatureFortitude = 10;
public const int CraftingSpeedMultiplier = 11;

/// <summary>
/// Index of additive taming multiplier in stat multipliers.
/// </summary>
public const int IndexTamingAdd = 0;
/// <summary>
/// Index of multiplicative taming multiplier in stat multipliers.
/// </summary>
public const int IndexTamingMult = 1;
/// <summary>
/// Index of domesticated level multiplier in stat multipliers.
/// </summary>
public const int IndexLevelDom = 2;
/// <summary>
/// Index of wild level multiplier in stat multipliers.
/// </summary>
public const int IndexLevelWild = 3;

/// <summary>
/// Returns the stat-index for the given order index (like it is ordered in game).
/// </summary>
Expand Down
19 changes: 16 additions & 3 deletions ARKBreedingStats/BreedingPlanning/BreedingPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
bool considerMutationLimit = nudBPMutationLimit.Value >= 0;

bool creaturesMutationsFilteredOut = false;
bool noCreaturesWithTopStatsInBothSexes = false;

// only consider creatures with top stats if breeding for that
Creature[] females, males;
Expand All @@ -301,6 +302,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
{
females = _females.Where(c => c.topStatsCountBP > 0).ToArray();
males = _males?.Where(c => c.topStatsCountBP > 0).ToArray();
noCreaturesWithTopStatsInBothSexes = !females.Any() || (males?.Any() != true && !_currentSpecies.noGender);
}

// filter by tags
Expand Down Expand Up @@ -399,7 +401,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()

if (!selectedFemales.Any() || !selectedMales.Any())
{
NoPossiblePairingsFound(creaturesMutationsFilteredOut);
NoPossiblePairingsFound(creaturesMutationsFilteredOut, noCreaturesWithTopStatsInBothSexes);
}
else
{
Expand Down Expand Up @@ -603,7 +605,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
/// <summary>
/// Hide unused controls and display info.
/// </summary>
private void NoPossiblePairingsFound(bool creaturesMutationsFilteredOut)
private void NoPossiblePairingsFound(bool creaturesMutationsFilteredOut, bool noCreaturesWithTopStatsInBothSexes)
{
// hide unused controls
pedigreeCreature1.Hide();
Expand All @@ -615,7 +617,18 @@ private void NoPossiblePairingsFound(bool creaturesMutationsFilteredOut)
_pcs[2 * i + 1].Hide();
_pbs[i].Hide();
}
lbBreedingPlanInfo.Text = string.Format(Loc.S("NoPossiblePairingForSpeciesFound"), _currentSpecies);

if (noCreaturesWithTopStatsInBothSexes)
{
lbBreedingPlanInfo.Text = $"The breeding mode is set to {Loc.S("rbBPTopStatsCn")}, but currently there is no pair where top stats can be combined."
+ Environment.NewLine + $"You can change the breeding mode to {Loc.S("rbBPHighStats")} to get the best recommendations in this situation."
+ Environment.NewLine + Environment.NewLine
+ string.Format(Loc.S("NoPossiblePairingForSpeciesFound"), _currentSpecies);
}
else
{
lbBreedingPlanInfo.Text = string.Format(Loc.S("NoPossiblePairingForSpeciesFound"), _currentSpecies);
}
lbBreedingPlanInfo.Visible = true;
if (!cbBPIncludeCryoCreatures.Checked
&& CreatureCollection.creatures.Any(c
Expand Down
18 changes: 11 additions & 7 deletions ARKBreedingStats/CreatureInfoInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Threading;
using ARKBreedingStats.library;
using ARKBreedingStats.Library;
using ARKBreedingStats.NamePatterns;
using ARKBreedingStats.Properties;
Expand Down Expand Up @@ -305,7 +306,7 @@ private void dhmsInputGrown_ValueChanged(object sender, TimeSpan ts)
private void SetMaturationAccordingToGrownUpIn()
{
double maturation = 1;
if (_selectedSpecies.breeding != null && _selectedSpecies.breeding.maturationTimeAdjusted > 0)
if (_selectedSpecies?.breeding != null && _selectedSpecies.breeding.maturationTimeAdjusted > 0)
{
maturation = 1 - dhmsInputGrown.Timespan.TotalSeconds / _selectedSpecies.breeding.maturationTimeAdjusted;
if (maturation < 0) maturation = 0;
Expand Down Expand Up @@ -353,8 +354,11 @@ public DateTime? GrowingUntil
get => dhmsInputGrown.changed ? DateTime.Now.Add(dhmsInputGrown.Timespan) : default(DateTime?);
set
{
if (!value.HasValue) return;
dhmsInputGrown.Timespan = value.Value - DateTime.Now;
if (value.HasValue)
dhmsInputGrown.Timespan = value.Value - DateTime.Now;
else
dhmsInputGrown.Timespan = TimeSpan.Zero;

SetMaturationAccordingToGrownUpIn();
}
}
Expand Down Expand Up @@ -591,20 +595,20 @@ private void btNamingPatternEditor_Click(object sender, EventArgs e)
/// <summary>
/// Generates a creature name with a given pattern
/// </summary>
public void GenerateCreatureName(Creature creature, Creature alreadyExistingCreature, int[] speciesTopLevels, int[] speciesLowestLevels, Dictionary<string, string> customReplacings, bool showDuplicateNameWarning, int namingPatternIndex)
public void GenerateCreatureName(Creature creature, Creature alreadyExistingCreature, TopLevels topLevels, Dictionary<string, string> customReplacings, bool showDuplicateNameWarning, int namingPatternIndex)
{
SetCreatureData(creature);
CreatureName = NamePattern.GenerateCreatureName(creature, alreadyExistingCreature, _sameSpecies, speciesTopLevels, speciesLowestLevels, customReplacings,
CreatureName = NamePattern.GenerateCreatureName(creature, alreadyExistingCreature, _sameSpecies, topLevels, customReplacings,
showDuplicateNameWarning, namingPatternIndex, false, colorsExisting: ColorAlreadyExistingInformation, libraryCreatureCount: LibraryCreatureCount);
if (CreatureName.Length > Ark.MaxCreatureNameLength)
SetMessageLabelText?.Invoke($"The generated name is longer than {Ark.MaxCreatureNameLength} characters, the name will look like this in game:\r\n" + CreatureName.Substring(0, Ark.MaxCreatureNameLength), MessageBoxIcon.Error);
}

public void OpenNamePatternEditor(Creature creature, int[] speciesTopLevels, int[] speciesLowestLevels, Dictionary<string, string> customReplacings, int namingPatternIndex, Action<PatternEditor> reloadCallback)
public void OpenNamePatternEditor(Creature creature, TopLevels topLevels, Dictionary<string, string> customReplacings, int namingPatternIndex, Action<PatternEditor> reloadCallback)
{
if (!parentListValid)
ParentListRequested?.Invoke(this);
using (var pe = new PatternEditor(creature, _sameSpecies, speciesTopLevels, speciesLowestLevels, ColorAlreadyExistingInformation, customReplacings, namingPatternIndex, reloadCallback, LibraryCreatureCount))
using (var pe = new PatternEditor(creature, _sameSpecies, topLevels, ColorAlreadyExistingInformation, customReplacings, namingPatternIndex, reloadCallback, LibraryCreatureCount))
{
if (pe.ShowDialog() == DialogResult.OK)
{
Expand Down
Loading

0 comments on commit 558062d

Please sign in to comment.