diff --git a/PKHeX.Core/Saves/SAV8.cs b/PKHeX.Core/Saves/SAV8.cs index 97272120b..2a51e9c7e 100644 --- a/PKHeX.Core/Saves/SAV8.cs +++ b/PKHeX.Core/Saves/SAV8.cs @@ -81,8 +81,6 @@ public override byte[] SetString(string value, int maxLength, int PadToSize = 0, public override int Gender { get => MyStatus.Gender; set => MyStatus.Gender = value; } public override int Language { get => MyStatus.Language; set => MyStatus.Language = value; } public override string OT { get => MyStatus.OT; set => MyStatus.OT = value; } - public virtual uint Watt { get => MyStatus.Watt; set => MyStatus.Watt = value; } - public virtual uint MaxWatt => MyStatus.MaxWatt; public override uint Money { get => Misc.Money; set => Misc.Money = value; } public int Badges { get => Misc.Badges; set => Misc.Badges = value; } diff --git a/PKHeX.Core/Saves/Substructures/Gen8/Record8.cs b/PKHeX.Core/Saves/Substructures/Gen8/Record8.cs index 1b06c8712..bf35190f1 100644 --- a/PKHeX.Core/Saves/Substructures/Gen8/Record8.cs +++ b/PKHeX.Core/Saves/Substructures/Gen8/Record8.cs @@ -7,6 +7,7 @@ namespace PKHeX.Core public sealed class Record8 : RecordBlock { public const int RecordCount = 50; + public const int WattTotal = 22; protected override IReadOnlyList RecordMax { get; } public Record8(SaveFile sav, SCBlock block, IReadOnlyList maxes) : base(sav, block.Data) => diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.Designer.cs index 53b742646..73f197621 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.Designer.cs @@ -700,12 +700,11 @@ private void InitializeComponent() this.MT_Watt.Size = new System.Drawing.Size(52, 20); this.MT_Watt.TabIndex = 74; this.MT_Watt.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.MT_Watt.TextChanged += new System.EventHandler(this.MT_Watt_TextChanged); // // L_Watt // this.L_Watt.AutoSize = true; - this.L_Watt.Location = new System.Drawing.Point(102, 56); + this.L_Watt.Location = new System.Drawing.Point(97, 56); this.L_Watt.Name = "L_Watt"; this.L_Watt.Size = new System.Drawing.Size(21, 13); this.L_Watt.TabIndex = 75; diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.cs index fe2998779..712d7157b 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen8/SAV_Trainer8.cs @@ -22,7 +22,7 @@ public SAV_Trainer8(SaveFile sav) } B_MaxCash.Click += (sender, e) => MT_Money.Text = SAV.MaxMoney.ToString(); - B_MaxWatt.Click += (sender, e) => MT_Watt.Text = SAV.MaxWatt.ToString(); + B_MaxWatt.Click += (sender, e) => MT_Watt.Text = SAV.MyStatus.MaxWatt.ToString(); CB_Gender.Items.Clear(); CB_Gender.Items.AddRange(Main.GenderSymbols.Take(2).ToArray()); // m/f depending on unicode selection @@ -60,7 +60,7 @@ private void GetTextBoxes() MT_TrainerCardID.Text = SAV.Blocks.TrainerCard.TrainerID.ToString("000000"); trainerID1.LoadIDValues(SAV); MT_Money.Text = SAV.Money.ToString(); - MT_Watt.Text = SAV.Watt.ToString(); + MT_Watt.Text = SAV.MyStatus.Watt.ToString(); CB_Language.SelectedValue = SAV.Language; //NUD_M.Value = SAV.Situation.M; @@ -111,13 +111,17 @@ private void SaveTrainerInfo() SAV.Gender = (byte)CB_Gender.SelectedIndex; SAV.Money = Util.ToUInt32(MT_Money.Text); - SAV.Watt = Util.ToUInt32(MT_Watt.Text); SAV.Language = WinFormsUtil.GetIndex(CB_Language); SAV.OT = TB_OTName.Text; SAV.Blocks.TrainerCard.OT = TB_TrainerCardName.Text; SAV.Blocks.TrainerCard.Number = TB_TrainerCardNumber.Text; SAV.Blocks.TrainerCard.TrainerID = Util.ToInt32(MT_TrainerCardID.Text); + var watt = Util.ToUInt32(MT_Watt.Text); + SAV.MyStatus.Watt = watt; + if (SAV.GetRecord(Record8.WattTotal) < watt) + SAV.SetRecord(Record8.WattTotal, (int)watt); + SAV.Misc.BP = (int)NUD_BP.Value; // Copy Position @@ -143,9 +147,6 @@ private void SaveTrainerInfo() // SAV.Played.LastSavedDate = new DateTime(CAL_LastSavedDate.Value.Year, CAL_LastSavedDate.Value.Month, CAL_LastSavedDate.Value.Day, CAL_LastSavedTime.Value.Hour, CAL_LastSavedTime.Value.Minute, 0); } - - #region Event handling - private void ClickOT(object sender, MouseEventArgs e) { TextBox tb = sender as TextBox ?? TB_OTName; @@ -183,20 +184,6 @@ private void ChangeMapValue(object sender, EventArgs e) // MapUpdated = true; } - private void MT_Watt_TextChanged(object sender, EventArgs e) - { - try { - var watt = Util.ToUInt32(MT_Watt.Text); - var kv = Records.RecordList_8.FirstOrDefault(kv => kv.Value.Equals("total_watt", StringComparison.OrdinalIgnoreCase)); - - if (kv.Value != null && SAV.GetRecord(kv.Key) < watt) - MessageBox.Show(this, "ya watt is greater than your total watt now!", "info"); - - } catch { } - } - - #endregion - //private string UpdateTip(int index) //{ // switch (index)