From 2d61c833bc641961ca0be8e663e15d0bfcafe46e Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 4 May 2024 14:48:19 -0500 Subject: [PATCH] MysteryGift drop: use extension-less method if w/o New Korean WC9 is restrict:0 so just make it behave like restrict:3 -- verifies all possible versions that way. --- PKHeX.Core/MysteryGifts/WC9.cs | 3 +-- PKHeX.Core/Util/FileUtil.cs | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/PKHeX.Core/MysteryGifts/WC9.cs b/PKHeX.Core/MysteryGifts/WC9.cs index 7c9abcefd..d119c36f5 100644 --- a/PKHeX.Core/MysteryGifts/WC9.cs +++ b/PKHeX.Core/MysteryGifts/WC9.cs @@ -34,10 +34,9 @@ public enum GiftType : byte public bool CanBeReceivedByVersion(PKM pk) => RestrictVersion switch { - 0 when !IsEntity => true, // Whatever, essentially unrestricted for SL/VL receipt. No Entity gifts are 0. 1 => pk.Version is GameVersion.SL || pk.MetLocation == LocationsHOME.SWSL, 2 => pk.Version is GameVersion.VL || pk.MetLocation == LocationsHOME.SHVL, - 3 => pk.Version is GameVersion.SL or GameVersion.VL || pk.MetLocation is LocationsHOME.SWSL or LocationsHOME.SHVL, + 0 or 3 => pk.Version is GameVersion.SL or GameVersion.VL || pk.MetLocation is LocationsHOME.SWSL or LocationsHOME.SHVL, _ => throw new ArgumentOutOfRangeException(nameof(RestrictVersion), RestrictVersion, null), }; diff --git a/PKHeX.Core/Util/FileUtil.cs b/PKHeX.Core/Util/FileUtil.cs index db387b8ce..112d26e45 100644 --- a/PKHeX.Core/Util/FileUtil.cs +++ b/PKHeX.Core/Util/FileUtil.cs @@ -289,7 +289,9 @@ public static bool TryGetBattleVideo(byte[] data, [NotNullWhen(true)] out IBattl /// True if file object reference is valid, false if none found. public static bool TryGetMysteryGift(byte[] data, [NotNullWhen(true)] out MysteryGift? mg, ReadOnlySpan ext) { - mg = MysteryGift.GetMysteryGift(data, ext); + mg = ext.Length == 0 + ? MysteryGift.GetMysteryGift(data) + : MysteryGift.GetMysteryGift(data, ext); return mg != null; }