Add pwt record get/set

thanks @sora10pls
This commit is contained in:
Kurt 2017-12-14 12:34:03 -08:00
parent 9a39f818f9
commit 278f7cad25
2 changed files with 53 additions and 1 deletions

View file

@ -274,7 +274,7 @@ namespace PKHeX.Core
new BlockInfo(0x22A00, 0x0850, 0x23252, 0x25F78), // Entralink Forest pokémon data (60d) new BlockInfo(0x22A00, 0x0850, 0x23252, 0x25F78), // Entralink Forest pokémon data (60d)
new BlockInfo(0x23300, 0x0284, 0x23586, 0x25F7A), // ??? new BlockInfo(0x23300, 0x0284, 0x23586, 0x25F7A), // ???
new BlockInfo(0x23600, 0x0010, 0x23612, 0x25F7C), // ??? new BlockInfo(0x23600, 0x0010, 0x23612, 0x25F7C), // ???
new BlockInfo(0x23700, 0x00a8, 0x237AA, 0x25F7E), // ??? new BlockInfo(0x23700, 0x00a8, 0x237AA, 0x25F7E), // PWT related data
new BlockInfo(0x23800, 0x016c, 0x2396E, 0x25F80), // ??? new BlockInfo(0x23800, 0x016c, 0x2396E, 0x25F80), // ???
new BlockInfo(0x23A00, 0x0080, 0x23A82, 0x25F82), // ??? new BlockInfo(0x23A00, 0x0080, 0x23A82, 0x25F82), // ???
new BlockInfo(0x23B00, 0x00fc, 0x23BFE, 0x25F84), // Hollow/Rival Block new BlockInfo(0x23B00, 0x00fc, 0x23BFE, 0x25F84), // Hollow/Rival Block
@ -613,6 +613,23 @@ namespace PKHeX.Core
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, BattleSubway); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, BattleSubway);
} }
public ushort GetPWTRecord(int id) => GetPWTRecord((PWTRecordID) id);
public ushort GetPWTRecord(PWTRecordID id)
{
if (id < PWTRecordID.Normal || id > PWTRecordID.MixMaster)
throw new ArgumentException(nameof(id));
int ofs = 0x2375C + (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)
{
if (id < PWTRecordID.Normal || id > PWTRecordID.MixMaster)
throw new ArgumentException(nameof(id));
int ofs = 0x2375C + (int)id * 2;
SetData(BitConverter.GetBytes(value), ofs);
}
protected override void SetDex(PKM pkm) protected override void SetDex(PKM pkm)
{ {
if (pkm.Species == 0) if (pkm.Species == 0)

View file

@ -0,0 +1,35 @@
namespace PKHeX.Core
{
public enum PWTRecordID
{
Normal,
Fighting,
Flying,
Poison,
Ground,
Rock,
Bug,
Ghost,
Steel,
Fire,
Water,
Grass,
Electric,
Psychic,
Ice,
Dragon,
Dark,
Champion,
Driftveil,
Unova,
Kanto,
Johto,
Hoenn,
Sinnoh,
World,
Rental,
RentalMaster,
Mix,
MixMaster
}
}