2019-06-09 02:56:11 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2019-10-04 02:09:02 +00:00
|
|
|
|
public sealed class PWTBlock5 : SaveBlock
|
2019-06-09 02:56:11 +00:00
|
|
|
|
{
|
|
|
|
|
public PWTBlock5(SAV5B2W2 sav, int offset) : base(sav) => Offset = offset;
|
|
|
|
|
|
|
|
|
|
public ushort GetPWTRecord(int id) => GetPWTRecord((PWTRecordID)id);
|
|
|
|
|
|
|
|
|
|
public ushort GetPWTRecord(PWTRecordID id)
|
|
|
|
|
{
|
2020-12-25 20:30:26 +00:00
|
|
|
|
if (id is < PWTRecordID.Normal or > PWTRecordID.MixMaster)
|
2019-06-09 02:56:11 +00:00
|
|
|
|
throw new ArgumentException(nameof(id));
|
|
|
|
|
int ofs = Offset + 0x5C + ((int)id * 2);
|
|
|
|
|
return BitConverter.ToUInt16(Data, ofs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetPWTRecord(int id, ushort value) => SetPWTRecord((PWTRecordID)id, value);
|
|
|
|
|
|
|
|
|
|
public void SetPWTRecord(PWTRecordID id, ushort value)
|
|
|
|
|
{
|
2020-12-25 20:30:26 +00:00
|
|
|
|
if (id is < PWTRecordID.Normal or > PWTRecordID.MixMaster)
|
2019-06-09 02:56:11 +00:00
|
|
|
|
throw new ArgumentException(nameof(id));
|
|
|
|
|
int ofs = Offset + 0x5C + ((int)id * 2);
|
|
|
|
|
SAV.SetData(BitConverter.GetBytes(value), ofs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|