2019-09-23 16:56:47 -07:00
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2020-09-09 12:47:24 -07:00
|
|
|
|
public sealed class BoxLayout8 : SaveBlock, IBoxDetailName
|
2019-09-23 16:56:47 -07:00
|
|
|
|
{
|
2019-11-15 17:34:18 -08:00
|
|
|
|
public const int BoxCount = 32;
|
2019-09-23 16:56:47 -07:00
|
|
|
|
|
2019-10-16 19:08:13 -07:00
|
|
|
|
private const int strlen = SAV6.LongStringLength / 2;
|
2019-09-23 16:56:47 -07:00
|
|
|
|
|
2019-11-15 17:34:18 -08:00
|
|
|
|
public BoxLayout8(SAV8SWSH sav, SCBlock block) : base(sav, block.Data) { }
|
2019-09-23 16:56:47 -07:00
|
|
|
|
|
2020-01-20 22:04:52 -08:00
|
|
|
|
private static int GetBoxNameOffset(int box) => SAV6.LongStringLength * box;
|
2019-09-23 16:56:47 -07:00
|
|
|
|
|
|
|
|
|
public string GetBoxName(int box)
|
|
|
|
|
{
|
2019-10-16 19:08:13 -07:00
|
|
|
|
return SAV.GetString(Data, GetBoxNameOffset(box), SAV6.LongStringLength);
|
2019-09-23 16:56:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetBoxName(int box, string value)
|
|
|
|
|
{
|
|
|
|
|
var data = SAV.SetString(value, strlen, strlen, 0);
|
2020-01-20 22:04:52 -08:00
|
|
|
|
var offset = GetBoxNameOffset(box);
|
2019-11-15 17:34:18 -08:00
|
|
|
|
SAV.SetData(Data, data, offset);
|
2019-09-23 16:56:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string this[int i]
|
|
|
|
|
{
|
|
|
|
|
get => GetBoxName(i);
|
|
|
|
|
set => SetBoxName(i, value);
|
|
|
|
|
}
|
2020-03-10 23:18:51 -07:00
|
|
|
|
|
|
|
|
|
public int CurrentBox
|
|
|
|
|
{
|
2020-03-11 16:31:53 -07:00
|
|
|
|
get => ((SAV8SWSH)SAV).GetValue<byte>(SaveBlockAccessor8SWSH.KCurrentBox);
|
2020-03-10 23:18:51 -07:00
|
|
|
|
set => ((SAV8SWSH)SAV).SetValue(SaveBlockAccessor8SWSH.KCurrentBox, (byte)value);
|
|
|
|
|
}
|
2019-09-23 16:56:47 -07:00
|
|
|
|
}
|
|
|
|
|
}
|