diff --git a/PKHeX.Core/MysteryGifts/WB7.cs b/PKHeX.Core/MysteryGifts/WB7.cs index 8f118489c..0b077f2ed 100644 --- a/PKHeX.Core/MysteryGifts/WB7.cs +++ b/PKHeX.Core/MysteryGifts/WB7.cs @@ -69,7 +69,7 @@ private uint Day set => RawDate = SetDate(Year, Month, value); } - private static uint SetDate(uint year, uint month, uint day) => ((year - 2000) * 10000) + (month * 100) + day; + private static uint SetDate(uint year, uint month, uint day) => Math.Max(0, year - 2000) * 10000 + (month * 100) + day; /// /// Gets or sets the date of the card. diff --git a/PKHeX.Core/MysteryGifts/WC6.cs b/PKHeX.Core/MysteryGifts/WC6.cs index 0d2c71149..1b3fdfa0f 100644 --- a/PKHeX.Core/MysteryGifts/WC6.cs +++ b/PKHeX.Core/MysteryGifts/WC6.cs @@ -18,21 +18,21 @@ public sealed class WC6 : MysteryGift, IRibbonSetEvent3, IRibbonSetEvent4, ILang public WC6(byte[] data) { - Data = data; - if (Data.Length != SizeFull) - return; + Data = data; if (Data.Length == SizeFull) + { + // Load Restrictions + RestrictVersion = Data[0x000]; + RestrictLanguage = Data[0x1FF]; + byte[] wc6 = new byte[Size]; + if (Data[0x205] != 0) // Valid data + Array.Copy(Data, SizeFull - Size, wc6, 0, wc6.Length); + Data = wc6; - // Load Restrictions - RestrictVersion = Data[0x000]; - RestrictLanguage = Data[0x1FF]; - - byte[] wc6 = new byte[Size]; - if (Data[0x205] != 0) // Valid data - Array.Copy(Data, SizeFull - Size, wc6, 0, wc6.Length); - Data = wc6; - - DateTime now = DateTime.Now; - RawDate = SetDate((uint) now.Year, (uint) now.Month, (uint) now.Day); + DateTime now = DateTime.Now; + SetDate((uint) now.Year, (uint) now.Month, (uint) now.Day); + } + if (Year < 2000) + Data = new byte[Data.Length]; // Invalidate } public int RestrictLanguage { get; set; } = 0; // None diff --git a/PKHeX.Core/MysteryGifts/WC7.cs b/PKHeX.Core/MysteryGifts/WC7.cs index 258318c42..df677efcb 100644 --- a/PKHeX.Core/MysteryGifts/WC7.cs +++ b/PKHeX.Core/MysteryGifts/WC7.cs @@ -85,7 +85,7 @@ private uint Day set => RawDate = SetDate(Year, Month, value); } - private static uint SetDate(uint year, uint month, uint day) => ((year - 2000) * 10000) + (month * 100) + day; + private static uint SetDate(uint year, uint month, uint day) => Math.Max(0, year - 2000) * 10000 + (month * 100) + day; /// /// Gets or sets the date of the card.