Update WB7.cs

This commit is contained in:
Kurt 2021-08-24 13:12:14 -07:00
parent 9f1a8d1da1
commit 5a53ae85bc

View file

@ -277,7 +277,14 @@ namespace PKHeX.Core
public int GetLanguage(int redeemLanguage)
{
var languageOffset = GetLanguageIndex(redeemLanguage);
return Data[0x1D8 + languageOffset];
var value = Data[0x1D8 + languageOffset];
if (value != 0) // Fixed receiving language
return value;
// Use redeeming language (clamped to legal values for our sake)
if (redeemLanguage is < (int)LanguageID.Japanese or (int)LanguageID.UNUSED_6 or > (int)LanguageID.ChineseT)
return (int)LanguageID.English; // fallback
return redeemLanguage;
}
public string GetNickname(int language) => StringConverter.GetString7b(Data, GetNicknameOffset(language), 0x1A);