Skip to content

Commit

Permalink
fix for max-possible-level determination
Browse files Browse the repository at this point in the history
fix for rounding errors
output is now with % for %-values
  • Loading branch information
cadon committed Nov 22, 2015
1 parent 149912f commit 46cbbce
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 34 deletions.
70 changes: 46 additions & 24 deletions ARKBreedingStats/Form1.Designer.cs

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

47 changes: 39 additions & 8 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ private void Form1_Load(object sender, EventArgs e)
{
statIOs[s].Title = statNames[s];
statIOs[s].Id = s;
if (precisions[s] == 3) { statIOs[s].Percent = true; }
}
statIOs[5].Percent = true;
statIOs[6].Percent = true;
loadFile();
comboBoxCreatures.SelectedIndex = 0;
labelVersion.Text = "v0.6";
labelVersion.Text = "v0.8";
}

private void clearAll()
Expand Down Expand Up @@ -131,8 +130,11 @@ private void buttonCalculate_Click(object sender, EventArgs e)
}
}
// max level for wild according to torpor (torpor is depending on taming efficiency up to 1.5 times "too high" for level
int maxLW2 = (int)Math.Round((statIOs[7].Input - (postTamed ? stats[c][7][3] : 0) - stats[c][7][0]) / (stats[c][7][0] * stats[c][7][1]), 0);
int maxLD2 = (int)this.numericUpDownLevel.Value - (int)Math.Floor(200 * maxLW2 / (200 + (double)this.numericUpDownLowerTEffU.Value)) - 1; // the first level is always wild. middle-term is equal to maxLW2/(1*TEffU.Value/200)
double torporLevelTamingMultMax = (postTamed ? (200 + (double)this.numericUpDownLowerTEffU.Value) / (400 + (double)this.numericUpDownLowerTEffU.Value) : 1);
double torporLevelTamingMultMin = (postTamed ? (200 + (double)this.numericUpDownLowerTEffL.Value) / (400 + (double)this.numericUpDownLowerTEffL.Value) : 1);
int maxLW2 = (int)Math.Round((statIOs[7].Input - (postTamed ? stats[c][7][3] : 0) - stats[c][7][0]) * torporLevelTamingMultMax / (stats[c][7][0] * stats[c][7][1]), 0);
int maxLW2min = (int)(maxLW2 * torporLevelTamingMultMin / torporLevelTamingMultMax);
int maxLD2 = (int)this.numericUpDownLevel.Value - maxLW2min - 1; // the first level is always wild. middle-term is equal to maxLW2/(1+TEffU.Value/200)
int wildSpeedLevel = maxLW2;
// substract all uniquely solved stat-levels
for (int s = 0; s < 7; s++)
Expand Down Expand Up @@ -165,7 +167,7 @@ private void buttonCalculate_Click(object sender, EventArgs e)
{
for (int erf = 0; erf < results[statWithEff[et]].Count; erf++)
{
// efficiency-calculation can be a bit off due to rounding, so treat them as equal when diff<0.002
// efficiency-calculation can be a bit off due to rounding-ingame, so treat them as equal when diff<0.002
if (Math.Abs(results[statWithEff[es]][ere][2] - results[statWithEff[et]][erf][2]) < 0.002)
{
// if entry is not yet in whitelist, add it
Expand Down Expand Up @@ -414,13 +416,42 @@ private void buttonCopyClipboard_Click(object sender, EventArgs e)
if (results.Count == 8 && chosenResults.Count == 8)
{
List<string> tsv = new List<string>();
tsv.Add(comboBoxCreatures.Items[comboBoxCreatures.SelectedIndex].ToString() + "\tLevel " + numericUpDownLevel.Value.ToString());
// if taming efficiency is unique, display it, too
string effString = "";
if (statWithEff.Count > 0)
{
double eff = results[statWithEff[0]][chosenResults[statWithEff[0]]][2];
bool useEff = true;
for (int st = 1; st < statWithEff.Count; st++)
{
// efficiency-calculation can be a bit off due to ingame-rounding
if (Math.Abs(results[statWithEff[st]][chosenResults[statWithEff[st]]][2] - eff) > 0.002)
{
useEff = false;
break;
}
}
if (useEff)
{
effString = "\tTamingEff:\t" + (100 * eff).ToString() + "%";
}
}
tsv.Add(comboBoxCreatures.Items[comboBoxCreatures.SelectedIndex].ToString() + "\tLevel " + numericUpDownLevel.Value.ToString() + effString);
tsv.Add("Stat\tWildLevel\tDomLevel\tBreedingValue");
for (int s = 0; s < 8; s++)
{
if (chosenResults[s] < results[s].Count)
{
tsv.Add(statNames[s] + "\t" + results[s][chosenResults[s]][0].ToString() + "\t" + results[s][chosenResults[s]][1].ToString() + "\t" + breedingValue(s, chosenResults[s]).ToString());
string breedingV = "";
if (precisions[s] == 3)
{
breedingV = (100 * breedingValue(s, chosenResults[s])).ToString() + "%";
}
else
{
breedingV = breedingValue(s, chosenResults[s]).ToString();
}
tsv.Add(statNames[s] + "\t" + results[s][chosenResults[s]][0].ToString() + "\t" + results[s][chosenResults[s]][1].ToString() + "\t" + breedingV);
}
else { return; }
}
Expand Down
3 changes: 2 additions & 1 deletion ARKBreedingStats/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
</resheader>
<data name="labelDoc.Text" xml:space="preserve">
<value>If the levels cannot be determined uniquely, the stat-box on the left becomes dark-grey. Click on it to choose a possibility from the list on the right. For example if you know that you never leveled up oxygen, you can choose the entry with the 0 in the Domesticated-column.
The exacter / narrower the "Taming Efficiency Range", the fewer possible results.</value>
The exacter / narrower the "Taming Efficiency Range", the fewer possible results.
The TEfficency can differ 0.1% due to ingame-rounding.</value>
</data>
</root>
Loading

0 comments on commit 46cbbce

Please sign in to comment.