Skip to content

Commit

Permalink
option to set considered top stats per species
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Sep 8, 2024
1 parent 065f596 commit b80b45f
Show file tree
Hide file tree
Showing 21 changed files with 599 additions and 355 deletions.
28 changes: 19 additions & 9 deletions ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,17 @@
<Compile Include="library\DummyCreatures.cs" />
<Compile Include="NamePatterns\JavaScriptNamePattern.cs" />
<Compile Include="NamePatterns\TokenModel.cs" />
<Compile Include="StatsOptions\StatsOptionsControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="StatsOptions\StatsOptionsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StatsOptions\TopStatsSettings\ConsiderTopStats.cs" />
<Compile Include="StatsOptions\StatOptionsBase.cs" />
<Compile Include="StatsOptions\LevelGraphRepresentation.cs" />
<Compile Include="StatsOptions\LevelColorSettings\LevelGraphRepresentation.cs" />
<Compile Include="library\LevelStatusFlags.cs" />
<Compile Include="StatsOptions\StatLevelColors.cs" />
<Compile Include="StatsOptions\LevelColorSettings\StatLevelColors.cs" />
<Compile Include="StatsOptions\StatsOptions.cs" />
<Compile Include="StatsOptions\StatsOptionsSettings.cs" />
<Compile Include="library\TopLevels.cs" />
Expand All @@ -127,6 +134,9 @@
<Compile Include="Pedigree\IPedigreeCreature.cs" />
<Compile Include="species\ArkColors.cs" />
<Compile Include="species\Troodonism.cs" />
<Compile Include="StatsOptions\TopStatsSettings\ConsiderTopStatsControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="uiControls\ArkVersionDialog.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -148,10 +158,10 @@
<Compile Include="uiControls\Hatching.Designer.cs">
<DependentUpon>Hatching.cs</DependentUpon>
</Compile>
<Compile Include="StatsOptions\HueControl.cs">
<Compile Include="StatsOptions\LevelColorSettings\HueControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="StatsOptions\HueControl.Designer.cs">
<Compile Include="StatsOptions\LevelColorSettings\HueControl.Designer.cs">
<DependentUpon>HueControl.cs</DependentUpon>
</Compile>
<Compile Include="uiControls\LibraryFilterTemplates.cs">
Expand All @@ -176,13 +186,13 @@
<Compile Include="uiControls\ScrollForm.Designer.cs">
<DependentUpon>ScrollForm.cs</DependentUpon>
</Compile>
<Compile Include="StatsOptions\StatLevelGraphOptionsControl.cs">
<Compile Include="StatsOptions\LevelColorSettings\StatLevelGraphOptionsControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="StatsOptions\StatLevelGraphOptionsControl.Designer.cs">
<Compile Include="StatsOptions\LevelColorSettings\StatLevelGraphOptionsControl.Designer.cs">
<DependentUpon>StatLevelGraphOptionsControl.cs</DependentUpon>
</Compile>
<Compile Include="StatsOptions\LevelGraphOptionsControl.cs">
<Compile Include="StatsOptions\LevelColorSettings\LevelGraphOptionsControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="uiControls\StatSelector.cs">
Expand Down Expand Up @@ -765,7 +775,7 @@
<EmbeddedResource Include="uiControls\Hatching.resx">
<DependentUpon>Hatching.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="StatsOptions\HueControl.resx">
<EmbeddedResource Include="StatsOptions\LevelColorSettings\HueControl.resx">
<DependentUpon>HueControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uiControls\LibraryFilterTemplates.resx">
Expand All @@ -777,7 +787,7 @@
<EmbeddedResource Include="uiControls\ScrollForm.resx">
<DependentUpon>ScrollForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="StatsOptions\StatLevelGraphOptionsControl.resx">
<EmbeddedResource Include="StatsOptions\LevelColorSettings\StatLevelGraphOptionsControl.resx">
<DependentUpon>StatLevelGraphOptionsControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="uiControls\StatSelector.resx">
Expand Down
60 changes: 30 additions & 30 deletions ARKBreedingStats/Form1.Designer.cs

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

42 changes: 11 additions & 31 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
using ARKBreedingStats.mods;
using ARKBreedingStats.NamePatterns;
using ARKBreedingStats.StatsOptions;
using ARKBreedingStats.StatsOptions.LevelColorSettings;
using ARKBreedingStats.StatsOptions.TopStatsSettings;
using ARKBreedingStats.utils;
using static ARKBreedingStats.settings.Settings;
using Color = System.Drawing.Color;
Expand Down Expand Up @@ -57,11 +59,6 @@ public delegate void SetMessageLabelTextEventHandler(string text = null, Message
private bool _updateTorporInTester;
private bool _filterListAllowed;

/// <summary>
/// The stat indices that are considered for color highlighting and topness calculation.
/// </summary>
private readonly bool[] _considerStatHighlight = new bool[Stats.StatsCount];

private DateTime _lastAutoSaveBackup;
private Creature _creatureTesterEdit;
private int _hiddenLevelsCreatureTester;
Expand Down Expand Up @@ -91,7 +88,8 @@ public delegate void SetMessageLabelTextEventHandler(string text = null, Message
private static double[] _lastOcrValues;
private Species _lastOcrSpecies;

internal static readonly StatsOptionsSettings<StatLevelColors> StatsLevelColors = new StatsOptionsSettings<StatLevelColors>("statsLevelColors.json");
internal static readonly StatsOptionsSettings<StatLevelColors> StatsLevelColors = new StatsOptionsSettings<StatLevelColors>("statsLevelColors.json", "Level colors");
internal static readonly StatsOptionsSettings<ConsiderTopStats> StatsTopStats = new StatsOptionsSettings<ConsiderTopStats>("statsTopStats.json", "Consider for top stats");

public Form1()
{
Expand Down Expand Up @@ -199,7 +197,6 @@ public Form1()
statIo.InputValueChanged += StatIOQuickWildLevelCheck;
statIo.LevelChanged += ExtractorStatLevelChanged;
statIo.Click += StatIO_Click;
_considerStatHighlight[s] = (Properties.Settings.Default.consideredStats & (1 << s)) != 0;

_statIOs[s] = statIo;
_testingIOs[s] = statIoTesting;
Expand All @@ -210,8 +207,6 @@ public Form1()
{
flowLayoutPanelStatIOsExtractor.Controls.Add(_statIOs[si]);
flowLayoutPanelStatIOsTester.Controls.Add(_testingIOs[si]);
checkedListBoxConsiderStatTop.Items.Add(Utils.StatName(si),
_considerStatHighlight[si]);
}

_timerGlobal.Interval = 1000;
Expand Down Expand Up @@ -1483,6 +1478,7 @@ private void SaveAppSettings()
Properties.Settings.Default.Save();

StatsLevelColors.SaveSettings();
StatsTopStats.SaveSettings();
}

/// <summary>
Expand Down Expand Up @@ -1987,27 +1983,6 @@ private void PasteCreatureFromClipboard()
EditCreatureInTester(importedCreatures[0], true);
}

private void buttonRecalculateTops_Click(object sender, EventArgs e)
{
int consideredStats = 0;
for (int s = 0; s < Stats.StatsCount; s++)
{
var si = Stats.DisplayOrder[s];
var statIndexUsed = checkedListBoxConsiderStatTop.GetItemChecked(s);
_considerStatHighlight[si] = statIndexUsed;

// save consideredStats
if (_considerStatHighlight[si])
consideredStats += 1 << si;
}

Properties.Settings.Default.consideredStats = consideredStats;

// recalculate topstats
CalculateTopStats(_creatureCollection.creatures);
FilterLibRecalculate();
}

private void aliveToolStripMenuItem_Click(object sender, EventArgs e)
{
SetStatusOfSelectedCreatures(CreatureStatus.Available);
Expand Down Expand Up @@ -4011,7 +3986,12 @@ private void showTokenPopupOnListeningToolStripMenuItem_Click(object sender, Eve

private void statsOptionsToolStripMenuItem_Click(object sender, EventArgs e)
{
LevelGraphOptionsControl.ShowWindow(this, StatsLevelColors);
StatsOptionsForm.ShowWindow(this, StatsLevelColors, StatsTopStats);
}

private void ButtonOpenTopStatsSettingsClick(object sender, EventArgs e)
{
StatsOptionsForm.ShowWindow(this, StatsLevelColors, StatsTopStats, 1);
}

private void ExportAppSettings()
Expand Down
Loading

0 comments on commit b80b45f

Please sign in to comment.