Extend individual transfer count to 999mil

Closes #3028
Thanks @CarlosofKalos !

Setting 9999 for both on Rattata; capturing the 10,000th didn't increment, but transferring the 10,000th did.

Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
This commit is contained in:
Kurt
2020-10-12 14:16:55 -07:00
parent 1524093099
commit 0a6534a208
2 changed files with 23 additions and 22 deletions

View File

@@ -7,7 +7,8 @@ public sealed class CaptureRecords : SaveBlock
public CaptureRecords(SAV7b sav, int offset) : base(sav) => Offset = offset;
private const int ENTRY_COUNT = 153;
private const int MAX_COUNT_ENTRY = 9_999;
private const int MAX_COUNT_ENTRY_CAPTURE = 9_999;
private const int MAX_COUNT_ENTRY_TRANSFER = 999_999_999;
private const int MAX_COUNT_TOTAL = 999_999_999;
// 0x468A8 to 0x46B0B contains 153 entries (u32) denoting how many of said Species you've caught (each cap out at 9,999).
@@ -29,8 +30,8 @@ public sealed class CaptureRecords : SaveBlock
private int GetTransferredOffset(int index) => Offset + TransferredOffset + (index * 4);
public uint GetCapturedCountIndex(int index) => BitConverter.ToUInt32(Data, GetCapturedOffset(index));
public uint GetTransferredCountIndex(int index) => BitConverter.ToUInt32(Data, GetTransferredOffset(index));
public void SetCapturedCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY, value)).CopyTo(Data, GetCapturedOffset(index));
public void SetTransferredCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY, value)).CopyTo(Data, GetTransferredOffset(index));
public void SetCapturedCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY_CAPTURE, value)).CopyTo(Data, GetCapturedOffset(index));
public void SetTransferredCountIndex(int index, uint value) => BitConverter.GetBytes(Math.Min(MAX_COUNT_ENTRY_TRANSFER, value)).CopyTo(Data, GetTransferredOffset(index));
public static int GetSpeciesIndex(int species)
{
@@ -108,10 +109,10 @@ public uint CalculateTotalTransferred()
return total;
}
public void SetAllCaptured(uint count = MAX_COUNT_ENTRY, Zukan7b? dex = null)
public void SetAllCaptured(uint count = MAX_COUNT_ENTRY_CAPTURE, Zukan7b? dex = null)
{
uint total = 0;
count = Math.Min(count, MAX_COUNT_ENTRY);
count = Math.Min(count, MAX_COUNT_ENTRY_CAPTURE);
for (int i = 0; i < ENTRY_COUNT; i++)
{
int species = GetIndexSpecies(i);
@@ -127,10 +128,10 @@ public void SetAllCaptured(uint count = MAX_COUNT_ENTRY, Zukan7b? dex = null)
TotalCaptured = total;
}
public void SetAllTransferred(uint count = MAX_COUNT_ENTRY, Zukan7b? dex = null)
public void SetAllTransferred(uint count = MAX_COUNT_ENTRY_TRANSFER, Zukan7b? dex = null)
{
uint total = 0;
count = Math.Min(count, MAX_COUNT_ENTRY);
count = Math.Min(count, MAX_COUNT_ENTRY_TRANSFER);
for (int i = 0; i < ENTRY_COUNT; i++)
{
int species = GetIndexSpecies(i);

View File

@@ -115,9 +115,9 @@ private void InitializeComponent()
//
// B_Modify
//
this.B_Modify.Location = new System.Drawing.Point(143, 17);
this.B_Modify.Location = new System.Drawing.Point(164, 17);
this.B_Modify.Name = "B_Modify";
this.B_Modify.Size = new System.Drawing.Size(64, 41);
this.B_Modify.Size = new System.Drawing.Size(47, 41);
this.B_Modify.TabIndex = 25;
this.B_Modify.Text = "Set All";
this.B_Modify.UseVisualStyleBackColor = true;
@@ -140,7 +140,7 @@ private void InitializeComponent()
//
// NUD_SpeciesCaptured
//
this.NUD_SpeciesCaptured.Location = new System.Drawing.Point(92, 17);
this.NUD_SpeciesCaptured.Location = new System.Drawing.Point(86, 17);
this.NUD_SpeciesCaptured.Maximum = new decimal(new int[] {
9999,
0,
@@ -157,24 +157,24 @@ private void InitializeComponent()
//
// NUD_SpeciesTransferred
//
this.NUD_SpeciesTransferred.Location = new System.Drawing.Point(92, 40);
this.NUD_SpeciesTransferred.Location = new System.Drawing.Point(86, 40);
this.NUD_SpeciesTransferred.Maximum = new decimal(new int[] {
9999,
999999999,
0,
0,
0});
this.NUD_SpeciesTransferred.Name = "NUD_SpeciesTransferred";
this.NUD_SpeciesTransferred.Size = new System.Drawing.Size(45, 20);
this.NUD_SpeciesTransferred.Size = new System.Drawing.Size(75, 20);
this.NUD_SpeciesTransferred.TabIndex = 54;
this.NUD_SpeciesTransferred.Value = new decimal(new int[] {
9999,
123456789,
0,
0,
0});
//
// NUD_TotalTransferred
//
this.NUD_TotalTransferred.Location = new System.Drawing.Point(92, 42);
this.NUD_TotalTransferred.Location = new System.Drawing.Point(84, 42);
this.NUD_TotalTransferred.Maximum = new decimal(new int[] {
999999999,
0,
@@ -191,7 +191,7 @@ private void InitializeComponent()
//
// NUD_TotalCaptured
//
this.NUD_TotalCaptured.Location = new System.Drawing.Point(92, 19);
this.NUD_TotalCaptured.Location = new System.Drawing.Point(84, 19);
this.NUD_TotalCaptured.Maximum = new decimal(new int[] {
999999999,
0,
@@ -208,7 +208,7 @@ private void InitializeComponent()
//
// L_SpeciesCaptured
//
this.L_SpeciesCaptured.Location = new System.Drawing.Point(6, 17);
this.L_SpeciesCaptured.Location = new System.Drawing.Point(4, 17);
this.L_SpeciesCaptured.Name = "L_SpeciesCaptured";
this.L_SpeciesCaptured.Size = new System.Drawing.Size(80, 20);
this.L_SpeciesCaptured.TabIndex = 61;
@@ -218,7 +218,7 @@ private void InitializeComponent()
//
// L_SpeciesTransferred
//
this.L_SpeciesTransferred.Location = new System.Drawing.Point(6, 38);
this.L_SpeciesTransferred.Location = new System.Drawing.Point(4, 38);
this.L_SpeciesTransferred.Name = "L_SpeciesTransferred";
this.L_SpeciesTransferred.Size = new System.Drawing.Size(80, 20);
this.L_SpeciesTransferred.TabIndex = 62;
@@ -228,7 +228,7 @@ private void InitializeComponent()
//
// L_TotalTransferred
//
this.L_TotalTransferred.Location = new System.Drawing.Point(6, 40);
this.L_TotalTransferred.Location = new System.Drawing.Point(2, 40);
this.L_TotalTransferred.Name = "L_TotalTransferred";
this.L_TotalTransferred.Size = new System.Drawing.Size(80, 20);
this.L_TotalTransferred.TabIndex = 64;
@@ -238,7 +238,7 @@ private void InitializeComponent()
//
// L_TotalCaptured
//
this.L_TotalCaptured.Location = new System.Drawing.Point(6, 19);
this.L_TotalCaptured.Location = new System.Drawing.Point(2, 19);
this.L_TotalCaptured.Name = "L_TotalCaptured";
this.L_TotalCaptured.Size = new System.Drawing.Size(80, 20);
this.L_TotalCaptured.TabIndex = 63;
@@ -262,9 +262,9 @@ private void InitializeComponent()
//
// B_SumTotal
//
this.B_SumTotal.Location = new System.Drawing.Point(170, 19);
this.B_SumTotal.Location = new System.Drawing.Point(164, 19);
this.B_SumTotal.Name = "B_SumTotal";
this.B_SumTotal.Size = new System.Drawing.Size(37, 43);
this.B_SumTotal.Size = new System.Drawing.Size(47, 43);
this.B_SumTotal.TabIndex = 66;
this.B_SumTotal.Text = "Σ";
this.B_SumTotal.UseVisualStyleBackColor = true;