mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-20 20:44:08 -05:00
Rework accessors for PKMConverter trainer cache
Might break downstream users, for the better. Internal behavior had to change!
This commit is contained in:
@@ -44,7 +44,8 @@ public static string[] GetFormList(int species, IReadOnlyList<string> types, IRe
|
||||
return GetFormsGen8(species, types, forms, genders);
|
||||
}
|
||||
|
||||
private static bool IsGG() => GameVersion.GG.Contains(PKMConverter.Trainer.Game);
|
||||
// this is a hack; depends on currently loaded SaveFile's Game ID
|
||||
private static bool IsGG() => GameVersion.GG.Contains(PKMConverter.Game);
|
||||
|
||||
public static bool IsTotemForm(int species, int form, int generation = 7)
|
||||
{
|
||||
|
||||
@@ -12,12 +12,20 @@ namespace PKHeX.Core
|
||||
/// </summary>
|
||||
public static class PKMConverter
|
||||
{
|
||||
public static ITrainerInfo Trainer { internal get; set; } = new SimpleTrainerInfo();
|
||||
private static readonly ITrainerInfo Trainer67 = new SimpleTrainerInfo(GameVersion.SN);
|
||||
public static void SetPrimaryTrainer(ITrainerInfo t)
|
||||
{
|
||||
Trainer = t;
|
||||
if (t.ConsoleRegion != 0)
|
||||
Trainer67 = t;
|
||||
}
|
||||
|
||||
private static ITrainerInfo Trainer { get; set; } = new SimpleTrainerInfo();
|
||||
private static ITrainerInfo Trainer67 { get; set; } = new SimpleTrainerInfo(GameVersion.SN);
|
||||
public static string OT_Name => Trainer.OT;
|
||||
public static int OT_Gender => Trainer.Gender;
|
||||
public static int Language => Trainer.Language;
|
||||
public static int Format => Trainer.Generation;
|
||||
public static int Game => Trainer.Game;
|
||||
public static bool AllowIncompatibleConversion { private get; set; }
|
||||
|
||||
public static void SetConsoleRegionData3DS(PKM pkm)
|
||||
|
||||
@@ -738,7 +738,7 @@ private bool OpenSAV(SaveFile sav, string path)
|
||||
|
||||
PKME_Tabs.Focus(); // flush any pending changes
|
||||
StoreLegalSaveGameData(sav);
|
||||
PKMConverter.Trainer = sav;
|
||||
PKMConverter.SetPrimaryTrainer(sav);
|
||||
SpriteUtil.Initialize(sav); // refresh sprite generator
|
||||
dragout.Size = new Size(SpriteUtil.Spriter.Width, SpriteUtil.Spriter.Height);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user