mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 00:37:11 +00:00
Only fetch strings when required for compat check
if item == 0, don't bother checking. Fetch strings only if there's an issue with the item.
This commit is contained in:
parent
63ee520e75
commit
527442bb49
1 changed files with 11 additions and 8 deletions
|
@ -75,16 +75,19 @@ namespace PKHeX.Core
|
|||
private static IReadOnlyList<string> GetSaveFileErrata(this SaveFile sav, PKM pkm, IBasicStrings strings)
|
||||
{
|
||||
var errata = new List<string>();
|
||||
if (sav.Generation > 1)
|
||||
ushort held = (ushort)pkm.HeldItem;
|
||||
if (sav.Generation > 1 && held != 0)
|
||||
{
|
||||
ushort held = (ushort)pkm.HeldItem;
|
||||
var itemstr = GameInfo.Strings.GetItemStrings(pkm.Format, (GameVersion) pkm.Version);
|
||||
if (held > itemstr.Count)
|
||||
errata.Add($"{MsgIndexItemRange} {held}");
|
||||
else if (held > sav.MaxItemID)
|
||||
errata.Add($"{MsgIndexItemGame} {itemstr[held]}");
|
||||
string? msg = null;
|
||||
if (held > sav.MaxItemID)
|
||||
msg = MsgIndexItemGame;
|
||||
else if (!pkm.CanHoldItem(sav.HeldItems))
|
||||
errata.Add($"{MsgIndexItemHeld} {itemstr[held]}");
|
||||
msg = MsgIndexItemHeld;
|
||||
if (msg != null)
|
||||
{
|
||||
var itemstr = GameInfo.Strings.GetItemStrings(pkm.Format, (GameVersion)pkm.Version);
|
||||
errata.Add($"{msg} {(held >= itemstr.Count ? held.ToString() : itemstr[held])}");
|
||||
}
|
||||
}
|
||||
|
||||
if (pkm.Species > strings.Species.Count)
|
||||
|
|
Loading…
Reference in a new issue