mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-10-02 00:38:43 -05:00
Misc simplifications
recordmax is simplified
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -698,6 +699,7 @@ public override int PlayedSeconds
|
||||
public ulong AlolaTime { get => BitConverter.ToUInt64(Data, AdventureInfo + 0x48); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x48); }
|
||||
|
||||
// Stat Records
|
||||
public int RecordCount => 200;
|
||||
public int GetRecord(int recordID)
|
||||
{
|
||||
int ofs = GetRecordOffset(recordID);
|
||||
@@ -728,7 +730,7 @@ public int GetRecordOffset(int recordID)
|
||||
return -1;
|
||||
}
|
||||
public int GetRecordMax(int recordID) => GetRecordMax(recordID, USUM ? RecordMaxType_USUM : RecordMaxType_SM);
|
||||
private static int GetRecordMax(int recordID, int[] maxes) => recordID < 200 ? RecordMax[(maxes ?? RecordMaxType_USUM)[recordID]] : 0;
|
||||
private static int GetRecordMax(int recordID, IReadOnlyList<int> maxes) => recordID < 200 ? RecordMax[maxes[recordID]] : 0;
|
||||
private static readonly int[] RecordMax = {999999999, 9999999, 999999, 99999, 65535, 9999, 999};
|
||||
private static readonly int[] RecordMaxType_SM =
|
||||
{
|
||||
|
||||
@@ -6,5 +6,6 @@ public interface ITrainerStatRecord
|
||||
int GetRecordOffset(int recordID);
|
||||
int GetRecordMax(int recordID);
|
||||
void SetRecord(int recordID, int value);
|
||||
int RecordCount { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public void LoadRecords(ITrainerStatRecord sav, Dictionary<int, string> records)
|
||||
SAV = sav;
|
||||
RecordList = records;
|
||||
CB_Stats.Items.Clear();
|
||||
for (int i = 0; i < 200; i++)
|
||||
for (int i = 0; i < sav.RecordCount; i++)
|
||||
{
|
||||
if (!RecordList.TryGetValue(i, out string name))
|
||||
name = $"{i:D3}";
|
||||
|
||||
Reference in New Issue
Block a user