diff --git a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs index 6140d0519..9cee44efb 100644 --- a/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/TrainerNameVerifier.cs @@ -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)); } diff --git a/PKHeX.Core/PKM/SK2.cs b/PKHeX.Core/PKM/SK2.cs index 2099b9317..dc691b7c2 100644 --- a/PKHeX.Core/PKM/SK2.cs +++ b/PKHeX.Core/PKM/SK2.cs @@ -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, }; } diff --git a/PKHeX.Core/Saves/SAV2Stadium.cs b/PKHeX.Core/Saves/SAV2Stadium.cs index cd5ed380b..2f569bd96 100644 --- a/PKHeX.Core/Saves/SAV2Stadium.cs +++ b/PKHeX.Core/Saves/SAV2Stadium.cs @@ -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) diff --git a/PKHeX.Core/Saves/SAV_STADIUM.cs b/PKHeX.Core/Saves/SAV_STADIUM.cs index 17d0f5ff2..7b21f179f 100644 --- a/PKHeX.Core/Saves/SAV_STADIUM.cs +++ b/PKHeX.Core/Saves/SAV_STADIUM.cs @@ -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";