mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-15 08:47:14 +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)
|
private static IReadOnlyList<string> GetSaveFileErrata(this SaveFile sav, PKM pkm, IBasicStrings strings)
|
||||||
{
|
{
|
||||||
var errata = new List<string>();
|
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;
|
string? msg = null;
|
||||||
var itemstr = GameInfo.Strings.GetItemStrings(pkm.Format, (GameVersion) pkm.Version);
|
if (held > sav.MaxItemID)
|
||||||
if (held > itemstr.Count)
|
msg = MsgIndexItemGame;
|
||||||
errata.Add($"{MsgIndexItemRange} {held}");
|
|
||||||
else if (held > sav.MaxItemID)
|
|
||||||
errata.Add($"{MsgIndexItemGame} {itemstr[held]}");
|
|
||||||
else if (!pkm.CanHoldItem(sav.HeldItems))
|
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)
|
if (pkm.Species > strings.Species.Count)
|
||||||
|
|
Loading…
Reference in a new issue