private void VerifyNicknameEgg(LegalityAnalysis data) { var Info = data.Info; var pkm = data.pkm; var EncounterMatch = Info.EncounterMatch; switch (pkm.Format) { case 4: if (pkm.IsNicknamed) // gen4 doesn't use the nickname flag for eggs { data.AddLine(GetInvalid(LNickFlagEggNo, CheckIdentifier.Egg)); } break; case 7: if (EncounterMatch is EncounterStatic ^ !pkm.IsNicknamed) // gen7 doesn't use for ingame gifts { data.AddLine(GetInvalid(pkm.IsNicknamed ? LNickFlagEggNo : LNickFlagEggYes, CheckIdentifier.Egg)); } break; default: if (!pkm.IsNicknamed) { data.AddLine(GetInvalid(LNickFlagEggYes, CheckIdentifier.Egg)); } break; } if (pkm.Format == 2 && pkm.IsEgg && !SpeciesName.IsNicknamedAnyLanguage(0, pkm.Nickname, 2)) { data.AddLine(GetValid(LNickMatchLanguageEgg, CheckIdentifier.Egg)); } else if (SpeciesName.GetSpeciesNameGeneration(0, pkm.Language, Info.Generation) != pkm.Nickname) { data.AddLine(GetInvalid(LNickMatchLanguageEggFail, CheckIdentifier.Egg)); } else { data.AddLine(GetValid(LNickMatchLanguageEgg, CheckIdentifier.Egg)); } }
protected override byte[] GetNonNickname(int language) { var name = SpeciesName.GetSpeciesNameGeneration(Species, language, Format); var len = Nickname_Trash.Length; byte[] data = new byte[len]; SetString(name.AsSpan(), data, len, StringConverterOption.Clear50); if (!Korean) { // Decimal point<->period fix for (int i = 0; i < data.Length; i++) { if (data[i] == 0xF2) { data[i] = 0xE8; } } } return(data); }
private bool IsNicknameValid(PKM pkm, IEncounterable EncounterMatch, string nickname) { if (SpeciesName.GetSpeciesNameGeneration(pkm.Species, pkm.Language, pkm.Format) == nickname) { return(true); } // Can't have another language name if it hasn't evolved or wasn't a language-traded egg. bool evolved = EncounterMatch.Species != pkm.Species; bool canHaveAnyLanguage = evolved || pkm.WasTradedEgg; if (canHaveAnyLanguage && !SpeciesName.IsNicknamedAnyLanguage(pkm.Species, nickname, pkm.Format)) { return(true); } switch (EncounterMatch) { case WC7 wc7 when wc7.IsAshGreninjaWC7(pkm): return(true); case ILangNick loc: if (loc.Language != 0 && !loc.IsNicknamed && !SpeciesName.IsNicknamedAnyLanguage(pkm.Species, nickname, pkm.Format)) { return(true); // fixed language without nickname, nice job event maker! } break; } if (pkm.Format == 5 && !pkm.IsNative) // transfer { if (canHaveAnyLanguage) { return(!SpeciesName.IsNicknamedAnyLanguage(pkm.Species, nickname, 4)); } return(SpeciesName.GetSpeciesNameGeneration(pkm.Species, pkm.Language, 4) == nickname); } return(false); }