2018-03-28 22:55:19 +00:00
|
|
|
namespace PKHeX.Core
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Minimal Trainer Information necessary for generating a <see cref="PKM"/>.
|
|
|
|
/// </summary>
|
2018-04-28 18:06:58 +00:00
|
|
|
public interface ITrainerInfo : ITrainerID
|
2018-03-28 22:55:19 +00:00
|
|
|
{
|
|
|
|
string OT { get; }
|
|
|
|
int Gender { get; }
|
|
|
|
int Game { get; }
|
|
|
|
int Language { get; }
|
|
|
|
|
|
|
|
int Country { get; }
|
|
|
|
int SubRegion { get; }
|
|
|
|
int ConsoleRegion { get; }
|
|
|
|
|
|
|
|
int Generation { get; }
|
|
|
|
}
|
2018-03-29 03:34:58 +00:00
|
|
|
|
|
|
|
public static partial class Extensions
|
|
|
|
{
|
|
|
|
public static void ApplyToPKM(this ITrainerInfo info, PKM pk)
|
|
|
|
{
|
|
|
|
pk.OT_Name = info.OT;
|
|
|
|
pk.TID = info.TID;
|
2018-04-01 03:37:36 +00:00
|
|
|
pk.SID = pk.Format < 3 || pk.VC ? 0 : info.SID;
|
2018-03-29 03:34:58 +00:00
|
|
|
pk.OT_Gender = info.Gender;
|
|
|
|
pk.Language = info.Language;
|
|
|
|
pk.Version = info.Game;
|
|
|
|
|
|
|
|
pk.Country = info.Country;
|
|
|
|
pk.Region = info.SubRegion;
|
|
|
|
pk.ConsoleRegion = info.ConsoleRegion;
|
|
|
|
}
|
2018-03-30 04:00:38 +00:00
|
|
|
|
2018-04-30 04:29:34 +00:00
|
|
|
public static void ApplyHandlingTrainerInfo(this ITrainerInfo SAV, PKM pk, bool force = false)
|
2018-03-30 04:00:38 +00:00
|
|
|
{
|
2018-04-30 04:29:34 +00:00
|
|
|
if (pk.Format == SAV.Generation && !force)
|
2018-03-30 04:00:38 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
pk.HT_Name = SAV.OT;
|
|
|
|
pk.HT_Gender = SAV.Gender;
|
|
|
|
pk.HT_Friendship = pk.OT_Friendship;
|
|
|
|
pk.CurrentHandler = 1;
|
|
|
|
|
2018-04-01 03:37:36 +00:00
|
|
|
if (pk.Format == 6)
|
2018-03-30 04:00:38 +00:00
|
|
|
{
|
|
|
|
pk.Geo1_Country = SAV.Country;
|
|
|
|
pk.Geo1_Region = SAV.SubRegion;
|
2018-04-28 22:58:53 +00:00
|
|
|
((PK6)pk).TradeMemory(true);
|
2018-03-30 04:00:38 +00:00
|
|
|
}
|
|
|
|
}
|
2018-03-29 03:34:58 +00:00
|
|
|
}
|
2018-03-28 22:55:19 +00:00
|
|
|
}
|