Add stad2 boxnames, registered flag handling

This commit is contained in:
Kurt 2020-10-05 08:29:17 -07:00
parent 978305b45e
commit aa43904869
4 changed files with 31 additions and 6 deletions

View file

@ -107,7 +107,7 @@ namespace PKHeX.Core
if (tr.Length == 0)
{
if (pkm is SK2 sk2 && sk2.TID == 0 && sk2.OT_Trash[0] == 0)
if (pkm is SK2 sk2 && sk2.TID == 0 && sk2.IsRental)
{
data.AddLine(Get(LOTShort, Severity.Fishy));
}

View file

@ -64,9 +64,25 @@ namespace PKHeX.Core
public override int CurrentFriendship { get => Data[0x1C]; set => Data[0x1C] = (byte)value; }
public override int Stat_Level { get => Data[0x1D]; set => Data[0x1D] = (byte)value; }
public override bool IsEgg { get => Data[0x1E] != 0; set => Data[0x1E] = (byte)(value ? 1 : 0); }
public override bool IsEgg { get => (Data[0x1E] & 1) == 1; set => Data[0x1E] = (byte)(Data[0x1E] & ~1 | (value ? 1 : 0)); }
// 0x1E, 0x1F
public bool IsRental
{
get => (Data[0x1E] & 4) == 4;
set
{
if (!value)
{
Data[0x1E] &= 0xFB;
return;
}
Data[0x1E] |= 4;
OT_Name = string.Empty;
}
}
// 0x1F
private byte PKRS { get => Data[0x20]; set => Data[0x20] = value; }
// Crystal only Caught Data
@ -87,7 +103,7 @@ namespace PKHeX.Core
get => GetString(0x30, StringLength);
set
{
if (value.Length == 0) // Rental
if (IsRental)
{
Array.Clear(Data, 0x30, StringLength);
return;
@ -172,7 +188,7 @@ namespace PKHeX.Core
// Only copies until first 0x50 terminator, but just copy everything
Nickname = Nickname,
OT_Name = OT_Name,
OT_Name = IsRental ? Japanese ? "1337" : "PKHeX" : OT_Name,
};
}

View file

@ -132,6 +132,15 @@ namespace PKHeX.Core
public static string GetTeamName(int team) => $"{((Stadium2TeamType)(team / TeamCountType)).ToString().Replace('_', ' ')} {(team % 10) + 1}";
public override string GetBoxName(int box)
{
var ofs = GetBoxOffset(box) - 0x10;
var str = GetString(ofs, 0x10);
if (string.IsNullOrWhiteSpace(str))
return $"Box {box + 1}";
return str;
}
public override SlotGroup GetTeam(int team)
{
if ((uint)team >= TeamCount)

View file

@ -44,7 +44,7 @@
protected sealed override byte[] DecryptPKM(byte[] data) => data;
public sealed override int GetPartyOffset(int slot) => -1;
public sealed override string GetBoxName(int box) => $"Box {box + 1}";
public override string GetBoxName(int box) => $"Box {box + 1}";
public sealed override void SetBoxName(int box, string value) { }
public sealed override bool ChecksumsValid => GetBoxChecksumsValid();
public sealed override string ChecksumInfo => ChecksumsValid ? "Checksum valid." : "Checksum invalid";