mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-13 07:47:07 +00:00
Minor clean
automatically update total_watt if insufficient SAV8 is not SAV8SWSH #2583
This commit is contained in:
parent
d9c59666e0
commit
4bf71de621
4 changed files with 9 additions and 24 deletions
|
@ -81,8 +81,6 @@ namespace PKHeX.Core
|
|||
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; }
|
||||
|
||||
|
|
|
@ -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<byte> RecordMax { get; }
|
||||
|
||||
public Record8(SaveFile sav, SCBlock block, IReadOnlyList<byte> maxes) : base(sav, block.Data) =>
|
||||
|
|
|
@ -700,12 +700,11 @@
|
|||
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;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
|
||||
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 @@ namespace PKHeX.WinForms
|
|||
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 @@ namespace PKHeX.WinForms
|
|||
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 @@ namespace PKHeX.WinForms
|
|||
// 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 @@ namespace PKHeX.WinForms
|
|||
// 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)
|
||||
|
|
Loading…
Reference in a new issue