Fix chinese language ID check

Some species have the same unicode name in CHS and in CHT, so it will lose language info after converting from a in-game string to textbox (The game will use different fonts to distinguish them, bad GF)
This change will give CHT encoding a higher priorty if the pkm is in CHT, although it's possible to get CHS encoding default species name with CHT language ID.
Also fixed previous editing error
This commit is contained in:
wwwwwwzx 2017-12-14 19:30:59 -08:00
parent b5640de538
commit 6c4a4ff4ec
3 changed files with 7 additions and 3 deletions

View File

@ -226,7 +226,7 @@ public override string Nickname
{
if (!IsNicknamed)
{
int lang = PKX.GetSpeciesNameLanguage(Species, value, 7);
int lang = PKX.GetSpeciesNameLanguage(Species, value, 7, Language);
if (lang == 9 || lang == 10)
{
StringConverter.SetString7(value, 12, lang, chinese: true).CopyTo(Data, 0x40);

View File

@ -266,11 +266,15 @@ private static IEnumerable<int> GetAvailableGameLanguages(int generation)
/// <param name="species">National Dex number of the Pokémon. Should be 0 if an egg.</param>
/// <param name="nick">Current name</param>
/// <param name="generation">Generation specific formatting option</param>
/// <param name="priorlang">Language ID with a higher priority</param>
/// <returns>Language ID if it does not match any language name, -1 if no matches</returns>
public static int GetSpeciesNameLanguage(int species, string nick, int generation)
public static int GetSpeciesNameLanguage(int species, string nick, int generation, int priorlang = -1)
{
var langs = GetAvailableGameLanguages(generation);
if (langs.Contains(priorlang) && GetSpeciesNameGeneration(species, priorlang, generation) == nick)
return priorlang;
foreach (var lang in langs)
if (GetSpeciesNameGeneration(species, lang, generation) == nick)
return lang;

View File

@ -3,5 +3,5 @@
433 卡璞蝶蝶 01:可对战,02:已击倒,03:已捕获
434 卡璞哞哞 01:可对战,02:已击倒,03:已捕获
404 卡璞鳍鳍 03:可对战,04:已击倒,05:已捕获
755 基格尔德 01:可对战,02:已击倒,03:已捕获
755 基格尔德 01:可对战,02:已击倒,05:已捕获
867 霸主礼物 00:未领取,01:领取了1只,02:领取了2只,03:领取了3只,04:领取了4只,05:领取了5只,06:已全部领取