Skip to content

Commit

Permalink
updated ver. fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Jul 4, 2016
1 parent 5a55c95 commit 3455752
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 543 deletions.
1 change: 0 additions & 1 deletion ARKBreedingStats/ARKBreedingStats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@
<Content Include="Resources\newTribe.png" />
<Content Include="Resources\settings.png" />
<Content Include="Resources\unlocked.png" />
<Content Include="stats.txt" />
<Content Include="ver.txt" />
<EmbeddedResource Include="AboutBox1.resx">
<DependentUpon>AboutBox1.cs</DependentUpon>
Expand Down
6 changes: 3 additions & 3 deletions ARKBreedingStats/ARKOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ internal void setBreedingProgressValues(float percentage, int maxTime)
txtBreedingProgress.Text = "";
return;
}
String text = "";
text = String.Format(@"Progress: {0:P2}", percentage);
string text = "";
text = string.Format(@"Progress: {0:P2}", percentage);
TimeSpan ts;
String tsformat = "";
string tsformat = "";
if (percentage <= 0.1)
{
ts = new TimeSpan(0, 0, (int)(maxTime * (0.1 - percentage)));
Expand Down
16 changes: 9 additions & 7 deletions ARKBreedingStats/ArkOCR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public class ArkOCR
public Bitmap[,] reducedAlphabet = new Bitmap[3, 255];
private double[] charWeighting = new double[255]; // contains weightings for chars
public Dictionary<Int64, List<byte>> hashMap = new Dictionary<long, List<byte>>();
public Dictionary<String, Point> statPositions = new Dictionary<string, Point>();
public Dictionary<string, Point> statPositions = new Dictionary<string, Point>();
private static ArkOCR _OCR;
public static FlowLayoutPanel debugPanel { get; set; }
private int[] calibrationResolution = new int[] { 0, 0 };
public Dictionary<String, Point> lastLetterPositions = new Dictionary<string, Point>();
public Dictionary<string, Point> lastLetterPositions = new Dictionary<string, Point>();
private bool coordsAfterDot = false;
public Process ARKProcess;
public int currentResolution = -1;
Expand Down Expand Up @@ -589,7 +589,7 @@ public float[] doOCR(out string OCRText, out string dinoName, string useImageFil
Win32Stuff.SetForegroundWindow(Application.OpenForms[0].Handle);

int count = -1;
foreach (String statName in statPositions.Keys)
foreach (string statName in statPositions.Keys)
{
count++;
testbmp = SubImage(screenshotbmp, statPositions[statName].X, statPositions[statName].Y, 500, 30); // 300 is enough, except for the name
Expand Down Expand Up @@ -637,7 +637,7 @@ public float[] doOCR(out string OCRText, out string dinoName, string useImageFil
}
}

String testStatName = mc[0].Groups[1].Value;
string testStatName = mc[0].Groups[1].Value;
float v = 0;
float.TryParse(mc[0].Groups[mc[0].Groups.Count - 1].Value.Replace('\'', '.').Replace(',', '.').Replace('O', '0'), System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.GetCultureInfo("en-US"), out v); // common substitutions: comma and apostrophe to dot,

Expand Down Expand Up @@ -881,7 +881,9 @@ internal void setDebugPanel(FlowLayoutPanel OCRDebugLayoutPanel)

public bool isDinoInventoryVisible()
{
string finishedText = "";
if (ARKProcess == null)
return false;

float[] finalValues = new float[1] { 0 };

Bitmap screenshotbmp = null;// = (Bitmap)Bitmap.FromFile(@"D:\ScreenshotsArk\Clipboard12.png");
Expand All @@ -897,9 +899,9 @@ public bool isDinoInventoryVisible()
if (!calibrate(screenshotbmp))
return false;

String statName = "NameAndLevel";
string statName = "NameAndLevel";
testbmp = SubImage(screenshotbmp, statPositions[statName].X, statPositions[statName].Y, 500, 30);
String statOCR = readImage(currentResolution, testbmp, true, false);
string statOCR = readImage(currentResolution, testbmp, true, false);

Regex r = new Regex(@"(.*)-?Lv[liI](\d*)Eq");
MatchCollection mc = r.Matches(statOCR);
Expand Down
28 changes: 15 additions & 13 deletions ARKBreedingStats/Form1.Designer.cs

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

10 changes: 6 additions & 4 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2688,7 +2688,7 @@ public void doOCR(string imageFilePath = "", bool manuallyTriggered = true)

List<int> possibleDinos = determineDinoRaceFromStats(OCRvalues, dinoName);

if (possibleDinos.Count == 0) // TODO shouldn't this be "==1"?
if (possibleDinos.Count == 0)
extractLevels(); // only one possible dino, use that one
else
{
Expand All @@ -2697,7 +2697,10 @@ public void doOCR(string imageFilePath = "", bool manuallyTriggered = true)
if (lastOCRValues != null)
for (int i = 0; i < 9; 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
Expand Down Expand Up @@ -2820,9 +2823,8 @@ private List<int> determineDinoRaceFromStats(float[] stats, string name)
return possibleDinos;
}

private void btnToggleOverlay_Click(object sender, EventArgs e)
private void checkBoxToggleOverlay_CheckedChanged(object sender, EventArgs e)
{

if (overlay == null)
{
overlay = new ARKOverlay();
Expand All @@ -2835,7 +2837,7 @@ private void btnToggleOverlay_Click(object sender, EventArgs e)
*/
}

overlay.Visible = !overlay.Visible;
overlay.Visible = checkBoxToggleOverlay.Checked;
overlay.inventoryCheckTimer.Enabled = overlay.Visible;
ArkOCR.OCR.calibrate(null);
}
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.19.6.0")]
[assembly: AssemblyFileVersion("0.20.0.0")]
3 changes: 2 additions & 1 deletion ARKBreedingStats/TamingControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ private void updateTamingData()
if (enoughFood)
{
int bonusLevel = (int)Math.Floor((double)nudLevel.Value * te / 2);
labelResult.Text = "It takes " + duration.ToString(@"hh\:mm\:ss") + " (until " + (DateTime.Now + duration).ToShortTimeString() + ") to tame the " + comboBoxSpecies.SelectedItem.ToString() + ".\nTaming Effectiveness: " + Math.Round(100 * te, 1).ToString() + " %\nBonus-Level: " + bonusLevel + " (total after Taming: " + (nudLevel.Value + bonusLevel).ToString() + ")"
labelResult.Text = "It takes " + duration.ToString(@"hh\:mm\:ss") + " (until " + (DateTime.Now + duration).ToShortTimeString() + ") to tame the " + comboBoxSpecies.SelectedItem.ToString() + "."
+ "\n\nTaming Effectiveness: " + Math.Round(100 * te, 1).ToString() + " %\nBonus-Level: " + bonusLevel + " (total level after Taming: " + (nudLevel.Value + bonusLevel).ToString() + ")"
+ "\n\n" + narcoBerries + " Narcoberries or\n" + narcotics + " Narcotics are needed";
}
else
Expand Down
Loading

0 comments on commit 3455752

Please sign in to comment.