Ejemplo n.º 1
0
 /// <summary>
 /// Clone trainerdata and mutate the language and then return the clone
 /// </summary>
 /// <param name="tr">Trainerdata to clone</param>
 /// <param name="lang">language to mutate</param>
 /// <returns></returns>
 public static ITrainerInfo MutateLanguage(this ITrainerInfo tr, LanguageID?lang, GameVersion ver)
 {
     if (lang is LanguageID.UNUSED_6 or LanguageID.Hacked or null)
     {
         return(tr);
     }
     if (tr is PokeTrainerDetails p)
     {
         var clone = PokeTrainerDetails.Clone(p);
         clone.Language = (int)lang;
         clone.OT       = MutateOT(clone.OT, lang, ver);
         return(clone);
     }
     if (tr is SimpleTrainerInfo s)
     {
         var version = GameUtil.GameVersions.FirstOrDefault(z => ver.Contains(z) && z != GameVersion.BU);
         return(new SimpleTrainerInfo(version)
         {
             OT = MutateOT(s.OT, lang, version),
             TID = s.TID,
             SID = s.SID,
             Gender = s.Gender,
             Language = (int)lang,
             ConsoleRegion = s.ConsoleRegion != 0 ? s.ConsoleRegion : (byte)1,
             Region = s.Region != 0 ? s.Region : (byte)7,
             Country = s.Country != 0 ? s.Country : (byte)49,
             Generation = s.Generation,
         });
     }
     return(tr);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Clone trainerdata and mutate the language and then return the clone
 /// </summary>
 /// <param name="tr">Trainerdata to clone</param>
 /// <param name="lang">language to mutate</param>
 /// <returns></returns>
 public static ITrainerInfo MutateLanguage(this ITrainerInfo tr, LanguageID?lang)
 {
     if (lang is LanguageID.UNUSED_6 or LanguageID.Hacked or null)
     {
         return(tr);
     }
     if (tr is PokeTrainerDetails p)
     {
         var clone = PokeTrainerDetails.Clone(p);
         clone.Language = (int)lang;
         return(clone);
     }
     if (tr is SimpleTrainerInfo s)
     {
         return(new SimpleTrainerInfo((GameVersion)s.Game)
         {
             OT = s.OT,
             TID = s.TID,
             SID = s.SID,
             Gender = s.Gender,
             Language = (int)lang,
             ConsoleRegion = s.ConsoleRegion,
             Region = s.Region,
             Country = s.Country,
             Generation = s.Generation
         });
     }
     return(tr);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Clone trainerdata and mutate the language and then return the clone
 /// </summary>
 /// <param name="tr">Trainerdata to clone</param>
 /// <param name="lang">language to mutate</param>
 /// <returns></returns>
 public static ITrainerInfo MutateLanguage(this ITrainerInfo tr, LanguageID?lang)
 {
     if (lang == LanguageID.UNUSED_6 || lang == LanguageID.Hacked || lang == null)
     {
         return(tr);
     }
     if (tr is PokeTrainerDetails p)
     {
         var clone = PokeTrainerDetails.Clone(p);
         clone.Language = (int)lang;
         return(clone);
     }
     if (tr is SimpleTrainerInfo s)
     {
         var sti = new SimpleTrainerInfo((GameVersion)s.Game);
         sti.OT            = s.OT;
         sti.TID           = s.TID;
         sti.SID           = s.SID;
         sti.Generation    = s.Gender;
         sti.Language      = (int)lang;
         sti.ConsoleRegion = s.ConsoleRegion;
         sti.Region        = s.Region;
         sti.Country       = s.Country;
         sti.Generation    = s.Generation;
         return(sti);
     }
     return(tr);
 }