Misc tweaks

Re-dump safari slots for HGSS; the repackaged narc accidentally shuffled files so the wrong water tables were output.
Add error log output on reporting exception fail first to always dump an error log file. Don't trust the popup/form.
Permit TID/OT duplication for in-game trades/N's pokemon.
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=287395
This commit is contained in:
Kurt
2024-01-16 21:43:10 -08:00
parent 513a0d6b7a
commit c617aa206d
4 changed files with 17 additions and 4 deletions

View File

@@ -49,9 +49,7 @@ private static void Verify(BulkAnalysis input, Dictionary<uint, CombinedReferenc
private static bool VerifyIDReuse(BulkAnalysis input, SlotCache ps, LegalityAnalysis pa, SlotCache cs, LegalityAnalysis ca)
{
if (pa.EncounterMatch is MysteryGift { EggEncounter: false })
return false;
if (ca.EncounterMatch is MysteryGift { EggEncounter: false })
if (IsNotPlayerDetails(pa.EncounterMatch) || IsNotPlayerDetails(ca.EncounterMatch))
return false;
const CheckIdentifier ident = Trainer;
@@ -77,6 +75,13 @@ private static bool VerifyIDReuse(BulkAnalysis input, SlotCache ps, LegalityAnal
return false;
}
private static bool IsNotPlayerDetails(IEncounterTemplate enc) => enc switch
{
IFixedTrainer { IsFixedTrainer: true } => true,
MysteryGift { IsEgg: false } => true,
_ => false,
};
private static bool IsSharedVersion(PKM pp, LegalityAnalysis pa, PKM cp, LegalityAnalysis ca)
{
if (pp.Version == cp.Version || pp.Version == 0 || cp.Version == 0)
@@ -95,6 +100,7 @@ private static bool IsSharedVersion(PKM pp, LegalityAnalysis pa, PKM cp, Legalit
static bool IsTradedEggVersionNoUpdate(PKM pk, LegalityAnalysis la) => la.Info.Generation switch
{
2 => true, // No version stored, just ignore.
3 => true, // No egg location, assume can be traded. Doesn't update version upon hatch.
4 => pk.WasTradedEgg, // Gen4 traded eggs do not update version upon hatch.
_ => false, // Gen5+ eggs have an egg location, and update the version upon hatch.

View File

@@ -108,6 +108,14 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc
private static void HandleReportingException(Exception? ex, Exception reportingException)
{
try
{
EmergencyErrorLog(ex, reportingException);
}
catch (Exception)
{
// We've failed to even save the error details to a file. There's nothing else we can do.
}
if (reportingException is FileNotFoundException x && x.FileName?.StartsWith("PKHeX.Core") == true)
{
Error("Could not locate PKHeX.Core.dll. Make sure you're running PKHeX together with its code library. Usually caused when all files are not extracted.");
@@ -116,7 +124,6 @@ private static void HandleReportingException(Exception? ex, Exception reportingE
try
{
Error("A fatal non-UI error has occurred in PKHeX, and there was a problem displaying the details. Please report this to the author.");
EmergencyErrorLog(ex, reportingException);
}
finally
{