Add battle agency slots to main window misc viewables

This commit is contained in:
Kurt 2021-07-26 23:57:05 -07:00
parent a07880d1ba
commit 0c6254835d
5 changed files with 31 additions and 4 deletions

View file

@ -142,12 +142,19 @@ namespace PKHeX.Core
new(sav.Data, 0, sav.AllBlocks[07].Offset) {Type = StorageSlotType.GTS},
new(sav.Data, 0, sav.GetFusedSlotOffset(0)) {Type = StorageSlotType.Fused}
};
if (sav is SAV7USUM)
if (sav is SAV7USUM uu)
{
list.AddRange(new[]
{
new SlotInfoMisc(sav.Data, 1, sav.GetFusedSlotOffset(1)) {Type = StorageSlotType.Fused},
new SlotInfoMisc(sav.Data, 2, sav.GetFusedSlotOffset(2)) {Type = StorageSlotType.Fused},
new SlotInfoMisc(uu.Data, 1, uu.GetFusedSlotOffset(1)) {Type = StorageSlotType.Fused},
new SlotInfoMisc(uu.Data, 2, uu.GetFusedSlotOffset(2)) {Type = StorageSlotType.Fused},
});
var ba = uu.BattleAgency;
list.AddRange(new[]
{
new SlotInfoMisc(uu.Data, 0, ba.GetSlotOffset(0)) {Type = StorageSlotType.Misc},
new SlotInfoMisc(uu.Data, 1, ba.GetSlotOffset(1)) {Type = StorageSlotType.Misc},
new SlotInfoMisc(uu.Data, 2, ba.GetSlotOffset(2)) {Type = StorageSlotType.Misc},
});
}

View file

@ -6,7 +6,7 @@
/// <remarks>Blocks specific for <see cref="SAV7USUM"/> in addition to the <see cref="ISaveBlock7Main"/> blocks.</remarks>
public interface ISaveBlock7USUM : ISaveBlock7Main
{
// BattleFesSave
BattleAgency7 BattleAgency { get; }
// FinderStudioSave
}
}

View file

@ -77,6 +77,7 @@ namespace PKHeX.Core
Records = new RecordBlock6(sav, bi[28].Offset);
BattleTree = new BattleTree7(sav, bi[32].Offset);
Daycare = new Daycare7(sav, bi[33].Offset);
BattleAgency = new BattleAgency7(sav, bi[37].Offset);
}
public IReadOnlyList<BlockInfo7> BlockInfo => BlockInfoUSUM;
@ -101,5 +102,6 @@ namespace PKHeX.Core
public FieldMenu7 FieldMenu { get; }
public FashionBlock7 Fashion { get; }
public HallOfFame7 Fame { get; }
public BattleAgency7 BattleAgency { get; }
}
}

View file

@ -66,6 +66,7 @@ namespace PKHeX.Core
public override FieldMenu7 FieldMenu => Blocks.FieldMenu;
public override FashionBlock7 Fashion => Blocks.Fashion;
public override HallOfFame7 Fame => Blocks.Fame;
public BattleAgency7 BattleAgency => Blocks.BattleAgency;
#endregion
}
}

View file

@ -0,0 +1,17 @@
using System;
namespace PKHeX.Core
{
public sealed class BattleAgency7 : SaveBlock
{
public BattleAgency7(SAV7USUM sav, int offset) : base(sav) => Offset = offset;
public int GetSlotOffset(int slot) => Offset + slot switch
{
0 => 0,
1 => PokeCrypto.SIZE_6STORED,
2 => 0x220,
_ => throw new ArgumentOutOfRangeException(nameof(slot)),
};
}
}