Skip to content

Commit

Permalink
fix for tamingEff. Fix: if creature is added, it's shown in the next …
Browse files Browse the repository at this point in the history
…breedingplan. Added easier editing by moving a creature in the Tester and saving it again from there. Fix for Procoptodon-values.
  • Loading branch information
cadon committed Apr 6, 2016
1 parent 61add17 commit 711bd4a
Show file tree
Hide file tree
Showing 8 changed files with 544 additions and 422 deletions.
2 changes: 1 addition & 1 deletion ARKBreedingStats/CreatureBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void updateLabel()
}
else
{
labelParents.Text = "found wild " + creature.levelFound + ", tamed with TE: " + (creature.tamingEff * 100).ToString("N1") + "%";
labelParents.Text = "found wild " + creature.levelFound + (creature.tamingEff >= 0 ? ", tamed with TE: " + (creature.tamingEff * 100).ToString("N1") + "%" : ", TE unknown.");
}
for (int s = 0; s < 8; s++) { updateStat(s); }
labelNotes.Text = creature.note;
Expand Down
14 changes: 13 additions & 1 deletion ARKBreedingStats/CreatureColored.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ public static Bitmap getColoredCreature(int[] colorIds, string species, bool[] e
{

float[][] hsl = new float[6][];
int[][] rgb = new int[6][];
for (int c = 0; c < 6; c++)
{
Color cl = Utils.creatureColor(colorIds[c]);
rgb[c] = new int[] { cl.R, cl.G, cl.B };
float mx = Math.Max(cl.R, Math.Max(cl.G, cl.B)) / 255f;
float mn = Math.Min(cl.R, Math.Min(cl.G, cl.B)) / 255f;
float s = mx - mn;
Expand Down Expand Up @@ -85,7 +87,17 @@ public static Bitmap getColoredCreature(int[] colorIds, string species, bool[] e
}
if (o == 0)
continue;
c = HSLtoRGB(hsl[m][0], hsl[m][1], l);
//c = HSLtoRGB(hsl[m][0], hsl[m][1], l);
r = bc.R + rgb[m][0] - 128;
if (r < 0) r = 0;
else if (r > 255) r = 255;
g = bc.G + rgb[m][1] - 128;
if (g < 0) g = 0;
else if (g > 255) g = 255;
b = bc.B + rgb[m][2] - 128;
if (b < 0) b = 0;
else if (b > 255) b = 255;
c = Color.FromArgb(r, g, b);
bc = Color.FromArgb(bc.A, (int)(o * c.R + (1 - o) * bc.R), (int)(o * c.G + (1 - o) * bc.G), (int)(o * c.B + (1 - o) * bc.B));
}
bm.SetPixel(i, j, bc);
Expand Down
844 changes: 443 additions & 401 deletions ARKBreedingStats/Form1.Designer.cs

Large diffs are not rendered by default.

81 changes: 66 additions & 15 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public partial class Form1 : Form
private DateTime lastAutoSaveBackup = DateTime.Now.AddDays(-1);
private int autoSaveMinutes;
private Dictionary<string, bool[]> colorRegionSpecies = new Dictionary<string, bool[]>();
private Creature creatureTesterEdit;

public Form1()
{
Expand Down Expand Up @@ -138,11 +139,12 @@ private void Form1_Load(object sender, EventArgs e)
// ToolTips
ToolTip tt = new ToolTip();
tt.SetToolTip(this.checkBoxOutputRowHeader, "Include Headerrow");
tt.SetToolTip(this.checkBoxJustTamed, "Check this if there was no server-restart or if you didn't logout since you tamed the creature.\nUncheck this if you know there was a server-restart (many servers restart every night).\nIf it is some days ago (IRL) you tamed the creature you should probably uncheck this checkbox.");
tt.SetToolTip(this.checkBoxJustTamed, "Check this if there was no server-restart or if you didn't logout since you tamed the creature.\nUncheck this if you know there was a server-restart (many servers restart every night).\nIf it is some days ago (IRL) you tamed the creature you should probably uncheck this checkbox.\nThe reason for this is a bug in the game, that displays a too high Torpor-value after a creature is tamed.");
tt.SetToolTip(checkBoxWildTamedAuto, "For most creatures the tool recognizes if they are wild or tamed.\nFor Giganotosaurus and maybe if you have custom server-settings you have to select manually if the creature is wild or tamed.");
tt.SetToolTip(checkBoxQuickWildCheck, "Check this if you just want a quick check of the levels of a wild (untamed) creature.\nThe levels are then shown without the extraction-process (and without validation).");
tt.SetToolTip(radioButtonBPTopStats, "Check for best long-term-results.\nSome offsprings might be worse, but that's the mode you go if you want to have that perfect creature in some generations.");
tt.SetToolTip(radioButtonBPHighStats, "Check for best next-generation-results.\nThe chance for an overall good creature is better.");
tt.SetToolTip(buttonSaveFromTester, "The wild- and domesticated levels and the taming effectiveness are saved.");

loadStatFile();
if (speciesNames.Count > 0)
Expand Down Expand Up @@ -877,6 +879,7 @@ private void cbbStatTestingRace_SelectedIndexChanged(object sender, EventArgs e)
}
updateAllTesterValues();
}
setButtonTesterEdit();
}

private void listBoxPossibilities_MouseClick(object sender, MouseEventArgs e)
Expand Down Expand Up @@ -1348,6 +1351,7 @@ private void updateCreatureListings(int speciesIndex = -1)
updateTreeListSpecies(creatureCollection.creatures);
filterLib();
toolStripStatusLabel.Text = creatureCollection.creatures.Count() + " creatures in Library";
breedingPlan1.currentSpecies = ""; // set to empty so creatures are loaded again if breeding plan is created
}

/// <summary>
Expand All @@ -1370,14 +1374,18 @@ private void updateTreeListSpecies(List<Creature> creatures)
int nn = 0;
while (nn < treeViewCreatureLib.Nodes.Count && String.Compare(treeViewCreatureLib.Nodes[nn].Text, cr.species, true) < 0) { nn++; }
treeViewCreatureLib.Nodes.Insert(nn, cr.species, cr.species);
//treeViewCreatureLib.Nodes[nn].Name = cr.species;
}
}

// set the same species to breedingplaner, except the 'all'
string selectedSpecies = "";
if (listBoxBreedingPlanSpecies.SelectedIndex >= 0)
selectedSpecies = listBoxBreedingPlanSpecies.SelectedItem.ToString();
listBoxBreedingPlanSpecies.Items.Clear();
for (int i = 1; i < treeViewCreatureLib.Nodes.Count; i++)
listBoxBreedingPlanSpecies.Items.Add(treeViewCreatureLib.Nodes[i].Text);
if (selectedSpecies.Length > 0)
listBoxBreedingPlanSpecies.SelectedIndex = listBoxBreedingPlanSpecies.Items.IndexOf(selectedSpecies);
}

private void createOwnerList()
Expand Down Expand Up @@ -2149,13 +2157,14 @@ private void creatureLevelTesting(Creature c)
if (c != null)
{
cbbStatTestingSpecies.SelectedIndex = speciesNames.IndexOf(c.species);
NumericUpDownTestingTE.Value = (decimal)c.tamingEff * 100;
NumericUpDownTestingTE.Value = (c.tamingEff >= 0 ? (decimal)c.tamingEff * 100 : 0);
for (int s = 0; s < 7; s++)
{
testingIOs[s].LevelWild = c.levelsWild[s];
testingIOs[s].LevelDom = c.levelsDom[s];
}
tabControl1.SelectedIndex = 0;
setButtonTesterEdit(c);
}
}

Expand All @@ -2179,17 +2188,6 @@ private void buttonExtractor2Tester_Click(object sender, EventArgs e)
tabControl1.SelectedIndex = 0;
}

private void labelTestingInfo_Click(object sender, EventArgs e)
{
// copy values over to extractor
for (int s = 0; s < 8; s++)
statIOs[s].Input = testingIOs[s].Input;
comboBoxCreatures.SelectedIndex = cbbStatTestingSpecies.SelectedIndex;
tabControl1.SelectedIndex = 1;
// set total level
numericUpDownLevel.Value = getCurrentWildLevels(false).Sum() - testingIOs[7].LevelWild + getCurrentDomLevels(false).Sum() + 1;
}

private void updateAllTesterValues()
{
updateTorporInTester = false;
Expand Down Expand Up @@ -2459,13 +2457,66 @@ private void determineBestBreeding()
{
breedingPlan1.currentSpecies = selectedSpecies;
newSpecies = true;
if (colorRegionSpecies.ContainsKey(selectedSpecies))
breedingPlan1.EnabledColorRegions = colorRegionSpecies[selectedSpecies];
else
breedingPlan1.EnabledColorRegions = new bool[] { true, true, true, true, true, true };
breedingPlan1.Creatures = creatureCollection.creatures.Where(c => c.species == selectedSpecies && c.status == CreatureStatus.Available).ToList();
}
breedingPlan1.statWeights = statWeighting1.Weightings;
breedingPlan1.EnabledColorRegions = colorRegionSpecies[selectedSpecies];
breedingPlan1.drawBestParents(radioButtonBPTopStats.Checked, newSpecies);
}

private void buttonCopyTester2Extractor_Click(object sender, EventArgs e)
{
// copy values over to extractor
for (int s = 0; s < 8; s++)
statIOs[s].Input = testingIOs[s].Input;
comboBoxCreatures.SelectedIndex = cbbStatTestingSpecies.SelectedIndex;
tabControl1.SelectedIndex = 1;
// set total level
numericUpDownLevel.Value = getCurrentWildLevels(false).Sum() - testingIOs[7].LevelWild + getCurrentDomLevels(false).Sum() + 1;
}

private void buttonSaveFromTester_Click(object sender, EventArgs e)
{
if (creatureTesterEdit != null)
{
bool wildChanged = (Math.Abs(creatureTesterEdit.tamingEff - (double)NumericUpDownTestingTE.Value / 100) > .0005);
if (!wildChanged)
{
int[] wildLevels = getCurrentWildLevels(false);
for (int s = 0; s < 8; s++)
{
if (wildLevels[s] != creatureTesterEdit.levelsWild[s])
{
wildChanged = true;
break;
}
}
}
if (!wildChanged || MessageBox.Show("The wild levels or the taming-effectiveness were changed. Save values anyway?\nOnly save if the wild levels or taming-effectiveness were extracted wrongly!\nIf you are not sure, don't save. The breeding-values could become invalid.", "Wild levels have been changed", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
{
creatureTesterEdit.levelsWild = getCurrentWildLevels(false);
creatureTesterEdit.levelsDom = getCurrentDomLevels(false);
creatureTesterEdit.tamingEff = (double)NumericUpDownTestingTE.Value / 100;
setButtonTesterEdit();
if (wildChanged)
calculateTopStats(creatureCollection.creatures.Where(c => c.species == creatureTesterEdit.species).ToList());
filterLib();
tabControl1.SelectedIndex = 2;
}
}
}

private void setButtonTesterEdit(Creature c = null)
{
bool enable = (c != null);
buttonSaveFromTester.Enabled = enable;
buttonSaveFromTester.Text = "Save Changed Levels" + (enable ? " to " + c.name : "");
creatureTesterEdit = c;
}

private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
{
Settings settingsfrm = new Settings(creatureCollection);
Expand Down
16 changes: 16 additions & 0 deletions ARKBreedingStats/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ The TEfficency can differ 0.1% due to ingame-rounding.</value>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="statWeighting1.CustomWeightings" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAPkBbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1u
ZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5XSxbU3lzdGVtLkRvdWJsZVtdLCBt
c2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3
N2E1YzU2MTkzNGUwODldXSwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5DAMAAACaAW1zY29ybGliLCBWZXJzaW9uPTQu
MC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjc3YTVjNTYxOTM0ZTA4OV1dLCBt
c2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3
N2E1YzU2MTkzNGUwODkFAQAAADZTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYy5EaWN0aW9uYXJ5YDJb
W1N5c3RlbS5TdHJpbmcDAAAAB1ZlcnNpb24IQ29tcGFyZXIISGFzaFNpemUABAAIQ1N5c3RlbS5Db2xs
ZWN0aW9ucy5HZW5lcmljLkdlbmVyaWNFcXVhbGl0eUNvbXBhcmVyYDFbW1N5c3RlbS5TdHJpbmcDAAAA
CAIAAAAAAAAACQQAAAAAAAAABQQAAABDU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuR2VuZXJpY0Vx
dWFsaXR5Q29tcGFyZXJgMVtbU3lzdGVtLlN0cmluZwAAAAADAAAACw==
</value>
</data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>248, 17</value>
</metadata>
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.18.1.0")]
[assembly: AssemblyFileVersion("0.18.2.0")]
3 changes: 2 additions & 1 deletion ARKBreedingStats/StatWeighting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ private string ShowInput()
Height = 150,
FormBorderStyle = FormBorderStyle.FixedToolWindow,
Text = "New Preset",
StartPosition = FormStartPosition.CenterScreen
StartPosition = FormStartPosition.CenterParent,
ShowInTaskbar = false
};
Label textLabel = new Label() { Left = 20, Top = 15, Text = "Preset-Name" };
TextBox textBox = new TextBox() { Left = 20, Top = 40, Width = 200 };
Expand Down
4 changes: 2 additions & 2 deletions ARKBreedingStats/stats.txt
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ Plesiosaur
1,0,0.025,0,0
1600,0.06,0,0.5,0
Procoptodon
400,0.11,0.27,0.5
350,0.05428571428,0.1,0,0
400,0.11,0.270000838,0.5
350,0.054287043,0.1,0,0
150,0.1,0.1,0,0
1500,0.1,0.1,0,0
450,0.02,0.04,0,0
Expand Down

0 comments on commit 711bd4a

Please sign in to comment.