2018-04-28 18:06:58 +00:00
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Object has Trainer ownership
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface ITrainerID
|
|
|
|
|
{
|
|
|
|
|
int TID { get; set; }
|
|
|
|
|
int SID { get; set; }
|
|
|
|
|
}
|
2018-07-27 02:34:27 +00:00
|
|
|
|
|
|
|
|
|
public static partial class Extensions
|
|
|
|
|
{
|
|
|
|
|
public static int GetTrainerIDFormat(this ITrainerID tr)
|
|
|
|
|
{
|
|
|
|
|
if (tr is PKM p)
|
|
|
|
|
{
|
|
|
|
|
var format = p.GenNumber;
|
|
|
|
|
if ((format < 3 && p.Format >= 7) || format <= 0) // VC or bad gen
|
|
|
|
|
return 4; // use TID/SID 16bit style
|
|
|
|
|
return format;
|
|
|
|
|
}
|
|
|
|
|
if (tr is SaveFile s)
|
|
|
|
|
return s.Generation;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-28 18:06:58 +00:00
|
|
|
|
}
|