Skip to content

Commit

Permalink
added cuddle-counter. maturationTimes are calculated more precisely t…
Browse files Browse the repository at this point in the history
…o avoid rounding errors with high multipliers.
  • Loading branch information
cadaei committed Jan 15, 2017
1 parent f14133c commit 725dc88
Show file tree
Hide file tree
Showing 9 changed files with 530 additions and 470 deletions.
4 changes: 4 additions & 0 deletions ARKBreedingStats/ArkOCR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ public Bitmap removePixelsUnderThreshold(Bitmap source, int threshold)
return dest;
}

/*
// function currently unused. ARK seems to be scaling down larger fonts rather than using entire pixel heights
private void GenerateLetterImagesFromFont(Int16 pixelSize)
{
Expand Down Expand Up @@ -414,6 +415,7 @@ private void GenerateLetterImagesFromFont(Int16 pixelSize)
//save the new image file within Images directory
//bitmap.Save(@"D:\Temp\test.png");
}
*/


public void CalibrateFromImage(int resolution, Bitmap source, string textInImage)
Expand Down Expand Up @@ -674,12 +676,14 @@ public float[] doOCR(out string OCRText, out string dinoName, out string ownerNa

return finalValues;

/*
Bitmap grab = Win32Stuff.GetSreenshotOfProcess("ShooterGame");
AddBitmapToDebug(grab);
//grab.Save("E:\\Temp\\Calibration8.png", ImageFormat.Png);
if (changeForegroundWindow)
Win32Stuff.SetForegroundWindow(Application.OpenForms[0].Handle);
*/
}

private string readImageAtCoords(int resolution, Bitmap source, int x, int y, int width, int height, bool onlyMaximalMatches, bool onlyNumbers, bool writingInWhite = true)
Expand Down
10 changes: 5 additions & 5 deletions ARKBreedingStats/BreedingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public void displayData(int speciesIndex)
switch (k)
{
default:
case 0: t1 = breeding.pregnancyTimeAdjusted == 0 ? breeding.incubationTimeAdjusted : breeding.pregnancyTimeAdjusted; totalTime = t1; break;
case 0: t1 = (int)(breeding.pregnancyTimeAdjusted == 0 ? breeding.incubationTimeAdjusted : breeding.pregnancyTimeAdjusted); totalTime = t1; break;
case 1: t1 = (int)(.1f * breeding.maturationTimeAdjusted); totalTime = t1; break;
case 2: t1 = breeding.maturationTimeAdjusted; totalTime = breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted + breeding.maturationTimeAdjusted; break;
case 2: t1 = (int)breeding.maturationTimeAdjusted; totalTime = (int)(breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted + breeding.maturationTimeAdjusted); break;
}

string[] subitems = new string[] { rowNames[k],
Expand All @@ -55,8 +55,8 @@ public void displayData(int speciesIndex)

breedingInfo += "\n";

TimeSpan incubation = new TimeSpan(0, 0, breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted);
TimeSpan growing = new TimeSpan(0, 0, breeding.maturationTimeAdjusted);
TimeSpan incubation = new TimeSpan(0, 0, (int)(breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted));
TimeSpan growing = new TimeSpan(0, 0, (int)breeding.maturationTimeAdjusted);
buttonHatching.Text = firstTime;

// further info
Expand All @@ -68,7 +68,7 @@ public void displayData(int speciesIndex)
if (breeding.eggTempMin > 0 && breeding.matingCooldownMinAdjusted > 0)
breedingInfo += "\n\n";
if (breeding.matingCooldownMinAdjusted > 0)
breedingInfo += "Time until next mating is possible:\n" + new TimeSpan(0, 0, breeding.matingCooldownMinAdjusted).ToString("d':'hh':'mm") + " - " + new TimeSpan(0, 0, breeding.matingCooldownMaxAdjusted).ToString("d':'hh':'mm");
breedingInfo += "Time until next mating is possible:\n" + new TimeSpan(0, 0, (int)breeding.matingCooldownMinAdjusted).ToString("d':'hh':'mm") + " - " + new TimeSpan(0, 0, (int)breeding.matingCooldownMaxAdjusted).ToString("d':'hh':'mm");
labelBreedingInfos.Text = breedingInfo;
}
}
Expand Down
10 changes: 5 additions & 5 deletions ARKBreedingStats/BreedingPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ private void setBreedingData(string species = "")
switch (k)
{
default:
case 0: t1 = breeding.pregnancyTimeAdjusted == 0 ? breeding.incubationTimeAdjusted : breeding.pregnancyTimeAdjusted; totalTime = t1; break;
case 0: t1 = (int)(breeding.pregnancyTimeAdjusted == 0 ? breeding.incubationTimeAdjusted : breeding.pregnancyTimeAdjusted); totalTime = t1; break;
case 1: t1 = (int)(.1f * breeding.maturationTimeAdjusted); totalTime += t1; break;
case 2: t1 = breeding.maturationTimeAdjusted; totalTime = breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted + breeding.maturationTimeAdjusted; break;
case 2: t1 = (int)breeding.maturationTimeAdjusted; totalTime = (int)(breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted + breeding.maturationTimeAdjusted); break;
}

string[] subitems = new string[] { rowNames[k],
Expand All @@ -310,8 +310,8 @@ private void setBreedingData(string species = "")
};
listView1.Items.Add(new ListViewItem(subitems));
}
incubation = new TimeSpan(0, 0, breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted);
growing = new TimeSpan(0, 0, breeding.maturationTimeAdjusted);
incubation = new TimeSpan(0, 0, (int)(breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted));
growing = new TimeSpan(0, 0, (int)breeding.maturationTimeAdjusted);
buttonHatching.Text = firstTime;

// further info
Expand All @@ -324,7 +324,7 @@ private void setBreedingData(string species = "")
if (breeding.eggTempMin > 0 && breeding.matingCooldownMinAdjusted > 0)
breedingInfo += "\n\n";
if (breeding.matingCooldownMinAdjusted > 0)
breedingInfo += "Time until next mating is possible: " + new TimeSpan(0, 0, breeding.matingCooldownMinAdjusted).ToString("d':'hh':'mm") + " - " + new TimeSpan(0, 0, breeding.matingCooldownMaxAdjusted).ToString("d':'hh':'mm");
breedingInfo += "Time until next mating is possible: " + new TimeSpan(0, 0, (int)breeding.matingCooldownMinAdjusted).ToString("d':'hh':'mm") + " - " + new TimeSpan(0, 0, (int)breeding.matingCooldownMaxAdjusted).ToString("d':'hh':'mm");
labelBreedingInfos.Text = breedingInfo;
}
}
Expand Down
Loading

0 comments on commit 725dc88

Please sign in to comment.