Fix Mystery Gift edit form save

Closes #4213
Also fixes XY/AO saves not having the button available when they should
This commit is contained in:
Kurt 2024-03-11 12:47:10 -05:00
parent 5d2c20d449
commit b6739e5547
3 changed files with 6 additions and 3 deletions

View file

@ -7,7 +7,7 @@ namespace PKHeX.Core;
/// Generation 6 <see cref="SaveFile"/> object for <see cref="GameVersion.ORAS"/>.
/// </summary>
/// <inheritdoc cref="SAV6" />
public sealed class SAV6AO : SAV6, ISaveBlock6AO, IMultiplayerSprite, IBoxDetailName, IBoxDetailWallpaper, IDaycareMulti
public sealed class SAV6AO : SAV6, ISaveBlock6AO, IMultiplayerSprite, IBoxDetailName, IBoxDetailWallpaper, IMysteryGiftStorageProvider, IDaycareMulti
{
public SAV6AO(byte[] data) : base(data, SaveBlockAccessor6AO.BlockMetadataOffset)
{
@ -75,6 +75,7 @@ public sealed class SAV6AO : SAV6, ISaveBlock6AO, IMultiplayerSprite, IBoxDetail
MyItem ISaveBlock6Core.Items => Items;
SubEventLog6 ISaveBlock6Main.SUBE => SUBE;
RecordBlock6 ISaveBlock6Core.Records => Records;
IMysteryGiftStorage IMysteryGiftStorageProvider.MysteryGiftStorage => MysteryGift;
#endregion
public override bool IsVersionValid() => Version is GameVersion.AS or GameVersion.OR;

View file

@ -7,7 +7,7 @@ namespace PKHeX.Core;
/// Generation 6 <see cref="SaveFile"/> object for <see cref="GameVersion.XY"/>.
/// </summary>
/// <inheritdoc cref="SAV6" />
public sealed class SAV6XY : SAV6, ISaveBlock6XY, IMultiplayerSprite, IBoxDetailName, IBoxDetailWallpaper, IDaycareStorage, IDaycareEggState, IDaycareExperience, IDaycareRandomState<ulong>
public sealed class SAV6XY : SAV6, ISaveBlock6XY, IMultiplayerSprite, IBoxDetailName, IBoxDetailWallpaper, IMysteryGiftStorageProvider, IDaycareStorage, IDaycareEggState, IDaycareExperience, IDaycareRandomState<ulong>
{
public SAV6XY(byte[] data) : base(data, SaveBlockAccessor6XY.BlockMetadataOffset)
{
@ -71,6 +71,8 @@ public sealed class SAV6XY : SAV6, ISaveBlock6XY, IMultiplayerSprite, IBoxDetail
public SubEventLog6 SUBE => Blocks.SUBE;
public ConfigSave6 Config => Blocks.Config;
public Encount6 Encount => Blocks.Encount;
IMysteryGiftStorage IMysteryGiftStorageProvider.MysteryGiftStorage => MysteryGift;
#endregion
protected override void SetDex(PKM pk) => Blocks.Zukan.SetDex(pk);

View file

@ -27,8 +27,8 @@ public partial class SAV_Wondercard : Form
{
InitializeComponent();
WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
Cards = GetMysteryGiftProvider(sav);
SAV = (Origin = sav).Clone();
Cards = GetMysteryGiftProvider(SAV);
Album = LoadMysteryGifts();
Flags = Cards as IMysteryGiftFlags;