PKHeX/PKHeX.Core/Legality/Structures/SimpleTrainerInfo.cs
Kurt 03182ebd3d Update 22.11.24
Adds support for Scarlet & Violet.

Co-Authored-By: SciresM <8676005+SciresM@users.noreply.github.com>
Co-Authored-By: Matt <17801814+sora10pls@users.noreply.github.com>
Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
2022-11-24 17:42:17 -08:00

50 lines
1.5 KiB
C#

namespace PKHeX.Core;
/// <summary>
/// Simple record containing trainer data
/// </summary>
public sealed record SimpleTrainerInfo : ITrainerInfo, IRegionOrigin
{
public string OT { get; set; } = "PKHeX";
public int TID { get; set; } = 12345;
public int SID { get; set; } = 54321;
public int Gender { get; set; }
public int Language { get; set; } = (int)LanguageID.English;
// IRegionOrigin for generation 6/7
public byte ConsoleRegion { get; set; } = 1; // North America
public byte Region { get; set; } = 7; // California
public byte Country { get; set; } = 49; // USA
public int Game { get; }
public int Generation { get; init; } = PKX.Generation;
public EntityContext Context { get; init; } = PKX.Context;
public SimpleTrainerInfo(GameVersion game = PKX.Version)
{
Game = (int) game;
SanityCheckRegionOrigin(game);
}
private void SanityCheckRegionOrigin(GameVersion game)
{
if (GameVersion.Gen7b.Contains(game) || game.GetGeneration() >= 8)
this.ClearRegionOrigin();
}
public SimpleTrainerInfo(ITrainerInfo other) : this((GameVersion)other.Game)
{
OT = other.OT;
TID = other.TID;
SID = other.SID;
Gender = other.Gender;
Language = other.Language;
Generation = other.Generation;
Context = other.Context;
if (other is IRegionOrigin r)
r.CopyRegionOrigin(this);
SanityCheckRegionOrigin((GameVersion)Game);
}
}