mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Revise IsHOMEGift, check Card ID for gift date range
Currently, HOME gifts present in wc8.pkl will not be flagged for invalid dates due to them missing their respective Card IDs. This will be fixed with the next stable release, so this works for now.
This commit is contained in:
parent
46f50a3a56
commit
34c401b7a0
3 changed files with 18 additions and 16 deletions
|
@ -6,26 +6,28 @@ namespace PKHeX.Core
|
|||
{
|
||||
public static class EncountersHOME
|
||||
{
|
||||
public static bool IsValidDateWC8(int species, DateTime obtained) => WC8Gifts.TryGetValue(species, out var time) && obtained >= time && obtained <= DateTime.UtcNow;
|
||||
public static bool IsValidDateWC8(int cardID, DateTime obtained) => WC8Gifts.TryGetValue(cardID, out var time) && obtained >= time && obtained <= DateTime.UtcNow;
|
||||
|
||||
/// <summary>
|
||||
/// Minimum date the gift can be received.
|
||||
/// </summary>
|
||||
public static readonly Dictionary<int, DateTime> WC8Gifts = new()
|
||||
{
|
||||
{(int) Bulbasaur, new DateTime(2020, 02, 12)},
|
||||
{(int) Charmander, new DateTime(2020, 02, 12)},
|
||||
{(int) Squirtle, new DateTime(2020, 02, 12)},
|
||||
{(int) Pikachu, new DateTime(2020, 02, 12)},
|
||||
{(int) Eevee, new DateTime(2020, 02, 12)},
|
||||
{(int) Pichu, new DateTime(2020, 02, 12)},
|
||||
{(int) Rotom, new DateTime(2020, 02, 12)},
|
||||
{(int) Magearna, new DateTime(2020, 02, 15)},
|
||||
{(int) Zeraora, new DateTime(2020, 06, 30)},
|
||||
{(int) Melmetal, new DateTime(2020, 11, 10)},
|
||||
{(int) Grookey, new DateTime(2020, 06, 02)},
|
||||
{(int) Scorbunny, new DateTime(2020, 06, 02)},
|
||||
{(int) Sobble, new DateTime(2020, 06, 02)},
|
||||
{9000, new DateTime(2020, 02, 12)}, // Bulbasaur
|
||||
{9001, new DateTime(2020, 02, 12)}, // Charmander
|
||||
{9002, new DateTime(2020, 02, 12)}, // Squirtle
|
||||
{9003, new DateTime(2020, 02, 12)}, // Pikachu
|
||||
{9004, new DateTime(2020, 02, 15)}, // Original Color Magearna
|
||||
{9005, new DateTime(2020, 02, 12)}, // Eevee
|
||||
{9006, new DateTime(2020, 02, 12)}, // Rotom
|
||||
{9007, new DateTime(2020, 02, 12)}, // Pichu
|
||||
{9008, new DateTime(2020, 06, 02)}, // Hidden Ability Grookey
|
||||
{9009, new DateTime(2020, 06, 02)}, // Hidden Ability Scorbunny
|
||||
{9010, new DateTime(2020, 06, 02)}, // Hidden Ability Sobble
|
||||
{9011, new DateTime(2020, 06, 30)}, // Shiny Zeraora
|
||||
{9012, new DateTime(2020, 11, 10)}, // Gigantamax Melmetal
|
||||
{9013, new DateTime(2021, 06, 17)}, // Gigantamax Bulbasaur
|
||||
{9014, new DateTime(2021, 06, 17)}, // Gigantamax Squirtle
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace PKHeX.Core
|
|||
if (data.EncounterMatch is WC8 { IsHOMEGift: true } w)
|
||||
{
|
||||
var date = new DateTime(pkm.Met_Year + 2000, pkm.Met_Month, pkm.Met_Day);
|
||||
if (!EncountersHOME.IsValidDateWC8(w.Species, date))
|
||||
if (!EncountersHOME.IsValidDateWC8(w.CardID, date))
|
||||
data.AddLine(GetInvalid(LDateOutsideDistributionWindow));
|
||||
}
|
||||
else if (data.EncounterMatch is IOverworldCorrelation8 z)
|
||||
|
|
|
@ -346,7 +346,7 @@ namespace PKHeX.Core
|
|||
return 0x12C + (index * 0x1C);
|
||||
}
|
||||
|
||||
public bool IsHOMEGift => Location == Locations.HOME8 || GetOT(2) == "HOME";
|
||||
public bool IsHOMEGift => CardID >= 9000;
|
||||
|
||||
public bool CanHandleOT(int language) => !GetHasOT(language);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue