diff --git a/ARKBreedingStats/ARKBreedingStats.csproj b/ARKBreedingStats/ARKBreedingStats.csproj index 239c28b3..1707e712 100644 --- a/ARKBreedingStats/ARKBreedingStats.csproj +++ b/ARKBreedingStats/ARKBreedingStats.csproj @@ -160,6 +160,9 @@ customSoundChooser.cs + + Component + Component diff --git a/ARKBreedingStats/BreedingPlan.cs b/ARKBreedingStats/BreedingPlan.cs index 94a14d1a..e3cc4f9d 100644 --- a/ARKBreedingStats/BreedingPlan.cs +++ b/ARKBreedingStats/BreedingPlan.cs @@ -28,7 +28,7 @@ public partial class BreedingPlan : UserControl private List pcs = new List(); private List pbs = new List(); private bool[] enabledColorRegions; - private TimeSpan incubationTime = new TimeSpan(0); + private TimeSpan incubationTime = TimeSpan.Zero; public Creature chosenCreature = null; public StatWeighting statWeighting; public bool breedingPlanNeedsUpdate; diff --git a/ARKBreedingStats/CreatureInfoInput.cs b/ARKBreedingStats/CreatureInfoInput.cs index b5c47b38..f949c45f 100644 --- a/ARKBreedingStats/CreatureInfoInput.cs +++ b/ARKBreedingStats/CreatureInfoInput.cs @@ -204,7 +204,7 @@ private void numericUpDownWeight_ValueChanged(object sender, EventArgs e) updateMaturation = false; if (Values.V.species[speciesIndex].breeding != null && weightStat.Input > 0) dhmInputGrown.Timespan = new TimeSpan(0, 0, (int)(Values.V.species[speciesIndex].breeding.maturationTimeAdjusted * (1 - (double)numericUpDownWeight.Value / weightStat.Input))); - else dhmInputGrown.Timespan = new TimeSpan(0); + else dhmInputGrown.Timespan = TimeSpan.Zero; updateMaturationPercentage(); updateMaturation = true; } @@ -314,8 +314,8 @@ public int SpeciesIndex if (!breedingPossible) { numericUpDownWeight.Value = 0; - dhmInputGrown.Timespan = new TimeSpan(0); - dhmInputCooldown.Timespan = new TimeSpan(0); + dhmInputGrown.Timespan = TimeSpan.Zero; + dhmInputCooldown.Timespan = TimeSpan.Zero; } } } diff --git a/ARKBreedingStats/Form1.Designer.cs b/ARKBreedingStats/Form1.Designer.cs index 271cd632..208bba27 100644 --- a/ARKBreedingStats/Form1.Designer.cs +++ b/ARKBreedingStats/Form1.Designer.cs @@ -1476,7 +1476,7 @@ private void InitializeComponent() // // creatureInfoInputTester // - this.creatureInfoInputTester.Cooldown = new System.DateTime(2017, 10, 3, 10, 33, 51, 715); + this.creatureInfoInputTester.Cooldown = new System.DateTime(2017, 10, 15, 19, 10, 19, 438); this.creatureInfoInputTester.CreatureName = ""; this.creatureInfoInputTester.CreatureNote = ""; this.creatureInfoInputTester.CreatureOwner = ""; @@ -1485,7 +1485,7 @@ private void InitializeComponent() this.creatureInfoInputTester.CreatureTribe = ""; this.creatureInfoInputTester.domesticatedAt = new System.DateTime(2016, 7, 5, 13, 11, 41, 997); this.creatureInfoInputTester.father = null; - this.creatureInfoInputTester.Grown = new System.DateTime(2017, 10, 3, 10, 33, 51, 716); + this.creatureInfoInputTester.Grown = new System.DateTime(2017, 10, 15, 19, 10, 19, 439); this.creatureInfoInputTester.Location = new System.Drawing.Point(321, 184); this.creatureInfoInputTester.mother = null; this.creatureInfoInputTester.MutationCounter = 0; @@ -1817,7 +1817,7 @@ private void InitializeComponent() // // creatureInfoInputExtractor // - this.creatureInfoInputExtractor.Cooldown = new System.DateTime(2017, 10, 3, 10, 33, 51, 749); + this.creatureInfoInputExtractor.Cooldown = new System.DateTime(2017, 10, 15, 19, 10, 19, 465); this.creatureInfoInputExtractor.CreatureName = ""; this.creatureInfoInputExtractor.CreatureNote = ""; this.creatureInfoInputExtractor.CreatureOwner = ""; @@ -1826,7 +1826,7 @@ private void InitializeComponent() this.creatureInfoInputExtractor.CreatureTribe = ""; this.creatureInfoInputExtractor.domesticatedAt = new System.DateTime(2016, 7, 5, 13, 12, 15, 968); this.creatureInfoInputExtractor.father = null; - this.creatureInfoInputExtractor.Grown = new System.DateTime(2017, 10, 3, 10, 33, 51, 750); + this.creatureInfoInputExtractor.Grown = new System.DateTime(2017, 10, 15, 19, 10, 19, 465); this.creatureInfoInputExtractor.Location = new System.Drawing.Point(321, 184); this.creatureInfoInputExtractor.mother = null; this.creatureInfoInputExtractor.MutationCounter = 0; @@ -2545,6 +2545,7 @@ private void InitializeComponent() this.timerList1.Name = "timerList1"; this.timerList1.Size = new System.Drawing.Size(926, 623); this.timerList1.TabIndex = 0; + this.timerList1.TimerAlertsCSV = ""; // // tabPagePlayerTribes // diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index 33552173..947729aa 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -401,6 +401,7 @@ private void clearAll() this.numericUpDownLowerTEffBound.BackColor = SystemColors.Window; this.numericUpDownUpperTEffBound.BackColor = SystemColors.Window; this.checkBoxJustTamed.BackColor = System.Drawing.Color.Transparent; + cbExactlyImprinting.BackColor = Color.Transparent; panelSums.BackColor = System.Drawing.Color.Transparent; panelWildTamedBred.BackColor = System.Drawing.Color.Transparent; labelTE.BackColor = System.Drawing.Color.Transparent; @@ -447,6 +448,9 @@ private bool extractLevels(bool autoExtraction = false) bool imprintingBonusChanged; + if (numericUpDownImprintingBonusExtractor.Value == 100 && !cbExactlyImprinting.Checked) + cbExactlyImprinting.BackColor = Color.LightSalmon; + extractor.extractLevels(speciesIndex, (int)numericUpDownLevel.Value, statIOs, (double)numericUpDownLowerTEffBound.Value / 100, (double)numericUpDownUpperTEffBound.Value / 100, !radioButtonBred.Checked, radioButtonTamed.Checked, false, radioButtonBred.Checked, @@ -724,6 +728,7 @@ private void showSumOfChosenLevels() { radarChartExtractor.setLevels(statIOs.Select(s => s.LevelWild).ToArray()); toolStripButtonSaveCreatureValuesTemp.Visible = false; + cbExactlyImprinting.BackColor = Color.Transparent; } creatureInfoInputExtractor.ButtonEnabled = allValid; groupBoxRadarChartExtractor.Visible = allValid; @@ -1166,8 +1171,11 @@ private void initializeCollection() private void applySettingsToValues() { // apply multipliers - Values.V.applyMultipliers(creatureCollection); - applyEvolutionMultipliers(); + Values.V.applyMultipliers(creatureCollection, cbEventMultipliers.Checked); + tamingControl1.setTamingMultipliers(Values.V.tamingSpeedMultiplier, + cbEventMultipliers.Checked ? creatureCollection.tamingFoodRateMultiplierEvent : creatureCollection.tamingFoodRateMultiplier); + breedingPlan1.updateBreedingData(); + raisingControl1.updateRaisingData(); // apply level settings creatureBoxListView.BarMaxLevel = creatureCollection.maxChartLevel; @@ -3164,6 +3172,8 @@ private void showBestBreedingPartner(Creature c) if (c.status != CreatureStatus.Available && MessageBox.Show("Selected Creature is currently not marked as \"Available\" and thus cannot be considered for breeding. Do you want to change its status to \"Available\"?", "Selected Creature not Available", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) setStatus(new List() { c }, CreatureStatus.Available); + breedingPlan1.breedingPlanNeedsUpdate = false; + comboBoxSpeciesGlobal.SelectedIndex = Values.V.speciesNames.IndexOf(c.species); breedingPlan1.determineBestBreeding(c); tabControlMain.SelectedTab = tabPageBreedingPlan; } diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index 6a7ae519..046a37a9 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.23.20")] +[assembly: AssemblyFileVersion("0.23.21")] diff --git a/ARKBreedingStats/RaisingControl.Designer.cs b/ARKBreedingStats/RaisingControl.Designer.cs index c293ff50..e664027f 100644 --- a/ARKBreedingStats/RaisingControl.Designer.cs +++ b/ARKBreedingStats/RaisingControl.Designer.cs @@ -36,7 +36,6 @@ private void InitializeComponent() this.columnHeaderTotalTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderUntil = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.nudCurrentWeight = new System.Windows.Forms.NumericUpDown(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); this.labelAmountFoodAdult = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.labelAmountFoodBaby = new System.Windows.Forms.Label(); @@ -60,17 +59,29 @@ private void InitializeComponent() this.extractValuesOfHatchedbornBabyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.deleteTimerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeAllExpiredTimersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.panel1 = new System.Windows.Forms.Panel(); - this.parentStats1 = new ARKBreedingStats.raising.ParentStats(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPageMaturationProgress = new System.Windows.Forms.TabPage(); + this.tabPageEditTimer = new System.Windows.Forms.TabPage(); + this.dateTimePickerEditTimerFinish = new System.Windows.Forms.DateTimePicker(); + this.label7 = new System.Windows.Forms.Label(); + this.lEditTimerName = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.bSaveTimerEdit = new System.Windows.Forms.Button(); + this.dhmInputTimerEditTimer = new ARKBreedingStats.uiControls.dhmInput(); + this.parentStats1 = new ARKBreedingStats.raising.ParentStats(); ((System.ComponentModel.ISupportInitialize)(this.nudCurrentWeight)).BeginInit(); - this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudTotalWeight)).BeginInit(); this.contextMenuStripBabyList.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); this.groupBox2.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPageMaturationProgress.SuspendLayout(); + this.tabPageEditTimer.SuspendLayout(); this.SuspendLayout(); // // labelRaisingInfos @@ -119,7 +130,7 @@ private void InitializeComponent() // nudCurrentWeight // this.nudCurrentWeight.DecimalPlaces = 2; - this.nudCurrentWeight.Location = new System.Drawing.Point(90, 19); + this.nudCurrentWeight.Location = new System.Drawing.Point(90, 4); this.nudCurrentWeight.Maximum = new decimal(new int[] { 100000, 0, @@ -135,33 +146,10 @@ private void InitializeComponent() 0}); this.nudCurrentWeight.ValueChanged += new System.EventHandler(this.nudCurrentWeight_ValueChanged); // - // groupBox1 - // - this.groupBox1.Controls.Add(this.labelAmountFoodAdult); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Controls.Add(this.labelAmountFoodBaby); - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.labelTimeLeftGrowing); - this.groupBox1.Controls.Add(this.label6); - this.groupBox1.Controls.Add(this.labelTimeLeftBaby); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.labelMaturationProgress); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.nudTotalWeight); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.nudCurrentWeight); - this.groupBox1.Location = new System.Drawing.Point(6, 229); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(329, 153); - this.groupBox1.TabIndex = 5; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Progress"; - // // labelAmountFoodAdult // this.labelAmountFoodAdult.AutoSize = true; - this.labelAmountFoodAdult.Location = new System.Drawing.Point(133, 126); + this.labelAmountFoodAdult.Location = new System.Drawing.Point(133, 111); this.labelAmountFoodAdult.Name = "labelAmountFoodAdult"; this.labelAmountFoodAdult.Size = new System.Drawing.Size(13, 13); this.labelAmountFoodAdult.TabIndex = 14; @@ -170,7 +158,7 @@ private void InitializeComponent() // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 126); + this.label8.Location = new System.Drawing.Point(6, 111); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(114, 13); this.label8.TabIndex = 15; @@ -179,7 +167,7 @@ private void InitializeComponent() // labelAmountFoodBaby // this.labelAmountFoodBaby.AutoSize = true; - this.labelAmountFoodBaby.Location = new System.Drawing.Point(133, 108); + this.labelAmountFoodBaby.Location = new System.Drawing.Point(133, 93); this.labelAmountFoodBaby.Name = "labelAmountFoodBaby"; this.labelAmountFoodBaby.Size = new System.Drawing.Size(13, 13); this.labelAmountFoodBaby.TabIndex = 6; @@ -188,7 +176,7 @@ private void InitializeComponent() // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 108); + this.label5.Location = new System.Drawing.Point(6, 93); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(114, 13); this.label5.TabIndex = 13; @@ -197,7 +185,7 @@ private void InitializeComponent() // labelTimeLeftGrowing // this.labelTimeLeftGrowing.AutoSize = true; - this.labelTimeLeftGrowing.Location = new System.Drawing.Point(133, 90); + this.labelTimeLeftGrowing.Location = new System.Drawing.Point(133, 75); this.labelTimeLeftGrowing.Name = "labelTimeLeftGrowing"; this.labelTimeLeftGrowing.Size = new System.Drawing.Size(13, 13); this.labelTimeLeftGrowing.TabIndex = 12; @@ -206,7 +194,7 @@ private void InitializeComponent() // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 90); + this.label6.Location = new System.Drawing.Point(6, 75); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(104, 13); this.label6.TabIndex = 11; @@ -215,7 +203,7 @@ private void InitializeComponent() // labelTimeLeftBaby // this.labelTimeLeftBaby.AutoSize = true; - this.labelTimeLeftBaby.Location = new System.Drawing.Point(133, 72); + this.labelTimeLeftBaby.Location = new System.Drawing.Point(133, 57); this.labelTimeLeftBaby.Name = "labelTimeLeftBaby"; this.labelTimeLeftBaby.Size = new System.Drawing.Size(13, 13); this.labelTimeLeftBaby.TabIndex = 10; @@ -224,7 +212,7 @@ private void InitializeComponent() // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 72); + this.label4.Location = new System.Drawing.Point(6, 57); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(91, 13); this.label4.TabIndex = 9; @@ -233,7 +221,7 @@ private void InitializeComponent() // labelMaturationProgress // this.labelMaturationProgress.AutoSize = true; - this.labelMaturationProgress.Location = new System.Drawing.Point(133, 54); + this.labelMaturationProgress.Location = new System.Drawing.Point(133, 39); this.labelMaturationProgress.Name = "labelMaturationProgress"; this.labelMaturationProgress.Size = new System.Drawing.Size(21, 13); this.labelMaturationProgress.TabIndex = 8; @@ -242,7 +230,7 @@ private void InitializeComponent() // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 54); + this.label3.Location = new System.Drawing.Point(6, 39); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(103, 13); this.label3.TabIndex = 7; @@ -251,7 +239,7 @@ private void InitializeComponent() // nudTotalWeight // this.nudTotalWeight.DecimalPlaces = 1; - this.nudTotalWeight.Location = new System.Drawing.Point(187, 19); + this.nudTotalWeight.Location = new System.Drawing.Point(187, 4); this.nudTotalWeight.Maximum = new decimal(new int[] { 100000, 0, @@ -275,7 +263,7 @@ private void InitializeComponent() // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(169, 21); + this.label2.Location = new System.Drawing.Point(169, 6); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(12, 13); this.label2.TabIndex = 5; @@ -284,7 +272,7 @@ private void InitializeComponent() // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 21); + this.label1.Location = new System.Drawing.Point(6, 6); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(78, 13); this.label1.TabIndex = 0; @@ -302,6 +290,7 @@ private void InitializeComponent() this.listViewBabies.Dock = System.Windows.Forms.DockStyle.Fill; this.listViewBabies.FullRowSelect = true; this.listViewBabies.GridLines = true; + this.listViewBabies.HideSelection = false; this.listViewBabies.Location = new System.Drawing.Point(347, 3); this.listViewBabies.Name = "listViewBabies"; this.listViewBabies.Size = new System.Drawing.Size(568, 543); @@ -340,9 +329,10 @@ private void InitializeComponent() this.contextMenuStripBabyList.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.extractValuesOfHatchedbornBabyToolStripMenuItem, this.toolStripSeparator1, - this.deleteTimerToolStripMenuItem}); + this.deleteTimerToolStripMenuItem, + this.removeAllExpiredTimersToolStripMenuItem}); this.contextMenuStripBabyList.Name = "contextMenuStripBabyList"; - this.contextMenuStripBabyList.Size = new System.Drawing.Size(265, 54); + this.contextMenuStripBabyList.Size = new System.Drawing.Size(265, 76); // // extractValuesOfHatchedbornBabyToolStripMenuItem // @@ -360,9 +350,16 @@ private void InitializeComponent() // this.deleteTimerToolStripMenuItem.Name = "deleteTimerToolStripMenuItem"; this.deleteTimerToolStripMenuItem.Size = new System.Drawing.Size(264, 22); - this.deleteTimerToolStripMenuItem.Text = "Delete Timer..."; + this.deleteTimerToolStripMenuItem.Text = "Remove selected Timers..."; this.deleteTimerToolStripMenuItem.Click += new System.EventHandler(this.deleteTimerToolStripMenuItem_Click); // + // removeAllExpiredTimersToolStripMenuItem + // + this.removeAllExpiredTimersToolStripMenuItem.Name = "removeAllExpiredTimersToolStripMenuItem"; + this.removeAllExpiredTimersToolStripMenuItem.Size = new System.Drawing.Size(264, 22); + this.removeAllExpiredTimersToolStripMenuItem.Text = "Remove all expired Timers..."; + this.removeAllExpiredTimersToolStripMenuItem.Click += new System.EventHandler(this.removeAllExpiredTimersToolStripMenuItem_Click); + // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 2; @@ -380,22 +377,15 @@ private void InitializeComponent() // // panel1 // + this.panel1.Controls.Add(this.tabControl1); this.panel1.Controls.Add(this.parentStats1); this.panel1.Controls.Add(this.groupBox2); - this.panel1.Controls.Add(this.groupBox1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(3, 3); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(338, 543); this.panel1.TabIndex = 0; // - // parentStats1 - // - this.parentStats1.Location = new System.Drawing.Point(6, 388); - this.parentStats1.Name = "parentStats1"; - this.parentStats1.Size = new System.Drawing.Size(329, 245); - this.parentStats1.TabIndex = 7; - // // groupBox2 // this.groupBox2.Controls.Add(this.labelRaisingInfos); @@ -407,6 +397,123 @@ private void InitializeComponent() this.groupBox2.TabStop = false; this.groupBox2.Text = "General Infos"; // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPageMaturationProgress); + this.tabControl1.Controls.Add(this.tabPageEditTimer); + this.tabControl1.Location = new System.Drawing.Point(6, 229); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(323, 166); + this.tabControl1.TabIndex = 8; + // + // tabPageMaturationProgress + // + this.tabPageMaturationProgress.Controls.Add(this.labelAmountFoodAdult); + this.tabPageMaturationProgress.Controls.Add(this.label8); + this.tabPageMaturationProgress.Controls.Add(this.label1); + this.tabPageMaturationProgress.Controls.Add(this.labelAmountFoodBaby); + this.tabPageMaturationProgress.Controls.Add(this.nudCurrentWeight); + this.tabPageMaturationProgress.Controls.Add(this.label5); + this.tabPageMaturationProgress.Controls.Add(this.label2); + this.tabPageMaturationProgress.Controls.Add(this.labelTimeLeftGrowing); + this.tabPageMaturationProgress.Controls.Add(this.nudTotalWeight); + this.tabPageMaturationProgress.Controls.Add(this.label6); + this.tabPageMaturationProgress.Controls.Add(this.label3); + this.tabPageMaturationProgress.Controls.Add(this.labelTimeLeftBaby); + this.tabPageMaturationProgress.Controls.Add(this.labelMaturationProgress); + this.tabPageMaturationProgress.Controls.Add(this.label4); + this.tabPageMaturationProgress.Location = new System.Drawing.Point(4, 22); + this.tabPageMaturationProgress.Name = "tabPageMaturationProgress"; + this.tabPageMaturationProgress.Padding = new System.Windows.Forms.Padding(3); + this.tabPageMaturationProgress.Size = new System.Drawing.Size(315, 140); + this.tabPageMaturationProgress.TabIndex = 0; + this.tabPageMaturationProgress.Text = "Maturation Progress"; + this.tabPageMaturationProgress.UseVisualStyleBackColor = true; + // + // tabPageEditTimer + // + this.tabPageEditTimer.Controls.Add(this.bSaveTimerEdit); + this.tabPageEditTimer.Controls.Add(this.label9); + this.tabPageEditTimer.Controls.Add(this.lEditTimerName); + this.tabPageEditTimer.Controls.Add(this.dhmInputTimerEditTimer); + this.tabPageEditTimer.Controls.Add(this.label7); + this.tabPageEditTimer.Controls.Add(this.dateTimePickerEditTimerFinish); + this.tabPageEditTimer.Location = new System.Drawing.Point(4, 22); + this.tabPageEditTimer.Name = "tabPageEditTimer"; + this.tabPageEditTimer.Padding = new System.Windows.Forms.Padding(3); + this.tabPageEditTimer.Size = new System.Drawing.Size(315, 140); + this.tabPageEditTimer.TabIndex = 1; + this.tabPageEditTimer.Text = "Edit Timer"; + this.tabPageEditTimer.UseVisualStyleBackColor = true; + // + // dateTimePickerEditTimerFinish + // + this.dateTimePickerEditTimerFinish.CustomFormat = ""; + this.dateTimePickerEditTimerFinish.Format = System.Windows.Forms.DateTimePickerFormat.Time; + this.dateTimePickerEditTimerFinish.Location = new System.Drawing.Point(96, 32); + this.dateTimePickerEditTimerFinish.Name = "dateTimePickerEditTimerFinish"; + this.dateTimePickerEditTimerFinish.Size = new System.Drawing.Size(156, 20); + this.dateTimePickerEditTimerFinish.TabIndex = 4; + this.dateTimePickerEditTimerFinish.ValueChanged += new System.EventHandler(this.dateTimePickerEditTimerFinish_ValueChanged); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(8, 61); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(82, 13); + this.label7.TabIndex = 14; + this.label7.Text = "Duration [d:h:m]"; + // + // lEditTimerName + // + this.lEditTimerName.AutoSize = true; + this.lEditTimerName.Location = new System.Drawing.Point(6, 3); + this.lEditTimerName.Name = "lEditTimerName"; + this.lEditTimerName.Size = new System.Drawing.Size(79, 13); + this.lEditTimerName.TabIndex = 16; + this.lEditTimerName.Text = "EditTimerName"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(6, 38); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(58, 13); + this.label9.TabIndex = 17; + this.label9.Text = "Finished at"; + // + // bSaveTimerEdit + // + this.bSaveTimerEdit.Location = new System.Drawing.Point(11, 84); + this.bSaveTimerEdit.Name = "bSaveTimerEdit"; + this.bSaveTimerEdit.Size = new System.Drawing.Size(158, 23); + this.bSaveTimerEdit.TabIndex = 18; + this.bSaveTimerEdit.Text = "Save Changes"; + this.bSaveTimerEdit.UseVisualStyleBackColor = true; + this.bSaveTimerEdit.Click += new System.EventHandler(this.bSaveTimerEdit_Click); + // + // dhmInputTimerEditTimer + // + this.dhmInputTimerEditTimer.BackColor = System.Drawing.SystemColors.Window; + this.dhmInputTimerEditTimer.ForeColor = System.Drawing.SystemColors.GrayText; + this.dhmInputTimerEditTimer.Location = new System.Drawing.Point(96, 58); + this.dhmInputTimerEditTimer.Mask = "00\\:00\\:00"; + this.dhmInputTimerEditTimer.Name = "dhmInputTimerEditTimer"; + this.dhmInputTimerEditTimer.Size = new System.Drawing.Size(73, 20); + this.dhmInputTimerEditTimer.TabIndex = 15; + this.dhmInputTimerEditTimer.Text = "000000"; + this.dhmInputTimerEditTimer.Timespan = System.TimeSpan.Parse("00:00:00"); + this.dhmInputTimerEditTimer.TextChanged += new System.EventHandler(this.dhmInputTimerEditTimer_TextChanged); + // + // parentStats1 + // + this.parentStats1.Location = new System.Drawing.Point(6, 397); + this.parentStats1.Name = "parentStats1"; + this.parentStats1.Size = new System.Drawing.Size(329, 245); + this.parentStats1.TabIndex = 7; + // // RaisingControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -416,14 +523,17 @@ private void InitializeComponent() this.Name = "RaisingControl"; this.Size = new System.Drawing.Size(918, 549); ((System.ComponentModel.ISupportInitialize)(this.nudCurrentWeight)).EndInit(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.nudTotalWeight)).EndInit(); this.contextMenuStripBabyList.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.panel1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + this.tabControl1.ResumeLayout(false); + this.tabPageMaturationProgress.ResumeLayout(false); + this.tabPageMaturationProgress.PerformLayout(); + this.tabPageEditTimer.ResumeLayout(false); + this.tabPageEditTimer.PerformLayout(); this.ResumeLayout(false); } @@ -436,7 +546,6 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader columnHeaderTotalTime; private System.Windows.Forms.ColumnHeader columnHeaderUntil; private System.Windows.Forms.NumericUpDown nudCurrentWeight; - private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label labelMaturationProgress; private System.Windows.Forms.Label label3; private System.Windows.Forms.NumericUpDown nudTotalWeight; @@ -464,5 +573,15 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem deleteTimerToolStripMenuItem; private raising.ParentStats parentStats1; + private System.Windows.Forms.ToolStripMenuItem removeAllExpiredTimersToolStripMenuItem; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPageMaturationProgress; + private System.Windows.Forms.TabPage tabPageEditTimer; + private System.Windows.Forms.DateTimePicker dateTimePickerEditTimerFinish; + private System.Windows.Forms.Button bSaveTimerEdit; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label lEditTimerName; + private uiControls.dhmInput dhmInputTimerEditTimer; + private System.Windows.Forms.Label label7; } } diff --git a/ARKBreedingStats/RaisingControl.cs b/ARKBreedingStats/RaisingControl.cs index 6e157bb0..c0406876 100644 --- a/ARKBreedingStats/RaisingControl.cs +++ b/ARKBreedingStats/RaisingControl.cs @@ -21,6 +21,8 @@ public partial class RaisingControl : UserControl private TimeSpan babyTime, maturationTime; private CreatureCollection cc; public TimerControl timerControl; + private IncubationTimerEntry iteEdit; + private Creature creatureMaturationEdit; public RaisingControl() { @@ -34,12 +36,12 @@ public RaisingControl() public void updateRaisingData() { - updateRaisingData(speciesIndex); + updateRaisingData(speciesIndex, true); } - public void updateRaisingData(int speciesIndex) + public void updateRaisingData(int speciesIndex, bool forceUpdate = false) { - if (this.speciesIndex != speciesIndex) + if (forceUpdate || this.speciesIndex != speciesIndex) { this.speciesIndex = speciesIndex; if (speciesIndex >= 0 && Values.V.species[speciesIndex].taming != null && Values.V.species[speciesIndex].breeding != null) @@ -95,12 +97,12 @@ public void updateRaisingData(int speciesIndex) + eggInfo + foodadmount; - groupBox1.Enabled = true; + tabPageMaturationProgress.Enabled = true; } else { labelRaisingInfos.Text = "No raising-data available."; - groupBox1.Enabled = false; + tabPageMaturationProgress.Enabled = false; } ResumeLayout(); @@ -326,9 +328,13 @@ private void deleteTimerToolStripMenuItem_Click(object sender, EventArgs e) && listViewBabies.SelectedItems[0].Tag.GetType() == typeof(IncubationTimerEntry)) { IncubationTimerEntry ite = (IncubationTimerEntry)listViewBabies.SelectedItems[0].Tag; - if (MessageBox.Show("Delete this timer?\n" + ite.mother.species + ", ending in " + Utils.timeLeft(ite.incubationEnd), "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + if (MessageBox.Show("Delete this timer?\n" + ite.mother.species + ", ending in " + Utils.timeLeft(ite.incubationEnd) + + (listViewBabies.SelectedIndices.Count > 1 ? "\n\nand " + (listViewBabies.SelectedIndices.Count - 1).ToString() + " more selected timers" : "") + "?" + , "Delete?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - removeIncubationTimer(ite); + for (int t = listViewBabies.SelectedIndices.Count - 1; t >= 0; t--) + removeIncubationTimer((IncubationTimerEntry)listViewBabies.SelectedItems[t].Tag); + recreateList(); onChange?.Invoke(); } @@ -353,6 +359,11 @@ public void deleteAllExpiredIncubationTimers() } } + private void removeAllExpiredTimersToolStripMenuItem_Click(object sender, EventArgs e) + { + deleteAllExpiredIncubationTimers(); + } + private void listViewBabies_SelectedIndexChanged(object sender, EventArgs e) { if (listViewBabies.SelectedIndices.Count > 0) @@ -372,6 +383,12 @@ private void listViewBabies_SelectedIndexChanged(object sender, EventArgs e) } } parentStats1.setParentValues(c.Mother, c.Father); + + // edit-box + creatureMaturationEdit = c; + iteEdit = null; + + setEditTimer(); } else if (listViewBabies.SelectedItems[0].Tag.GetType() == typeof(IncubationTimerEntry)) { @@ -380,8 +397,73 @@ private void listViewBabies_SelectedIndexChanged(object sender, EventArgs e) setSpeciesIndex?.Invoke(sI); parentStats1.setParentValues(ite.mother, ite.father); + + // edit-box + creatureMaturationEdit = null; + iteEdit = ite; + + setEditTimer(); } } + else + { + iteEdit = null; + creatureMaturationEdit = null; + setEditTimer(); + } + } + + private void setEditTimer() + { + if (iteEdit != null) + { + lEditTimerName.Text = "Incubation" + (iteEdit.mother != null ? " (" + iteEdit.mother.species + ")" : ""); + dateTimePickerEditTimerFinish.Value = iteEdit.incubationEnd; + TimeSpan ts = iteEdit.incubationEnd.Subtract(DateTime.Now); + dhmInputTimerEditTimer.Timespan = (ts.TotalSeconds > 0 ? ts : TimeSpan.Zero); + + } + else if (creatureMaturationEdit != null) + { + lEditTimerName.Text = creatureMaturationEdit.name + " (" + creatureMaturationEdit.species + ")"; + dateTimePickerEditTimerFinish.Value = creatureMaturationEdit.growingUntil; + TimeSpan ts = creatureMaturationEdit.growingUntil.Subtract(DateTime.Now); + dhmInputTimerEditTimer.Timespan = (ts.TotalSeconds > 0 ? ts : TimeSpan.Zero); + } + else + { + lEditTimerName.Text = "no timer selected"; + dateTimePickerEditTimerFinish.Value = DateTime.Now; + dhmInputTimerEditTimer.Timespan = TimeSpan.Zero; + } + } + + private void dhmInputTimerEditTimer_TextChanged(object sender, EventArgs e) + { + if (dhmInputTimerEditTimer.Focused) + dateTimePickerEditTimerFinish.Value = DateTime.Now.Add(dhmInputTimerEditTimer.Timespan); + } + + private void dateTimePickerEditTimerFinish_ValueChanged(object sender, EventArgs e) + { + if (dateTimePickerEditTimerFinish.Focused) + dhmInputTimerEditTimer.Timespan = dateTimePickerEditTimerFinish.Value.Subtract(DateTime.Now); + } + + private void bSaveTimerEdit_Click(object sender, EventArgs e) + { + if (iteEdit != null) + { + iteEdit.incubationEnd = dateTimePickerEditTimerFinish.Value; + } + else if (creatureMaturationEdit != null) + { + creatureMaturationEdit.growingUntil = dateTimePickerEditTimerFinish.Value; + } + else return; + + recreateList(); + onChange?.Invoke(); } } } diff --git a/ARKBreedingStats/Taming.cs b/ARKBreedingStats/Taming.cs index 6550c889..97fa7bcd 100644 --- a/ARKBreedingStats/Taming.cs +++ b/ARKBreedingStats/Taming.cs @@ -18,7 +18,7 @@ public static void tamingTimes(int speciesI, int level, double tamingSpeedMultip bonusLevel = 0; te = 1; - duration = new TimeSpan(0); + duration = TimeSpan.Zero; neededNarcoberries = 0; neededNarcotics = 0; neededBioToxines = 0; diff --git a/ARKBreedingStats/TimerControl.Designer.cs b/ARKBreedingStats/TimerControl.Designer.cs index 360136b7..659d370c 100644 --- a/ARKBreedingStats/TimerControl.Designer.cs +++ b/ARKBreedingStats/TimerControl.Designer.cs @@ -34,18 +34,16 @@ private void InitializeComponent() this.columnHeaderFinishedAt = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderTimeLeft = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToOverlayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeAllExpiredTimersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.groupBoxAddTimer = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.bSetTimerNow = new System.Windows.Forms.Button(); this.dhmInputTimer = new ARKBreedingStats.uiControls.dhmInput(); - this.button10m = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); - this.button1h = new System.Windows.Forms.Button(); - this.buttonSet = new System.Windows.Forms.Button(); - this.button5h = new System.Windows.Forms.Button(); - this.button10h = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.dateTimePickerTimerFinish = new System.Windows.Forms.DateTimePicker(); @@ -93,24 +91,38 @@ private void InitializeComponent() // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addToOverlayToolStripMenuItem, + this.toolStripSeparator1, this.removeToolStripMenuItem, - this.addToOverlayToolStripMenuItem}); + this.removeAllExpiredTimersToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(156, 48); + this.contextMenuStrip1.Size = new System.Drawing.Size(222, 76); + // + // addToOverlayToolStripMenuItem + // + this.addToOverlayToolStripMenuItem.Name = "addToOverlayToolStripMenuItem"; + this.addToOverlayToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.addToOverlayToolStripMenuItem.Text = "Add To Overlay"; + this.addToOverlayToolStripMenuItem.Click += new System.EventHandler(this.addToOverlayToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(218, 6); // // removeToolStripMenuItem // this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(155, 22); - this.removeToolStripMenuItem.Text = "Remove"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.removeToolStripMenuItem.Text = "Remove selected Timers..."; this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); // - // addToOverlayToolStripMenuItem + // removeAllExpiredTimersToolStripMenuItem // - this.addToOverlayToolStripMenuItem.Name = "addToOverlayToolStripMenuItem"; - this.addToOverlayToolStripMenuItem.Size = new System.Drawing.Size(155, 22); - this.addToOverlayToolStripMenuItem.Text = "Add To Overlay"; - this.addToOverlayToolStripMenuItem.Click += new System.EventHandler(this.addToOverlayToolStripMenuItem_Click); + this.removeAllExpiredTimersToolStripMenuItem.Name = "removeAllExpiredTimersToolStripMenuItem"; + this.removeAllExpiredTimersToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.removeAllExpiredTimersToolStripMenuItem.Text = "Remove all expired Timers..."; + this.removeAllExpiredTimersToolStripMenuItem.Click += new System.EventHandler(this.removeAllExpiredTimersToolStripMenuItem_Click); // // tableLayoutPanel1 // @@ -123,8 +135,8 @@ private void InitializeComponent() this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 200F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 494F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 494F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(648, 494); this.tableLayoutPanel1.TabIndex = 0; // @@ -138,98 +150,55 @@ private void InitializeComponent() this.groupBoxAddTimer.Controls.Add(this.buttonAddTimer); this.groupBoxAddTimer.Location = new System.Drawing.Point(3, 3); this.groupBoxAddTimer.Name = "groupBoxAddTimer"; - this.groupBoxAddTimer.Size = new System.Drawing.Size(234, 186); + this.groupBoxAddTimer.Size = new System.Drawing.Size(234, 250); this.groupBoxAddTimer.TabIndex = 1; this.groupBoxAddTimer.TabStop = false; this.groupBoxAddTimer.Text = "Add Manual Timer"; // // groupBox1 // + this.groupBox1.Controls.Add(this.bSetTimerNow); this.groupBox1.Controls.Add(this.dhmInputTimer); - this.groupBox1.Controls.Add(this.button10m); this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.button1h); - this.groupBox1.Controls.Add(this.buttonSet); - this.groupBox1.Controls.Add(this.button5h); - this.groupBox1.Controls.Add(this.button10h); - this.groupBox1.Location = new System.Drawing.Point(6, 71); + this.groupBox1.Location = new System.Drawing.Point(6, 100); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(222, 79); + this.groupBox1.Size = new System.Drawing.Size(222, 143); this.groupBox1.TabIndex = 13; this.groupBox1.TabStop = false; this.groupBox1.Text = "Set Timer to end in"; // + // bSetTimerNow + // + this.bSetTimerNow.Location = new System.Drawing.Point(6, 19); + this.bSetTimerNow.Name = "bSetTimerNow"; + this.bSetTimerNow.Size = new System.Drawing.Size(90, 23); + this.bSetTimerNow.TabIndex = 14; + this.bSetTimerNow.Text = "now (reset)"; + this.bSetTimerNow.UseVisualStyleBackColor = true; + this.bSetTimerNow.Click += new System.EventHandler(this.bSetTimerNow_Click); + // // dhmInputTimer // this.dhmInputTimer.BackColor = System.Drawing.SystemColors.Window; this.dhmInputTimer.ForeColor = System.Drawing.SystemColors.GrayText; - this.dhmInputTimer.Location = new System.Drawing.Point(87, 50); + this.dhmInputTimer.Location = new System.Drawing.Point(87, 116); this.dhmInputTimer.Mask = "00\\:00\\:00"; this.dhmInputTimer.Name = "dhmInputTimer"; this.dhmInputTimer.Size = new System.Drawing.Size(73, 20); this.dhmInputTimer.TabIndex = 13; this.dhmInputTimer.Text = "000000"; this.dhmInputTimer.Timespan = System.TimeSpan.Parse("00:00:00"); - // - // button10m - // - this.button10m.Location = new System.Drawing.Point(6, 19); - this.button10m.Name = "button10m"; - this.button10m.Size = new System.Drawing.Size(48, 23); - this.button10m.TabIndex = 6; - this.button10m.Text = "10 m"; - this.button10m.UseVisualStyleBackColor = true; - this.button10m.Click += new System.EventHandler(this.button10m_Click); + this.dhmInputTimer.TextChanged += new System.EventHandler(this.dhmInputTimer_TextChanged); // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(5, 53); + this.label3.Location = new System.Drawing.Point(5, 119); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(77, 13); this.label3.TabIndex = 12; this.label3.Text = "Custom [d:h:m]"; // - // button1h - // - this.button1h.Location = new System.Drawing.Point(60, 19); - this.button1h.Name = "button1h"; - this.button1h.Size = new System.Drawing.Size(48, 23); - this.button1h.TabIndex = 7; - this.button1h.Text = "1 h"; - this.button1h.UseVisualStyleBackColor = true; - this.button1h.Click += new System.EventHandler(this.button1h_Click); - // - // buttonSet - // - this.buttonSet.Location = new System.Drawing.Point(166, 48); - this.buttonSet.Name = "buttonSet"; - this.buttonSet.Size = new System.Drawing.Size(50, 23); - this.buttonSet.TabIndex = 11; - this.buttonSet.Text = "Set"; - this.buttonSet.UseVisualStyleBackColor = true; - this.buttonSet.Click += new System.EventHandler(this.buttonSet_Click); - // - // button5h - // - this.button5h.Location = new System.Drawing.Point(114, 19); - this.button5h.Name = "button5h"; - this.button5h.Size = new System.Drawing.Size(48, 23); - this.button5h.TabIndex = 8; - this.button5h.Text = "5 h"; - this.button5h.UseVisualStyleBackColor = true; - this.button5h.Click += new System.EventHandler(this.button5h_Click); - // - // button10h - // - this.button10h.Location = new System.Drawing.Point(168, 19); - this.button10h.Name = "button10h"; - this.button10h.Size = new System.Drawing.Size(48, 23); - this.button10h.TabIndex = 9; - this.button10h.Text = "10 h"; - this.button10h.UseVisualStyleBackColor = true; - this.button10h.Click += new System.EventHandler(this.button10h_Click); - // // label2 // this.label2.AutoSize = true; @@ -266,7 +235,7 @@ private void InitializeComponent() // // buttonAddTimer // - this.buttonAddTimer.Location = new System.Drawing.Point(6, 156); + this.buttonAddTimer.Location = new System.Drawing.Point(6, 71); this.buttonAddTimer.Name = "buttonAddTimer"; this.buttonAddTimer.Size = new System.Drawing.Size(222, 23); this.buttonAddTimer.TabIndex = 4; @@ -306,14 +275,12 @@ private void InitializeComponent() private System.Windows.Forms.DateTimePicker dateTimePickerTimerFinish; private System.Windows.Forms.TextBox textBoxTimerName; private System.Windows.Forms.Button buttonAddTimer; - private System.Windows.Forms.Button button10h; - private System.Windows.Forms.Button button5h; - private System.Windows.Forms.Button button1h; - private System.Windows.Forms.Button button10m; private System.Windows.Forms.ToolStripMenuItem addToOverlayToolStripMenuItem; private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button buttonSet; private System.Windows.Forms.GroupBox groupBox1; private uiControls.dhmInput dhmInputTimer; + private System.Windows.Forms.Button bSetTimerNow; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem removeAllExpiredTimersToolStripMenuItem; } } diff --git a/ARKBreedingStats/TimerControl.cs b/ARKBreedingStats/TimerControl.cs index fb39b8c1..4d852eac 100644 --- a/ARKBreedingStats/TimerControl.cs +++ b/ARKBreedingStats/TimerControl.cs @@ -29,6 +29,30 @@ public TimerControl() timerAlerts = new List(); // prevent flickering ControlExtensions.DoubleBuffered(listViewTimer, true); + + // add ButtonAddTimers + var times = new Dictionary() { + {"+1 m", new TimeSpan(0,1,0)}, + {"+5 m", new TimeSpan(0,5,0)}, + {"+20 m", new TimeSpan(0,20,0)}, + {"+1 h", new TimeSpan(1,0,0)}, + {"+5 h", new TimeSpan(5,0,0)}, + {"+1 d", new TimeSpan(24,0,0)} + }; + + int i = 0; + foreach (KeyValuePair ts in times) + { + var bta = new uiControls.ButtonAddTime(); + bta.timeSpan = ts.Value; + bta.Text = "Hi"; + bta.Text = ts.Key; + bta.addTimer += buttonAddTime_addTimer; + bta.Size = new Size(54, 23); + bta.Location = new Point(6 + (i % 3) * 60, 48 + (i / 3) * 29); + groupBox1.Controls.Add(bta); + i++; + } } public void addTimer(string name, DateTime finishTime, Creature c, string group = "Custom") @@ -46,11 +70,12 @@ public void addTimer(string name, DateTime finishTime, Creature c, string group onTimerChange?.Invoke(); } - public void removeTimer(TimerListEntry timerEntry) + public void removeTimer(TimerListEntry timerEntry, bool invokeChange = true) { timerEntry.lvi.Remove(); timerListEntries.Remove(timerEntry); - onTimerChange?.Invoke(); + if (invokeChange) + onTimerChange?.Invoke(); } private ListViewItem createLvi(string name, DateTime finishTime, TimerListEntry tle) @@ -222,9 +247,14 @@ private void listViewTimer_KeyUp(object sender, KeyEventArgs e) private void removeSelectedEntry() { - if (listViewTimer.SelectedIndices.Count > 0 && MessageBox.Show("Remove the timer \"" + ((TimerListEntry)listViewTimer.SelectedItems[0].Tag).name + "\"?", "Remove Timer?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + if (listViewTimer.SelectedIndices.Count > 0 && MessageBox.Show("Remove the timer \"" + ((TimerListEntry)listViewTimer.SelectedItems[0].Tag).name + "\"" + + (listViewTimer.SelectedIndices.Count > 1 ? " and " + (listViewTimer.SelectedIndices.Count - 1).ToString() + " more timers" : "") + "?" + , "Remove Timer?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { - removeTimer((TimerListEntry)listViewTimer.SelectedItems[0].Tag); + for (int t = listViewTimer.SelectedIndices.Count - 1; t >= 0; t--) + removeTimer((TimerListEntry)listViewTimer.SelectedItems[t].Tag, false); + + onTimerChange?.Invoke(); } } @@ -233,27 +263,20 @@ private void buttonAddTimer_Click(object sender, EventArgs e) addTimer(textBoxTimerName.Text, dateTimePickerTimerFinish.Value, null); } - private void button10m_Click(object sender, EventArgs e) - { - dateTimePickerTimerFinish.Value = DateTime.Now.AddMinutes(10); - } - - private void button1h_Click(object sender, EventArgs e) + private void bSetTimerNow_Click(object sender, EventArgs e) { - dateTimePickerTimerFinish.Value = DateTime.Now.AddHours(1); - } + if (dhmInputTimer.Timespan == TimeSpan.Zero) // if already zero, update finishTimer manually + dateTimePickerTimerFinish.Value = DateTime.Now; - private void button5h_Click(object sender, EventArgs e) - { - dateTimePickerTimerFinish.Value = DateTime.Now.AddHours(5); + dhmInputTimer.Timespan = TimeSpan.Zero; } - private void button10h_Click(object sender, EventArgs e) + private void buttonAddTime_addTimer(TimeSpan timeSpan) { - dateTimePickerTimerFinish.Value = DateTime.Now.AddHours(10); + dhmInputTimer.Timespan = dhmInputTimer.Timespan.Add(timeSpan); } - private void buttonSet_Click(object sender, EventArgs e) + private void dhmInputTimer_TextChanged(object sender, EventArgs e) { dateTimePickerTimerFinish.Value = DateTime.Now.Add(dhmInputTimer.Timespan); } @@ -302,9 +325,16 @@ internal void deleteAllExpiredTimers() for (int i = 0; i < timerListEntries.Count; i++) { if (timerListEntries[i].time < DateTime.Now) - removeTimer(timerListEntries[i--]); + removeTimer(timerListEntries[i--], false); } + + onTimerChange?.Invoke(); } } + + private void removeAllExpiredTimersToolStripMenuItem_Click(object sender, EventArgs e) + { + deleteAllExpiredTimers(); + } } } diff --git a/ARKBreedingStats/Values.cs b/ARKBreedingStats/Values.cs index 25aa4b20..7d260902 100644 --- a/ARKBreedingStats/Values.cs +++ b/ARKBreedingStats/Values.cs @@ -33,16 +33,20 @@ public class Values public double babyCuddleIntervalMultiplier = 1; public double tamingSpeedMultiplier = 1; + [DataMember] public double matingIntervalMultiplierSP = 1; + [DataMember] public double eggHatchSpeedMultiplierSP = 1; + [DataMember] public double babyMatureSpeedMultiplierSP = 1; + [DataMember] public double babyCuddleIntervalMultiplierSP = 1; + [DataMember] public double tamingSpeedMultiplierSP = 1; - public bool celsius; + public bool celsius = true; public Values() { - celsius = true; } public static Values V @@ -257,7 +261,7 @@ public void applyMultipliers(CreatureCollection cc, bool eventMultipliers = fals for (int s = 0; s < 8; s++) { species[sp].stats[s].BaseValue = (double)species[sp].statsRaw[s][0]; - // don't apply the multiplier if AddWhenTamed is negative (currently the only case is the Giganotosaurus, which does not get the subtraction multiplied) + // don't apply the multiplier if AddWhenTamed is negative (e.g. Giganotosaurus, Griffin) species[sp].stats[s].AddWhenTamed = (double)species[sp].statsRaw[s][3] * (species[sp].statsRaw[s][3] > 0 ? cc.multipliers[s][0] : 1); species[sp].stats[s].MultAffinity = (double)species[sp].statsRaw[s][4] * cc.multipliers[s][1]; species[sp].stats[s].IncPerTamedLevel = (double)species[sp].statsRaw[s][2] * cc.multipliers[s][2]; @@ -265,7 +269,8 @@ public void applyMultipliers(CreatureCollection cc, bool eventMultipliers = fals if (cc.singlePlayerSettings && statMultipliersSP[s] != null) { - species[sp].stats[s].AddWhenTamed *= statMultipliersSP[s][0] != null ? (double)statMultipliersSP[s][0] : 1; + // don't apply the multiplier if AddWhenTamed is negative (e.g. Giganotosaurus, Griffin) + species[sp].stats[s].AddWhenTamed *= statMultipliersSP[s][0] != null && species[sp].stats[s].AddWhenTamed > 0 ? (double)statMultipliersSP[s][0] : 1; species[sp].stats[s].MultAffinity *= statMultipliersSP[s][1] != null ? (double)statMultipliersSP[s][1] : 1; species[sp].stats[s].IncPerTamedLevel *= statMultipliersSP[s][2] != null ? (double)statMultipliersSP[s][2] : 1; species[sp].stats[s].IncPerWildLevel *= statMultipliersSP[s][3] != null ? (double)statMultipliersSP[s][3] : 1; diff --git a/ARKBreedingStats/uiControls/ButtonAddTime.cs b/ARKBreedingStats/uiControls/ButtonAddTime.cs new file mode 100644 index 00000000..e5ba10de --- /dev/null +++ b/ARKBreedingStats/uiControls/ButtonAddTime.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ARKBreedingStats.uiControls +{ + class ButtonAddTime : Button + { + public TimeSpan timeSpan; + + public delegate void addTimerEventHandler(TimeSpan timeSpan); + public event addTimerEventHandler addTimer; + + public ButtonAddTime() + { + timeSpan = new TimeSpan(0, 1, 0); + Click += ButtonAddTime_Click; + } + + private void ButtonAddTime_Click(object sender, EventArgs e) + { + addTimer(timeSpan); + } + } +} diff --git a/ARKBreedingStats/uiControls/dhmInput.cs b/ARKBreedingStats/uiControls/dhmInput.cs index be2f7e4b..a07487ac 100644 --- a/ARKBreedingStats/uiControls/dhmInput.cs +++ b/ARKBreedingStats/uiControls/dhmInput.cs @@ -43,7 +43,7 @@ public TimeSpan Timespan get { return ts; } set { - ts = value.TotalMinutes >= 0 ? value : new TimeSpan(0); + ts = value.TotalMinutes >= 0 ? value : TimeSpan.Zero; changed = false; Text = ((int)Math.Floor(ts.TotalDays)).ToString("D2") + ":" + ts.Hours.ToString("D2") + ":" + ts.Minutes.ToString("D2"); } diff --git a/ARKBreedingStats/ver.txt b/ARKBreedingStats/ver.txt index 61b98a96..4d2fb76a 100644 --- a/ARKBreedingStats/ver.txt +++ b/ARKBreedingStats/ver.txt @@ -1 +1 @@ -268.22.1,0.23.20 \ No newline at end of file +268.22.1,0.23.21 \ No newline at end of file