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 1, 2023
2 parents 0fc7e9f + 12c45e3 commit 7035324
Show file tree
Hide file tree
Showing 12 changed files with 298 additions and 225 deletions.
2 changes: 1 addition & 1 deletion ARKBreedingStats/Extraction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void Clear()
/// <param name="highPrecisionInputs">If true, the input is expected to be a float value from an export file.
/// If false, it's assumed to be a displayed value from the game with one decimal digit.</param>
/// <param name="imprintingChanged"></param>
public void ExtractLevels(Species species, int level, List<StatIO> statIOs, double lowerTEBound, double upperTEBound,
public void ExtractLevels(Species species, int level, StatIO[] statIOs, double lowerTEBound, double upperTEBound,
bool tamed, bool bred, double imprintingBonusRounded, bool adjustImprinting, bool allowMoreThanHundredImprinting, double imprintingBonusMultiplier,
bool considerWildLevelSteps, int wildLevelSteps, bool highPrecisionInputs, bool mutagenApplied, out bool imprintingChanged)
{
Expand Down
6 changes: 3 additions & 3 deletions ARKBreedingStats/Form1.Designer.cs

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

84 changes: 42 additions & 42 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public partial class Form1 : Form
private readonly Dictionary<Species, int[]> _topLevels = new Dictionary<Species, int[]>();

private readonly Dictionary<Species, int[]> _lowestLevels = new Dictionary<Species, int[]>();
private readonly List<StatIO> _statIOs = new List<StatIO>();
private readonly List<StatIO> _testingIOs = new List<StatIO>();
private readonly StatIO[] _statIOs = new StatIO[Stats.StatsCount];
private readonly StatIO[] _testingIOs = new StatIO[Stats.StatsCount];
private int _activeStatIndex = -1;

private readonly bool[]
Expand Down Expand Up @@ -188,6 +188,46 @@ public Form1()
openSettingsToolStripMenuItem.ShortcutKeyDisplayString = new KeysConverter()
.ConvertTo(Keys.Control, typeof(string))?.ToString().Replace("None", ",");

for (int s = 0; s < Stats.StatsCount; s++)
{
var statIo = new StatIO
{
InputType = StatIOInputType.FinalValueInputType,
Title = Utils.StatName(s),
statIndex = s
};
var statIoTesting = new StatIO
{
InputType = StatIOInputType.LevelsInputType,
Title = Utils.StatName(s),
statIndex = s
};

if (Utils.Precision(s) == 3)
{
statIo.Percent = true;
statIoTesting.Percent = true;
}

statIoTesting.LevelChanged += TestingStatIoValueUpdate;
statIo.InputValueChanged += StatIOQuickWildLevelCheck;
statIo.Click += StatIO_Click;
_considerStatHighlight[s] = (Properties.Settings.Default.consideredStats & (1 << s)) != 0;

_statIOs[s] = statIo;
_testingIOs[s] = statIoTesting;
}

// add controls in the order they are shown in-game
for (int s = 0; s < Stats.StatsCount; s++)
{
var displayIndex = Stats.DisplayOrder[s];
flowLayoutPanelStatIOsExtractor.Controls.Add(_statIOs[displayIndex]);
flowLayoutPanelStatIOsTester.Controls.Add(_testingIOs[displayIndex]);
checkedListBoxConsiderStatTop.Items.Add(Utils.StatName(displayIndex),
_considerStatHighlight[displayIndex]);
}

_timerGlobal.Interval = 1000;
_timerGlobal.Tick += TimerGlobal_Tick;

Expand Down Expand Up @@ -251,46 +291,6 @@ private void Form1_Load(object sender, EventArgs e)
tamingControl1.WeaponDamages = Properties.Settings.Default.weaponDamages;
tamingControl1.WeaponDamagesEnabled = Properties.Settings.Default.weaponDamagesEnabled;

for (int s = 0; s < Stats.StatsCount; s++)
{
var statIO = new StatIO
{
InputType = StatIOInputType.FinalValueInputType,
Title = Utils.StatName(s),
statIndex = s
};
var statIoTesting = new StatIO
{
InputType = StatIOInputType.LevelsInputType,
Title = Utils.StatName(s),
statIndex = s
};

if (Utils.Precision(s) == 3)
{
statIO.Percent = true;
statIoTesting.Percent = true;
}

statIoTesting.LevelChanged += TestingStatIoValueUpdate;
statIO.InputValueChanged += StatIOQuickWildLevelCheck;
statIO.Click += StatIO_Click;
_considerStatHighlight[s] = (Properties.Settings.Default.consideredStats & (1 << s)) != 0;

_statIOs.Add(statIO);
_testingIOs.Add(statIoTesting);
}

// add controls in the order they are shown in-game
for (int s = 0; s < Stats.StatsCount; s++)
{
var displayIndex = Stats.DisplayOrder[s];
flowLayoutPanelStatIOsExtractor.Controls.Add(_statIOs[displayIndex]);
flowLayoutPanelStatIOsTester.Controls.Add(_testingIOs[displayIndex]);
checkedListBoxConsiderStatTop.Items.Add(Utils.StatName(displayIndex),
_considerStatHighlight[displayIndex]);
}

// torpor should not show bar, it get's too wide and is not interesting for breeding
_statIOs[Stats.Torpidity].ShowBarAndLock = false;
_testingIOs[Stats.Torpidity].ShowBarAndLock = false;
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Form1.extractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void ShowSumOfChosenLevels()
var checkLowLevels = _lowestLevels.TryGetValue(species, out int[] lowSpeciesLevels);

var customStatNames = species.statNames;
var statWeights = breedingPlan1.StatWeighting.GetWeightingByPresetName(species.name);
var statWeights = breedingPlan1.StatWeighting.GetWeightingForSpecies(species);
if (statWeights.Item1 == null) checkLowLevels = false;
var analysisState = LevelStatus.Neutral;
var newTopStatsText = new List<string>();
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Form1.l10n.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private void SetLocalizations(bool initialize = true)
Loc.SetToolTip(lbExtractorDomLevel, "domLevelExplanation", _tt);
Loc.SetToolTip(lbExtractorWildLevel, "wildLevelExplanation", _tt);
var statNames = speciesSelector1.SelectedSpecies?.statNames;
for (int si = 0; si < _statIOs.Count; si++)
for (int si = 0; si < _statIOs.Length; si++)
{
_statIOs[si].Title = Utils.StatName(si, false, statNames);
_testingIOs[si].Title = Utils.StatName(si, false, statNames);
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Form1.library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private void CalculateTopStats(List<Creature> creatures)
List<int> usedAndConsideredStatIndices = new List<int>(Stats.StatsCount);
int[] bestStat = new int[Stats.StatsCount];
int[] lowestStat = new int[Stats.StatsCount];
var statWeights = breedingPlan1.StatWeighting.GetWeightingByPresetName(species.name);
var statWeights = breedingPlan1.StatWeighting.GetWeightingForSpecies(species);
for (int s = 0; s < Stats.StatsCount; s++)
{
bestStat[s] = -1;
Expand Down
Loading

0 comments on commit 7035324

Please sign in to comment.