Skip to content

Commit

Permalink
fix for direpolarbear when using OCR. added OCR for 3440x1440, made b…
Browse files Browse the repository at this point in the history
…y WarBird25. fix for ocr reading too many decimal places. fix for creatureName when exporting to clipboard. reenabled speech-recognition. improved name-display in raising-tab for long parent-names. changed mutation-counter in name-generator to only 2 digits (more than 20 doesn't matter).
  • Loading branch information
cadaei committed Sep 30, 2017
1 parent 86b79cf commit 861aa58
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 41 deletions.
6 changes: 6 additions & 0 deletions ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,15 @@
<None Include="json\ocr_1920x1080_100.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="json\ocr_2560x1440_100.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="json\ocr_2680x1080_100.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="json\ocr_3440x1440_100.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\kofi.png" />
<Content Include="Resources\ARKExtractor.ico" />
<Content Include="Resources\lock.png" />
Expand Down
10 changes: 5 additions & 5 deletions ARKBreedingStats/Form1.Designer.cs

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

28 changes: 17 additions & 11 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,12 @@ private void Form1_Load(object sender, EventArgs e)
bool labelListeningVisible = false;
if (Properties.Settings.Default.SpeechRecognition)
{
var speechRecognitionAvailable = (AppDomain.CurrentDomain.GetAssemblies().Any(a => a.FullName.Substring(0, 13) == "System.Speech"));
// var speechRecognitionAvailable = (AppDomain.CurrentDomain.GetAssemblies().Any(a => a.FullName.Substring(0, 13) == "System.Speech")); // TODO doens't work as intended. Should only require System.Speech if available to allow running it on MONO

if (speechRecognitionAvailable)
{
labelListeningVisible = true;
speechRecognition = new SpeechRecognition(300, labelListening);
speechRecognition.speechRecognized += new SpeechRecognition.SpeechRecognizedEventHandler(tellTamingData);
speechRecognition.speechCommandRecognized += new SpeechRecognition.SpeechCommandRecognizedEventHandler(speechCommand);
}
labelListeningVisible = true;
speechRecognition = new SpeechRecognition(300, labelListening);
speechRecognition.speechRecognized += new SpeechRecognition.SpeechRecognizedEventHandler(tellTamingData);
speechRecognition.speechCommandRecognized += new SpeechRecognition.SpeechCommandRecognizedEventHandler(speechCommand);
}
else labelListening.Visible = labelListeningVisible;

Expand Down Expand Up @@ -2835,7 +2832,7 @@ private void exportAsTextToClipboard(Creature c, bool breeding = true, bool ARKm
else if (c.imprintingBonus > 0) modifierText = ", Impr: " + Math.Round(100 * c.imprintingBonus, 2) + "%";
}

string output = creatureInfoInputExtractor.CreatureName + " (" + (ARKml ? Utils.getARKml(c.species, 50, 172, 255) : c.species)
string output = c.name + " (" + (ARKml ? Utils.getARKml(c.species, 50, 172, 255) : c.species)
+ ", Lvl " + (breeding ? c.levelHatched : c.level) + modifierText + (c.gender != Sex.Unknown ? ", " + c.gender.ToString() : "") + "): ";
for (int s = 0; s < 8; s++)
{
Expand Down Expand Up @@ -3351,6 +3348,7 @@ private void setCreatureValuesToExtractor(Creature c, bool onlyWild = false)
int sI = Values.V.speciesNames.IndexOf(c.species);
if (sI >= 0)
{
clearAll();
// copy values over to extractor
for (int s = 0; s < 8; s++)
statIOs[s].Input = (onlyWild ? Stats.calculateValue(sI, s, c.levelsWild[s], 0, true, c.tamingEff, c.imprintingBonus) : c.valuesDom[s]);
Expand Down Expand Up @@ -3424,8 +3422,15 @@ public void doOCR(string imageFilePath = "", bool manuallyTriggered = true)
}
else { radioButtonTamed.Checked = true; }

if (species == "Paraceratherium") //todo do more species
species = "Paracer";
// fixing ocr species names
switch (species)
{
case "DireBear": species = "Dire Bear"; break;
case "DirePolarBear": species = "Dire Polar Bear"; break;
case "DirePoiarBear": species = "Dire Polar Bear"; break;
case "Paraceratherium": species = "Paracer"; break;
default: break;
}

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

Expand Down Expand Up @@ -3645,6 +3650,7 @@ private void toolStripButtonClear_Click_1(object sender, EventArgs e)

private void toolStripButtonCopy2Extractor_Click(object sender, EventArgs e)
{
clearAll();
// copy values from tester over to extractor
for (int s = 0; s < 8; s++)
statIOs[s].Input = testingIOs[s].Input;
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.23.18")]
[assembly: AssemblyFileVersion("0.23.19")]
16 changes: 8 additions & 8 deletions ARKBreedingStats/RaisingControl.Designer.cs

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

1 change: 1 addition & 0 deletions ARKBreedingStats/json/ocr_3440x1440_100.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ARKBreedingStats/ocr/ArkOCR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ public float[] doOCR(out string OCRText, out string dinoName, out string species
r = new Regex(@".*:(\d+)");
else
{
r = new Regex(@"(?:\d+[\.,'][\d\/]%?[\/1])?(\d+[\.,']?\d?\d?)(%)?"); // only the second numbers is interesting after the current weight is not shown anymore
r = new Regex(@"(?:\d+[\.,'][\d\/]%?[\/1])?(\d+[\.,']?\d?)(%)?"); // only the second numbers is interesting after the current weight is not shown anymore

//if (onlyNumbers)
//r = new Regex(@"((\d*[\.,']?\d?\d?)\/)?(\d*[\.,']?\d?\d?)");
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/ocr/OCRControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ private void buttonLoadOCRTemplate_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "OCR configuration File (*.json)|*.json";
dlg.InitialDirectory = Application.StartupPath + "/json";
dlg.InitialDirectory = Application.StartupPath + "\\json";
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
loadOCRTemplate(dlg.FileName);
Expand Down
41 changes: 34 additions & 7 deletions ARKBreedingStats/raising/ParentStats.Designer.cs

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

8 changes: 4 additions & 4 deletions ARKBreedingStats/raising/ParentStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public void setParentValues(Creature mother, Creature father)
{
if (mother == null && father == null)
{
labelMother.Text = "Mother:\nunknown";
labelFather.Text = "Father:\nunknown";
labelMother.Text = "unknown";
labelFather.Text = "unknown";
for (int s = 0; s < 7; s++)
{
parentStatValues[s].setValues("-", "-", 0);
Expand All @@ -58,8 +58,8 @@ public void setParentValues(Creature mother, Creature father)
mother != null && father != null ? (mother.valuesBreeding[s] > father.valuesBreeding[s] ? 1 : 2) : 0
);
}
labelMother.Text = "Mother:\n" + mother.name;
labelFather.Text = "Father:\n" + father.name;
labelMother.Text = mother.name;
labelFather.Text = (labelMother.Width > 78 ? "\n" : "") + father.name;
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion ARKBreedingStats/uiControls/NamePatterns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ static public Dictionary<string, string> createTokenDictionary(Creature creature
dmg +
effImp;

var mutasn = creature.mutationCounter;
string mutas;
if (mutasn > 99)
mutas = "99";
else
mutas = mutasn.ToString().PadLeft(2, '0');

var spcShort = creature.species.Replace(" ", "");
var speciesShort = spcShort;
var vowels = new string[] { "a", "e", "i", "o", "u" };
Expand Down Expand Up @@ -157,7 +164,7 @@ static public Dictionary<string, string> createTokenDictionary(Creature creature
{ "trp" , trp },
{ "baselvl" , baselvl },
{ "effImp" , effImp },
{ "muta", creature.mutationCounter.ToString().PadLeft(3,'0')},
{ "muta", mutas},
{ "gen",generation.ToString().PadLeft(3,'0')},
{ "gena",dec2hexvig(generation).PadLeft(2,'0')},
{ "rnd", randStr },
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/uiControls/PatternEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void Initialization(Creature creature = null, List<Creature> females = n
{"effImp","Taming-effectiveness or Imprinting (if tamed / bred)"},
{"gen","Generation"},
{"gena","Generation in letters"},
{"muta","Mutations"},
{"muta","Mutations. Numbers larger than 99 will be displayed as 99"},
{"rnd","random number (10000 - 99999"},
{"tn","number of creatures of the current species in the library + 1"}
};
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/ver.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
268.22,0.23.18
268.22,0.23.19

0 comments on commit 861aa58

Please sign in to comment.