From caf25efb46a590f1ce00a7b7cfe8e2e171f52c53 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 23 Sep 2017 16:03:59 -0700 Subject: [PATCH] Add RTC ResetKey calc --- PKHeX.Core/Saves/SAV2.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PKHeX.Core/Saves/SAV2.cs b/PKHeX.Core/Saves/SAV2.cs index 21dccdf84..e1ddfdb0c 100644 --- a/PKHeX.Core/Saves/SAV2.cs +++ b/PKHeX.Core/Saves/SAV2.cs @@ -529,6 +529,16 @@ namespace PKHeX.Core return (Data[Offsets.PokedexCaught + ofs] & bitval) != 0; } + // Misc + public ushort ResetKey => GetResetKey(); + private ushort GetResetKey() + { + var val = (TID >> 8) + (TID & 0xFF) + (Money >> 8) + (Money & 0xFF); + var ot = Data.Skip(Offsets.Trainer1 + 2).TakeWhile((z, i) => i < 5 && z != 0x50); + var tr = ot.Sum(z => z); + return (ushort)(val + tr); + } + public override string GetString(int Offset, int Count) { if (Korean)