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.
This commit is contained in:
Kurt
2024-05-04 14:48:19 -05:00
parent 6855c842ca
commit 2d61c833bc
2 changed files with 4 additions and 3 deletions

View File

@@ -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),
};

View File

@@ -289,7 +289,9 @@ public static bool TryGetBattleVideo(byte[] data, [NotNullWhen(true)] out IBattl
/// <returns>True if file object reference is valid, false if none found.</returns>
public static bool TryGetMysteryGift(byte[] data, [NotNullWhen(true)] out MysteryGift? mg, ReadOnlySpan<char> ext)
{
mg = MysteryGift.GetMysteryGift(data, ext);
mg = ext.Length == 0
? MysteryGift.GetMysteryGift(data)
: MysteryGift.GetMysteryGift(data, ext);
return mg != null;
}