Add nickname length check for gen>2

Closes #2091
This commit is contained in:
Kurt 2018-08-14 20:13:15 -07:00
parent 75d700c171
commit 57c6de2825
2 changed files with 15 additions and 0 deletions

View file

@ -75,6 +75,11 @@ namespace PKHeX.Core
data.AddLine(GetInvalid(V222));
return true;
}
if (nickname.Length > GetNicknameMaxLength(data.Info.Generation, (LanguageID)pkm.Language))
{
data.AddLine(GetInvalid(V1));
return true;
}
data.AddLine(GetValid(V17));
}
else if (pkm.Format < 3)
@ -412,5 +417,15 @@ namespace PKHeX.Core
return true;
return ((EncounterTrade)EncounterMatch).IsNicknamed;
}
private static int GetNicknameMaxLength(int gen, LanguageID lang)
{
switch (lang)
{
case LanguageID.Korean:
case LanguageID.Japanese: return gen >= 6 ? 6 : 5;
default: return gen >= 6 ? 12 : 6;
}
}
}
}