From 9fead34917ea2f78d2321c1af81800184e00ada4 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Tue, 23 Aug 2016 18:11:35 -0700 Subject: [PATCH] Expose SecondsToFame for Gen6 Closes #192 --- .../Save Editors/Gen6/SAV_Trainer.Designer.cs | 146 +++++++++++------- .../Subforms/Save Editors/Gen6/SAV_Trainer.cs | 7 + 2 files changed, 101 insertions(+), 52 deletions(-) diff --git a/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs b/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs index 401b769f7..11747e675 100644 --- a/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs +++ b/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.Designer.cs @@ -181,6 +181,10 @@ namespace PKHeX this.Tab_Overview = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.L_Started = new System.Windows.Forms.Label(); + this.CAL_AdventureStartDate = new System.Windows.Forms.DateTimePicker(); + this.CAL_AdventureStartTime = new System.Windows.Forms.DateTimePicker(); + this.CAL_LastSavedTime = new System.Windows.Forms.DateTimePicker(); this.Tab_BadgeMap = new System.Windows.Forms.TabPage(); this.GB_Map = new System.Windows.Forms.GroupBox(); this.NUD_Z = new System.Windows.Forms.NumericUpDown(); @@ -195,10 +199,9 @@ namespace PKHeX this.Tab_Multiplayer = new System.Windows.Forms.TabPage(); this.Tab_Maison = new System.Windows.Forms.TabPage(); this.Tab_Appearance = new System.Windows.Forms.TabPage(); - this.CAL_AdventureStartTime = new System.Windows.Forms.DateTimePicker(); - this.CAL_AdventureStartDate = new System.Windows.Forms.DateTimePicker(); - this.L_Started = new System.Windows.Forms.Label(); - this.CAL_LastSavedTime = new System.Windows.Forms.DateTimePicker(); + this.L_Fame = new System.Windows.Forms.Label(); + this.CAL_HoFDate = new System.Windows.Forms.DateTimePicker(); + this.CAL_HoFTime = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.PB_Badge8)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_Badge6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.PB_Badge4)).BeginInit(); @@ -620,7 +623,7 @@ namespace PKHeX // // L_LastSaved // - this.L_LastSaved.Location = new System.Drawing.Point(4, 107); + this.L_LastSaved.Location = new System.Drawing.Point(3, 110); this.L_LastSaved.Name = "L_LastSaved"; this.L_LastSaved.Size = new System.Drawing.Size(80, 20); this.L_LastSaved.TabIndex = 32; @@ -630,7 +633,7 @@ namespace PKHeX // CAL_LastSavedDate // this.CAL_LastSavedDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; - this.CAL_LastSavedDate.Location = new System.Drawing.Point(90, 107); + this.CAL_LastSavedDate.Location = new System.Drawing.Point(89, 110); this.CAL_LastSavedDate.MaxDate = new System.DateTime(4095, 12, 31, 0, 0, 0, 0); this.CAL_LastSavedDate.Name = "CAL_LastSavedDate"; this.CAL_LastSavedDate.Size = new System.Drawing.Size(99, 20); @@ -640,7 +643,7 @@ namespace PKHeX // L_Seconds // this.L_Seconds.AutoSize = true; - this.L_Seconds.Location = new System.Drawing.Point(136, 20); + this.L_Seconds.Location = new System.Drawing.Point(136, 17); this.L_Seconds.Name = "L_Seconds"; this.L_Seconds.Size = new System.Drawing.Size(29, 13); this.L_Seconds.TabIndex = 30; @@ -649,7 +652,7 @@ namespace PKHeX // L_Minutes // this.L_Minutes.AutoSize = true; - this.L_Minutes.Location = new System.Drawing.Point(84, 20); + this.L_Minutes.Location = new System.Drawing.Point(84, 17); this.L_Minutes.Name = "L_Minutes"; this.L_Minutes.Size = new System.Drawing.Size(27, 13); this.L_Minutes.TabIndex = 29; @@ -657,7 +660,7 @@ namespace PKHeX // // MT_Seconds // - this.MT_Seconds.Location = new System.Drawing.Point(166, 17); + this.MT_Seconds.Location = new System.Drawing.Point(166, 14); this.MT_Seconds.Mask = "00"; this.MT_Seconds.Name = "MT_Seconds"; this.MT_Seconds.Size = new System.Drawing.Size(22, 20); @@ -667,7 +670,7 @@ namespace PKHeX // // MT_Minutes // - this.MT_Minutes.Location = new System.Drawing.Point(111, 17); + this.MT_Minutes.Location = new System.Drawing.Point(111, 14); this.MT_Minutes.Mask = "00"; this.MT_Minutes.Name = "MT_Minutes"; this.MT_Minutes.Size = new System.Drawing.Size(22, 20); @@ -678,7 +681,7 @@ namespace PKHeX // L_Hours // this.L_Hours.AutoSize = true; - this.L_Hours.Location = new System.Drawing.Point(12, 20); + this.L_Hours.Location = new System.Drawing.Point(12, 17); this.L_Hours.Name = "L_Hours"; this.L_Hours.Size = new System.Drawing.Size(26, 13); this.L_Hours.TabIndex = 26; @@ -686,7 +689,7 @@ namespace PKHeX // // MT_Hours // - this.MT_Hours.Location = new System.Drawing.Point(44, 17); + this.MT_Hours.Location = new System.Drawing.Point(44, 14); this.MT_Hours.Mask = "00000"; this.MT_Hours.Name = "MT_Hours"; this.MT_Hours.Size = new System.Drawing.Size(38, 20); @@ -1826,6 +1829,9 @@ namespace PKHeX // // groupBox2 // + this.groupBox2.Controls.Add(this.L_Fame); + this.groupBox2.Controls.Add(this.CAL_HoFDate); + this.groupBox2.Controls.Add(this.CAL_HoFTime); this.groupBox2.Controls.Add(this.L_Started); this.groupBox2.Controls.Add(this.CAL_AdventureStartDate); this.groupBox2.Controls.Add(this.CAL_LastSavedDate); @@ -1845,6 +1851,52 @@ namespace PKHeX this.groupBox2.TabStop = false; this.groupBox2.Text = "Adventure Info"; // + // L_Started + // + this.L_Started.Location = new System.Drawing.Point(3, 35); + this.L_Started.Name = "L_Started"; + this.L_Started.Size = new System.Drawing.Size(80, 20); + this.L_Started.TabIndex = 36; + this.L_Started.Text = "Game Started:"; + this.L_Started.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CAL_AdventureStartDate + // + this.CAL_AdventureStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; + this.CAL_AdventureStartDate.Location = new System.Drawing.Point(89, 35); + this.CAL_AdventureStartDate.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); + this.CAL_AdventureStartDate.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + this.CAL_AdventureStartDate.Name = "CAL_AdventureStartDate"; + this.CAL_AdventureStartDate.Size = new System.Drawing.Size(99, 20); + this.CAL_AdventureStartDate.TabIndex = 35; + this.CAL_AdventureStartDate.Value = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + // + // CAL_AdventureStartTime + // + this.CAL_AdventureStartTime.CustomFormat = "hh:mm tt"; + this.CAL_AdventureStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.CAL_AdventureStartTime.Location = new System.Drawing.Point(115, 54); + this.CAL_AdventureStartTime.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); + this.CAL_AdventureStartTime.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + this.CAL_AdventureStartTime.Name = "CAL_AdventureStartTime"; + this.CAL_AdventureStartTime.ShowUpDown = true; + this.CAL_AdventureStartTime.Size = new System.Drawing.Size(73, 20); + this.CAL_AdventureStartTime.TabIndex = 34; + this.CAL_AdventureStartTime.Value = new System.DateTime(2001, 1, 1, 0, 0, 0, 0); + // + // CAL_LastSavedTime + // + this.CAL_LastSavedTime.CustomFormat = "hh:mm tt"; + this.CAL_LastSavedTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.CAL_LastSavedTime.Location = new System.Drawing.Point(115, 129); + this.CAL_LastSavedTime.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); + this.CAL_LastSavedTime.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + this.CAL_LastSavedTime.Name = "CAL_LastSavedTime"; + this.CAL_LastSavedTime.ShowUpDown = true; + this.CAL_LastSavedTime.Size = new System.Drawing.Size(73, 20); + this.CAL_LastSavedTime.TabIndex = 37; + this.CAL_LastSavedTime.Value = new System.DateTime(2001, 1, 1, 0, 0, 0, 0); + // // Tab_BadgeMap // this.Tab_BadgeMap.Controls.Add(this.GB_Map); @@ -2067,51 +2119,38 @@ namespace PKHeX this.Tab_Appearance.Text = "Appearance"; this.Tab_Appearance.UseVisualStyleBackColor = true; // - // CAL_AdventureStartTime + // L_Fame // - this.CAL_AdventureStartTime.CustomFormat = "hh:mm tt"; - this.CAL_AdventureStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.CAL_AdventureStartTime.Location = new System.Drawing.Point(116, 70); - this.CAL_AdventureStartTime.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); - this.CAL_AdventureStartTime.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); - this.CAL_AdventureStartTime.Name = "CAL_AdventureStartTime"; - this.CAL_AdventureStartTime.ShowUpDown = true; - this.CAL_AdventureStartTime.Size = new System.Drawing.Size(73, 20); - this.CAL_AdventureStartTime.TabIndex = 34; - this.CAL_AdventureStartTime.Value = new System.DateTime(2001, 1, 1, 0, 0, 0, 0); + this.L_Fame.Location = new System.Drawing.Point(3, 72); + this.L_Fame.Name = "L_Fame"; + this.L_Fame.Size = new System.Drawing.Size(80, 20); + this.L_Fame.TabIndex = 40; + this.L_Fame.Text = "HoF Entered:"; + this.L_Fame.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // CAL_AdventureStartDate + // CAL_HoFDate // - this.CAL_AdventureStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; - this.CAL_AdventureStartDate.Location = new System.Drawing.Point(90, 51); - this.CAL_AdventureStartDate.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); - this.CAL_AdventureStartDate.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); - this.CAL_AdventureStartDate.Name = "CAL_AdventureStartDate"; - this.CAL_AdventureStartDate.Size = new System.Drawing.Size(99, 20); - this.CAL_AdventureStartDate.TabIndex = 35; - this.CAL_AdventureStartDate.Value = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + this.CAL_HoFDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; + this.CAL_HoFDate.Location = new System.Drawing.Point(89, 72); + this.CAL_HoFDate.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); + this.CAL_HoFDate.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + this.CAL_HoFDate.Name = "CAL_HoFDate"; + this.CAL_HoFDate.Size = new System.Drawing.Size(99, 20); + this.CAL_HoFDate.TabIndex = 39; + this.CAL_HoFDate.Value = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); // - // L_Started + // CAL_HoFTime // - this.L_Started.Location = new System.Drawing.Point(4, 51); - this.L_Started.Name = "L_Started"; - this.L_Started.Size = new System.Drawing.Size(80, 20); - this.L_Started.TabIndex = 36; - this.L_Started.Text = "Game Started:"; - this.L_Started.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // CAL_LastSavedTime - // - this.CAL_LastSavedTime.CustomFormat = "hh:mm tt"; - this.CAL_LastSavedTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.CAL_LastSavedTime.Location = new System.Drawing.Point(116, 126); - this.CAL_LastSavedTime.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); - this.CAL_LastSavedTime.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); - this.CAL_LastSavedTime.Name = "CAL_LastSavedTime"; - this.CAL_LastSavedTime.ShowUpDown = true; - this.CAL_LastSavedTime.Size = new System.Drawing.Size(73, 20); - this.CAL_LastSavedTime.TabIndex = 37; - this.CAL_LastSavedTime.Value = new System.DateTime(2001, 1, 1, 0, 0, 0, 0); + this.CAL_HoFTime.CustomFormat = "hh:mm tt"; + this.CAL_HoFTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.CAL_HoFTime.Location = new System.Drawing.Point(115, 91); + this.CAL_HoFTime.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); + this.CAL_HoFTime.MinDate = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + this.CAL_HoFTime.Name = "CAL_HoFTime"; + this.CAL_HoFTime.ShowUpDown = true; + this.CAL_HoFTime.Size = new System.Drawing.Size(73, 20); + this.CAL_HoFTime.TabIndex = 38; + this.CAL_HoFTime.Value = new System.DateTime(2001, 1, 1, 0, 0, 0, 0); // // SAV_Trainer // @@ -2338,5 +2377,8 @@ namespace PKHeX private System.Windows.Forms.DateTimePicker CAL_AdventureStartTime; private System.Windows.Forms.Label L_Started; private System.Windows.Forms.DateTimePicker CAL_LastSavedTime; + private System.Windows.Forms.Label L_Fame; + private System.Windows.Forms.DateTimePicker CAL_HoFDate; + private System.Windows.Forms.DateTimePicker CAL_HoFTime; } } diff --git a/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.cs b/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.cs index d106096cd..8dc6171e5 100644 --- a/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.cs +++ b/PKHeX/Subforms/Save Editors/Gen6/SAV_Trainer.cs @@ -454,6 +454,8 @@ namespace PKHeX CAL_LastSavedTime.Value = new DateTime(2000, 1, 1, SAV.LastSavedHour, SAV.LastSavedMinute, 0); CAL_AdventureStartDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart); CAL_AdventureStartTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToStart % 86400); + CAL_HoFDate.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame); + CAL_HoFTime.Value = new DateTime(2000, 1, 1).AddSeconds(SAV.SecondsToFame % 86400); } private void save() { @@ -540,6 +542,11 @@ namespace PKHeX seconds += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds; SAV.SecondsToStart = seconds; + int fame = (int)(CAL_HoFDate.Value - new DateTime(2000, 1, 1)).TotalSeconds; + fame -= fame % 86400; + fame += (int)(CAL_HoFTime.Value - new DateTime(2000, 1, 1)).TotalSeconds; + SAV.SecondsToFame = fame; + SAV.LastSavedYear = CAL_LastSavedDate.Value.Year; SAV.LastSavedMonth = CAL_LastSavedDate.Value.Month; SAV.LastSavedDay = CAL_LastSavedDate.Value.Day;