예제 #1
0
 private bool VerifyUnNicknamedEncounter(LegalityAnalysis data, PKM pkm, string nickname)
 {
     if (pkm.IsNicknamed)
     {
         for (int i = 0; i < SpeciesName.SpeciesLang.Count; i++)
         {
             if (!SpeciesName.SpeciesDict[i].TryGetValue(nickname, out int index))
             {
                 continue;
             }
             var msg = index == pkm.Species && i != pkm.Language ? LNickMatchNoOthersFail : LNickMatchLanguageFlag;
             data.AddLine(Get(msg, Severity.Fishy));
             return(true);
         }
         if (StringConverter.HasEastAsianScriptCharacters(nickname) && !(pkm is PB7)) // East Asian Scripts
         {
             data.AddLine(GetInvalid(LNickInvalidChar));
             return(true);
         }
         if (nickname.Length > Legal.GetMaxLengthNickname(data.Info.Generation, (LanguageID)pkm.Language))
         {
             var severe = data.EncounterOriginal.EggEncounter && pkm.WasTradedEgg && nickname.Length <= Legal.GetMaxLengthNickname(data.Info.Generation, LanguageID.English)
                     ? Severity.Fishy
                     : Severity.Invalid;
             data.AddLine(Get(LNickLengthLong, severe));
             return(true);
         }
         data.AddLine(GetValid(LNickMatchNoOthers));
     }
     else if (pkm.Format < 3)
     {
         // pk1/pk2 IsNicknamed getter checks for match, logic should only reach here if matches.
         data.AddLine(GetValid(LNickMatchLanguage));
     }
     else
     {
         var  EncounterMatch = data.EncounterOriginal;
         bool valid          = IsNicknameValid(pkm, EncounterMatch, nickname);
         var  result         = valid ? GetValid(LNickMatchLanguage) : GetInvalid(LNickMatchLanguageFail);
         data.AddLine(result);
     }
     return(false);
 }