Add Roto Rally score, copy Jersey # to other block

Closes #2635
This commit is contained in:
Kurt 2020-01-15 20:48:19 -08:00
parent f1b1f5e64e
commit 41f909c08a
5 changed files with 54 additions and 1 deletions

View file

@ -51,6 +51,7 @@ namespace PKHeX.Core
private const uint KMisc = 0x1b882b09; // Money
private const uint KParty = 0x2985fe5d; // Party Data
private const uint KDaycare = 0x2d6fba6a; // Daycare slots (2 daycares)
internal const uint KRotoRally = 0x38548020;
private const uint KRecord = 0x37da95a3;
private const uint KZukan = 0x4716c404; // PokeDex
private const uint KTrainerCard = 0x874da6fa; // Trainer Card

View file

@ -1,4 +1,5 @@
using System;
using System.Text;
namespace PKHeX.Core
{
@ -6,6 +7,17 @@ namespace PKHeX.Core
{
public MyStatus8(SAV8SWSH sav, SCBlock block) : base(sav, block.Data) { }
public string Number
{
get => Encoding.ASCII.GetString(Data, 0x01, 3);
set
{
for (int i = 0; i < 3; i++)
Data[0x01 + i] = (byte)(value.Length > i ? value[i] : '\0');
SAV.Edited = true;
}
}
public ulong Hair
{
get => BitConverter.ToUInt64(Data, 0x10);

View file

@ -19,6 +19,19 @@ namespace PKHeX.Core
set => SAV.SetData(Data, BitConverter.GetBytes(value), 0x1C);
}
public int RotoRallyScore
{
get => BitConverter.ToInt32(Data, 0x28);
set
{
var data = BitConverter.GetBytes(value);
SAV.SetData(Data, data, 0x28);
// set to the other block since it doesn't have an accessor
var used = ((SAV8SWSH) SAV).Blocks.GetBlock(SaveBlockAccessorSWSH.KRotoRally);
SAV.SetData(used.Data, data, 0);
}
}
public string Number
{
get => Encoding.ASCII.GetString(Data, 0x39, 3);

View file

@ -93,6 +93,8 @@
this.L_SinglesC = new System.Windows.Forms.Label();
this.TC_Editor = new System.Windows.Forms.TabControl();
this.Tab_Overview = new System.Windows.Forms.TabPage();
this.L_RotoRally = new System.Windows.Forms.Label();
this.MT_RotoRally = new System.Windows.Forms.MaskedTextBox();
this.B_MaxWatt = new System.Windows.Forms.Button();
this.MT_Watt = new System.Windows.Forms.MaskedTextBox();
this.L_Watt = new System.Windows.Forms.Label();
@ -653,6 +655,8 @@
//
// Tab_Overview
//
this.Tab_Overview.Controls.Add(this.L_RotoRally);
this.Tab_Overview.Controls.Add(this.MT_RotoRally);
this.Tab_Overview.Controls.Add(this.B_MaxWatt);
this.Tab_Overview.Controls.Add(this.MT_Watt);
this.Tab_Overview.Controls.Add(this.L_Watt);
@ -682,6 +686,25 @@
this.Tab_Overview.Text = "Overview";
this.Tab_Overview.UseVisualStyleBackColor = true;
//
// L_RotoRally
//
this.L_RotoRally.Location = new System.Drawing.Point(209, 101);
this.L_RotoRally.Name = "L_RotoRally";
this.L_RotoRally.Size = new System.Drawing.Size(117, 16);
this.L_RotoRally.TabIndex = 78;
this.L_RotoRally.Text = "Roto Rally Score:";
this.L_RotoRally.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// MT_RotoRally
//
this.MT_RotoRally.Location = new System.Drawing.Point(331, 100);
this.MT_RotoRally.Mask = "000000";
this.MT_RotoRally.Name = "MT_RotoRally";
this.MT_RotoRally.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.MT_RotoRally.Size = new System.Drawing.Size(43, 20);
this.MT_RotoRally.TabIndex = 77;
this.MT_RotoRally.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// B_MaxWatt
//
this.B_MaxWatt.Location = new System.Drawing.Point(172, 52);
@ -1229,5 +1252,7 @@
private System.Windows.Forms.MaskedTextBox MT_Watt;
private System.Windows.Forms.Label L_Watt;
private System.Windows.Forms.Button B_MaxWatt;
private System.Windows.Forms.Label L_RotoRally;
private System.Windows.Forms.MaskedTextBox MT_RotoRally;
}
}

View file

@ -58,6 +58,7 @@ namespace PKHeX.WinForms
TB_TrainerCardName.Text = SAV.Blocks.TrainerCard.OT;
TB_TrainerCardNumber.Text = SAV.Blocks.TrainerCard.Number;
MT_TrainerCardID.Text = SAV.Blocks.TrainerCard.TrainerID.ToString("000000");
MT_RotoRally.Text = SAV.Blocks.TrainerCard.RotoRallyScore.ToString();
trainerID1.LoadIDValues(SAV);
MT_Money.Text = SAV.Money.ToString();
MT_Watt.Text = SAV.MyStatus.Watt.ToString();
@ -114,8 +115,9 @@ namespace PKHeX.WinForms
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.MyStatus.Number = SAV.Blocks.TrainerCard.Number = TB_TrainerCardNumber.Text;
SAV.Blocks.TrainerCard.TrainerID = Util.ToInt32(MT_TrainerCardID.Text);
SAV.Blocks.TrainerCard.RotoRallyScore = Util.ToInt32(MT_RotoRally.Text);
var watt = Util.ToUInt32(MT_Watt.Text);
SAV.MyStatus.Watt = watt;