mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Extend core api
add copy/fetch new
This commit is contained in:
parent
4cc31ea5e2
commit
314a92b67b
3 changed files with 27 additions and 0 deletions
|
@ -7,4 +7,9 @@
|
|||
{
|
||||
int Generation { get; set; }
|
||||
}
|
||||
|
||||
public static partial class Extensions
|
||||
{
|
||||
internal static PKM GetBlank(this IGeneration gen) => PKMConverter.GetBlank(gen.Generation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,4 +18,21 @@ namespace PKHeX.Core
|
|||
|
||||
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 = 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -458,5 +458,10 @@ namespace PKHeX.Core
|
|||
var argCount = constructors.First().GetParameters().Length;
|
||||
return (PKM)Activator.CreateInstance(t, new object[argCount]);
|
||||
}
|
||||
public static PKM GetBlank(int gen)
|
||||
{
|
||||
var type = Type.GetType($"PKHeX.Core.PK{gen}");
|
||||
return GetBlank(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue