From 3fd083bcbaaea1d7a3a9241d44f2446f5e4e1245 Mon Sep 17 00:00:00 2001 From: cadon Date: Sat, 28 Nov 2015 00:13:53 +0100 Subject: [PATCH] +sum of levels and what it should be to see correct combinations easier. --- ARKBreedingStats/Form1.Designer.cs | 118 ++++++++++++++++++++++++++--- ARKBreedingStats/Form1.cs | 82 ++++++++++++++++++-- 2 files changed, 183 insertions(+), 17 deletions(-) diff --git a/ARKBreedingStats/Form1.Designer.cs b/ARKBreedingStats/Form1.Designer.cs index ab02240d..f7a50b2f 100644 --- a/ARKBreedingStats/Form1.Designer.cs +++ b/ARKBreedingStats/Form1.Designer.cs @@ -59,6 +59,13 @@ private void InitializeComponent() this.radioButtonOutputRow = new System.Windows.Forms.RadioButton(); this.checkBoxOutputRowHeader = new System.Windows.Forms.CheckBox(); this.checkBoxJustTamed = new System.Windows.Forms.CheckBox(); + this.buttonClear = new System.Windows.Forms.Button(); + this.labelSum = new System.Windows.Forms.Label(); + this.labelSumWild = new System.Windows.Forms.Label(); + this.labelSumDom = new System.Windows.Forms.Label(); + this.labelSumDomSB = new System.Windows.Forms.Label(); + this.labelSumWildSB = new System.Windows.Forms.Label(); + this.labelSumSB = new System.Windows.Forms.Label(); this.statIOSpeed = new ARKBreedingStats.StatIO(); this.statIOTorpor = new ARKBreedingStats.StatIO(); this.statIODamage = new ARKBreedingStats.StatIO(); @@ -67,6 +74,7 @@ private void InitializeComponent() this.statIOHealth = new ARKBreedingStats.StatIO(); this.statIOOxygen = new ARKBreedingStats.StatIO(); this.statIOStamina = new ARKBreedingStats.StatIO(); + this.panelSums = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLowerTEffBound)).BeginInit(); this.groupBoxTE.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownUpperTEffBound)).BeginInit(); @@ -75,6 +83,7 @@ private void InitializeComponent() this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownXP)).BeginInit(); this.groupBox1.SuspendLayout(); + this.panelSums.SuspendLayout(); this.SuspendLayout(); // // buttonCalculate @@ -216,7 +225,7 @@ private void InitializeComponent() this.listBoxPossibilities.FormattingEnabled = true; this.listBoxPossibilities.Location = new System.Drawing.Point(3, 16); this.listBoxPossibilities.Name = "listBoxPossibilities"; - this.listBoxPossibilities.Size = new System.Drawing.Size(162, 409); + this.listBoxPossibilities.Size = new System.Drawing.Size(162, 432); this.listBoxPossibilities.TabIndex = 0; this.listBoxPossibilities.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listBoxPossibilities_MouseClick); // @@ -225,7 +234,7 @@ private void InitializeComponent() this.groupBoxPossibilities.Controls.Add(this.tableLayoutPanel1); this.groupBoxPossibilities.Location = new System.Drawing.Point(473, 12); this.groupBoxPossibilities.Name = "groupBoxPossibilities"; - this.groupBoxPossibilities.Size = new System.Drawing.Size(174, 447); + this.groupBoxPossibilities.Size = new System.Drawing.Size(174, 470); this.groupBoxPossibilities.TabIndex = 16; this.groupBoxPossibilities.TabStop = false; this.groupBoxPossibilities.Text = "Possible Levels"; @@ -242,7 +251,7 @@ private void InitializeComponent() this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 13F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(168, 428); + this.tableLayoutPanel1.Size = new System.Drawing.Size(168, 451); this.tableLayoutPanel1.TabIndex = 25; // // label2 @@ -267,7 +276,7 @@ private void InitializeComponent() this.buttonCopyClipboard.Enabled = false; this.buttonCopyClipboard.Location = new System.Drawing.Point(313, 447); this.buttonCopyClipboard.Name = "buttonCopyClipboard"; - this.buttonCopyClipboard.Size = new System.Drawing.Size(154, 36); + this.buttonCopyClipboard.Size = new System.Drawing.Size(154, 55); this.buttonCopyClipboard.TabIndex = 15; this.buttonCopyClipboard.Text = "Copy retrieved Values to Clipboard"; this.buttonCopyClipboard.UseVisualStyleBackColor = true; @@ -277,7 +286,7 @@ private void InitializeComponent() // this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(579, 473); + this.linkLabel1.Location = new System.Drawing.Point(579, 489); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(67, 13); this.linkLabel1.TabIndex = 20; @@ -287,16 +296,16 @@ private void InitializeComponent() // // labelFootnote // - this.labelFootnote.Location = new System.Drawing.Point(12, 462); + this.labelFootnote.Location = new System.Drawing.Point(12, 495); this.labelFootnote.Name = "labelFootnote"; - this.labelFootnote.Size = new System.Drawing.Size(295, 27); + this.labelFootnote.Size = new System.Drawing.Size(295, 16); this.labelFootnote.TabIndex = 18; - this.labelFootnote.Text = "label3"; + this.labelFootnote.Text = "*Creature is not yet tamed and may get better values then."; // // labelVersion // this.labelVersion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.labelVersion.Location = new System.Drawing.Point(525, 473); + this.labelVersion.Location = new System.Drawing.Point(525, 489); this.labelVersion.Name = "labelVersion"; this.labelVersion.Size = new System.Drawing.Size(46, 13); this.labelVersion.TabIndex = 19; @@ -402,6 +411,70 @@ private void InitializeComponent() this.checkBoxJustTamed.UseVisualStyleBackColor = true; this.checkBoxJustTamed.CheckedChanged += new System.EventHandler(this.checkBoxJustTamed_CheckedChanged); // + // buttonClear + // + this.buttonClear.Location = new System.Drawing.Point(12, 36); + this.buttonClear.Name = "buttonClear"; + this.buttonClear.Size = new System.Drawing.Size(57, 23); + this.buttonClear.TabIndex = 28; + this.buttonClear.Text = "Clear"; + this.buttonClear.UseVisualStyleBackColor = true; + this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click); + // + // labelSum + // + this.labelSum.AutoSize = true; + this.labelSum.Location = new System.Drawing.Point(76, 3); + this.labelSum.Name = "labelSum"; + this.labelSum.Size = new System.Drawing.Size(28, 13); + this.labelSum.TabIndex = 29; + this.labelSum.Text = "Sum"; + // + // labelSumWild + // + this.labelSumWild.AutoSize = true; + this.labelSumWild.Location = new System.Drawing.Point(121, 3); + this.labelSumWild.Name = "labelSumWild"; + this.labelSumWild.Size = new System.Drawing.Size(25, 13); + this.labelSumWild.TabIndex = 30; + this.labelSumWild.Text = "100"; + // + // labelSumDom + // + this.labelSumDom.AutoSize = true; + this.labelSumDom.Location = new System.Drawing.Point(162, 3); + this.labelSumDom.Name = "labelSumDom"; + this.labelSumDom.Size = new System.Drawing.Size(25, 13); + this.labelSumDom.TabIndex = 31; + this.labelSumDom.Text = "100"; + // + // labelSumDomSB + // + this.labelSumDomSB.AutoSize = true; + this.labelSumDomSB.Location = new System.Drawing.Point(162, 17); + this.labelSumDomSB.Name = "labelSumDomSB"; + this.labelSumDomSB.Size = new System.Drawing.Size(25, 13); + this.labelSumDomSB.TabIndex = 34; + this.labelSumDomSB.Text = "100"; + // + // labelSumWildSB + // + this.labelSumWildSB.AutoSize = true; + this.labelSumWildSB.Location = new System.Drawing.Point(121, 17); + this.labelSumWildSB.Name = "labelSumWildSB"; + this.labelSumWildSB.Size = new System.Drawing.Size(25, 13); + this.labelSumWildSB.TabIndex = 33; + this.labelSumWildSB.Text = "100"; + // + // labelSumSB + // + this.labelSumSB.AutoSize = true; + this.labelSumSB.Location = new System.Drawing.Point(49, 17); + this.labelSumSB.Name = "labelSumSB"; + this.labelSumSB.Size = new System.Drawing.Size(55, 13); + this.labelSumSB.TabIndex = 32; + this.labelSumSB.Text = "Should be"; + // // statIOSpeed // this.statIOSpeed.BackColor = System.Drawing.SystemColors.Control; @@ -513,12 +586,27 @@ private void InitializeComponent() this.statIOStamina.TabIndex = 3; this.statIOStamina.Click += new System.EventHandler(this.statIO_Click); // + // panelSums + // + this.panelSums.Controls.Add(this.labelSum); + this.panelSums.Controls.Add(this.labelSumDomSB); + this.panelSums.Controls.Add(this.labelSumWild); + this.panelSums.Controls.Add(this.labelSumWildSB); + this.panelSums.Controls.Add(this.labelSumDom); + this.panelSums.Controls.Add(this.labelSumSB); + this.panelSums.Location = new System.Drawing.Point(12, 460); + this.panelSums.Name = "panelSums"; + this.panelSums.Size = new System.Drawing.Size(295, 32); + this.panelSums.TabIndex = 35; + // // Form1 // this.AcceptButton = this.buttonCalculate; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(658, 495); + this.ClientSize = new System.Drawing.Size(658, 511); + this.Controls.Add(this.panelSums); + this.Controls.Add(this.buttonClear); this.Controls.Add(this.checkBoxJustTamed); this.Controls.Add(this.checkBoxOutputRowHeader); this.Controls.Add(this.radioButtonOutputRow); @@ -560,6 +648,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.numericUpDownXP)).EndInit(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + this.panelSums.ResumeLayout(false); + this.panelSums.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -604,6 +694,14 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox checkBoxOutputRowHeader; private System.Windows.Forms.CheckBox checkBoxJustTamed; private System.Windows.Forms.Label labelTE; + private System.Windows.Forms.Button buttonClear; + private System.Windows.Forms.Label labelSum; + private System.Windows.Forms.Label labelSumWild; + private System.Windows.Forms.Label labelSumDom; + private System.Windows.Forms.Label labelSumDomSB; + private System.Windows.Forms.Label labelSumWildSB; + private System.Windows.Forms.Label labelSumSB; + private System.Windows.Forms.Panel panelSums; } } diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 81e67343..acfa1620 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -24,6 +24,7 @@ public partial class Form1 : Form private List statWithEff = new List(); private List chosenResults = new List(); private int[] precisions = new int[] { 1, 1, 1, 1, 1, 3, 3, 1 }; // damage and speed are percentagevalues, need more precision + private int levelFromXP = 0, maxWildLevelFromTorpor; public Form1() { @@ -48,7 +49,8 @@ private void Form1_Load(object sender, EventArgs e) } loadFile(); comboBoxCreatures.SelectedIndex = 0; - labelVersion.Text = "v0.9.2"; + labelVersion.Text = "v0.10"; + labelSumDomSB.Text = ""; ToolTip tt = new ToolTip(); tt.SetToolTip(this.labelDomLevel, "level since domesticated"); tt.SetToolTip(this.checkBoxOutputRowHeader, "Include Headerrow"); @@ -58,6 +60,7 @@ private void Form1_Load(object sender, EventArgs e) private void clearAll() { results.Clear(); + statWithEff.Clear(); listBoxPossibilities.Items.Clear(); chosenResults.Clear(); for (int s = 0; s < 8; s++) @@ -67,20 +70,25 @@ private void clearAll() statIOs[s].BarLength = 0; } this.labelFootnote.Text = ""; - statWithEff.Clear(); this.numericUpDownLevel.BackColor = SystemColors.Window; this.numericUpDownLowerTEffBound.BackColor = SystemColors.Window; this.numericUpDownUpperTEffBound.BackColor = SystemColors.Window; this.numericUpDownXP.BackColor = SystemColors.Window; this.checkBoxAlreadyBred.BackColor = System.Drawing.Color.Transparent; this.checkBoxJustTamed.BackColor = System.Drawing.Color.Transparent; + panelSums.BackColor = SystemColors.Control; buttonCopyClipboard.Enabled = false; - labelTE.Text = "Extracted: n/a"; activeStat = -1; + labelTE.Text = "Extracted: n/a"; + labelSumDom.Text = ""; + labelSumWild.Text = ""; + labelSumWildSB.Text = ""; + maxWildLevelFromTorpor = 0; } private void buttonCalculate_Click(object sender, EventArgs e) { + if (numericUpDownXP.Focused) { numericUpDownXP_ValueChanged(sender, e); } int activeStatKeeper = activeStat; clearAll(); bool resultsValid = true; @@ -150,7 +158,7 @@ private void buttonCalculate_Click(object sender, EventArgs e) { torporLevelTamingMultMax = (200 + (double)this.numericUpDownUpperTEffBound.Value) / (400 + (double)this.numericUpDownUpperTEffBound.Value); } - 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) - 1; // -1 because creature starts with level 1 + maxWildLevelFromTorpor = (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) - 1; // -1 because creature starts with level 1 int levelDom = 0; // lower/upper Bound of each stat (wild has no upper bound as wild-speed is unknown) int[] lowerBoundExtraWs = new int[] { 0, 0, 0, 0, 0, 0, 0 }; @@ -158,9 +166,9 @@ private void buttonCalculate_Click(object sender, EventArgs e) int[] upperBoundExtraDs = new int[] { 0, 0, 0, 0, 0, 0, 0 }; if (postTamed) { - levelDom = getLevelFromXP(); + levelDom = levelFromXP; } - int wildSpeedLevel = maxLW2; + int maxLW2 = maxWildLevelFromTorpor; // substract all uniquely solved stat-levels for (int s = 0; s < 7; s++) { @@ -314,6 +322,7 @@ private void buttonCalculate_Click(object sender, EventArgs e) { // speed gets remaining wild levels if all other are unique bool setSpeed = true; + int wildSpeedLevel = maxWildLevelFromTorpor; for (int s = 0; s < 6; s++) { if (results[s].Count != 1) @@ -328,12 +337,15 @@ private void buttonCalculate_Click(object sender, EventArgs e) { statIOs[6].LevelWild = wildSpeedLevel.ToString(); } + else { statIOs[6].LevelWild = "?"; } } if (resultsValid) { buttonCopyClipboard.Enabled = true; setActiveStat(activeStatKeeper); setUniqueTE(); + showSumOfChosenLevels(); + labelSumWildSB.Text = "≤" + maxWildLevelFromTorpor.ToString(); } if (!postTamed) { @@ -508,6 +520,7 @@ private void setPossibility(int s, int i) statIOs[s].BreedingValue = breedingValue(s, i); chosenResults[s] = i; setUniqueTE(); + showSumOfChosenLevels(); } private void buttonCopyClipboard_Click(object sender, EventArgs e) @@ -611,7 +624,9 @@ private void numericUpDown_Enter(object sender, EventArgs e) private void numericUpDownXP_ValueChanged(object sender, EventArgs e) { - this.labelDomLevel.Text = "DLevel " + getLevelFromXP(); + levelFromXP = getLevelFromXP(); + this.labelDomLevel.Text = "DLevel " + levelFromXP; + labelSumDomSB.Text = levelFromXP.ToString(); } private int getLevelFromXP() @@ -636,5 +651,58 @@ private void checkBoxJustTamed_CheckedChanged(object sender, EventArgs e) { checkBoxAlreadyBred.Checked = checkBoxAlreadyBred.Checked && !checkBoxJustTamed.Checked; } + + private void buttonClear_Click(object sender, EventArgs e) + { + clearAll(); + numericUpDownLevel.Value = 1; + numericUpDownXP.Value = 0; + } + + private void showSumOfChosenLevels() + { + int sumW = 0, sumD = 0; + bool valid = true, inbound = true; + for (int s = 0; s < 7; s++) + { + if (results[s].Count > chosenResults[s]) + { + sumW += (int)results[s][chosenResults[s]][0]; + sumD += (int)results[s][chosenResults[s]][1]; + } + else + { + valid = false; + break; + } + } + if (valid) + { + labelSumWild.Text = sumW.ToString(); + labelSumDom.Text = sumD.ToString(); + if (sumW <= maxWildLevelFromTorpor) { labelSumWild.ForeColor = SystemColors.ControlText; } + else + { + labelSumWild.ForeColor = Color.Red; + inbound = false; + } + if (sumD == levelFromXP) { labelSumDom.ForeColor = SystemColors.ControlText; } + else + { + labelSumDom.ForeColor = Color.Red; + inbound = false; + } + } + else + { + labelSumWild.Text = "n/a"; + labelSumDom.Text = "n/a"; + } + if (!inbound) + { + panelSums.BackColor = Color.FromArgb(255, 200, 200); + } + + } } }