PKHeX/PKHeX.Core/Legality/Structures/ITrainerInfo.cs
Kurt ab71ea2d8b More generator updates
Graveler (SM Trade) -> Force applying handling trainer details for
ingame trades
Ponyta (Ranch Trade) Apply correct ability for encountertradePID

Up to 98 : Wild Gen2 Krabby (safari zone impossible location needs to
get filtered from possible encounters)
2018-04-29 21:29:34 -07:00

54 lines
No EOL
1.5 KiB
C#

namespace PKHeX.Core
{
/// <summary>
/// Minimal Trainer Information necessary for generating a <see cref="PKM"/>.
/// </summary>
public interface ITrainerInfo : ITrainerID
{
string OT { get; }
int Gender { get; }
int Game { get; }
int Language { get; }
int Country { get; }
int SubRegion { get; }
int ConsoleRegion { get; }
int Generation { get; }
}
public static partial class Extensions
{
public static void ApplyToPKM(this ITrainerInfo info, PKM pk)
{
pk.OT_Name = info.OT;
pk.TID = info.TID;
pk.SID = pk.Format < 3 || pk.VC ? 0 : info.SID;
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;
}
public static void ApplyHandlingTrainerInfo(this ITrainerInfo SAV, PKM pk, bool force = false)
{
if (pk.Format == SAV.Generation && !force)
return;
pk.HT_Name = SAV.OT;
pk.HT_Gender = SAV.Gender;
pk.HT_Friendship = pk.OT_Friendship;
pk.CurrentHandler = 1;
if (pk.Format == 6)
{
pk.Geo1_Country = SAV.Country;
pk.Geo1_Region = SAV.SubRegion;
((PK6)pk).TradeMemory(true);
}
}
}
}