Fix recog of Home fixed PID shinies

Not to be confused with Home fixed PID antishinies
WC8 is the only format to have fixed shinies, but let's copy the logic to WB8 and WA8 if they're ever added in the future.

Fix mgdb display filtering for SWSH & PLA (swapped oops)

Closes #3511
This commit is contained in:
Kurt 2022-06-02 19:04:27 -07:00
parent e571a0b95f
commit 86814d014d
4 changed files with 16 additions and 3 deletions

View File

@ -548,9 +548,13 @@ private void SetPINGA(PKM pk, EncounterCriteria criteria)
ShinyType8.FixedValue => GetFixedPID(tr),
_ => throw new ArgumentOutOfRangeException(nameof(type)),
};
private uint GetFixedPID(ITrainerID tr)
{
var pid = PID;
if (pid != 0 && !(TID == 0 && SID == 0))
return pid;
if (!tr.IsShiny(pid, 8))
return pid;
if (IsHOMEGift)

View File

@ -548,6 +548,9 @@ private void SetPINGA(PKM pk, EncounterCriteria criteria)
private uint GetFixedPID(ITrainerID tr)
{
var pid = PID;
if (pid != 0 && !(TID == 0 && SID == 0))
return pid;
if (!tr.IsShiny(pid, 8))
return pid;
if (IsHOMEGift)

View File

@ -541,6 +541,9 @@ private void SetPINGA(PKM pk, EncounterCriteria criteria)
private uint GetFixedPID(ITrainerID tr)
{
var pid = PID;
if (pid != 0 && !(TID == 0 && SID == 0))
return pid;
if (!tr.IsShiny(pid, 8))
return pid;
if (IsHOMEGift && !IsHOMEShinyPossible(DateTime.Now))

View File

@ -214,11 +214,14 @@ private void LoadDatabase()
if (Main.Settings.MysteryDb.FilterUnavailableSpecies)
{
static bool IsPresentInGameSWSH(ISpeciesForm pk) => PersonalTable.SWSH.IsPresentInGame(pk.Species, pk.Form);
static bool IsPresentInGameBDSP(ISpeciesForm pk) => PersonalTable.BDSP.IsPresentInGame(pk.Species, pk.Form);
static bool IsPresentInGameLA(ISpeciesForm pk) => PersonalTable.LA.IsPresentInGame(pk.Species, pk.Form);
db = SAV switch
{
SAV8LA => db.Where(z => PersonalTable.SWSH.IsPresentInGame(z.Species, z.Form)),
SAV8BS => db.Where(z => PersonalTable.BDSP.IsPresentInGame(z.Species, z.Form)),
SAV8SWSH => db.Where(z => PersonalTable.LA.IsPresentInGame(z.Species, z.Form)),
SAV8SWSH => db.Where(IsPresentInGameSWSH),
SAV8BS => db.Where(IsPresentInGameBDSP),
SAV8LA => db.Where(IsPresentInGameLA),
SAV7b => db.Where(z => z is WB7),
SAV7 => db.Where(z => z.Generation < 7 || z is WC7),
_ => db.Where(z => z.Generation <= SAV.Generation),