diff --git a/PKHeX.Core/Legality/Encounters/Data/Live/EncounterServerDate.cs b/PKHeX.Core/Legality/Encounters/Data/Live/EncounterServerDate.cs index 87a6d31ba..1aeb5a43b 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Live/EncounterServerDate.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Live/EncounterServerDate.cs @@ -28,14 +28,16 @@ public static class EncounterServerDate WC8 wc8 => Result(IsValidDateWC8(wc8.CardID, obtained)), WA8 wa8 => Result(IsValidDateWA8(wa8.CardID, obtained)), WB8 wb8 => Result(IsValidDateWB8(wb8.CardID, obtained)), - //WC9 wc9 => Result(IsValidDateWC9(wc9.CardID, obtained)), + WC9 wc9 => Result(IsValidDateWC9(wc9, obtained)), _ => throw new ArgumentOutOfRangeException(nameof(enc)), }; public static bool IsValidDateWC8(int cardID, DateOnly obtained) => WC8Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time); public static bool IsValidDateWA8(int cardID, DateOnly obtained) => WA8Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time); public static bool IsValidDateWB8(int cardID, DateOnly obtained) => WB8Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time); - public static bool IsValidDateWC9(int cardID, DateOnly obtained) => WC9Gifts.TryGetValue(cardID, out var time) && IsValidDate(obtained, time); + + public static bool IsValidDateWC9(WC9 card , DateOnly obtained) => (WC9Gifts.TryGetValue(card.CardID, out var time) + || WC9GiftsChk.TryGetValue(card.Checksum, out time)) && IsValidDate(obtained, time); /// /// Minimum date the gift can be received. @@ -89,9 +91,20 @@ public static class EncounterServerDate {9017, (new(2022, 05, 18), Never)}, // Hidden Ability Piplup }; - // ReSharper disable once CollectionNeverUpdated.Global /// /// Minimum date the gift can be received. /// - public static readonly Dictionary WC9Gifts = new(0); + public static readonly Dictionary WC9GiftsChk = new() + { + {0xE5EB, (new(2022, 11, 17), new(2023, 02, 03))}, // Fly Pikachu - rev 1 (male 128) + {0x908B, (new(2023, 02, 02), Never)}, // Fly Pikachu - rev 2 (both 0) + }; + + /// + /// Minimum date the gift can be received. + /// + public static readonly Dictionary WC9Gifts = new() + { + {1501, (new(2022, 11, 17), Never)}, // Flabébé Pokécenter + }; } diff --git a/PKHeX.Core/MysteryGifts/WC9.cs b/PKHeX.Core/MysteryGifts/WC9.cs index 2b80bb4c9..5a43b3d41 100644 --- a/PKHeX.Core/MysteryGifts/WC9.cs +++ b/PKHeX.Core/MysteryGifts/WC9.cs @@ -268,6 +268,8 @@ public sealed class WC9 : DataMysteryGift, ILangNick, INature, ITeraType, IRibbo public byte OT_Feeling { get => Data[CardStart + 0x277]; set => Data[CardStart + 0x277] = value; } public ushort OT_TextVar { get => ReadUInt16LittleEndian(Data.AsSpan(CardStart + 0x278)); set => WriteUInt16LittleEndian(Data.AsSpan(CardStart + 0x278), value); } + public ushort Checksum => ReadUInt16LittleEndian(Data.AsSpan(0x2C4)); + // Meta Accessible Properties public override int[] IVs { @@ -505,7 +507,7 @@ public sealed class WC9 : DataMysteryGift, ILangNick, INature, ITeraType, IRibbo } } - pk.MetDate = IsDateRestricted && EncounterServerDate.WC9Gifts.TryGetValue(CardID, out var dt) ? dt.Start : DateOnly.FromDateTime(DateTime.Now); + pk.MetDate = IsDateRestricted && EncounterServerDate.WC9GiftsChk.TryGetValue(CardID, out var dt) ? dt.Start : DateOnly.FromDateTime(DateTime.Now); var nickname_language = GetLanguage(language); pk.Language = nickname_language != 0 ? nickname_language : tr.Language; @@ -525,12 +527,10 @@ public sealed class WC9 : DataMysteryGift, ILangNick, INature, ITeraType, IRibbo SetEggMetData(pk); pk.CurrentFriendship = pk.IsEgg ? pi.HatchCycles : pi.BaseFriendship; + pk.HeightScalar = (byte)HeightValue; + pk.WeightScalar = (byte)WeightValue; if (!IsHOMEGift) - { - pk.HeightScalar = PokeSizeUtil.GetRandomScalar(); - pk.WeightScalar = PokeSizeUtil.GetRandomScalar(); pk.Scale = PokeSizeUtil.GetRandomScalar(); - } pk.Obedience_Level = Level; pk.ResetPartyStats(); @@ -723,12 +723,13 @@ public sealed class WC9 : DataMysteryGift, ILangNick, INature, ITeraType, IRibbo if (Nature != -1 && pk.Nature != Nature) return false; if (Gender != 3 && Gender != pk.Gender) return false; - if (IsHOMEGift && pk is IScaledSize s) + if (pk is IScaledSize s) { - if (s.HeightScalar != 0) + if (s.HeightScalar != HeightValue) return false; - if (s.WeightScalar != 0) + if (s.WeightScalar != WeightValue) return false; + // Random scalar } // PID Types 0 and 1 do not use the fixed PID value. @@ -740,7 +741,7 @@ public sealed class WC9 : DataMysteryGift, ILangNick, INature, ITeraType, IRibbo return pk.PID == GetPID(pk, type); } - public bool IsDateRestricted => IsHOMEGift; + public bool IsDateRestricted => true; protected override bool IsMatchDeferred(PKM pk) => Species != pk.Species; protected override bool IsMatchPartial(PKM pk) diff --git a/PKHeX.Core/Resources/legality/mgdb/wc9.pkl b/PKHeX.Core/Resources/legality/mgdb/wc9.pkl index 9dfcf77ea..3d2c2993f 100644 Binary files a/PKHeX.Core/Resources/legality/mgdb/wc9.pkl and b/PKHeX.Core/Resources/legality/mgdb/wc9.pkl differ