Skip to content

Commit

Permalink
fix for custom timer creation. added checkbox to disable guessing of …
Browse files Browse the repository at this point in the history
…species after ocr.
  • Loading branch information
cadaei committed Nov 28, 2017
1 parent 98d8a71 commit cb86e8a
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 57 deletions.
49 changes: 31 additions & 18 deletions ARKBreedingStats/Form1.Designer.cs

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

72 changes: 38 additions & 34 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ private void Form1_Load(object sender, EventArgs e)
tt.SetToolTip(lblTesterDomLevel, "Levels assigned manually to this stat after the creature was domesticated");
tt.SetToolTip(lblExtractorWildLevel, "Wild levels, which are considered for breeding");
tt.SetToolTip(lblTesterWildLevel, "Wild levels, which are considered for breeding");
tt.SetToolTip(cbGuessSpecies, "If checked, the tool will try to guess the species after reading the values from ARK.\nIf the tool recognizes the species-name it will take that, otherwise it will check if the stat-values match a certain species.\n\nUncheck this if the tool repeatedly selects the wrong species after OCR (you have to choose it manually then).");

// was used to calculate the growing-progress. TODO: remove? (UI doesn't show the current weight anymore)
creatureInfoInputExtractor.weightStat = statIOs[4];
Expand Down Expand Up @@ -3467,47 +3468,50 @@ public void doOCR(string imageFilePath = "", bool manuallyTriggered = true)
default: break;
}

List<int> possibleDinos = determineSpeciesFromStats(OCRvalues, species);

if (possibleDinos.Count == 1)
if (!manuallyTriggered || cbGuessSpecies.Checked)
{
if (possibleDinos[0] >= 0 && possibleDinos[0] < comboBoxSpeciesGlobal.Items.Count)
comboBoxSpeciesGlobal.SelectedIndex = possibleDinos[0];
extractLevels(true); // only one possible dino, use that one
}
else
{
bool sameValues = true;
List<int> possibleDinos = determineSpeciesFromStats(OCRvalues, species);

if (lastOCRValues != null)
for (int i = 0; i < 10; i++)
if (OCRvalues[i] != lastOCRValues[i])
{
sameValues = false;
break;
}

// if there's more than one option, on manual we cycle through the options if we're trying multiple times
// on automated, we take the first one that yields an error-free level extraction
if (manuallyTriggered && sameValues)
if (possibleDinos.Count == 1)
{
int newindex = (possibleDinos.IndexOf(lastOCRSpecies) + 1) % possibleDinos.Count;
comboBoxSpeciesGlobal.SelectedIndex = possibleDinos[newindex];
lastOCRSpecies = possibleDinos[newindex];
lastOCRValues = OCRvalues;
extractLevels(true);
if (possibleDinos[0] >= 0 && possibleDinos[0] < comboBoxSpeciesGlobal.Items.Count)
comboBoxSpeciesGlobal.SelectedIndex = possibleDinos[0];
extractLevels(true); // only one possible dino, use that one
}
else
{ // automated, or first manual attempt at new values
bool foundPossiblyGood = false;
for (int dinooption = 0; dinooption < possibleDinos.Count() && foundPossiblyGood == false; dinooption++)
{
bool sameValues = true;

if (lastOCRValues != null)
for (int i = 0; i < 10; i++)
if (OCRvalues[i] != lastOCRValues[i])
{
sameValues = false;
break;
}

// if there's more than one option, on manual we cycle through the options if we're trying multiple times
// on automated, we take the first one that yields an error-free level extraction
if (manuallyTriggered && sameValues)
{
// if the last OCR'ed values are the same as this one, the user may not be happy with the dino species selection and want another one
// so we'll cycle to the next one, but only if the OCR is manually triggered, on autotrigger (ie, overlay), don't change
comboBoxSpeciesGlobal.SelectedIndex = possibleDinos[dinooption];
lastOCRSpecies = possibleDinos[dinooption];
int newindex = (possibleDinos.IndexOf(lastOCRSpecies) + 1) % possibleDinos.Count;
comboBoxSpeciesGlobal.SelectedIndex = possibleDinos[newindex];
lastOCRSpecies = possibleDinos[newindex];
lastOCRValues = OCRvalues;
foundPossiblyGood = extractLevels();
extractLevels(true);
}
else
{ // automated, or first manual attempt at new values
bool foundPossiblyGood = false;
for (int dinooption = 0; dinooption < possibleDinos.Count() && foundPossiblyGood == false; dinooption++)
{
// if the last OCR'ed values are the same as this one, the user may not be happy with the dino species selection and want another one
// so we'll cycle to the next one, but only if the OCR is manually triggered, on autotrigger (ie, overlay), don't change
comboBoxSpeciesGlobal.SelectedIndex = possibleDinos[dinooption];
lastOCRSpecies = possibleDinos[dinooption];
lastOCRValues = OCRvalues;
foundPossiblyGood = extractLevels();
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.24.0")]
[assembly: AssemblyFileVersion("0.24.1")]
2 changes: 1 addition & 1 deletion ARKBreedingStats/TimerControl.Designer.cs

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

5 changes: 3 additions & 2 deletions ARKBreedingStats/TimerControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,12 @@ private void bSetTimerNow_Click(object sender, EventArgs e)
private void buttonAddTime_addTimer(TimeSpan timeSpan)
{
dhmsInputTimer.Timespan = dhmsInputTimer.Timespan.Add(timeSpan);
dateTimePickerTimerFinish.Value = DateTime.Now.Add(dhmsInputTimer.Timespan);
}

private void dhmsInputTimer_TextChanged(object sender, EventArgs e)
private void dhmsInputTimer_ValueChanged(uiControls.dhmsInput sender, TimeSpan timespan)
{
dateTimePickerTimerFinish.Value = DateTime.Now.Add(dhmsInputTimer.Timespan);
dateTimePickerTimerFinish.Value = DateTime.Now.Add(timespan);
}

private void addToOverlayToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/ver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
273.85,0.24.0
273.85,0.24.1
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[**Download** the latest release](https://github.com/cadon/ARKStatsExtractor/releases/latest). Support the development of this tool: [<img src="https://az743702.vo.msecnd.net/cdn/kofi2.png?v=a" alt="Buy me a Coffee" height="36">](https://ko-fi.com/826WMCII3B24)

**Discord**: https://discord.gg/qCYYbQK

# ARK Smart Breeding

For the game ARK Survival Evolved. Extracts possible levelups of creatures to get the values for breeding. Save your creatures in a library, sort and compare their stats, view their pedigree, use the breeding-plan to get the best possible creatures and keep track of the growing babies with timers.
Expand Down

0 comments on commit cb86e8a

Please sign in to comment.