Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed May 19, 2024
2 parents ca99f6e + a3a047e commit 36c5fd3
Show file tree
Hide file tree
Showing 30 changed files with 941 additions and 87 deletions.
1 change: 1 addition & 0 deletions ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
<Compile Include="library\DummyCreatures.cs" />
<Compile Include="library\LevelStatusFlags.cs" />
<Compile Include="multiplierTesting\CalculateMultipliers.cs" />
<Compile Include="multiplierTesting\TaTmSolver.cs" />
<Compile Include="NamePatterns\NameList.cs" />
<Compile Include="NamePatterns\NamePatternEntry.cs">
<SubType>Component</SubType>
Expand Down
20 changes: 20 additions & 0 deletions ARKBreedingStats/Ark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,25 @@ public static class Stats
false, //TemperatureFortitude,
false, //CraftingSpeedMultiplier
};

/// <summary>
/// Returns if the stat is a percentage value.
/// </summary>
public static bool IsPercentage(int statIndex)
{
return statIndex == MeleeDamageMultiplier
|| statIndex == SpeedMultiplier
|| statIndex == TemperatureFortitude
|| statIndex == CraftingSpeedMultiplier;
}

/// <summary>
/// Returns the displayed decimal values of the stat with the given index
/// </summary>
public static int Precision(int statIndex)
{
// damage and speed are percentage values and thus the displayed values have a higher precision
return IsPercentage(statIndex) ? 3 : 1;
}
}
}
2 changes: 1 addition & 1 deletion ARKBreedingStats/Extraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void ExtractLevels(Species species, int level, StatIO[] statIOs, double l
statIOs[s].postTame = PostTamed;

// determine the precision of the input value
float toleranceForThisStat = StatValueCalculation.DisplayedAberration(statIOs[s].Input, Utils.Precision(s), highPrecisionInputs);
float toleranceForThisStat = StatValueCalculation.DisplayedAberration(statIOs[s].Input, Stats.Precision(s), highPrecisionInputs);
//Console.WriteLine($"Precision stat {s}: {toleranceForThisStat}");

MinMaxDouble inputValue = new MinMaxDouble(statIOs[s].Input - toleranceForThisStat, statIOs[s].Input + toleranceForThisStat);
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public Form1()
statIndex = s
};

if (Utils.Precision(s) == 3)
if (Stats.IsPercentage(s))
{
statIo.Percent = true;
statIoTesting.Percent = true;
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/NamePatterns/NamePattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public static Dictionary<string, string> CreateTokenDictionary(Creature creature
for (int s = 0; s < Stats.StatsCount; s++)
{
dict.Add(StatAbbreviationFromIndex[s], creature.levelsWild[s].ToString());
dict.Add($"{StatAbbreviationFromIndex[s]}_vb", (creature.valuesBreeding[s] * (Utils.Precision(s) == 3 ? 100 : 1)).ToString());
dict.Add($"{StatAbbreviationFromIndex[s]}_vb", (creature.valuesBreeding[s] * (Stats.IsPercentage(s) ? 100 : 1)).ToString());
dict.Add($"istop{StatAbbreviationFromIndex[s]}", speciesTopLevels == null ? (creature.levelsWild[s] > 0 ? "1" : string.Empty) :
creature.levelsWild[s] >= speciesTopLevels[s] ? "1" : string.Empty);
dict.Add($"isnewtop{StatAbbreviationFromIndex[s]}", speciesTopLevels == null ? (creature.levelsWild[s] > 0 ? "1" : string.Empty) :
Expand Down
8 changes: 4 additions & 4 deletions ARKBreedingStats/Pedigree/PedigreeCreature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ public Creature Creature
_labels[s].BackColor = Color.WhiteSmoke;
_labels[s].ForeColor = Color.LightGray;
_ttMonospaced.SetToolTip(_labels[s], Utils.StatName(si, false, _creature.Species?.statNames) + ": "
+ $"{_creature.valuesBreeding[si] * (Utils.Precision(si) == 3 ? 100 : 1),7:#,0.0}"
+ (Utils.Precision(si) == 3 ? "%" : string.Empty));
+ $"{_creature.valuesBreeding[si] * (Stats.IsPercentage(si) ? 100 : 1),7:#,0.0}"
+ (Stats.IsPercentage(si) ? "%" : string.Empty));
}
else
{
Expand All @@ -234,8 +234,8 @@ public Creature Creature
_labels[s].BackColor = Utils.GetColorFromPercent((int)(_creature.levelsWild[si] * 2.5), _creature.IsTopStat(si) ? 0.2 : 0.7);
_labels[s].ForeColor = Parent?.ForeColor ?? Color.Black; // needed so text is not transparent on overlay
_ttMonospaced.SetToolTip(_labels[s], Utils.StatName(si, false, _creature.Species?.statNames) + ": "
+ $"{_creature.valuesBreeding[si] * (Utils.Precision(si) == 3 ? 100 : 1),7:#,0.0}"
+ (Utils.Precision(si) == 3 ? "%" : string.Empty)
+ $"{_creature.valuesBreeding[si] * (Stats.IsPercentage(si) ? 100 : 1),7:#,0.0}"
+ (Stats.IsPercentage(si) ? "%" : string.Empty)
+ (_creature.levelsMutated == null ? string.Empty
: Environment.NewLine + Loc.S("Mutations") + ": " + _creature.levelsMutated[si]
));
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.61.3.0")]
[assembly: AssemblyFileVersion("0.61.4.0")]
[assembly: NeutralResourcesLanguage("en")]

2 changes: 1 addition & 1 deletion ARKBreedingStats/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static double CalculateValue(Species species, int stat, int levelWild, in
if (result <= 0) return 0;

if (roundToIngamePrecision)
return Math.Round(result, Utils.Precision(stat), MidpointRounding.AwayFromZero);
return Math.Round(result, Stats.Precision(stat), MidpointRounding.AwayFromZero);

return result;
}
Expand Down
9 changes: 0 additions & 9 deletions ARKBreedingStats/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,6 @@ public static string StatName(int statIndex, bool abbreviation = false, Dictiona
return abbreviation ? _statNamesAbb[statIndex] : _statNames[statIndex];
}

/// <summary>
/// Returns the displayed decimal values of the stat with the given index
/// </summary>
public static int Precision(int statIndex)
{
// damage and speed are percentage values, need more precision
return (statIndex == Stats.SpeedMultiplier || statIndex == Stats.MeleeDamageMultiplier || statIndex == Stats.CraftingSpeedMultiplier) ? 3 : 1;
}

/// <summary>
/// String that represents a duration.
/// </summary>
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.61.3.0"
"version": "0.61.4.0"
},
"SpeciesColorImages": {
"Id": "SpeciesColorImages",
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/importExportGun/ImportExportGun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ private static Creature ConvertExportGunToCreature(ExportGunCreatureFile ec, out
wildLevels[si] = s.Wild;
domLevels[si] = s.Tamed;
mutLevels[si] = s.Mutated;
statValues[si] = s.Value;
statValues[si] = s.Value + (Stats.IsPercentage(si) ? 1 : 0);
si++;
}

var arkId = Utils.ConvertArkIdsToLongArkId(ec.DinoId1Int, ec.DinoId2Int);

// wild creatures have a TE of 100 %, so don't use that here
var isWild = string.IsNullOrEmpty(ec.DinoName)
&& string.IsNullOrEmpty(ec.TribeName)
&& string.IsNullOrEmpty(ec.TamerString)
&& string.IsNullOrEmpty(ec.OwningPlayerName)
&& string.IsNullOrEmpty(ec.ImprinterName)
&& ec.OwningPlayerID == 0
&& ec.TameEffectiveness == 0
;

var isBred = !string.IsNullOrEmpty(ec.ImprinterName)
Expand Down
16 changes: 16 additions & 0 deletions ARKBreedingStats/json/serverMultipliers.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@
"MatingIntervalMultiplier": 0.5,
"EggHatchSpeedMultiplier": 2,
"BabyMatureSpeedMultiplier": 2
},
"all 1": {
"statMultipliers": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
]
}
}
}
Loading

0 comments on commit 36c5fd3

Please sign in to comment.