diff --git a/PKHeX.Core/MysteryGifts/MysteryGift.cs b/PKHeX.Core/MysteryGifts/MysteryGift.cs index 37cddcc0d..d6863a153 100644 --- a/PKHeX.Core/MysteryGifts/MysteryGift.cs +++ b/PKHeX.Core/MysteryGifts/MysteryGift.cs @@ -95,7 +95,7 @@ public MysteryGift Clone() public string Name => $"Event Gift ({Type})"; // Properties - public virtual int Species { get { return -1; } set { } } + public virtual int Species { get => -1; set { } } public abstract bool GiftUsed { get; set; } public abstract string CardTitle { get; set; } public abstract int CardID { get; set; } @@ -104,14 +104,14 @@ public MysteryGift Clone() public abstract int Item { get; set; } public abstract bool IsPokémon { get; set; } - public virtual int Quantity { get { return 1; } set { } } + public virtual int Quantity { get => 1; set { } } public bool Empty => Data.SequenceEqual(new byte[Data.Length]); - public virtual bool IsBP { get { return false; } set { } } - public virtual int BP { get { return 0; } set { } } - public virtual bool IsBean { get { return false; } set { } } - public virtual int Bean { get { return 0; } set { } } - public virtual int BeanCount { get { return 0; } set { } } + public virtual bool IsBP { get => false; set { } } + public virtual int BP { get => 0; set { } } + public virtual bool IsBean { get => false; set { } } + public virtual int Bean { get => 0; set { } } + public virtual int BeanCount { get => 0; set { } } public string getCardHeader() => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}"; @@ -124,11 +124,11 @@ public override int GetHashCode() } // Search Properties - public virtual int[] Moves { get { return new int[4]; } set { } } - public virtual int[] RelearnMoves { get { return new int[4]; } set { } } + public virtual int[] Moves { get => new int[4]; set { } } + public virtual int[] RelearnMoves { get => new int[4]; set { } } public virtual bool IsShiny => false; - public virtual bool IsEgg { get { return false; } set { } } - public virtual int HeldItem { get { return -1; } set { } } + public virtual bool IsEgg { get => false; set { } } + public virtual int HeldItem { get => -1; set { } } public virtual object Content => this; public abstract int Level { get; set; } diff --git a/PKHeX.Core/MysteryGifts/PGF.cs b/PKHeX.Core/MysteryGifts/PGF.cs index f6d03ce81..ac95ffa43 100644 --- a/PKHeX.Core/MysteryGifts/PGF.cs +++ b/PKHeX.Core/MysteryGifts/PGF.cs @@ -15,84 +15,84 @@ public PGF(byte[] data = null) else Data = (byte[])data.Clone(); } - public ushort TID { get { return BitConverter.ToUInt16(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } } - public ushort SID { get { return BitConverter.ToUInt16(Data, 0x02); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x02); } } - public int OriginGame { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } } + public ushort TID { get => BitConverter.ToUInt16(Data, 0x00); set => BitConverter.GetBytes(value).CopyTo(Data, 0x00); } + public ushort SID { get => BitConverter.ToUInt16(Data, 0x02); set => BitConverter.GetBytes(value).CopyTo(Data, 0x02); } + public int OriginGame { get => Data[0x04]; set => Data[0x04] = (byte)value; } // Unused 0x05 0x06, 0x07 - public uint PID { get { return BitConverter.ToUInt32(Data, 0x08); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x08); } } + public uint PID { get => BitConverter.ToUInt32(Data, 0x08); set => BitConverter.GetBytes(value).CopyTo(Data, 0x08); } - private byte RIB0 { get { return Data[0x0C]; } set { Data[0x0C] = value; } } - public bool RibbonCountry { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Country Ribbon - public bool RibbonNational { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // National Ribbon - public bool RibbonEarth { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Earth Ribbon - public bool RibbonWorld { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // World Ribbon - public bool RibbonClassic { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Classic Ribbon - public bool RibbonPremier { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Premier Ribbon - public bool RibbonEvent { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Event Ribbon - public bool RibbonBirthday { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Birthday Ribbon - private byte RIB1 { get { return Data[0x0D]; } set { Data[0x0D] = value; } } - public bool RibbonSpecial { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Special Ribbon - public bool RibbonSouvenir { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Souvenir Ribbon - public bool RibbonWishing { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Wishing Ribbon - public bool RibbonChampionBattle { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Battle Champ Ribbon - public bool RibbonChampionRegional { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Regional Champ Ribbon - public bool RibbonChampionNational { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // National Champ Ribbon - public bool RibbonChampionWorld { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // World Champ Ribbon - public bool RIB1_7 { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Empty + private byte RIB0 { get => Data[0x0C]; set => Data[0x0C] = value; } + public bool RibbonCountry { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Country Ribbon + public bool RibbonNational { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // National Ribbon + public bool RibbonEarth { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Earth Ribbon + public bool RibbonWorld { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // World Ribbon + public bool RibbonClassic { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Classic Ribbon + public bool RibbonPremier { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Premier Ribbon + public bool RibbonEvent { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Event Ribbon + public bool RibbonBirthday { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Birthday Ribbon + private byte RIB1 { get => Data[0x0D]; set => Data[0x0D] = value; } + public bool RibbonSpecial { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Special Ribbon + public bool RibbonSouvenir { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Souvenir Ribbon + public bool RibbonWishing { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Wishing Ribbon + public bool RibbonChampionBattle { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Battle Champ Ribbon + public bool RibbonChampionRegional { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Regional Champ Ribbon + public bool RibbonChampionNational { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // National Champ Ribbon + public bool RibbonChampionWorld { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // World Champ Ribbon + public bool RIB1_7 { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Empty - public override int Ball { get { return Data[0x0E]; } set { Data[0x0E] = (byte)value; } } - public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } } - public int Move1 { get { return BitConverter.ToUInt16(Data, 0x12); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } } - public int Move2 { get { return BitConverter.ToUInt16(Data, 0x14); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); } } - public int Move3 { get { return BitConverter.ToUInt16(Data, 0x16); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x16); } } - public int Move4 { get { return BitConverter.ToUInt16(Data, 0x18); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } } - public override int Species { get { return BitConverter.ToUInt16(Data, 0x1A); } set { BitConverter.GetBytes((ushort) value).CopyTo(Data, 0x1A); } } - public int Form { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } } - public int Language { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } } + public override int Ball { get => Data[0x0E]; set => Data[0x0E] = (byte)value; } + public override int HeldItem { get => BitConverter.ToUInt16(Data, 0x10); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } + public int Move1 { get => BitConverter.ToUInt16(Data, 0x12); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } + public int Move2 { get => BitConverter.ToUInt16(Data, 0x14); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); } + public int Move3 { get => BitConverter.ToUInt16(Data, 0x16); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x16); } + public int Move4 { get => BitConverter.ToUInt16(Data, 0x18); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } + public override int Species { get => BitConverter.ToUInt16(Data, 0x1A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1A); } + public int Form { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public int Language { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } public string Nickname { - get { return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x1E, 0x16)); } - set { Encoding.Unicode.GetBytes(value.PadRight(0xB, (char)0xFFFF)).CopyTo(Data, 0x1E); } + get => PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x1E, 0x16)); + set => Encoding.Unicode.GetBytes(value.PadRight(0xB, (char)0xFFFF)).CopyTo(Data, 0x1E); } - public int Nature { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } } - public int Gender { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } } - public int AbilityType { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } } - public int PIDType { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } } - public ushort EggLocation { get { return BitConverter.ToUInt16(Data, 0x38); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x38); } } - public ushort MetLocation { get { return BitConverter.ToUInt16(Data, 0x3A); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x3A); } } - public int MetLevel { get { return Data[0x3C]; } set { Data[0x3C] = (byte)value; } } - public int CNT_Cool { get { return Data[0x3D]; } set { Data[0x3D] = (byte)value; } } - public int CNT_Beauty { get { return Data[0x3E]; } set { Data[0x3E] = (byte)value; } } - public int CNT_Cute { get { return Data[0x3F]; } set { Data[0x3F] = (byte)value; } } - public int CNT_Smart { get { return Data[0x40]; } set { Data[0x40] = (byte)value; } } - public int CNT_Tough { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } } - public int CNT_Sheen { get { return Data[0x42]; } set { Data[0x42] = (byte)value; } } - public int IV_HP { get { return Data[0x43]; } set { Data[0x43] = (byte)value; } } - public int IV_ATK { get { return Data[0x44]; } set { Data[0x44] = (byte)value; } } - public int IV_DEF { get { return Data[0x45]; } set { Data[0x45] = (byte)value; } } - public int IV_SPE { get { return Data[0x46]; } set { Data[0x46] = (byte)value; } } - public int IV_SPA { get { return Data[0x47]; } set { Data[0x47] = (byte)value; } } - public int IV_SPD { get { return Data[0x48]; } set { Data[0x48] = (byte)value; } } + public int Nature { get => Data[0x34]; set => Data[0x34] = (byte)value; } + public int Gender { get => Data[0x35]; set => Data[0x35] = (byte)value; } + public int AbilityType { get => Data[0x36]; set => Data[0x36] = (byte)value; } + public int PIDType { get => Data[0x37]; set => Data[0x37] = (byte)value; } + public ushort EggLocation { get => BitConverter.ToUInt16(Data, 0x38); set => BitConverter.GetBytes(value).CopyTo(Data, 0x38); } + public ushort MetLocation { get => BitConverter.ToUInt16(Data, 0x3A); set => BitConverter.GetBytes(value).CopyTo(Data, 0x3A); } + public int MetLevel { get => Data[0x3C]; set => Data[0x3C] = (byte)value; } + public int CNT_Cool { get => Data[0x3D]; set => Data[0x3D] = (byte)value; } + public int CNT_Beauty { get => Data[0x3E]; set => Data[0x3E] = (byte)value; } + public int CNT_Cute { get => Data[0x3F]; set => Data[0x3F] = (byte)value; } + public int CNT_Smart { get => Data[0x40]; set => Data[0x40] = (byte)value; } + public int CNT_Tough { get => Data[0x41]; set => Data[0x41] = (byte)value; } + public int CNT_Sheen { get => Data[0x42]; set => Data[0x42] = (byte)value; } + public int IV_HP { get => Data[0x43]; set => Data[0x43] = (byte)value; } + public int IV_ATK { get => Data[0x44]; set => Data[0x44] = (byte)value; } + public int IV_DEF { get => Data[0x45]; set => Data[0x45] = (byte)value; } + public int IV_SPE { get => Data[0x46]; set => Data[0x46] = (byte)value; } + public int IV_SPA { get => Data[0x47]; set => Data[0x47] = (byte)value; } + public int IV_SPD { get => Data[0x48]; set => Data[0x48] = (byte)value; } // Unused 0x49 public string OT { - get { return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x4A, 0x10)); } - set { Encoding.Unicode.GetBytes(value.PadRight(0x08, (char)0xFFFF)).CopyTo(Data, 0x4A); } } - public int OTGender { get { return Data[0x5A]; } set { Data[0x5A] = (byte)value; } } - public override int Level { get { return Data[0x5B]; } set { Data[0x5C] = (byte)value; } } - public override bool IsEgg { get { return Data[0x5C] == 1; } set { Data[0x5C] = (byte)(value ? 1 : 0); } } + get => PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x4A, 0x10)); + set => Encoding.Unicode.GetBytes(value.PadRight(0x08, (char)0xFFFF)).CopyTo(Data, 0x4A); } + public int OTGender { get => Data[0x5A]; set => Data[0x5A] = (byte)value; } + public override int Level { get => Data[0x5B]; set => Data[0x5C] = (byte)value; } + public override bool IsEgg { get => Data[0x5C] == 1; set => Data[0x5C] = (byte)(value ? 1 : 0); } // Unused 0x5D 0x5E 0x5F public override string CardTitle { - get { return PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x60, 0x4A)); } - set { Encoding.Unicode.GetBytes((value + '\uFFFF').PadRight(0x4A/2, '\0')).CopyTo(Data, 0x60); } + get => PKX.TrimFromFFFF(Encoding.Unicode.GetString(Data, 0x60, 0x4A)); + set => Encoding.Unicode.GetBytes((value + '\uFFFF').PadRight(0x4A / 2, '\0')).CopyTo(Data, 0x60); } // Card Attributes - public override int Item { get { return BitConverter.ToUInt16(Data, 0x00); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } } + public override int Item { get => BitConverter.ToUInt16(Data, 0x00); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } - private ushort Year { get { return BitConverter.ToUInt16(Data, 0xAE); } set { BitConverter.GetBytes(value).CopyTo(Data, 0xAE); } } - private byte Month { get { return Data[0xAD]; } set { Data[0xAD] = value; } } - private byte Day { get { return Data[0xAC]; } set { Data[0xAC] = value; } } + private ushort Year { get => BitConverter.ToUInt16(Data, 0xAE); set => BitConverter.GetBytes(value).CopyTo(Data, 0xAE); } + private byte Month { get => Data[0xAD]; set => Data[0xAD] = value; } + private byte Day { get => Data[0xAC]; set => Data[0xAC] = value; } /// /// Gets or sets the date of the card. @@ -130,22 +130,22 @@ public override string CardTitle public override int CardID { - get { return BitConverter.ToUInt16(Data, 0xB0); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xB0); } + get => BitConverter.ToUInt16(Data, 0xB0); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xB0); } - public int CardLocation { get { return Data[0xB2]; } set { Data[0xB2] = (byte)value; } } - public int CardType { get { return Data[0xB3]; } set { Data[0xB3] = (byte)value; } } - public override bool GiftUsed { get { return Data[0xB4] >> 1 > 0; } set { Data[0xB4] = (byte)(Data[0xB4] & ~2 | (value ? 2 : 0)); } } - public bool MultiObtain { get { return Data[0xB4] == 1; } set { Data[0xB4] = (byte)(value ? 1 : 0); } } + public int CardLocation { get => Data[0xB2]; set => Data[0xB2] = (byte)value; } + public int CardType { get => Data[0xB3]; set => Data[0xB3] = (byte)value; } + public override bool GiftUsed { get => Data[0xB4] >> 1 > 0; set => Data[0xB4] = (byte)(Data[0xB4] & ~2 | (value ? 2 : 0)); } + public bool MultiObtain { get => Data[0xB4] == 1; set => Data[0xB4] = (byte)(value ? 1 : 0); } // Meta Accessible Properties public int[] IVs => new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; public bool IsNicknamed => Nickname.Length > 0; public override int[] Moves => new[] { Move1, Move2, Move3, Move4 }; - public override bool IsPokémon { get { return CardType == 1; } set { if (value) CardType = 1; } } - public override bool IsItem { get { return CardType == 2; } set { if (value) CardType = 2; } } - public bool IsPower { get { return CardType == 3; } set { if (value) CardType = 3; } } + public override bool IsPokémon { get => CardType == 1; set { if (value) CardType = 1; } } + public override bool IsItem { get => CardType == 2; set { if (value) CardType = 2; } } + public bool IsPower { get => CardType == 3; set { if (value) CardType = 3; } } public override PKM convertToPKM(SaveFile SAV) { diff --git a/PKHeX.Core/MysteryGifts/PGT.cs b/PKHeX.Core/MysteryGifts/PGT.cs index aceca34a0..96f3b9c87 100644 --- a/PKHeX.Core/MysteryGifts/PGT.cs +++ b/PKHeX.Core/MysteryGifts/PGT.cs @@ -14,13 +14,13 @@ public sealed class PCD : MysteryGift public override int Format => 4; public override int Level { - get { return Gift.Level; } - set { Gift.Level = value; } + get => Gift.Level; + set => Gift.Level = value; } public override int Ball { - get { return Gift.Ball; } - set { Gift.Ball = value; } + get => Gift.Ball; + set => Gift.Ball = value; } public PCD(byte[] data = null) @@ -36,7 +36,7 @@ public PGT Gift Array.Copy(Data, 0, giftData, 0, PGT.Size); return new PGT(giftData); } - set { value?.Data.CopyTo(Data, 0); } + set => value?.Data.CopyTo(Data, 0); } public byte[] Information { @@ -46,21 +46,21 @@ public byte[] Information Array.Copy(Data, PGT.Size, data, 0, data.Length); return data; } - set { value?.CopyTo(Data, Data.Length - PGT.Size); } + set => value?.CopyTo(Data, Data.Length - PGT.Size); } public override object Content => Gift.PK; - public override bool GiftUsed { get { return Gift.GiftUsed; } set { Gift.GiftUsed = value; } } - public override bool IsPokémon { get { return Gift.IsPokémon; } set { Gift.IsPokémon = value; } } - public override bool IsItem { get { return Gift.IsItem; } set { Gift.IsItem = value; } } - public override int Item { get { return Gift.Item; } set { Gift.Item = value; } } + public override bool GiftUsed { get => Gift.GiftUsed; set => Gift.GiftUsed = value; } + public override bool IsPokémon { get => Gift.IsPokémon; set => Gift.IsPokémon = value; } + public override bool IsItem { get => Gift.IsItem; set => Gift.IsItem = value; } + public override int Item { get => Gift.Item; set => Gift.Item = value; } public override int CardID { - get { return BitConverter.ToUInt16(Data, 0x150); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x150); } + get => BitConverter.ToUInt16(Data, 0x150); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x150); } public override string CardTitle { - get { return PKX.getString4(Data, 0x104, 0x48); } + get => PKX.getString4(Data, 0x104, 0x48); set { byte[] data = PKX.setString4(value, 0x48/2-1, 0x48/2, 0xFFFF); @@ -72,11 +72,11 @@ public override string CardTitle } } - public override int Species { get { return Gift.IsManaphyEgg ? 490 : Gift.Species; } set { Gift.Species = value; } } - public override int[] Moves { get { return Gift.Moves; } set { Gift.Moves = value; } } - public override int HeldItem { get { return Gift.HeldItem; } set { Gift.HeldItem = value; } } + public override int Species { get => Gift.IsManaphyEgg ? 490 : Gift.Species; set => Gift.Species = value; } + public override int[] Moves { get => Gift.Moves; set => Gift.Moves = value; } + public override int HeldItem { get => Gift.HeldItem; set => Gift.HeldItem = value; } public override bool IsShiny => Gift.IsShiny; - public override bool IsEgg { get { return Gift.IsEgg; } set { Gift.IsEgg = value; } } + public override bool IsEgg { get => Gift.IsEgg; set => Gift.IsEgg = value; } public bool GiftEquals(PGT pgt) { @@ -106,12 +106,12 @@ public sealed class PGT : MysteryGift public override int Format => 4; public override int Level { - get { return IsPokémon ? PK.Met_Level : 0; } + get => IsPokémon ? PK.Met_Level : 0; set { if (IsPokémon) PK.Met_Level = value; } } public override int Ball { - get { return IsPokémon ? PK.Ball : 0; } + get => IsPokémon ? PK.Ball : 0; set { if (IsPokémon) PK.Ball = value; } } @@ -132,9 +132,9 @@ private enum GiftType PokéWalkerArea = 14 } - public override string CardTitle { get { return "Raw Gift (PGT)"; } set { } } - public override int CardID { get { return -1; } set { } } - public override bool GiftUsed { get { return false; } set { } } + public override string CardTitle { get => "Raw Gift (PGT)"; set { } } + public override int CardID { get => -1; set { } } + public override bool GiftUsed { get => false; set { } } public override object Content => PK; public PGT(byte[] data = null) @@ -142,11 +142,11 @@ public PGT(byte[] data = null) Data = (byte[])(data?.Clone() ?? new byte[Size]); } - public byte CardType { get { return Data[0]; } set { Data[0] = value; } } + public byte CardType { get => Data[0]; set => Data[0] = value; } // Unused 0x01 - public byte Slot { get { return Data[2]; } set { Data[2] = value; } } - public byte Detail { get { return Data[3]; } set { Data[3] = value; } } - public override int Item { get { return BitConverter.ToUInt16(Data, 0x4); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4); } } + public byte Slot { get => Data[2]; set => Data[2] = value; } + public byte Detail { get => Data[3]; set => Data[3] = value; } + public override int Item { get => BitConverter.ToUInt16(Data, 0x4); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4); } public PK4 PK { @@ -185,17 +185,17 @@ private byte[] Unknown } } - private GiftType PGTGiftType { get { return (GiftType)Data[0]; } set {Data[0] = (byte)value; } } + private GiftType PGTGiftType { get => (GiftType)Data[0]; set => Data[0] = (byte)value; } public bool IsHatched => PGTGiftType == GiftType.Pokémon; - public override bool IsEgg { get { return PGTGiftType == GiftType.PokémonEgg; } set { if (value) { PGTGiftType = GiftType.PokémonEgg; PK.IsEgg = true; } } } - public bool IsManaphyEgg { get { return PGTGiftType == GiftType.ManaphyEgg; } set { if (value) PGTGiftType = GiftType.ManaphyEgg; } } + public override bool IsEgg { get => PGTGiftType == GiftType.PokémonEgg; set { if (value) { PGTGiftType = GiftType.PokémonEgg; PK.IsEgg = true; } } } + public bool IsManaphyEgg { get => PGTGiftType == GiftType.ManaphyEgg; set { if (value) PGTGiftType = GiftType.ManaphyEgg; } } public override bool EggEncounter => IsEgg || IsManaphyEgg; - public override bool IsItem { get { return PGTGiftType == GiftType.Item; } set { if (value) PGTGiftType = GiftType.Item; } } - public override bool IsPokémon { get { return PGTGiftType == GiftType.Pokémon || PGTGiftType == GiftType.PokémonEgg || PGTGiftType == GiftType.ManaphyEgg; } set { } } + public override bool IsItem { get => PGTGiftType == GiftType.Item; set { if (value) PGTGiftType = GiftType.Item; } } + public override bool IsPokémon { get => PGTGiftType == GiftType.Pokémon || PGTGiftType == GiftType.PokémonEgg || PGTGiftType == GiftType.ManaphyEgg; set { } } - public override int Species { get { return IsManaphyEgg ? 490 : PK.Species; } set { PK.Species = value; } } - public override int[] Moves { get { return PK.Moves; } set { PK.Moves = value; } } - public override int HeldItem { get { return PK.HeldItem; } set { PK.HeldItem = value; } } + public override int Species { get => IsManaphyEgg ? 490 : PK.Species; set => PK.Species = value; } + public override int[] Moves { get => PK.Moves; set => PK.Moves = value; } + public override int HeldItem { get => PK.HeldItem; set => PK.HeldItem = value; } public override bool IsShiny => PK.IsShiny; public override PKM convertToPKM(SaveFile SAV) diff --git a/PKHeX.Core/MysteryGifts/PL6.cs b/PKHeX.Core/MysteryGifts/PL6.cs index 80ebb0981..64aedeff1 100644 --- a/PKHeX.Core/MysteryGifts/PL6.cs +++ b/PKHeX.Core/MysteryGifts/PL6.cs @@ -16,39 +16,39 @@ public PL6(byte[] data = null) } // Pokémon Link Flag public byte PL_Flag { - get { return Data[0x00]; } - set { Data[0x00] = value; } } - public bool PL_enabled { get { return PL_Flag != 0; } set { PL_Flag = (byte)(value ? 1 << 7 : 0); } } + get => Data[0x00]; set => Data[0x00] = value; + } + public bool PL_enabled { get => PL_Flag != 0; set => PL_Flag = (byte)(value ? 1 << 7 : 0); } //Name of data source public string Origin_app { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x01, 0x6E)); } - set { Encoding.Unicode.GetBytes(value.PadRight(54 + 1, '\0')).CopyTo(Data, 0x01); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x01, 0x6E)); + set => Encoding.Unicode.GetBytes(value.PadRight(54 + 1, '\0')).CopyTo(Data, 0x01); + } //Pokemon transfer flags? public uint PKM1_flags { - get { return BitConverter.ToUInt32(Data, 0x99); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x99); } } + get => BitConverter.ToUInt32(Data, 0x99); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x99); } public uint PKM2_flags { - get { return BitConverter.ToUInt32(Data, 0x141); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x141); } } + get => BitConverter.ToUInt32(Data, 0x141); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x141); } public uint PKM3_flags { - get { return BitConverter.ToUInt32(Data, 0x1E9); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x1E9); } } + get => BitConverter.ToUInt32(Data, 0x1E9); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x1E9); } public uint PKM4_flags { - get { return BitConverter.ToUInt32(Data, 0x291); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x291); } } + get => BitConverter.ToUInt32(Data, 0x291); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x291); } public uint PKM5_flags { - get { return BitConverter.ToUInt32(Data, 0x339); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x339); } } + get => BitConverter.ToUInt32(Data, 0x339); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x339); } public uint PKM6_flags { - get { return BitConverter.ToUInt32(Data, 0x3E1); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x3E1); } } + get => BitConverter.ToUInt32(Data, 0x3E1); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x3E1); } public uint[] Flags { - get { return new[] {PKM1_flags, PKM2_flags, PKM3_flags, PKM4_flags, PKM5_flags, PKM6_flags}; } - set + get => new[] { PKM1_flags, PKM2_flags, PKM3_flags, PKM4_flags, PKM5_flags, PKM6_flags }; set { if (value.Length > 0) PKM1_flags = value[0]; if (value.Length > 1) PKM2_flags = value[1]; @@ -62,27 +62,27 @@ public uint[] Flags //Pokémon public PL6_PKM poke1 { - get { return new PL6_PKM(Data.Skip(0x9D).Take(PL6_PKM.Size).ToArray()); } - set { value.Data.CopyTo(Data, 0x9D); } } + get => new PL6_PKM(Data.Skip(0x9D).Take(PL6_PKM.Size).ToArray()); + set => value.Data.CopyTo(Data, 0x9D); } public PL6_PKM poke2 { - get { return new PL6_PKM(Data.Skip(0x145).Take(PL6_PKM.Size).ToArray()); } - set { value.Data.CopyTo(Data, 0x145); } } + get => new PL6_PKM(Data.Skip(0x145).Take(PL6_PKM.Size).ToArray()); + set => value.Data.CopyTo(Data, 0x145); } public PL6_PKM poke3 { - get { return new PL6_PKM(Data.Skip(0x1ED).Take(PL6_PKM.Size).ToArray()); } - set { value.Data.CopyTo(Data, 0x1ED); } } + get => new PL6_PKM(Data.Skip(0x1ED).Take(PL6_PKM.Size).ToArray()); + set => value.Data.CopyTo(Data, 0x1ED); } public PL6_PKM poke4 { - get { return new PL6_PKM(Data.Skip(0x295).Take(PL6_PKM.Size).ToArray()); } - set { value.Data.CopyTo(Data, 0x295); } } + get => new PL6_PKM(Data.Skip(0x295).Take(PL6_PKM.Size).ToArray()); + set => value.Data.CopyTo(Data, 0x295); } public PL6_PKM poke5 { - get { return new PL6_PKM(Data.Skip(0x33D).Take(PL6_PKM.Size).ToArray()); } - set { value.Data.CopyTo(Data, 0x33D); } } + get => new PL6_PKM(Data.Skip(0x33D).Take(PL6_PKM.Size).ToArray()); + set => value.Data.CopyTo(Data, 0x33D); } public PL6_PKM poke6 { - get { return new PL6_PKM(Data.Skip(0x3E5).Take(PL6_PKM.Size).ToArray()); } - set { value.Data.CopyTo(Data, 0x3E5); } } + get => new PL6_PKM(Data.Skip(0x3E5).Take(PL6_PKM.Size).ToArray()); + set => value.Data.CopyTo(Data, 0x3E5); } public PL6_PKM[] Pokes { - get { return new[] {poke1, poke2, poke3, poke4, poke5, poke6}; } + get => new[] { poke1, poke2, poke3, poke4, poke5, poke6 }; set { if (value.Length > 0) poke1 = value[0]; @@ -96,45 +96,45 @@ public PL6_PKM[] Pokes // Item Properties public int Item_1 { - get { return BitConverter.ToUInt16(Data, 0x489); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x489); } } + get => BitConverter.ToUInt16(Data, 0x489); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x489); } public int Quantity_1 { - get { return BitConverter.ToUInt16(Data, 0x48B); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x48B); } } + get => BitConverter.ToUInt16(Data, 0x48B); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x48B); } public int Item_2 { - get { return BitConverter.ToUInt16(Data, 0x48D); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x48D); } } + get => BitConverter.ToUInt16(Data, 0x48D); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x48D); } public int Quantity_2 { - get { return BitConverter.ToUInt16(Data, 0x48F); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x48F); } } + get => BitConverter.ToUInt16(Data, 0x48F); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x48F); } public int Item_3 { - get { return BitConverter.ToUInt16(Data, 0x491); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x491); } } + get => BitConverter.ToUInt16(Data, 0x491); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x491); } public int Quantity_3 { - get { return BitConverter.ToUInt16(Data, 0x493); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x493); } } + get => BitConverter.ToUInt16(Data, 0x493); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x493); } public int Item_4 { - get { return BitConverter.ToUInt16(Data, 0x495); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x495); } } + get => BitConverter.ToUInt16(Data, 0x495); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x495); } public int Quantity_4 { - get { return BitConverter.ToUInt16(Data, 0x497); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x497); } } + get => BitConverter.ToUInt16(Data, 0x497); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x497); } public int Item_5 { - get { return BitConverter.ToUInt16(Data, 0x499); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x499); } } + get => BitConverter.ToUInt16(Data, 0x499); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x499); } public int Quantity_5 { - get { return BitConverter.ToUInt16(Data, 0x49B); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x49B); } } + get => BitConverter.ToUInt16(Data, 0x49B); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x49B); } public int Item_6 { - get { return BitConverter.ToUInt16(Data, 0x49D); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x49D); } } + get => BitConverter.ToUInt16(Data, 0x49D); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x49D); } public int Quantity_6 { - get { return BitConverter.ToUInt16(Data, 0x49F); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x49F); } } + get => BitConverter.ToUInt16(Data, 0x49F); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x49F); } public int[] Items { - get { return new[] {Item_1, Item_2, Item_3, Item_4, Item_5, Item_6}; } + get => new[] { Item_1, Item_2, Item_3, Item_4, Item_5, Item_6 }; set { if (value.Length > 0) Item_1 = value[0]; @@ -148,7 +148,7 @@ public int[] Items public int[] Quantities { - get { return new[] {Quantity_1, Quantity_2, Quantity_3, Quantity_4, Quantity_5, Quantity_6}; } + get => new[] { Quantity_1, Quantity_2, Quantity_3, Quantity_4, Quantity_5, Quantity_6 }; set { if (value.Length > 0) Quantity_1 = value[0]; @@ -163,12 +163,12 @@ public int[] Quantities //Battle Points public int BattlePoints { - get { return BitConverter.ToUInt16(Data, 0x4A1); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4A1); } } + get => BitConverter.ToUInt16(Data, 0x4A1); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4A1); } //PokéMiles public int Pokemiles { - get { return BitConverter.ToUInt16(Data, 0x4A3); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4A3); } } + get => BitConverter.ToUInt16(Data, 0x4A3); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4A3); } } public class PL6_PKM : IEncounterable @@ -182,134 +182,134 @@ public PL6_PKM(byte[] data = null) Data = (byte[])(data?.Clone() ?? new byte[Size]); } - public int TID { - get { return BitConverter.ToUInt16(Data, 0x00); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } } - public int SID { - get { return BitConverter.ToUInt16(Data, 0x02); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); } } + public int TID { + get => BitConverter.ToUInt16(Data, 0x00); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } + public int SID { + get => BitConverter.ToUInt16(Data, 0x02); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); } public int OriginGame { - get { return Data[0x04]; } - set { Data[0x04] = (byte)value; } } + get => Data[0x04]; + set => Data[0x04] = (byte)value; } public uint EncryptionConstant { - get { return BitConverter.ToUInt32(Data, 0x08); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x08); } } + get => BitConverter.ToUInt32(Data, 0x08); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x08); } public int Pokéball { - get { return Data[0xE]; } - set { Data[0xE] = (byte)value; } } + get => Data[0xE]; + set => Data[0xE] = (byte)value; } public int HeldItem { - get { return BitConverter.ToUInt16(Data, 0x10); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } } + get => BitConverter.ToUInt16(Data, 0x10); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } public int Move1 { - get { return BitConverter.ToUInt16(Data, 0x12); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } } + get => BitConverter.ToUInt16(Data, 0x12); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } public int Move2 { - get { return BitConverter.ToUInt16(Data, 0x14); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); } } + get => BitConverter.ToUInt16(Data, 0x14); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); } public int Move3 { - get { return BitConverter.ToUInt16(Data, 0x16); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x16); } } + get => BitConverter.ToUInt16(Data, 0x16); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x16); } public int Move4 { - get { return BitConverter.ToUInt16(Data, 0x18); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } } + get => BitConverter.ToUInt16(Data, 0x18); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); } public int Species { - get { return BitConverter.ToUInt16(Data, 0x1A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1A); } } + get => BitConverter.ToUInt16(Data, 0x1A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1A); } public int Form { - get { return Data[0x1C]; } - set { Data[0x1C] = (byte)value; } } + get => Data[0x1C]; + set => Data[0x1C] = (byte)value; } public int Language { - get { return Data[0x1D]; } - set { Data[0x1D] = (byte)value; } } + get => Data[0x1D]; + set => Data[0x1D] = (byte)value; } public string Nickname { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x1E, 0x1A)); } - set { Encoding.Unicode.GetBytes(value.PadRight(12 + 1, '\0')).CopyTo(Data, 0x1E); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x1E, 0x1A)); + set => Encoding.Unicode.GetBytes(value.PadRight(12 + 1, '\0')).CopyTo(Data, 0x1E); } public int Nature { - get { return Data[0x38]; } - set { Data[0x38] = (byte)value; } } + get => Data[0x38]; + set => Data[0x38] = (byte)value; } public int Gender { - get { return Data[0x39]; } - set { Data[0x39] = (byte)value; } } + get => Data[0x39]; + set => Data[0x39] = (byte)value; } public int AbilityType { - get { return Data[0x3A]; } - set { Data[0x3A] = (byte)value; } } + get => Data[0x3A]; + set => Data[0x3A] = (byte)value; } public int PIDType { - get { return Data[0x3B]; } - set { Data[0x3B] = (byte)value; } } + get => Data[0x3B]; + set => Data[0x3B] = (byte)value; } public int EggLocation { - get { return BitConverter.ToUInt16(Data, 0x3C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x3C); } } + get => BitConverter.ToUInt16(Data, 0x3C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x3C); } public int MetLocation { - get { return BitConverter.ToUInt16(Data, 0x3E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x3F); } } + get => BitConverter.ToUInt16(Data, 0x3E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x3F); } public int MetLevel { - get { return Data[0x40]; } - set { Data[0x40] = (byte)value; } } - public int LevelMin { get { return MetLevel; } } - public int LevelMax { get { return MetLevel; } } + get => Data[0x40]; + set => Data[0x40] = (byte)value; } + public int LevelMin => MetLevel; + public int LevelMax => MetLevel; - public int CNT_Cool { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } } - public int CNT_Beauty { get { return Data[0x42]; } set { Data[0x42] = (byte)value; } } - public int CNT_Cute { get { return Data[0x43]; } set { Data[0x43] = (byte)value; } } - public int CNT_Smart { get { return Data[0x44]; } set { Data[0x44] = (byte)value; } } - public int CNT_Tough { get { return Data[0x45]; } set { Data[0x45] = (byte)value; } } - public int CNT_Sheen { get { return Data[0x46]; } set { Data[0x46] = (byte)value; } } + public int CNT_Cool { get => Data[0x41]; set => Data[0x41] = (byte)value; } + public int CNT_Beauty { get => Data[0x42]; set => Data[0x42] = (byte)value; } + public int CNT_Cute { get => Data[0x43]; set => Data[0x43] = (byte)value; } + public int CNT_Smart { get => Data[0x44]; set => Data[0x44] = (byte)value; } + public int CNT_Tough { get => Data[0x45]; set => Data[0x45] = (byte)value; } + public int CNT_Sheen { get => Data[0x46]; set => Data[0x46] = (byte)value; } - public int IV_HP { get { return Data[0x47]; } set { Data[0x47] = (byte)value; } } - public int IV_ATK { get { return Data[0x48]; } set { Data[0x48] = (byte)value; } } - public int IV_DEF { get { return Data[0x49]; } set { Data[0x49] = (byte)value; } } - public int IV_SPE { get { return Data[0x4A]; } set { Data[0x4A] = (byte)value; } } - public int IV_SPA { get { return Data[0x4B]; } set { Data[0x4B] = (byte)value; } } - public int IV_SPD { get { return Data[0x4C]; } set { Data[0x4C] = (byte)value; } } + public int IV_HP { get => Data[0x47]; set => Data[0x47] = (byte)value; } + public int IV_ATK { get => Data[0x48]; set => Data[0x48] = (byte)value; } + public int IV_DEF { get => Data[0x49]; set => Data[0x49] = (byte)value; } + public int IV_SPE { get => Data[0x4A]; set => Data[0x4A] = (byte)value; } + public int IV_SPA { get => Data[0x4B]; set => Data[0x4B] = (byte)value; } + public int IV_SPD { get => Data[0x4C]; set => Data[0x4C] = (byte)value; } - public int OTGender { get { return Data[0x4D]; } set { Data[0x4D] = (byte)value; } } + public int OTGender { get => Data[0x4D]; set => Data[0x4D] = (byte)value; } public string OT { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x4E, 0x1A)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, 0x4E); } } - public int Level { get { return Data[0x68]; } set { Data[0x68] = (byte)value; } } - public bool IsEgg { get { return Data[0x69] == 1; } set { Data[0x69] = (byte)(value ? 1 : 0); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x4E, 0x1A)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, 0x4E); } + public int Level { get => Data[0x68]; set => Data[0x68] = (byte)value; } + public bool IsEgg { get => Data[0x69] == 1; set => Data[0x69] = (byte)(value ? 1 : 0); } public uint PID { - get { return BitConverter.ToUInt32(Data, 0x6C); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x6C); } } + get => BitConverter.ToUInt32(Data, 0x6C); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x6C); } public int RelearnMove1 { - get { return BitConverter.ToUInt16(Data, 0x70); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } } + get => BitConverter.ToUInt16(Data, 0x70); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } public int RelearnMove2 { - get { return BitConverter.ToUInt16(Data, 0x72); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x72); } } + get => BitConverter.ToUInt16(Data, 0x72); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x72); } public int RelearnMove3 { - get { return BitConverter.ToUInt16(Data, 0x74); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x74); } } + get => BitConverter.ToUInt16(Data, 0x74); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x74); } public int RelearnMove4 { - get { return BitConverter.ToUInt16(Data, 0x76); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x76); } } - public int OT_Intensity { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } } - public int OT_Memory { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } } - public int OT_TextVar { get { return BitConverter.ToUInt16(Data, 0x7A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7A); } } - public int OT_Feeling { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } } + get => BitConverter.ToUInt16(Data, 0x76); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x76); } + public int OT_Intensity { get => Data[0x78]; set => Data[0x78] = (byte)value; } + public int OT_Memory { get => Data[0x79]; set => Data[0x79] = (byte)value; } + public int OT_TextVar { get => BitConverter.ToUInt16(Data, 0x7A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7A); } + public int OT_Feeling { get => Data[0x7C]; set => Data[0x7C] = (byte)value; } - private byte RIB0 { get { return Data[0x0C]; } set { Data[0x0C] = value; } } - public bool RIB0_0 { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Battle Champ Ribbon - public bool RIB0_1 { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Regional Champ Ribbon - public bool RIB0_2 { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // National Champ Ribbon - public bool RIB0_3 { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Country Ribbon - public bool RIB0_4 { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // National Ribbon - public bool RIB0_5 { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Earth Ribbon - public bool RIB0_6 { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // World Ribbon - public bool RIB0_7 { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Event Ribbon - private byte RIB1 { get { return Data[0x0D]; } set { Data[0x0D] = value; } } - public bool RIB1_0 { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // World Champ Ribbon - public bool RIB1_1 { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Birthday Ribbon - public bool RIB1_2 { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Special Ribbon - public bool RIB1_3 { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Souvenir Ribbon - public bool RIB1_4 { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Wishing Ribbon - public bool RIB1_5 { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Classic Ribbon - public bool RIB1_6 { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Premier Ribbon - public bool RIB1_7 { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Empty + private byte RIB0 { get => Data[0x0C]; set => Data[0x0C] = value; } + public bool RIB0_0 { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Battle Champ Ribbon + public bool RIB0_1 { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Regional Champ Ribbon + public bool RIB0_2 { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // National Champ Ribbon + public bool RIB0_3 { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Country Ribbon + public bool RIB0_4 { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // National Ribbon + public bool RIB0_5 { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Earth Ribbon + public bool RIB0_6 { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // World Ribbon + public bool RIB0_7 { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Event Ribbon + private byte RIB1 { get => Data[0x0D]; set => Data[0x0D] = value; } + public bool RIB1_0 { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // World Champ Ribbon + public bool RIB1_1 { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Birthday Ribbon + public bool RIB1_2 { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Special Ribbon + public bool RIB1_3 { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Souvenir Ribbon + public bool RIB1_4 { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Wishing Ribbon + public bool RIB1_5 { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Classic Ribbon + public bool RIB1_6 { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Premier Ribbon + public bool RIB1_7 { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Empty public int[] Moves { - get { return new[] {Move1, Move2, Move3, Move4}; } + get => new[] { Move1, Move2, Move3, Move4 }; set { if (value.Length > 0) Move1 = value[0]; @@ -320,7 +320,7 @@ public int[] Moves } public int[] RelearnMoves { - get { return new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; } + get => new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; set { if (value.Length > 0) RelearnMove1 = value[0]; diff --git a/PKHeX.Core/MysteryGifts/WC6.cs b/PKHeX.Core/MysteryGifts/WC6.cs index 94814f625..6ef74dedf 100644 --- a/PKHeX.Core/MysteryGifts/WC6.cs +++ b/PKHeX.Core/MysteryGifts/WC6.cs @@ -30,23 +30,23 @@ public WC6(byte[] data = null) // General Card Properties public override int CardID { - get { return BitConverter.ToUInt16(Data, 0); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0); } } + get => BitConverter.ToUInt16(Data, 0); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0); } public override string CardTitle { // Max len 36 char, followed by null terminator - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 2, 72)); } - set { Encoding.Unicode.GetBytes(value.PadRight(36, '\0')).CopyTo(Data, 2); } } - private uint RawDate { - get { return BitConverter.ToUInt32(Data, 0x4C); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 2, 72)); + set => Encoding.Unicode.GetBytes(value.PadRight(36, '\0')).CopyTo(Data, 2); } + private uint RawDate { + get => BitConverter.ToUInt32(Data, 0x4C); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } private uint Year { - get { return RawDate/10000; } - set { RawDate = value*10000 + RawDate%10000; } } + get => RawDate / 10000; + set => RawDate = value * 10000 + RawDate % 10000; } private uint Month { - get { return RawDate%10000/100; } - set { RawDate = Year*10000 + value*100 + RawDate%100; } } + get => RawDate % 10000 / 100; + set => RawDate = Year * 10000 + value * 100 + RawDate % 100; } private uint Day { - get { return RawDate%100; } - set { RawDate = Year*10000 + Month*100 + value; } } + get => RawDate % 100; + set => RawDate = Year * 10000 + Month * 100 + value; } /// /// Gets or sets the date of the card. @@ -81,155 +81,155 @@ public WC6(byte[] data = null) } } - public int CardLocation { get { return Data[0x50]; } set { Data[0x50] = (byte)value; } } + public int CardLocation { get => Data[0x50]; set => Data[0x50] = (byte)value; } - public int CardType { get { return Data[0x51]; } set { Data[0x51] = (byte)value; } } - public override bool GiftUsed { get { return Data[0x52] >> 1 > 0; } set { Data[0x52] = (byte)(Data[0x52] & ~2 | (value ? 2 : 0)); } } - public bool MultiObtain { get { return Data[0x53] == 1; } set { Data[0x53] = (byte)(value ? 1 : 0); } } + public int CardType { get => Data[0x51]; set => Data[0x51] = (byte)value; } + public override bool GiftUsed { get => Data[0x52] >> 1 > 0; set => Data[0x52] = (byte)(Data[0x52] & ~2 | (value ? 2 : 0)); } + public bool MultiObtain { get => Data[0x53] == 1; set => Data[0x53] = (byte)(value ? 1 : 0); } // Item Properties - public override bool IsItem { get { return CardType == 1; } set { if (value) CardType = 1; } } + public override bool IsItem { get => CardType == 1; set { if (value) CardType = 1; } } public override int Item { - get { return BitConverter.ToUInt16(Data, 0x68); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } } + get => BitConverter.ToUInt16(Data, 0x68); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } public override int Quantity { - get { return BitConverter.ToUInt16(Data, 0x70); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } } + get => BitConverter.ToUInt16(Data, 0x70); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } // Pokémon Properties - public override bool IsPokémon { get { return CardType == 0; } set { if (value) CardType = 0; } } + public override bool IsPokémon { get => CardType == 0; set { if (value) CardType = 0; } } public override bool IsShiny => PIDType == 2; - public int TID { - get { return BitConverter.ToUInt16(Data, 0x68); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } } - public int SID { - get { return BitConverter.ToUInt16(Data, 0x6A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } } + public int TID { + get => BitConverter.ToUInt16(Data, 0x68); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } + public int SID { + get => BitConverter.ToUInt16(Data, 0x6A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } public int OriginGame { - get { return Data[0x6C]; } - set { Data[0x6C] = (byte)value; } } + get => Data[0x6C]; + set => Data[0x6C] = (byte)value; } public uint EncryptionConstant { - get { return BitConverter.ToUInt32(Data, 0x70); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x70); } } + get => BitConverter.ToUInt32(Data, 0x70); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x70); } public override int Ball { - get { return Data[0x76]; } - set { Data[0x76] = (byte)value; } } + get => Data[0x76]; + set => Data[0x76] = (byte)value; } public override int HeldItem { - get { return BitConverter.ToUInt16(Data, 0x78); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x78); } } + get => BitConverter.ToUInt16(Data, 0x78); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x78); } public int Move1 { - get { return BitConverter.ToUInt16(Data, 0x7A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7A); } } + get => BitConverter.ToUInt16(Data, 0x7A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7A); } public int Move2 { - get { return BitConverter.ToUInt16(Data, 0x7C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7C); } } + get => BitConverter.ToUInt16(Data, 0x7C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7C); } public int Move3 { - get { return BitConverter.ToUInt16(Data, 0x7E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } } + get => BitConverter.ToUInt16(Data, 0x7E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } public int Move4 { - get { return BitConverter.ToUInt16(Data, 0x80); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } } + get => BitConverter.ToUInt16(Data, 0x80); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } public override int Species { - get { return BitConverter.ToUInt16(Data, 0x82); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x82); } } + get => BitConverter.ToUInt16(Data, 0x82); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x82); } public int Form { - get { return Data[0x84]; } - set { Data[0x84] = (byte)value; } } + get => Data[0x84]; + set => Data[0x84] = (byte)value; } public int Language { - get { return Data[0x85]; } - set { Data[0x85] = (byte)value; } } + get => Data[0x85]; + set => Data[0x85] = (byte)value; } public string Nickname { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x86, 0x1A)); } - set { Encoding.Unicode.GetBytes(value.PadRight(12 + 1, '\0')).CopyTo(Data, 0x86); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x86, 0x1A)); + set => Encoding.Unicode.GetBytes(value.PadRight(12 + 1, '\0')).CopyTo(Data, 0x86); } public int Nature { - get { return Data[0xA0]; } - set { Data[0xA0] = (byte)value; } } + get => Data[0xA0]; + set => Data[0xA0] = (byte)value; } public int Gender { - get { return Data[0xA1]; } - set { Data[0xA1] = (byte)value; } } + get => Data[0xA1]; + set => Data[0xA1] = (byte)value; } public int AbilityType { - get { return Data[0xA2]; } - set { Data[0xA2] = (byte)value; } } + get => Data[0xA2]; + set => Data[0xA2] = (byte)value; } public int PIDType { - get { return Data[0xA3]; } - set { Data[0xA3] = (byte)value; } } + get => Data[0xA3]; + set => Data[0xA3] = (byte)value; } public int EggLocation { - get { return BitConverter.ToUInt16(Data, 0xA4); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA4); } } + get => BitConverter.ToUInt16(Data, 0xA4); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA4); } public int MetLocation { - get { return BitConverter.ToUInt16(Data, 0xA6); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA6); } } + get => BitConverter.ToUInt16(Data, 0xA6); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA6); } - public int CNT_Cool { get { return Data[0xA9]; } set { Data[0xA9] = (byte)value; } } - public int CNT_Beauty { get { return Data[0xAA]; } set { Data[0xAA] = (byte)value; } } - public int CNT_Cute { get { return Data[0xAB]; } set { Data[0xAB] = (byte)value; } } - public int CNT_Smart { get { return Data[0xAC]; } set { Data[0xAC] = (byte)value; } } - public int CNT_Tough { get { return Data[0xAD]; } set { Data[0xAD] = (byte)value; } } - public int CNT_Sheen { get { return Data[0xAE]; } set { Data[0xAE] = (byte)value; } } + public int CNT_Cool { get => Data[0xA9]; set => Data[0xA9] = (byte)value; } + public int CNT_Beauty { get => Data[0xAA]; set => Data[0xAA] = (byte)value; } + public int CNT_Cute { get => Data[0xAB]; set => Data[0xAB] = (byte)value; } + public int CNT_Smart { get => Data[0xAC]; set => Data[0xAC] = (byte)value; } + public int CNT_Tough { get => Data[0xAD]; set => Data[0xAD] = (byte)value; } + public int CNT_Sheen { get => Data[0xAE]; set => Data[0xAE] = (byte)value; } - public int IV_HP { get { return Data[0xAF]; } set { Data[0xAF] = (byte)value; } } - public int IV_ATK { get { return Data[0xB0]; } set { Data[0xB0] = (byte)value; } } - public int IV_DEF { get { return Data[0xB1]; } set { Data[0xB1] = (byte)value; } } - public int IV_SPE { get { return Data[0xB2]; } set { Data[0xB2] = (byte)value; } } - public int IV_SPA { get { return Data[0xB3]; } set { Data[0xB3] = (byte)value; } } - public int IV_SPD { get { return Data[0xB4]; } set { Data[0xB4] = (byte)value; } } + public int IV_HP { get => Data[0xAF]; set => Data[0xAF] = (byte)value; } + public int IV_ATK { get => Data[0xB0]; set => Data[0xB0] = (byte)value; } + public int IV_DEF { get => Data[0xB1]; set => Data[0xB1] = (byte)value; } + public int IV_SPE { get => Data[0xB2]; set => Data[0xB2] = (byte)value; } + public int IV_SPA { get => Data[0xB3]; set => Data[0xB3] = (byte)value; } + public int IV_SPD { get => Data[0xB4]; set => Data[0xB4] = (byte)value; } - public int OTGender { get { return Data[0xB5]; } set { Data[0xB5] = (byte)value; } } + public int OTGender { get => Data[0xB5]; set => Data[0xB5] = (byte)value; } public string OT { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0xB6, 0x1A)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, 0xB6); } } - public override int Level { get { return Data[0xD0]; } set { Data[0xD0] = (byte)value; } } - public override bool IsEgg { get { return Data[0xD1] == 1; } set { Data[0xD1] = (byte)(value ? 1 : 0); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0xB6, 0x1A)); set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, 0xB6); + } + public override int Level { get => Data[0xD0]; set => Data[0xD0] = (byte)value; } + public override bool IsEgg { get => Data[0xD1] == 1; set => Data[0xD1] = (byte)(value ? 1 : 0); } public uint PID { - get { return BitConverter.ToUInt32(Data, 0xD4); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0xD4); } } + get => BitConverter.ToUInt32(Data, 0xD4); set => BitConverter.GetBytes(value).CopyTo(Data, 0xD4); + } public int RelearnMove1 { - get { return BitConverter.ToUInt16(Data, 0xD8); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } } + get => BitConverter.ToUInt16(Data, 0xD8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); + } public int RelearnMove2 { - get { return BitConverter.ToUInt16(Data, 0xDA); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } } + get => BitConverter.ToUInt16(Data, 0xDA); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); + } public int RelearnMove3 { - get { return BitConverter.ToUInt16(Data, 0xDC); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDC); } } + get => BitConverter.ToUInt16(Data, 0xDC); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDC); + } public int RelearnMove4 { - get { return BitConverter.ToUInt16(Data, 0xDE); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDE); } } - public int OT_Intensity { get { return Data[0xE0]; } set { Data[0xE0] = (byte)value; } } - public int OT_Memory { get { return Data[0xE1]; } set { Data[0xE1] = (byte)value; } } - public int OT_TextVar { get { return BitConverter.ToUInt16(Data, 0xE2); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xE2); } } - public int OT_Feeling { get { return Data[0xE4]; } set { Data[0xE4] = (byte)value; } } + get => BitConverter.ToUInt16(Data, 0xDE); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDE); + } + public int OT_Intensity { get => Data[0xE0]; set => Data[0xE0] = (byte)value; } + public int OT_Memory { get => Data[0xE1]; set => Data[0xE1] = (byte)value; } + public int OT_TextVar { get => BitConverter.ToUInt16(Data, 0xE2); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xE2); } + public int OT_Feeling { get => Data[0xE4]; set => Data[0xE4] = (byte)value; } - public int EV_HP { get { return Data[0xE5]; } set { Data[0xE5] = (byte)value; } } - public int EV_ATK { get { return Data[0xE6]; } set { Data[0xE6] = (byte)value; } } - public int EV_DEF { get { return Data[0xE7]; } set { Data[0xE7] = (byte)value; } } - public int EV_SPE { get { return Data[0xE8]; } set { Data[0xE8] = (byte)value; } } - public int EV_SPA { get { return Data[0xE9]; } set { Data[0xE9] = (byte)value; } } - public int EV_SPD { get { return Data[0xEA]; } set { Data[0xEA] = (byte)value; } } + public int EV_HP { get => Data[0xE5]; set => Data[0xE5] = (byte)value; } + public int EV_ATK { get => Data[0xE6]; set => Data[0xE6] = (byte)value; } + public int EV_DEF { get => Data[0xE7]; set => Data[0xE7] = (byte)value; } + public int EV_SPE { get => Data[0xE8]; set => Data[0xE8] = (byte)value; } + public int EV_SPA { get => Data[0xE9]; set => Data[0xE9] = (byte)value; } + public int EV_SPD { get => Data[0xEA]; set => Data[0xEA] = (byte)value; } - private byte RIB0 { get { return Data[0x74]; } set { Data[0x74] = value; } } - public bool RibbonChampionBattle { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Battle Champ Ribbon - public bool RibbonChampionRegional { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Regional Champ Ribbon - public bool RibbonChampionNational { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // National Champ Ribbon - public bool RibbonCountry { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Country Ribbon - public bool RibbonNational { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // National Ribbon - public bool RibbonEarth { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Earth Ribbon - public bool RibbonWorld { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // World Ribbon - public bool RibbonEvent { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Event Ribbon - private byte RIB1 { get { return Data[0x75]; } set { Data[0x75] = value; } } - public bool RibbonChampionWorld { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // World Champ Ribbon - public bool RibbonBirthday { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Birthday Ribbon - public bool RibbonSpecial { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Special Ribbon - public bool RibbonSouvenir { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Souvenir Ribbon - public bool RibbonWishing { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Wishing Ribbon - public bool RibbonClassic { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Classic Ribbon - public bool RibbonPremier { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Premier Ribbon - public bool RIB1_7 { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Empty + private byte RIB0 { get => Data[0x74]; set => Data[0x74] = value; } + public bool RibbonChampionBattle { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Battle Champ Ribbon + public bool RibbonChampionRegional { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Regional Champ Ribbon + public bool RibbonChampionNational { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // National Champ Ribbon + public bool RibbonCountry { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Country Ribbon + public bool RibbonNational { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // National Ribbon + public bool RibbonEarth { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Earth Ribbon + public bool RibbonWorld { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // World Ribbon + public bool RibbonEvent { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Event Ribbon + private byte RIB1 { get => Data[0x75]; set => Data[0x75] = value; } + public bool RibbonChampionWorld { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // World Champ Ribbon + public bool RibbonBirthday { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Birthday Ribbon + public bool RibbonSpecial { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Special Ribbon + public bool RibbonSouvenir { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Souvenir Ribbon + public bool RibbonWishing { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Wishing Ribbon + public bool RibbonClassic { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Classic Ribbon + public bool RibbonPremier { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Premier Ribbon + public bool RIB1_7 { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Empty // Meta Accessible Properties public int[] IVs { - get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; } + get => new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; set { if (value?.Length != 6) return; @@ -239,7 +239,7 @@ public int[] IVs } public int[] EVs { - get { return new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; } + get => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; set { if (value?.Length != 6) return; @@ -251,7 +251,7 @@ public int[] EVs public override int[] Moves { - get { return new[] { Move1, Move2, Move3, Move4 }; } + get => new[] { Move1, Move2, Move3, Move4 }; set { if (value.Length > 0) Move1 = value[0]; @@ -262,7 +262,7 @@ public override int[] Moves } public override int[] RelearnMoves { - get { return new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; } + get => new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; set { if (value.Length > 0) RelearnMove1 = value[0]; diff --git a/PKHeX.Core/MysteryGifts/WC7.cs b/PKHeX.Core/MysteryGifts/WC7.cs index 5abf43580..b111628d6 100644 --- a/PKHeX.Core/MysteryGifts/WC7.cs +++ b/PKHeX.Core/MysteryGifts/WC7.cs @@ -25,23 +25,23 @@ public WC7(byte[] data = null) // General Card Properties public override int CardID { - get { return BitConverter.ToUInt16(Data, 0); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0); } } + get => BitConverter.ToUInt16(Data, 0); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0); } public override string CardTitle { // Max len 36 char, followed by null terminator - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 2, 72)); } - set { Encoding.Unicode.GetBytes(value.PadRight(36, '\0')).CopyTo(Data, 2); } } - private uint RawDate { - get { return BitConverter.ToUInt32(Data, 0x4C); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 2, 72)); + set => Encoding.Unicode.GetBytes(value.PadRight(36, '\0')).CopyTo(Data, 2); } + private uint RawDate { + get => BitConverter.ToUInt32(Data, 0x4C); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } private uint Year { - get { return RawDate/10000 + 2000; } - set { RawDate = (value-2000)*10000 + RawDate%10000; } } + get => RawDate / 10000 + 2000; + set => RawDate = (value - 2000) * 10000 + RawDate % 10000; } private uint Month { - get { return RawDate%10000/100; } - set { RawDate = (Year-2000)*10000 + value*100 + RawDate%100; } } + get => RawDate % 10000 / 100; + set => RawDate = (Year - 2000) * 10000 + value * 100 + RawDate % 100; } private uint Day { - get { return RawDate%100; } - set { RawDate = (Year-2000)*10000 + Month*100 + value; } } + get => RawDate % 100; + set => RawDate = (Year - 2000) * 10000 + Month * 100 + value; } /// /// Gets or sets the date of the card. @@ -76,200 +76,184 @@ public WC7(byte[] data = null) } } - public int CardLocation { get { return Data[0x50]; } set { Data[0x50] = (byte)value; } } + public int CardLocation { get => Data[0x50]; set => Data[0x50] = (byte)value; } - public int CardType { get { return Data[0x51]; } set { Data[0x51] = (byte)value; } } - public byte CardFlags { get { return Data[0x52]; } set { Data[0x52] = value; } } + public int CardType { get => Data[0x51]; set => Data[0x51] = (byte)value; } + public byte CardFlags { get => Data[0x52]; set => Data[0x52] = value; } - public bool GiftRepeatable { get { return (CardFlags & 1) == 0; } set { CardFlags = (byte)(CardFlags & ~1 | (value ? 0 : 1)); } } - public override bool GiftUsed { get { return (CardFlags & 2) == 2; } set { CardFlags = (byte)(CardFlags & ~2 | (value ? 2 : 0)); } } - public bool GiftOncePerDay { get { return (CardFlags & 4) == 4; } set { CardFlags = (byte)(CardFlags & ~4 | (value ? 4 : 0)); } } + public bool GiftRepeatable { get => (CardFlags & 1) == 0; set => CardFlags = (byte)(CardFlags & ~1 | (value ? 0 : 1)); } + public override bool GiftUsed { get => (CardFlags & 2) == 2; set => CardFlags = (byte)(CardFlags & ~2 | (value ? 2 : 0)); } + public bool GiftOncePerDay { get => (CardFlags & 4) == 4; set => CardFlags = (byte)(CardFlags & ~4 | (value ? 4 : 0)); } - public bool MultiObtain { get { return Data[0x53] == 1; } set { Data[0x53] = (byte)(value ? 1 : 0); } } + public bool MultiObtain { get => Data[0x53] == 1; set => Data[0x53] = (byte)(value ? 1 : 0); } // BP Properties - public override bool IsBP { get { return CardType == 3; } set { if (value) CardType = 3; } } + public override bool IsBP { get => CardType == 3; set { if (value) CardType = 3; } } public override int BP { - get { return Item; } - set { Item = value; } + get => Item; + set => Item = value; } // Bean (Mame) Properties - public override bool IsBean { get { return CardType == 2; } set { if (value) CardType = 2; } } + public override bool IsBean { get => CardType == 2; set { if (value) CardType = 2; } } public override int Bean { - get { return Item; } - set { Item = value; } + get => Item; + set => Item = value; } // Item Properties - public override bool IsItem { get { return CardType == 1; } set { if (value) CardType = 1; } } + public override bool IsItem { get => CardType == 1; set { if (value) CardType = 1; } } public override int Item { - get { return BitConverter.ToUInt16(Data, 0x68); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } } + get => BitConverter.ToUInt16(Data, 0x68); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } - public int GetItem(int index) - { - return BitConverter.ToUInt16(Data, 0x68 + 0x4*index); - } - - public void SetItem(int index, ushort item) - { - BitConverter.GetBytes(item).CopyTo(Data, 0x68 + 4*index); - } + public int GetItem(int index) => BitConverter.ToUInt16(Data, 0x68 + 0x4*index); + public void SetItem(int index, ushort item) => BitConverter.GetBytes(item).CopyTo(Data, 0x68 + 4*index); + public int GetQuantity(int index) => BitConverter.ToUInt16(Data, 0x6A + 0x4 * index); + public void SetQuantity(int index, ushort quantity) => BitConverter.GetBytes(quantity).CopyTo(Data, 0x6A + 4 * index); public override int Quantity { - get { return BitConverter.ToUInt16(Data, 0x6A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } } - - public int GetQuantity(int index) - { - return BitConverter.ToUInt16(Data, 0x6A + 0x4 * index); - } - - public void SetQuantity(int index, ushort quantity) - { - BitConverter.GetBytes(quantity).CopyTo(Data, 0x6A + 4 * index); - } - + get => BitConverter.ToUInt16(Data, 0x6A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } // Pokémon Properties - public override bool IsPokémon { get { return CardType == 0; } set { if (value) CardType = 0; } } + public override bool IsPokémon { get => CardType == 0; set { if (value) CardType = 0; } } public override bool IsShiny => PIDType == 2; - public int TID { - get { return BitConverter.ToUInt16(Data, 0x68); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } } - public int SID { - get { return BitConverter.ToUInt16(Data, 0x6A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } } + public int TID { + get => BitConverter.ToUInt16(Data, 0x68); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x68); } + public int SID { + get => BitConverter.ToUInt16(Data, 0x6A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } public int OriginGame { - get { return Data[0x6C]; } - set { Data[0x6C] = (byte)value; } } + get => Data[0x6C]; + set => Data[0x6C] = (byte)value; } public uint EncryptionConstant { - get { return BitConverter.ToUInt32(Data, 0x70); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x70); } } + get => BitConverter.ToUInt32(Data, 0x70); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x70); } public override int Ball { - get { return Data[0x76]; } - set { Data[0x76] = (byte)value; } } + get => Data[0x76]; + set => Data[0x76] = (byte)value; } public override int HeldItem { - get { return BitConverter.ToUInt16(Data, 0x78); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x78); } } + get => BitConverter.ToUInt16(Data, 0x78); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x78); } public int Move1 { - get { return BitConverter.ToUInt16(Data, 0x7A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7A); } } + get => BitConverter.ToUInt16(Data, 0x7A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7A); } public int Move2 { - get { return BitConverter.ToUInt16(Data, 0x7C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7C); } } + get => BitConverter.ToUInt16(Data, 0x7C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7C); } public int Move3 { - get { return BitConverter.ToUInt16(Data, 0x7E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } } + get => BitConverter.ToUInt16(Data, 0x7E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } public int Move4 { - get { return BitConverter.ToUInt16(Data, 0x80); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } } + get => BitConverter.ToUInt16(Data, 0x80); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } public override int Species { - get { return BitConverter.ToUInt16(Data, 0x82); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x82); } } + get => BitConverter.ToUInt16(Data, 0x82); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x82); } public int Form { - get { return Data[0x84]; } - set { Data[0x84] = (byte)value; } } + get => Data[0x84]; + set => Data[0x84] = (byte)value; } public int Language { - get { return Data[0x85]; } - set { Data[0x85] = (byte)value; } } + get => Data[0x85]; + set => Data[0x85] = (byte)value; } public string Nickname { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x86, 0x1A)); } - set { Encoding.Unicode.GetBytes(value.PadRight(12 + 1, '\0')).CopyTo(Data, 0x86); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x86, 0x1A)); + set => Encoding.Unicode.GetBytes(value.PadRight(12 + 1, '\0')).CopyTo(Data, 0x86); } public int Nature { - get { return Data[0xA0]; } - set { Data[0xA0] = (byte)value; } } + get => Data[0xA0]; + set => Data[0xA0] = (byte)value; } public int Gender { - get { return Data[0xA1]; } - set { Data[0xA1] = (byte)value; } } + get => Data[0xA1]; + set => Data[0xA1] = (byte)value; } public int AbilityType { - get { return Data[0xA2]; } - set { Data[0xA2] = (byte)value; } } + get => Data[0xA2]; + set => Data[0xA2] = (byte)value; } public int PIDType { - get { return Data[0xA3]; } - set { Data[0xA3] = (byte)value; } } + get => Data[0xA3]; + set => Data[0xA3] = (byte)value; } public int EggLocation { - get { return BitConverter.ToUInt16(Data, 0xA4); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA4); } } + get => BitConverter.ToUInt16(Data, 0xA4); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA4); } public int MetLocation { - get { return BitConverter.ToUInt16(Data, 0xA6); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA6); } } - public int MetLevel { get { return Data[0xA8]; } set { Data[0xA8] = (byte)value; } } + get => BitConverter.ToUInt16(Data, 0xA6); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA6); } + public int MetLevel { get => Data[0xA8]; set => Data[0xA8] = (byte)value; } - public int CNT_Cool { get { return Data[0xA9]; } set { Data[0xA9] = (byte)value; } } - public int CNT_Beauty { get { return Data[0xAA]; } set { Data[0xAA] = (byte)value; } } - public int CNT_Cute { get { return Data[0xAB]; } set { Data[0xAB] = (byte)value; } } - public int CNT_Smart { get { return Data[0xAC]; } set { Data[0xAC] = (byte)value; } } - public int CNT_Tough { get { return Data[0xAD]; } set { Data[0xAD] = (byte)value; } } - public int CNT_Sheen { get { return Data[0xAE]; } set { Data[0xAE] = (byte)value; } } + public int CNT_Cool { get => Data[0xA9]; set => Data[0xA9] = (byte)value; } + public int CNT_Beauty { get => Data[0xAA]; set => Data[0xAA] = (byte)value; } + public int CNT_Cute { get => Data[0xAB]; set => Data[0xAB] = (byte)value; } + public int CNT_Smart { get => Data[0xAC]; set => Data[0xAC] = (byte)value; } + public int CNT_Tough { get => Data[0xAD]; set => Data[0xAD] = (byte)value; } + public int CNT_Sheen { get => Data[0xAE]; set => Data[0xAE] = (byte)value; } - public int IV_HP { get { return Data[0xAF]; } set { Data[0xAF] = (byte)value; } } - public int IV_ATK { get { return Data[0xB0]; } set { Data[0xB0] = (byte)value; } } - public int IV_DEF { get { return Data[0xB1]; } set { Data[0xB1] = (byte)value; } } - public int IV_SPE { get { return Data[0xB2]; } set { Data[0xB2] = (byte)value; } } - public int IV_SPA { get { return Data[0xB3]; } set { Data[0xB3] = (byte)value; } } - public int IV_SPD { get { return Data[0xB4]; } set { Data[0xB4] = (byte)value; } } + public int IV_HP { get => Data[0xAF]; set => Data[0xAF] = (byte)value; } + public int IV_ATK { get => Data[0xB0]; set => Data[0xB0] = (byte)value; } + public int IV_DEF { get => Data[0xB1]; set => Data[0xB1] = (byte)value; } + public int IV_SPE { get => Data[0xB2]; set => Data[0xB2] = (byte)value; } + public int IV_SPA { get => Data[0xB3]; set => Data[0xB3] = (byte)value; } + public int IV_SPD { get => Data[0xB4]; set => Data[0xB4] = (byte)value; } - public int OTGender { get { return Data[0xB5]; } set { Data[0xB5] = (byte)value; } } + public int OTGender { get => Data[0xB5]; set => Data[0xB5] = (byte)value; } public string OT { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0xB6, 0x1A)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, 0xB6); } } - public override int Level { get { return Data[0xD0]; } set { Data[0xD0] = (byte)value; } } - public override bool IsEgg { get { return Data[0xD1] == 1; } set { Data[0xD1] = (byte)(value ? 1 : 0); } } - public ushort AdditionalItem { get { return BitConverter.ToUInt16(Data, 0xD2); } set { BitConverter.GetBytes(value).CopyTo(Data, 0xD2); } } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0xB6, 0x1A)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, 0xB6); } + public override int Level { get => Data[0xD0]; set => Data[0xD0] = (byte)value; } + public override bool IsEgg { get => Data[0xD1] == 1; set => Data[0xD1] = (byte)(value ? 1 : 0); } + public ushort AdditionalItem { get => BitConverter.ToUInt16(Data, 0xD2); set => BitConverter.GetBytes(value).CopyTo(Data, 0xD2); } public uint PID { - get { return BitConverter.ToUInt32(Data, 0xD4); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0xD4); } } + get => BitConverter.ToUInt32(Data, 0xD4); + set => BitConverter.GetBytes(value).CopyTo(Data, 0xD4); } public int RelearnMove1 { - get { return BitConverter.ToUInt16(Data, 0xD8); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } } + get => BitConverter.ToUInt16(Data, 0xD8); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } public int RelearnMove2 { - get { return BitConverter.ToUInt16(Data, 0xDA); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } } + get => BitConverter.ToUInt16(Data, 0xDA); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } public int RelearnMove3 { - get { return BitConverter.ToUInt16(Data, 0xDC); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDC); } } + get => BitConverter.ToUInt16(Data, 0xDC); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDC); } public int RelearnMove4 { - get { return BitConverter.ToUInt16(Data, 0xDE); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDE); } } - public int OT_Intensity { get { return Data[0xE0]; } set { Data[0xE0] = (byte)value; } } - public int OT_Memory { get { return Data[0xE1]; } set { Data[0xE1] = (byte)value; } } - public int OT_TextVar { get { return BitConverter.ToUInt16(Data, 0xE2); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xE2); } } - public int OT_Feeling { get { return Data[0xE4]; } set { Data[0xE4] = (byte)value; } } + get => BitConverter.ToUInt16(Data, 0xDE); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDE); } + public int OT_Intensity { get => Data[0xE0]; set => Data[0xE0] = (byte)value; } + public int OT_Memory { get => Data[0xE1]; set => Data[0xE1] = (byte)value; } + public int OT_TextVar { get => BitConverter.ToUInt16(Data, 0xE2); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xE2); } + public int OT_Feeling { get => Data[0xE4]; set => Data[0xE4] = (byte)value; } - public int EV_HP { get { return Data[0xE5]; } set { Data[0xE5] = (byte)value; } } - public int EV_ATK { get { return Data[0xE6]; } set { Data[0xE6] = (byte)value; } } - public int EV_DEF { get { return Data[0xE7]; } set { Data[0xE7] = (byte)value; } } - public int EV_SPE { get { return Data[0xE8]; } set { Data[0xE8] = (byte)value; } } - public int EV_SPA { get { return Data[0xE9]; } set { Data[0xE9] = (byte)value; } } - public int EV_SPD { get { return Data[0xEA]; } set { Data[0xEA] = (byte)value; } } + public int EV_HP { get => Data[0xE5]; set => Data[0xE5] = (byte)value; } + public int EV_ATK { get => Data[0xE6]; set => Data[0xE6] = (byte)value; } + public int EV_DEF { get => Data[0xE7]; set => Data[0xE7] = (byte)value; } + public int EV_SPE { get => Data[0xE8]; set => Data[0xE8] = (byte)value; } + public int EV_SPA { get => Data[0xE9]; set => Data[0xE9] = (byte)value; } + public int EV_SPD { get => Data[0xEA]; set => Data[0xEA] = (byte)value; } - private byte RIB0 { get { return Data[0x74]; } set { Data[0x74] = value; } } - public bool RibbonChampionBattle { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Battle Champ Ribbon - public bool RibbonChampionRegional { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Regional Champ Ribbon - public bool RibbonChampionNational { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // National Champ Ribbon - public bool RibbonCountry { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Country Ribbon - public bool RibbonNational { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // National Ribbon - public bool RibbonEarth { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Earth Ribbon - public bool RibbonWorld { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // World Ribbon - public bool RibbonEvent { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Event Ribbon - private byte RIB1 { get { return Data[0x75]; } set { Data[0x75] = value; } } - public bool RibbonChampionWorld { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // World Champ Ribbon - public bool RibbonBirthday { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Birthday Ribbon - public bool RibbonSpecial { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Special Ribbon - public bool RibbonSouvenir { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Souvenir Ribbon - public bool RibbonWishing { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Wishing Ribbon - public bool RibbonClassic { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Classic Ribbon - public bool RibbonPremier { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Premier Ribbon - public bool RIB1_7 { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Empty + private byte RIB0 { get => Data[0x74]; set => Data[0x74] = value; } + public bool RibbonChampionBattle { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Battle Champ Ribbon + public bool RibbonChampionRegional { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Regional Champ Ribbon + public bool RibbonChampionNational { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // National Champ Ribbon + public bool RibbonCountry { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Country Ribbon + public bool RibbonNational { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // National Ribbon + public bool RibbonEarth { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Earth Ribbon + public bool RibbonWorld { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // World Ribbon + public bool RibbonEvent { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Event Ribbon + private byte RIB1 { get => Data[0x75]; set => Data[0x75] = value; } + public bool RibbonChampionWorld { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } // World Champ Ribbon + public bool RibbonBirthday { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Birthday Ribbon + public bool RibbonSpecial { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Special Ribbon + public bool RibbonSouvenir { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Souvenir Ribbon + public bool RibbonWishing { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Wishing Ribbon + public bool RibbonClassic { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Classic Ribbon + public bool RibbonPremier { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Premier Ribbon + public bool RIB1_7 { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Empty // Meta Accessible Properties public int[] IVs { - get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; } + get => new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; set { if (value?.Length != 6) return; @@ -279,7 +263,7 @@ public int[] IVs } public int[] EVs { - get { return new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; } + get => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; set { if (value?.Length != 6) return; @@ -291,7 +275,7 @@ public int[] EVs public override int[] Moves { - get { return new[] { Move1, Move2, Move3, Move4 }; } + get => new[] { Move1, Move2, Move3, Move4 }; set { if (value.Length > 0) Move1 = value[0]; @@ -302,7 +286,7 @@ public override int[] Moves } public override int[] RelearnMoves { - get { return new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; } + get => new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; set { if (value.Length > 0) RelearnMove1 = value[0]; diff --git a/PKHeX.Core/PKM/BK4.cs b/PKHeX.Core/PKM/BK4.cs index 6a3128896..53dbc46a5 100644 --- a/PKHeX.Core/PKM/BK4.cs +++ b/PKHeX.Core/PKM/BK4.cs @@ -39,202 +39,202 @@ public BK4(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setBEString4(value, maxLength); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x48, 24); } set { if (value?.Length == 24) value.CopyTo(Data, 0x48); } } - public override byte[] OT_Trash { get { return getData(0x68, 16); } set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } } + public override byte[] Nickname_Trash { get => getData(0x48, 24); set { if (value?.Length == 24) value.CopyTo(Data, 0x48); } } + public override byte[] OT_Trash { get => getData(0x68, 16); set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } } // Future Attributes - public override uint EncryptionConstant { get { return PID; } set { } } - public override int Nature { get { return (int)(PID%25); } set { } } - public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } } - public override int CurrentHandler { get { return 0; } set { } } + public override uint EncryptionConstant { get => PID; set { } } + public override int Nature { get => (int)(PID % 25); set { } } + public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; } + public override int CurrentHandler { get => 0; set { } } // Structure - public override uint PID { get { return BigEndian.ToUInt32(Data, 0x00); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x00); } } - public override ushort Sanity { get { return BigEndian.ToUInt16(Data, 0x04); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x04); } } - public override ushort Checksum { get { return BigEndian.ToUInt16(Data, 0x06); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x06); } } + public override uint PID { get => BigEndian.ToUInt32(Data, 0x00); set => BigEndian.GetBytes(value).CopyTo(Data, 0x00); } + public override ushort Sanity { get => BigEndian.ToUInt16(Data, 0x04); set => BigEndian.GetBytes(value).CopyTo(Data, 0x04); } + public override ushort Checksum { get => BigEndian.ToUInt16(Data, 0x06); set => BigEndian.GetBytes(value).CopyTo(Data, 0x06); } #region Block A - public override int Species { get { return BigEndian.ToUInt16(Data, 0x08); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x08); } } - public override int HeldItem { get { return BigEndian.ToUInt16(Data, 0x0A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0A); } } - public override int SID { get { return BigEndian.ToUInt16(Data, 0x0C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0C); } } - public override int TID { get { return BigEndian.ToUInt16(Data, 0x0E); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0E); } } + public override int Species { get => BigEndian.ToUInt16(Data, 0x08); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x08); } + public override int HeldItem { get => BigEndian.ToUInt16(Data, 0x0A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + public override int SID { get => BigEndian.ToUInt16(Data, 0x0C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0C); } + public override int TID { get => BigEndian.ToUInt16(Data, 0x0E); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0E); } public override uint EXP { - get { return BigEndian.ToUInt32(Data, 0x10); } - set { BigEndian.GetBytes(value).CopyTo(Data, 0x10); } + get => BigEndian.ToUInt32(Data, 0x10); + set => BigEndian.GetBytes(value).CopyTo(Data, 0x10); } - public override int OT_Friendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } - public override int Ability { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } - public override int MarkValue { get { return Data[0x16]; } protected set { Data[0x16] = (byte)value; } } - public override int Language { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } } - public override int EV_HP { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } } - public override int EV_ATK { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } } - public override int EV_DEF { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } } - public override int EV_SPE { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } } - public override int EV_SPA { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } } - public override int EV_SPD { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } } - public override int CNT_Cool { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } } - public override int CNT_Cute { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } - public override int CNT_Smart { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } } - public override int CNT_Tough { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } } + public override int OT_Friendship { get => Data[0x14]; set => Data[0x14] = (byte)value; } + public override int Ability { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public override int MarkValue { get => Data[0x16]; protected set => Data[0x16] = (byte)value; } + public override int Language { get => Data[0x17]; set => Data[0x17] = (byte)value; } + public override int EV_HP { get => Data[0x18]; set => Data[0x18] = (byte)value; } + public override int EV_ATK { get => Data[0x19]; set => Data[0x19] = (byte)value; } + public override int EV_DEF { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } + public override int EV_SPE { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + public override int EV_SPA { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public override int EV_SPD { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } + public override int CNT_Cool { get => Data[0x1E]; set => Data[0x1E] = (byte)value; } + public override int CNT_Beauty { get => Data[0x1F]; set => Data[0x1F] = (byte)value; } + public override int CNT_Cute { get => Data[0x20]; set => Data[0x20] = (byte)value; } + public override int CNT_Smart { get => Data[0x21]; set => Data[0x21] = (byte)value; } + public override int CNT_Tough { get => Data[0x22]; set => Data[0x22] = (byte)value; } + public override int CNT_Sheen { get => Data[0x23]; set => Data[0x23] = (byte)value; } - private byte RIB0 { get { return Data[0x24]; } set { Data[0x24] = value; } } // Sinnoh 1 - private byte RIB1 { get { return Data[0x25]; } set { Data[0x25] = value; } } // Sinnoh 2 - private byte RIB2 { get { return Data[0x26]; } set { Data[0x26] = value; } } // Unova 1 - private byte RIB3 { get { return Data[0x27]; } set { Data[0x27] = value; } } // Unova 2 - public bool RibbonChampionSinnoh { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonAbility { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonAbilityGreat { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonAbilityDouble { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonAbilityMulti { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonAbilityPair { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonAbilityWorld { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonAlert { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonShock { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonDowncast { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonCareless { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonRelax { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonSnooze { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonSmile { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonGorgeous { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonRoyal { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonGorgeousRoyal { get { return (RIB2 & (1 << 0)) == 1 << 0; } set { RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonFootprint { get { return (RIB2 & (1 << 1)) == 1 << 1; } set { RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonRecord { get { return (RIB2 & (1 << 2)) == 1 << 2; } set { RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonEvent { get { return (RIB2 & (1 << 3)) == 1 << 3; } set { RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonLegend { get { return (RIB2 & (1 << 4)) == 1 << 4; } set { RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonChampionWorld { get { return (RIB2 & (1 << 5)) == 1 << 5; } set { RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonBirthday { get { return (RIB2 & (1 << 6)) == 1 << 6; } set { RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonSpecial { get { return (RIB2 & (1 << 7)) == 1 << 7; } set { RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonSouvenir { get { return (RIB3 & (1 << 0)) == 1 << 0; } set { RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonWishing { get { return (RIB3 & (1 << 1)) == 1 << 1; } set { RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonClassic { get { return (RIB3 & (1 << 2)) == 1 << 2; } set { RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonPremier { get { return (RIB3 & (1 << 3)) == 1 << 3; } set { RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RIB3_4 { get { return (RIB3 & (1 << 4)) == 1 << 4; } set { RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIB3_5 { get { return (RIB3 & (1 << 5)) == 1 << 5; } set { RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIB3_6 { get { return (RIB3 & (1 << 6)) == 1 << 6; } set { RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIB3_7 { get { return (RIB3 & (1 << 7)) == 1 << 7; } set { RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused + private byte RIB0 { get => Data[0x24]; set => Data[0x24] = value; } // Sinnoh 1 + private byte RIB1 { get => Data[0x25]; set => Data[0x25] = value; } // Sinnoh 2 + private byte RIB2 { get => Data[0x26]; set => Data[0x26] = value; } // Unova 1 + private byte RIB3 { get => Data[0x27]; set => Data[0x27] = value; } // Unova 2 + public bool RibbonChampionSinnoh { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonAbility { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonAbilityGreat { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonAbilityDouble { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonAbilityMulti { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonAbilityPair { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonAbilityWorld { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonAlert { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonShock { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonDowncast { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonCareless { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonRelax { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonSnooze { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonSmile { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonGorgeous { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonRoyal { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonGorgeousRoyal { get => (RIB2 & (1 << 0)) == 1 << 0; set => RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonFootprint { get => (RIB2 & (1 << 1)) == 1 << 1; set => RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonRecord { get => (RIB2 & (1 << 2)) == 1 << 2; set => RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonEvent { get => (RIB2 & (1 << 3)) == 1 << 3; set => RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonLegend { get => (RIB2 & (1 << 4)) == 1 << 4; set => RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonChampionWorld { get => (RIB2 & (1 << 5)) == 1 << 5; set => RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonBirthday { get => (RIB2 & (1 << 6)) == 1 << 6; set => RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonSpecial { get => (RIB2 & (1 << 7)) == 1 << 7; set => RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonSouvenir { get => (RIB3 & (1 << 0)) == 1 << 0; set => RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonWishing { get => (RIB3 & (1 << 1)) == 1 << 1; set => RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonClassic { get => (RIB3 & (1 << 2)) == 1 << 2; set => RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonPremier { get => (RIB3 & (1 << 3)) == 1 << 3; set => RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RIB3_4 { get => (RIB3 & (1 << 4)) == 1 << 4; set => RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIB3_5 { get => (RIB3 & (1 << 5)) == 1 << 5; set => RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIB3_6 { get => (RIB3 & (1 << 6)) == 1 << 6; set => RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIB3_7 { get => (RIB3 & (1 << 7)) == 1 << 7; set => RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused #endregion #region Block B - public override int Move1 { get { return BigEndian.ToUInt16(Data, 0x28); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } } - public override int Move2 { get { return BigEndian.ToUInt16(Data, 0x2A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } } - public override int Move3 { get { return BigEndian.ToUInt16(Data, 0x2C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2C); } } - public override int Move4 { get { return BigEndian.ToUInt16(Data, 0x2E); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2E); } } - public override int Move1_PP { get { return Data[0x30]; } set { Data[0x30] = (byte)value; } } - public override int Move2_PP { get { return Data[0x31]; } set { Data[0x31] = (byte)value; } } - public override int Move3_PP { get { return Data[0x32]; } set { Data[0x32] = (byte)value; } } - public override int Move4_PP { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } } - public override int Move1_PPUps { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } } - public override int Move2_PPUps { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } } - public override int Move3_PPUps { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } } - public override int Move4_PPUps { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } } - public uint IV32 { get { return BigEndian.ToUInt32(Data, 0x38); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x38); } } - public override int IV_HP { get { return (int)(IV32 >> 02) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 02)) | (uint)((value > 31 ? 31 : value) << 02)); } } - public override int IV_ATK { get { return (int)(IV32 >> 07) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 07)) | (uint)((value > 31 ? 31 : value) << 07)); } } - public override int IV_DEF { get { return (int)(IV32 >> 12) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 12)) | (uint)((value > 31 ? 31 : value) << 12)); } } - public override int IV_SPE { get { return (int)(IV32 >> 17) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 17)) | (uint)((value > 31 ? 31 : value) << 17)); } } - public override int IV_SPA { get { return (int)(IV32 >> 22) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 22)) | (uint)((value > 31 ? 31 : value) << 22)); } } - public override int IV_SPD { get { return (int)(IV32 >> 27) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 27)) | (uint)((value > 31 ? 31 : value) << 27)); } } - public override bool IsNicknamed { get { return ((IV32 >> 0) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x00000001) | (uint)(value ? 0x00000001 : 0)); } } - public override bool IsEgg { get { return ((IV32 >> 1) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x00000002) | (uint)(value ? 0x00000002 : 0)); } } + public override int Move1 { get => BigEndian.ToUInt16(Data, 0x28); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } + public override int Move2 { get => BigEndian.ToUInt16(Data, 0x2A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } + public override int Move3 { get => BigEndian.ToUInt16(Data, 0x2C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2C); } + public override int Move4 { get => BigEndian.ToUInt16(Data, 0x2E); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2E); } + public override int Move1_PP { get => Data[0x30]; set => Data[0x30] = (byte)value; } + public override int Move2_PP { get => Data[0x31]; set => Data[0x31] = (byte)value; } + public override int Move3_PP { get => Data[0x32]; set => Data[0x32] = (byte)value; } + public override int Move4_PP { get => Data[0x33]; set => Data[0x33] = (byte)value; } + public override int Move1_PPUps { get => Data[0x34]; set => Data[0x34] = (byte)value; } + public override int Move2_PPUps { get => Data[0x35]; set => Data[0x35] = (byte)value; } + public override int Move3_PPUps { get => Data[0x36]; set => Data[0x36] = (byte)value; } + public override int Move4_PPUps { get => Data[0x37]; set => Data[0x37] = (byte)value; } + public uint IV32 { get => BigEndian.ToUInt32(Data, 0x38); set => BigEndian.GetBytes(value).CopyTo(Data, 0x38); } + public override int IV_HP { get => (int)(IV32 >> 02) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 02)) | (uint)((value > 31 ? 31 : value) << 02)); } + public override int IV_ATK { get => (int)(IV32 >> 07) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 07)) | (uint)((value > 31 ? 31 : value) << 07)); } + public override int IV_DEF { get => (int)(IV32 >> 12) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 12)) | (uint)((value > 31 ? 31 : value) << 12)); } + public override int IV_SPE { get => (int)(IV32 >> 17) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 17)) | (uint)((value > 31 ? 31 : value) << 17)); } + public override int IV_SPA { get => (int)(IV32 >> 22) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 22)) | (uint)((value > 31 ? 31 : value) << 22)); } + public override int IV_SPD { get => (int)(IV32 >> 27) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 27)) | (uint)((value > 31 ? 31 : value) << 27)); } + public override bool IsNicknamed { get => ((IV32 >> 0) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x00000001) | (uint)(value ? 0x00000001 : 0)); } + public override bool IsEgg { get => ((IV32 >> 1) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x00000002) | (uint)(value ? 0x00000002 : 0)); } - private byte RIB4 { get { return Data[0x3C]; } set { Data[0x3C] = value; } } // Hoenn 1a - private byte RIB5 { get { return Data[0x3D]; } set { Data[0x3D] = value; } } // Hoenn 1b - private byte RIB6 { get { return Data[0x3E]; } set { Data[0x3E] = value; } } // Hoenn 2a - private byte RIB7 { get { return Data[0x3F]; } set { Data[0x3F] = value; } } // Hoenn 2b - public bool RibbonG3Cool { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3CoolSuper { get { return (RIB4 & (1 << 1)) == 1 << 1; } set { RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3CoolHyper { get { return (RIB4 & (1 << 2)) == 1 << 2; } set { RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3CoolMaster { get { return (RIB4 & (1 << 3)) == 1 << 3; } set { RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG3Beauty { get { return (RIB4 & (1 << 4)) == 1 << 4; } set { RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG3BeautySuper { get { return (RIB4 & (1 << 5)) == 1 << 5; } set { RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG3BeautyHyper { get { return (RIB4 & (1 << 6)) == 1 << 6; } set { RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG3BeautyMaster { get { return (RIB4 & (1 << 7)) == 1 << 7; } set { RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG3Cute { get { return (RIB5 & (1 << 0)) == 1 << 0; } set { RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3CuteSuper { get { return (RIB5 & (1 << 1)) == 1 << 1; } set { RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3CuteHyper { get { return (RIB5 & (1 << 2)) == 1 << 2; } set { RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3CuteMaster { get { return (RIB5 & (1 << 3)) == 1 << 3; } set { RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG3Smart { get { return (RIB5 & (1 << 4)) == 1 << 4; } set { RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG3SmartSuper { get { return (RIB5 & (1 << 5)) == 1 << 5; } set { RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG3SmartHyper { get { return (RIB5 & (1 << 6)) == 1 << 6; } set { RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG3SmartMaster { get { return (RIB5 & (1 << 7)) == 1 << 7; } set { RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG3Tough { get { return (RIB6 & (1 << 0)) == 1 << 0; } set { RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3ToughSuper { get { return (RIB6 & (1 << 1)) == 1 << 1; } set { RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3ToughHyper { get { return (RIB6 & (1 << 2)) == 1 << 2; } set { RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3ToughMaster { get { return (RIB6 & (1 << 3)) == 1 << 3; } set { RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonChampionG3Hoenn { get { return (RIB6 & (1 << 4)) == 1 << 4; } set { RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonWinning { get { return (RIB6 & (1 << 5)) == 1 << 5; } set { RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonVictory { get { return (RIB6 & (1 << 6)) == 1 << 6; } set { RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonArtist { get { return (RIB6 & (1 << 7)) == 1 << 7; } set { RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonEffort { get { return (RIB7 & (1 << 0)) == 1 << 0; } set { RIB7 = (byte)(RIB7 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonChampionBattle { get { return (RIB7 & (1 << 1)) == 1 << 1; } set { RIB7 = (byte)(RIB7 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonChampionRegional{ get { return (RIB7 & (1 << 2)) == 1 << 2; } set { RIB7 = (byte)(RIB7 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonChampionNational{ get { return (RIB7 & (1 << 3)) == 1 << 3; } set { RIB7 = (byte)(RIB7 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonCountry { get { return (RIB7 & (1 << 4)) == 1 << 4; } set { RIB7 = (byte)(RIB7 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonNational { get { return (RIB7 & (1 << 5)) == 1 << 5; } set { RIB7 = (byte)(RIB7 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonEarth { get { return (RIB7 & (1 << 6)) == 1 << 6; } set { RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonWorld { get { return (RIB7 & (1 << 7)) == 1 << 7; } set { RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } + private byte RIB4 { get => Data[0x3C]; set => Data[0x3C] = value; } // Hoenn 1a + private byte RIB5 { get => Data[0x3D]; set => Data[0x3D] = value; } // Hoenn 1b + private byte RIB6 { get => Data[0x3E]; set => Data[0x3E] = value; } // Hoenn 2a + private byte RIB7 { get => Data[0x3F]; set => Data[0x3F] = value; } // Hoenn 2b + public bool RibbonG3Cool { get => (RIB4 & (1 << 0)) == 1 << 0; set => RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3CoolSuper { get => (RIB4 & (1 << 1)) == 1 << 1; set => RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3CoolHyper { get => (RIB4 & (1 << 2)) == 1 << 2; set => RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3CoolMaster { get => (RIB4 & (1 << 3)) == 1 << 3; set => RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG3Beauty { get => (RIB4 & (1 << 4)) == 1 << 4; set => RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG3BeautySuper { get => (RIB4 & (1 << 5)) == 1 << 5; set => RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG3BeautyHyper { get => (RIB4 & (1 << 6)) == 1 << 6; set => RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG3BeautyMaster { get => (RIB4 & (1 << 7)) == 1 << 7; set => RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG3Cute { get => (RIB5 & (1 << 0)) == 1 << 0; set => RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3CuteSuper { get => (RIB5 & (1 << 1)) == 1 << 1; set => RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3CuteHyper { get => (RIB5 & (1 << 2)) == 1 << 2; set => RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3CuteMaster { get => (RIB5 & (1 << 3)) == 1 << 3; set => RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG3Smart { get => (RIB5 & (1 << 4)) == 1 << 4; set => RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG3SmartSuper { get => (RIB5 & (1 << 5)) == 1 << 5; set => RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG3SmartHyper { get => (RIB5 & (1 << 6)) == 1 << 6; set => RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG3SmartMaster { get => (RIB5 & (1 << 7)) == 1 << 7; set => RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG3Tough { get => (RIB6 & (1 << 0)) == 1 << 0; set => RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3ToughSuper { get => (RIB6 & (1 << 1)) == 1 << 1; set => RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3ToughHyper { get => (RIB6 & (1 << 2)) == 1 << 2; set => RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3ToughMaster { get => (RIB6 & (1 << 3)) == 1 << 3; set => RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonChampionG3Hoenn { get => (RIB6 & (1 << 4)) == 1 << 4; set => RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonWinning { get => (RIB6 & (1 << 5)) == 1 << 5; set => RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonVictory { get => (RIB6 & (1 << 6)) == 1 << 6; set => RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonArtist { get => (RIB6 & (1 << 7)) == 1 << 7; set => RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonEffort { get => (RIB7 & (1 << 0)) == 1 << 0; set => RIB7 = (byte)(RIB7 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonChampionBattle { get => (RIB7 & (1 << 1)) == 1 << 1; set => RIB7 = (byte)(RIB7 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonChampionRegional{ get => (RIB7 & (1 << 2)) == 1 << 2; set => RIB7 = (byte)(RIB7 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonChampionNational{ get => (RIB7 & (1 << 3)) == 1 << 3; set => RIB7 = (byte)(RIB7 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonCountry { get => (RIB7 & (1 << 4)) == 1 << 4; set => RIB7 = (byte)(RIB7 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonNational { get => (RIB7 & (1 << 5)) == 1 << 5; set => RIB7 = (byte)(RIB7 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonEarth { get => (RIB7 & (1 << 6)) == 1 << 6; set => RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonWorld { get => (RIB7 & (1 << 7)) == 1 << 7; set => RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } - public override bool FatefulEncounter { get { return (Data[0x40] & 0x80) == 0x80; } set { Data[0x40] = (byte)(Data[0x40] & ~0x80 | (value ? 0x80 : 0)); } } - public override int Gender { get { return (Data[0x40] >> 5) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x60 | ((value & 3) << 5)); } } - public override int AltForm { get { return Data[0x40] & 0x1F; } set { Data[0x40] = (byte)(Data[0x40] & ~0x1F | (value & 0x1F)); } } + public override bool FatefulEncounter { get => (Data[0x40] & 0x80) == 0x80; set => Data[0x40] = (byte)(Data[0x40] & ~0x80 | (value ? 0x80 : 0)); } + public override int Gender { get => (Data[0x40] >> 5) & 0x3; set => Data[0x40] = (byte)(Data[0x40] & ~0x60 | ((value & 3) << 5)); } + public override int AltForm { get => Data[0x40] & 0x1F; set => Data[0x40] = (byte)(Data[0x40] & ~0x1F | (value & 0x1F)); } // 0x43-0x47 Unused #endregion #region Block C - public override string Nickname { get { return getString(0x48, 24); } set { setString(value, 11).CopyTo(Data, 0x48); } } + public override string Nickname { get => getString(0x48, 24); set => setString(value, 11).CopyTo(Data, 0x48); } // 0x5E unused - public override int Version { get { return Data[0x5F]; } set { Data[0x5F] = (byte)value; } } - private byte RIB8 { get { return Data[0x60]; } set { Data[0x60] = value; } } // Sinnoh 3 - private byte RIB9 { get { return Data[0x61]; } set { Data[0x61] = value; } } // Sinnoh 4 - private byte RIBA { get { return Data[0x62]; } set { Data[0x62] = value; } } // Sinnoh 5 - private byte RIBB { get { return Data[0x63]; } set { Data[0x63] = value; } } // Sinnoh 6 - public bool RibbonG4Cool { get { return (RIB8 & (1 << 0)) == 1 << 0; } set { RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4CoolGreat { get { return (RIB8 & (1 << 1)) == 1 << 1; } set { RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4CoolUltra { get { return (RIB8 & (1 << 2)) == 1 << 2; } set { RIB8 = (byte)(RIB8 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4CoolMaster { get { return (RIB8 & (1 << 3)) == 1 << 3; } set { RIB8 = (byte)(RIB8 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG4Beauty { get { return (RIB8 & (1 << 4)) == 1 << 4; } set { RIB8 = (byte)(RIB8 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG4BeautyGreat { get { return (RIB8 & (1 << 5)) == 1 << 5; } set { RIB8 = (byte)(RIB8 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG4BeautyUltra { get { return (RIB8 & (1 << 6)) == 1 << 6; } set { RIB8 = (byte)(RIB8 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG4BeautyMaster { get { return (RIB8 & (1 << 7)) == 1 << 7; } set { RIB8 = (byte)(RIB8 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG4Cute { get { return (RIB9 & (1 << 0)) == 1 << 0; } set { RIB9 = (byte)(RIB9 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4CuteGreat { get { return (RIB9 & (1 << 1)) == 1 << 1; } set { RIB9 = (byte)(RIB9 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4CuteUltra { get { return (RIB9 & (1 << 2)) == 1 << 2; } set { RIB9 = (byte)(RIB9 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4CuteMaster { get { return (RIB9 & (1 << 3)) == 1 << 3; } set { RIB9 = (byte)(RIB9 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG4Smart { get { return (RIB9 & (1 << 4)) == 1 << 4; } set { RIB9 = (byte)(RIB9 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG4SmartGreat { get { return (RIB9 & (1 << 5)) == 1 << 5; } set { RIB9 = (byte)(RIB9 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG4SmartUltra { get { return (RIB9 & (1 << 6)) == 1 << 6; } set { RIB9 = (byte)(RIB9 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG4SmartMaster { get { return (RIB9 & (1 << 7)) == 1 << 7; } set { RIB9 = (byte)(RIB9 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG4Tough { get { return (RIBA & (1 << 0)) == 1 << 0; } set { RIBA = (byte)(RIBA & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4ToughGreat { get { return (RIBA & (1 << 1)) == 1 << 1; } set { RIBA = (byte)(RIBA & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4ToughUltra { get { return (RIBA & (1 << 2)) == 1 << 2; } set { RIBA = (byte)(RIBA & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4ToughMaster { get { return (RIBA & (1 << 3)) == 1 << 3; } set { RIBA = (byte)(RIBA & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RIBA_4 { get { return (RIBA & (1 << 4)) == 1 << 4; } set { RIBA = (byte)(RIBA & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIBA_5 { get { return (RIBA & (1 << 5)) == 1 << 5; } set { RIBA = (byte)(RIBA & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIBA_6 { get { return (RIBA & (1 << 6)) == 1 << 6; } set { RIBA = (byte)(RIBA & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIBA_7 { get { return (RIBA & (1 << 7)) == 1 << 7; } set { RIBA = (byte)(RIBA & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused - public bool RIBB_0 { get { return (RIBB & (1 << 0)) == 1 << 0; } set { RIBB = (byte)(RIBB & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Unused - public bool RIBB_1 { get { return (RIBB & (1 << 1)) == 1 << 1; } set { RIBB = (byte)(RIBB & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Unused - public bool RIBB_2 { get { return (RIBB & (1 << 2)) == 1 << 2; } set { RIBB = (byte)(RIBB & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Unused - public bool RIBB_3 { get { return (RIBB & (1 << 3)) == 1 << 3; } set { RIBB = (byte)(RIBB & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Unused - public bool RIBB_4 { get { return (RIBB & (1 << 4)) == 1 << 4; } set { RIBB = (byte)(RIBB & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIBB_5 { get { return (RIBB & (1 << 5)) == 1 << 5; } set { RIBB = (byte)(RIBB & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIBB_6 { get { return (RIBB & (1 << 6)) == 1 << 6; } set { RIBB = (byte)(RIBB & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIBB_7 { get { return (RIBB & (1 << 7)) == 1 << 7; } set { RIBB = (byte)(RIBB & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused + public override int Version { get => Data[0x5F]; set => Data[0x5F] = (byte)value; } + private byte RIB8 { get => Data[0x60]; set => Data[0x60] = value; } // Sinnoh 3 + private byte RIB9 { get => Data[0x61]; set => Data[0x61] = value; } // Sinnoh 4 + private byte RIBA { get => Data[0x62]; set => Data[0x62] = value; } // Sinnoh 5 + private byte RIBB { get => Data[0x63]; set => Data[0x63] = value; } // Sinnoh 6 + public bool RibbonG4Cool { get => (RIB8 & (1 << 0)) == 1 << 0; set => RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4CoolGreat { get => (RIB8 & (1 << 1)) == 1 << 1; set => RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4CoolUltra { get => (RIB8 & (1 << 2)) == 1 << 2; set => RIB8 = (byte)(RIB8 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4CoolMaster { get => (RIB8 & (1 << 3)) == 1 << 3; set => RIB8 = (byte)(RIB8 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG4Beauty { get => (RIB8 & (1 << 4)) == 1 << 4; set => RIB8 = (byte)(RIB8 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG4BeautyGreat { get => (RIB8 & (1 << 5)) == 1 << 5; set => RIB8 = (byte)(RIB8 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG4BeautyUltra { get => (RIB8 & (1 << 6)) == 1 << 6; set => RIB8 = (byte)(RIB8 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG4BeautyMaster { get => (RIB8 & (1 << 7)) == 1 << 7; set => RIB8 = (byte)(RIB8 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG4Cute { get => (RIB9 & (1 << 0)) == 1 << 0; set => RIB9 = (byte)(RIB9 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4CuteGreat { get => (RIB9 & (1 << 1)) == 1 << 1; set => RIB9 = (byte)(RIB9 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4CuteUltra { get => (RIB9 & (1 << 2)) == 1 << 2; set => RIB9 = (byte)(RIB9 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4CuteMaster { get => (RIB9 & (1 << 3)) == 1 << 3; set => RIB9 = (byte)(RIB9 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG4Smart { get => (RIB9 & (1 << 4)) == 1 << 4; set => RIB9 = (byte)(RIB9 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG4SmartGreat { get => (RIB9 & (1 << 5)) == 1 << 5; set => RIB9 = (byte)(RIB9 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG4SmartUltra { get => (RIB9 & (1 << 6)) == 1 << 6; set => RIB9 = (byte)(RIB9 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG4SmartMaster { get => (RIB9 & (1 << 7)) == 1 << 7; set => RIB9 = (byte)(RIB9 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG4Tough { get => (RIBA & (1 << 0)) == 1 << 0; set => RIBA = (byte)(RIBA & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4ToughGreat { get => (RIBA & (1 << 1)) == 1 << 1; set => RIBA = (byte)(RIBA & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4ToughUltra { get => (RIBA & (1 << 2)) == 1 << 2; set => RIBA = (byte)(RIBA & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4ToughMaster { get => (RIBA & (1 << 3)) == 1 << 3; set => RIBA = (byte)(RIBA & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RIBA_4 { get => (RIBA & (1 << 4)) == 1 << 4; set => RIBA = (byte)(RIBA & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIBA_5 { get => (RIBA & (1 << 5)) == 1 << 5; set => RIBA = (byte)(RIBA & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIBA_6 { get => (RIBA & (1 << 6)) == 1 << 6; set => RIBA = (byte)(RIBA & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIBA_7 { get => (RIBA & (1 << 7)) == 1 << 7; set => RIBA = (byte)(RIBA & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused + public bool RIBB_0 { get => (RIBB & (1 << 0)) == 1 << 0; set => RIBB = (byte)(RIBB & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Unused + public bool RIBB_1 { get => (RIBB & (1 << 1)) == 1 << 1; set => RIBB = (byte)(RIBB & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Unused + public bool RIBB_2 { get => (RIBB & (1 << 2)) == 1 << 2; set => RIBB = (byte)(RIBB & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Unused + public bool RIBB_3 { get => (RIBB & (1 << 3)) == 1 << 3; set => RIBB = (byte)(RIBB & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Unused + public bool RIBB_4 { get => (RIBB & (1 << 4)) == 1 << 4; set => RIBB = (byte)(RIBB & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIBB_5 { get => (RIBB & (1 << 5)) == 1 << 5; set => RIBB = (byte)(RIBB & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIBB_6 { get => (RIBB & (1 << 6)) == 1 << 6; set => RIBB = (byte)(RIBB & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIBB_7 { get => (RIBB & (1 << 7)) == 1 << 7; set => RIBB = (byte)(RIBB & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused // 0x64-0x67 Unused #endregion #region Block D - public override string OT_Name { get { return getString(0x68, 16); } set { setString(value, 7).CopyTo(Data, 0x68); } } - public override int Egg_Year { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } } - public override int Egg_Month { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } } - public override int Egg_Day { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } } - public override int Met_Year { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } } - public override int Met_Month { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } } - public override int Met_Day { get { return Data[0x7D]; } set { Data[0x7D] = (byte)value; } } + public override string OT_Name { get => getString(0x68, 16); set => setString(value, 7).CopyTo(Data, 0x68); } + public override int Egg_Year { get => Data[0x78]; set => Data[0x78] = (byte)value; } + public override int Egg_Month { get => Data[0x79]; set => Data[0x79] = (byte)value; } + public override int Egg_Day { get => Data[0x7A]; set => Data[0x7A] = (byte)value; } + public override int Met_Year { get => Data[0x7B]; set => Data[0x7B] = (byte)value; } + public override int Met_Month { get => Data[0x7C]; set => Data[0x7C] = (byte)value; } + public override int Met_Day { get => Data[0x7D]; set => Data[0x7D] = (byte)value; } public override int Egg_Location { @@ -304,21 +304,19 @@ public override int Met_Location } } } - private byte PKRS { get { return Data[0x82]; } set { Data[0x82] = value; } } - public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } - public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } } + private byte PKRS { get => Data[0x82]; set => Data[0x82] = value; } + public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)(PKRS & ~0xF | value); } + public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)(PKRS & 0xF | (value << 4)); } public override int Ball { - get - { - // Pokemon obtained in HGSS have the HGSS ball set (@0x86) - // However, this info is not set when receiving a wondercard! - // The PGT contains a preformatted PK4 file, which is slightly modified. - // No HGSS balls were used, and no HGSS ball info is set. + get => Math.Max(Data[0x86], Data[0x83]); + // Pokemon obtained in HGSS have the HGSS ball set (@0x86) + // However, this info is not set when receiving a wondercard! + // The PGT contains a preformatted PK4 file, which is slightly modified. + // No HGSS balls were used, and no HGSS ball info is set. + + // Sneaky way = return the higher of the two values. - // Sneaky way = return the higher of the two values. - return Math.Max(Data[0x86], Data[0x83]); - } set { // Ball to display in DPPt @@ -331,20 +329,20 @@ public override int Ball Data[0x86] = 0; // Unused } } - public override int Met_Level { get { return Data[0x84] >> 1; } set { Data[0x84] = (byte)((Data[0x84] & 0x1) | value << 1); } } - public override int OT_Gender { get { return Data[0x84] & 1; } set { Data[0x84] = (byte)((Data[0x84] & ~0x1) | value & 1); } } - public override int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } } + public override int Met_Level { get => Data[0x84] >> 1; set => Data[0x84] = (byte)((Data[0x84] & 0x1) | value << 1); } + public override int OT_Gender { get => Data[0x84] & 1; set => Data[0x84] = (byte)((Data[0x84] & ~0x1) | value & 1); } + public override int EncounterType { get => Data[0x85]; set => Data[0x85] = (byte)value; } // Unused 0x87 #endregion - public override int Stat_Level { get { return Data[0x8C]; } set { Data[0x8C] = (byte)value; } } - public override int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x8E); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8E); } } - public override int Stat_HPMax { get { return BigEndian.ToUInt16(Data, 0x90); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x90); } } - public override int Stat_ATK { get { return BigEndian.ToUInt16(Data, 0x92); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x92); } } - public override int Stat_DEF { get { return BigEndian.ToUInt16(Data, 0x94); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x94); } } - public override int Stat_SPE { get { return BigEndian.ToUInt16(Data, 0x96); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x96); } } - public override int Stat_SPA { get { return BigEndian.ToUInt16(Data, 0x98); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x98); } } - public override int Stat_SPD { get { return BigEndian.ToUInt16(Data, 0x9A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x9A); } } + public override int Stat_Level { get => Data[0x8C]; set => Data[0x8C] = (byte)value; } + public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x8E); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8E); } + public override int Stat_HPMax { get => BigEndian.ToUInt16(Data, 0x90); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x90); } + public override int Stat_ATK { get => BigEndian.ToUInt16(Data, 0x92); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x92); } + public override int Stat_DEF { get => BigEndian.ToUInt16(Data, 0x94); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x94); } + public override int Stat_SPE { get => BigEndian.ToUInt16(Data, 0x96); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x96); } + public override int Stat_SPA { get => BigEndian.ToUInt16(Data, 0x98); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x98); } + public override int Stat_SPD { get => BigEndian.ToUInt16(Data, 0x9A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x9A); } public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3); public override int TSV => (TID ^ SID) >> 3; diff --git a/PKHeX.Core/PKM/CK3.cs b/PKHeX.Core/PKM/CK3.cs index c9d2a0513..b2f347c69 100644 --- a/PKHeX.Core/PKM/CK3.cs +++ b/PKHeX.Core/PKM/CK3.cs @@ -31,160 +31,160 @@ public CK3(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setBEString3(value, maxLength); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x2E, 20); } set { if (value?.Length == 20) value.CopyTo(Data, 0x2E); } } - public override byte[] OT_Trash { get { return getData(0x18, 20); } set { if (value?.Length == 20) value.CopyTo(Data, 0x18); } } + public override byte[] Nickname_Trash { get => getData(0x2E, 20); set { if (value?.Length == 20) value.CopyTo(Data, 0x2E); } } + public override byte[] OT_Trash { get => getData(0x18, 20); set { if (value?.Length == 20) value.CopyTo(Data, 0x18); } } // Future Attributes - public override uint EncryptionConstant { get { return PID; } set { } } - public override int Nature { get { return (int)(PID % 25); } set { } } - public override int AltForm { get { return Species == 201 ? PKX.getUnownForm(PID) : 0; } set { } } + public override uint EncryptionConstant { get => PID; set { } } + public override int Nature { get => (int)(PID % 25); set { } } + public override int AltForm { get => Species == 201 ? PKX.getUnownForm(PID) : 0; set { } } - public override bool IsNicknamed { get { return PKX.getIsNicknamedAnyLanguage(Species, Nickname, Format); } set { } } - public override int Gender { get { return PKX.getGender(Species, PID); } set { } } + public override bool IsNicknamed { get => PKX.getIsNicknamedAnyLanguage(Species, Nickname, Format); set { } } + public override int Gender { get => PKX.getGender(Species, PID); set { } } public override int Characteristic => -1; - public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } } + public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; } public override int Ability { get { int[] abils = PersonalTable.RS.getAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } } - public override int CurrentHandler { get { return 0; } set { } } - public override int Egg_Location { get { return 0; } set { } } + public override int CurrentHandler { get => 0; set { } } + public override int Egg_Location { get => 0; set { } } // Silly Attributes - public override ushort Sanity { get { return 0; } set { } } // valid flag set in pkm structure. - public override ushort Checksum { get { return SaveUtil.ccitt16(Data); } set { } } // totally false, just a way to get a 'random' ident for the pkm. + public override ushort Sanity { get => 0; set { } } // valid flag set in pkm structure. + public override ushort Checksum { get => SaveUtil.ccitt16(Data); set { } } // totally false, just a way to get a 'random' ident for the pkm. public override bool ChecksumValid => Valid; - public override int Species { get { return PKX.getG4Species(BigEndian.ToUInt16(Data, 0x00)); } set { BigEndian.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x00); } } + public override int Species { get => PKX.getG4Species(BigEndian.ToUInt16(Data, 0x00)); set => BigEndian.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x00); } // 02-04 unused - public override uint PID { get { return BigEndian.ToUInt32(Data, 0x04); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x04); } } - public override int Version { get { return SaveUtil.getG3VersionID(Data[0x08]); } set { Data[0x08] = (byte)SaveUtil.getCXDVersionID(value); } } - public int CurrentRegion { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } } - public int OriginalRegion { get { return Data[0x0A]; } set { Data[0x0A] = (byte)value; } } - public override int Language { get { return PKX.getMainLangIDfromGC(Data[0x0B]); } set { Data[0x0B] = PKX.getGCLangIDfromMain((byte)value); } } - public override int Met_Location { get { return BigEndian.ToUInt16(Data, 0x0C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0C);} } - public override int Met_Level { get { return Data[0x0E]; } set { Data[0x0E] = (byte)value; } } - public override int Ball { get { return Data[0x0F]; } set { Data[0x0F] = (byte)value; } } - public override int OT_Gender { get { return Data[0x10]; } set { Data[0x10] = (byte)value; } } - public override int SID { get { return BigEndian.ToUInt16(Data, 0x14); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x14); } } - public override int TID { get { return BigEndian.ToUInt16(Data, 0x16); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x16); } } - public override string OT_Name { get { return getString(0x18, 20); } set { setString(value, 10).CopyTo(Data, 0x18); } } // +2 terminator - public override string Nickname { get { return getString(0x2E, 20); } set { setString(value, 10).CopyTo(Data, 0x2E); Nickname2 = value; } } // +2 terminator - private string Nickname2 { get { return getString(0x44, 20); } set { setString(value, 10).CopyTo(Data, 0x44); } } // +2 terminator - public override uint EXP { get { return BigEndian.ToUInt32(Data, 0x5C); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x5C);} } - public override int Stat_Level { get { return Data[0x60]; } set { Data[0x60] = (byte)value; } } + public override uint PID { get => BigEndian.ToUInt32(Data, 0x04); set => BigEndian.GetBytes(value).CopyTo(Data, 0x04); } + public override int Version { get => SaveUtil.getG3VersionID(Data[0x08]); set => Data[0x08] = (byte)SaveUtil.getCXDVersionID(value); } + public int CurrentRegion { get => Data[0x09]; set => Data[0x09] = (byte)value; } + public int OriginalRegion { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } + public override int Language { get => PKX.getMainLangIDfromGC(Data[0x0B]); set => Data[0x0B] = PKX.getGCLangIDfromMain((byte)value); } + public override int Met_Location { get => BigEndian.ToUInt16(Data, 0x0C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0C); } + public override int Met_Level { get => Data[0x0E]; set => Data[0x0E] = (byte)value; } + public override int Ball { get => Data[0x0F]; set => Data[0x0F] = (byte)value; } + public override int OT_Gender { get => Data[0x10]; set => Data[0x10] = (byte)value; } + public override int SID { get => BigEndian.ToUInt16(Data, 0x14); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x14); } + public override int TID { get => BigEndian.ToUInt16(Data, 0x16); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x16); } + public override string OT_Name { get => getString(0x18, 20); set => setString(value, 10).CopyTo(Data, 0x18); } // +2 terminator + public override string Nickname { get => getString(0x2E, 20); set { setString(value, 10).CopyTo(Data, 0x2E); Nickname2 = value; } } // +2 terminator + private string Nickname2 { get => getString(0x44, 20); set => setString(value, 10).CopyTo(Data, 0x44); } // +2 terminator + public override uint EXP { get => BigEndian.ToUInt32(Data, 0x5C); set => BigEndian.GetBytes(value).CopyTo(Data, 0x5C); } + public override int Stat_Level { get => Data[0x60]; set => Data[0x60] = (byte)value; } // 0x64-0x77 are battle/status related // Not that the program cares // Moves - public override int Move1 { get { return BigEndian.ToUInt16(Data, 0x78); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x78); } } - public override int Move1_PP { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } } - public override int Move1_PPUps { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } } - public override int Move2 { get { return BigEndian.ToUInt16(Data, 0x7C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x7C); } } - public override int Move2_PP { get { return Data[0x7E]; } set { Data[0x7E] = (byte)value; } } - public override int Move2_PPUps { get { return Data[0x7F]; } set { Data[0x7F] = (byte)value; } } - public override int Move3 { get { return BigEndian.ToUInt16(Data, 0x80); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x80); } } - public override int Move3_PP { get { return Data[0x82]; } set { Data[0x82] = (byte)value; } } - public override int Move3_PPUps { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } } - public override int Move4 { get { return BigEndian.ToUInt16(Data, 0x84); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x84); } } - public override int Move4_PP { get { return Data[0x86]; } set { Data[0x86] = (byte)value; } } - public override int Move4_PPUps { get { return Data[0x87]; } set { Data[0x87] = (byte)value; } } + public override int Move1 { get => BigEndian.ToUInt16(Data, 0x78); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x78); } + public override int Move1_PP { get => Data[0x7A]; set => Data[0x7A] = (byte)value; } + public override int Move1_PPUps { get => Data[0x7B]; set => Data[0x7B] = (byte)value; } + public override int Move2 { get => BigEndian.ToUInt16(Data, 0x7C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x7C); } + public override int Move2_PP { get => Data[0x7E]; set => Data[0x7E] = (byte)value; } + public override int Move2_PPUps { get => Data[0x7F]; set => Data[0x7F] = (byte)value; } + public override int Move3 { get => BigEndian.ToUInt16(Data, 0x80); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x80); } + public override int Move3_PP { get => Data[0x82]; set => Data[0x82] = (byte)value; } + public override int Move3_PPUps { get => Data[0x83]; set => Data[0x83] = (byte)value; } + public override int Move4 { get => BigEndian.ToUInt16(Data, 0x84); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x84); } + public override int Move4_PP { get => Data[0x86]; set => Data[0x86] = (byte)value; } + public override int Move4_PPUps { get => Data[0x87]; set => Data[0x87] = (byte)value; } public override int SpriteItem => PKX.getG4Item((ushort)HeldItem); - public override int HeldItem { get { return BigEndian.ToUInt16(Data, 0x88); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x88); } } + public override int HeldItem { get => BigEndian.ToUInt16(Data, 0x88); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x88); } // More party stats - public override int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x8A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8A); } } - public override int Stat_HPMax { get { return BigEndian.ToUInt16(Data, 0x8C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8C); } } - public override int Stat_ATK { get { return BigEndian.ToUInt16(Data, 0x8E); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8E); } } - public override int Stat_DEF { get { return BigEndian.ToUInt16(Data, 0x90); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x90); } } - public override int Stat_SPA { get { return BigEndian.ToUInt16(Data, 0x92); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x92); } } - public override int Stat_SPD { get { return BigEndian.ToUInt16(Data, 0x94); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x94); } } - public override int Stat_SPE { get { return BigEndian.ToUInt16(Data, 0x96); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x96); } } + public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x8A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8A); } + public override int Stat_HPMax { get => BigEndian.ToUInt16(Data, 0x8C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8C); } + public override int Stat_ATK { get => BigEndian.ToUInt16(Data, 0x8E); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8E); } + public override int Stat_DEF { get => BigEndian.ToUInt16(Data, 0x90); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x90); } + public override int Stat_SPA { get => BigEndian.ToUInt16(Data, 0x92); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x92); } + public override int Stat_SPD { get => BigEndian.ToUInt16(Data, 0x94); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x94); } + public override int Stat_SPE { get => BigEndian.ToUInt16(Data, 0x96); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x96); } // EVs - public override int EV_HP { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x98)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x98); } } + public override int EV_HP { + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x98)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x98); } public override int EV_ATK { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9A)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9A); } } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9A)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9A); } public override int EV_DEF { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9C)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9C); } } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9C)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9C); } public override int EV_SPA { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9E)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9E); } } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9E)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9E); } public override int EV_SPD { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA0)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA0); } } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA0)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA0); } public override int EV_SPE { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA2)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA2); } } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA2)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA2); } // IVs public override int IV_HP { - get { return Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA4)); } - set { BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA4); } } + get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA4)); + set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA4); } public override int IV_ATK { - get { return Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA6)); } - set { BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA6); } } + get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA6)); + set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA6); } public override int IV_DEF { - get { return Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA8)); } - set { BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA8); } } + get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA8)); + set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA8); } public override int IV_SPA { - get { return Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAA)); } - set { BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAA); } } + get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAA)); + set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAA); } public override int IV_SPD { - get { return Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAC)); } - set { BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAC); } } + get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAC)); + set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAC); } public override int IV_SPE { - get { return Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAE)); } - set { BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAE); } } + get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAE)); + set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAE); } - public override int OT_Friendship { get { return Data[0xB0]; } set { Data[0xB0] = (byte)value; } } + public override int OT_Friendship { get => Data[0xB0]; set => Data[0xB0] = (byte)value; } // Contest - public override int CNT_Cool { get { return Data[0xB2]; } set { Data[0xB2] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0xB3]; } set { Data[0xB3] = (byte)value; } } - public override int CNT_Cute { get { return Data[0xB4]; } set { Data[0xB4] = (byte)value; } } - public override int CNT_Smart { get { return Data[0xB5]; } set { Data[0xB5] = (byte)value; } } - public override int CNT_Tough { get { return Data[0xB6]; } set { Data[0xB6] = (byte)value; } } - public int RibbonCountG3Cool { get { return Data[0xB7]; } set { Data[0xB7] = (byte)value; } } - public int RibbonCountG3Beauty { get { return Data[0xB8]; } set { Data[0xB8] = (byte)value; } } - public int RibbonCountG3Cute { get { return Data[0xB9]; } set { Data[0xB9] = (byte)value; } } - public int RibbonCountG3Smart { get { return Data[0xBA]; } set { Data[0xBA] = (byte)value; } } - public int RibbonCountG3Tough { get { return Data[0xBB]; } set { Data[0xBB] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0xBC]; } set { Data[0xBC] = (byte)value; } } + public override int CNT_Cool { get => Data[0xB2]; set => Data[0xB2] = (byte)value; } + public override int CNT_Beauty { get => Data[0xB3]; set => Data[0xB3] = (byte)value; } + public override int CNT_Cute { get => Data[0xB4]; set => Data[0xB4] = (byte)value; } + public override int CNT_Smart { get => Data[0xB5]; set => Data[0xB5] = (byte)value; } + public override int CNT_Tough { get => Data[0xB6]; set => Data[0xB6] = (byte)value; } + public int RibbonCountG3Cool { get => Data[0xB7]; set => Data[0xB7] = (byte)value; } + public int RibbonCountG3Beauty { get => Data[0xB8]; set => Data[0xB8] = (byte)value; } + public int RibbonCountG3Cute { get => Data[0xB9]; set => Data[0xB9] = (byte)value; } + public int RibbonCountG3Smart { get => Data[0xBA]; set => Data[0xBA] = (byte)value; } + public int RibbonCountG3Tough { get => Data[0xBB]; set => Data[0xBB] = (byte)value; } + public override int CNT_Sheen { get => Data[0xBC]; set => Data[0xBC] = (byte)value; } // Ribbons - public bool RibbonChampionG3Hoenn { get { return Data[0xBD] == 1; } set { Data[0xBD] = (byte)(value ? 1 : 0); } } - public bool RibbonWinning { get { return Data[0xBE] == 1; } set { Data[0xBE] = (byte)(value ? 1 : 0); } } - public bool RibbonVictory { get { return Data[0xBF] == 1; } set { Data[0xBF] = (byte)(value ? 1 : 0); } } - public bool RibbonArtist { get { return Data[0xC0] == 1; } set { Data[0xC0] = (byte)(value ? 1 : 0); } } - public bool RibbonEffort { get { return Data[0xC1] == 1; } set { Data[0xC1] = (byte)(value ? 1 : 0); } } - public bool RibbonChampionBattle { get { return Data[0xC2] == 1; } set { Data[0xC2] = (byte)(value ? 1 : 0); } } - public bool RibbonChampionRegional { get { return Data[0xC3] == 1; } set { Data[0xC3] = (byte)(value ? 1 : 0); } } - public bool RibbonChampionNational { get { return Data[0xC4] == 1; } set { Data[0xC4] = (byte)(value ? 1 : 0); } } - public bool RibbonCountry { get { return Data[0xC5] == 1; } set { Data[0xC5] = (byte)(value ? 1 : 0); } } - public bool RibbonNational { get { return Data[0xC6] == 1; } set { Data[0xC6] = (byte)(value ? 1 : 0); } } - public bool RibbonEarth { get { return Data[0xC7] == 1; } set { Data[0xC7] = (byte)(value ? 1 : 0); } } - public bool RibbonWorld { get { return Data[0xC8] == 1; } set { Data[0xC8] = (byte)(value ? 1 : 0); } } - public bool Unused1 { get { return ((Data[0xC9]>>0) & 1) == 1; } set { Data[0xC9] = (byte)(Data[0xC9] & ~1 | (value ? 1 : 0)); } } - public bool Unused2 { get { return ((Data[0xC9]>>1) & 1) == 1; } set { Data[0xC9] = (byte)(Data[0xC9] & ~2 | (value ? 2 : 0)); } } - public bool Unused3 { get { return ((Data[0xC9]>>2) & 1) == 1; } set { Data[0xC9] = (byte)(Data[0xC9] & ~4 | (value ? 4 : 0)); } } - public bool Unused4 { get { return ((Data[0xC9]>>3) & 1) == 1; } set { Data[0xC9] = (byte)(Data[0xC9] & ~8 | (value ? 8 : 0)); } } + public bool RibbonChampionG3Hoenn { get => Data[0xBD] == 1; set => Data[0xBD] = (byte)(value ? 1 : 0); } + public bool RibbonWinning { get => Data[0xBE] == 1; set => Data[0xBE] = (byte)(value ? 1 : 0); } + public bool RibbonVictory { get => Data[0xBF] == 1; set => Data[0xBF] = (byte)(value ? 1 : 0); } + public bool RibbonArtist { get => Data[0xC0] == 1; set => Data[0xC0] = (byte)(value ? 1 : 0); } + public bool RibbonEffort { get => Data[0xC1] == 1; set => Data[0xC1] = (byte)(value ? 1 : 0); } + public bool RibbonChampionBattle { get => Data[0xC2] == 1; set => Data[0xC2] = (byte)(value ? 1 : 0); } + public bool RibbonChampionRegional { get => Data[0xC3] == 1; set => Data[0xC3] = (byte)(value ? 1 : 0); } + public bool RibbonChampionNational { get => Data[0xC4] == 1; set => Data[0xC4] = (byte)(value ? 1 : 0); } + public bool RibbonCountry { get => Data[0xC5] == 1; set => Data[0xC5] = (byte)(value ? 1 : 0); } + public bool RibbonNational { get => Data[0xC6] == 1; set => Data[0xC6] = (byte)(value ? 1 : 0); } + public bool RibbonEarth { get => Data[0xC7] == 1; set => Data[0xC7] = (byte)(value ? 1 : 0); } + public bool RibbonWorld { get => Data[0xC8] == 1; set => Data[0xC8] = (byte)(value ? 1 : 0); } + public bool Unused1 { get => ((Data[0xC9] >> 0) & 1) == 1; set => Data[0xC9] = (byte)(Data[0xC9] & ~1 | (value ? 1 : 0)); } + public bool Unused2 { get => ((Data[0xC9] >> 1) & 1) == 1; set => Data[0xC9] = (byte)(Data[0xC9] & ~2 | (value ? 2 : 0)); } + public bool Unused3 { get => ((Data[0xC9] >> 2) & 1) == 1; set => Data[0xC9] = (byte)(Data[0xC9] & ~4 | (value ? 4 : 0)); } + public bool Unused4 { get => ((Data[0xC9] >> 3) & 1) == 1; set => Data[0xC9] = (byte)(Data[0xC9] & ~8 | (value ? 8 : 0)); } - public override int PKRS_Strain { get { return Data[0xCA] & 0xF; } set { Data[0xCA] = (byte)(value & 0xF); } } - public override bool IsEgg { get { return Data[0xCB] == 1; } set { Data[0xCB] = (byte)(value ? 1 : 0); } } - public override int AbilityNumber { get { return 1 << Data[0xCC]; } set { Data[0xCC] = (byte)((value >> 1) & 1); } } - public override bool Valid { get { return Data[0xCD] == 0; } set { if (value) Data[0xCD] = 0; } } + public override int PKRS_Strain { get => Data[0xCA] & 0xF; set => Data[0xCA] = (byte)(value & 0xF); } + public override bool IsEgg { get => Data[0xCB] == 1; set => Data[0xCB] = (byte)(value ? 1 : 0); } + public override int AbilityNumber { get => 1 << Data[0xCC]; set => Data[0xCC] = (byte)((value >> 1) & 1); } + public override bool Valid { get => Data[0xCD] == 0; set { if (value) Data[0xCD] = 0; } } // 0xCE unknown - public override int MarkValue { get { return Data[0xCF]; } protected set { Data[0xCF] = (byte)value; } } - public override int PKRS_Days { get { return Math.Max((sbyte)Data[0xD0], (sbyte)0); } set { Data[0xD0] = (byte)(value == 0 ? 0xFF : value & 0xF); } } - public int ShadowID { get { return BigEndian.ToUInt16(Data, 0xD8); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xD8); } } - public int Purification { get { return BigEndian.ToInt32(Data, 0xDC); } set { BigEndian.GetBytes(value).CopyTo(Data, 0xDC); } } - public uint EXP_Shadow { get { return BigEndian.ToUInt32(Data, 0xC0); } set { BigEndian.GetBytes(value).CopyTo(Data, 0xC0); } } - public override bool FatefulEncounter { get { return Data[0x11C] == 1; } set { Data[0x11C] = (byte)(value ? 1 : 0); } } - public new int EncounterType { get { return Data[0xFB]; } set { Data[0xFB] = (byte)value; } } + public override int MarkValue { get => Data[0xCF]; protected set => Data[0xCF] = (byte)value; } + public override int PKRS_Days { get => Math.Max((sbyte)Data[0xD0], (sbyte)0); set => Data[0xD0] = (byte)(value == 0 ? 0xFF : value & 0xF); } + public int ShadowID { get => BigEndian.ToUInt16(Data, 0xD8); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xD8); } + public int Purification { get => BigEndian.ToInt32(Data, 0xDC); set => BigEndian.GetBytes(value).CopyTo(Data, 0xDC); } + public uint EXP_Shadow { get => BigEndian.ToUInt32(Data, 0xC0); set => BigEndian.GetBytes(value).CopyTo(Data, 0xC0); } + public override bool FatefulEncounter { get => Data[0x11C] == 1; set => Data[0x11C] = (byte)(value ? 1 : 0); } + public new int EncounterType { get => Data[0xFB]; set => Data[0xFB] = (byte)value; } // Generated Attributes public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3); diff --git a/PKHeX.Core/PKM/PK1.cs b/PKHeX.Core/PKM/PK1.cs index 7282a4592..cb6869f51 100644 --- a/PKHeX.Core/PKM/PK1.cs +++ b/PKHeX.Core/PKM/PK1.cs @@ -24,8 +24,8 @@ public class PK1 : PKM public override byte[] setString(string value, int maxLength) => PKX.setString1(value, maxLength, Japanese); // Trash Bytes - public override byte[] Nickname_Trash { get { return nick; } set { if (value?.Length == nick.Length) nick = value; } } - public override byte[] OT_Trash { get { return otname; } set { if (value?.Length == otname.Length) otname = value; } } + public override byte[] Nickname_Trash { get => nick; set { if (value?.Length == nick.Length) nick = value; } } + public override byte[] OT_Trash { get => otname; set { if (value?.Length == otname.Length) otname = value; } } public override int Format => 1; @@ -53,7 +53,7 @@ public override PKM Clone() } public override string Nickname { - get { return PKX.getString1(nick, 0, nick.Length, Japanese); } + get => PKX.getString1(nick, 0, nick.Length, Japanese); set { byte[] strdata = setString(value, StringLength); @@ -71,7 +71,7 @@ public override string Nickname public override string OT_Name { - get { return PKX.getString1(otname, 0, otname.Length, Japanese); } + get => PKX.getString1(otname, 0, otname.Length, Japanese); set { byte[] strdata = setString(value, StringLength); @@ -87,14 +87,7 @@ public override string OT_Name } } - public override byte[] Encrypt() - { - // Oh god this is such total abuse of what this method is meant to do - // Please forgive me - return new PokemonList1(this).GetBytes(); - } - - // Please forgive me. + public override byte[] Encrypt() => new PokemonList1(this).GetBytes(); public override byte[] EncryptedPartyData => Encrypt().ToArray(); public override byte[] EncryptedBoxData => Encrypt().ToArray(); public override byte[] DecryptedBoxData => Encrypt().ToArray(); @@ -138,7 +131,7 @@ public void setNotNicknamed() #region Stored Attributes public override int Species { - get { return PKX.getG1Species(Data[0]); } + get => PKX.getG1Species(Data[0]); set { Data[0] = (byte)PKX.setG1Species(value); @@ -151,60 +144,60 @@ public override int Species } } - public override int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x1); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1); } } - public int Status_Condition { get { return Data[4]; } set { Data[4] = (byte)value; } } - public int Type_A { get { return Data[5]; } set { Data[5] = (byte)value; } } - public int Type_B { get { return Data[6]; } set { Data[6] = (byte)value; } } - public int Catch_Rate { get { return Data[7]; } set { Data[7] = (byte)value; } } - public override int Move1 { get { return Data[8]; } set { Data[8] = (byte) value; } } - public override int Move2 { get { return Data[9]; } set { Data[9] = (byte)value; } } - public override int Move3 { get { return Data[10]; } set { Data[10] = (byte)value; } } - public override int Move4 { get { return Data[11]; } set { Data[11] = (byte)value; } } - public override int TID { get { return BigEndian.ToUInt16(Data, 0xC); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xC); } } + public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x1); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1); } + public int Status_Condition { get => Data[4]; set => Data[4] = (byte)value; } + public int Type_A { get => Data[5]; set => Data[5] = (byte)value; } + public int Type_B { get => Data[6]; set => Data[6] = (byte)value; } + public int Catch_Rate { get => Data[7]; set => Data[7] = (byte)value; } + public override int Move1 { get => Data[8]; set => Data[8] = (byte)value; } + public override int Move2 { get => Data[9]; set => Data[9] = (byte)value; } + public override int Move3 { get => Data[10]; set => Data[10] = (byte)value; } + public override int Move4 { get => Data[11]; set => Data[11] = (byte)value; } + public override int TID { get => BigEndian.ToUInt16(Data, 0xC); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xC); } public override uint EXP { - get { return (BigEndian.ToUInt32(Data, 0xE) >> 8) & 0x00FFFFFF; } - set { Array.Copy(BigEndian.GetBytes((value << 8) & 0xFFFFFF00), 0, Data, 0xE, 3); } + get => (BigEndian.ToUInt32(Data, 0xE) >> 8) & 0x00FFFFFF; + set => Array.Copy(BigEndian.GetBytes((value << 8) & 0xFFFFFF00), 0, Data, 0xE, 3); } - public override int EV_HP { get { return BigEndian.ToUInt16(Data, 0x11); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x11); } } - public override int EV_ATK { get { return BigEndian.ToUInt16(Data, 0x13); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x13); } } - public override int EV_DEF { get { return BigEndian.ToUInt16(Data, 0x15); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x15); } } - public override int EV_SPE { get { return BigEndian.ToUInt16(Data, 0x17); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x17); } } - public int EV_SPC { get { return BigEndian.ToUInt16(Data, 0x19); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x19); } } - public override int EV_SPA { get { return EV_SPC; } set { EV_SPC = value; } } - public override int EV_SPD { get { return EV_SPC; } set { } } - public ushort DV16 { get { return BigEndian.ToUInt16(Data, 0x1B); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x1B); } } - public override int IV_HP { get { return ((IV_ATK & 1) << 3) | ((IV_DEF & 1) << 2) | ((IV_SPE & 1) << 1) | ((IV_SPC & 1) << 0); } set { } } - public override int IV_ATK { get { return (DV16 >> 12) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 12)) | (ushort)((value > 0xF ? 0xF : value) << 12)); } } - public override int IV_DEF { get { return (DV16 >> 8) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 8)) | (ushort)((value > 0xF ? 0xF : value) << 8)); } } - public override int IV_SPE { get { return (DV16 >> 4) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 4)) | (ushort)((value > 0xF ? 0xF : value) << 4)); } } - public int IV_SPC { get { return (DV16 >> 0) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 0)) | (ushort)((value > 0xF ? 0xF : value) << 0)); } } - public override int IV_SPA { get { return IV_SPC; } set { IV_SPC = value; } } - public override int IV_SPD { get { return IV_SPC; } set { } } - public override int Move1_PP { get { return Data[0x1D] & 0x3F; } set { Data[0x1D] = (byte)((Data[0x1D] & 0xC0) | (value & 0x3F)); } } - public override int Move2_PP { get { return Data[0x1E] & 0x3F; } set { Data[0x1E] = (byte)((Data[0x1E] & 0xC0) | (value & 0x3F)); } } - public override int Move3_PP { get { return Data[0x1F] & 0x3F; } set { Data[0x1F] = (byte)((Data[0x1F] & 0xC0) | (value & 0x3F)); } } - public override int Move4_PP { get { return Data[0x20] & 0x3F; } set { Data[0x20] = (byte)((Data[0x20] & 0xC0) | (value & 0x3F)); } } - public override int Move1_PPUps { get { return (Data[0x1D] & 0xC0) >> 6; } set { Data[0x1D] = (byte)((Data[0x1D] & 0x3F) | ((value & 0x3) << 6)); } } - public override int Move2_PPUps { get { return (Data[0x1E] & 0xC0) >> 6; } set { Data[0x1E] = (byte)((Data[0x1E] & 0x3F) | ((value & 0x3) << 6)); } } - public override int Move3_PPUps { get { return (Data[0x1F] & 0xC0) >> 6; } set { Data[0x1F] = (byte)((Data[0x1F] & 0x3F) | ((value & 0x3) << 6)); } } - public override int Move4_PPUps { get { return (Data[0x20] & 0xC0) >> 6; } set { Data[0x20] = (byte)((Data[0x20] & 0x3F) | ((value & 0x3) << 6)); } } + public override int EV_HP { get => BigEndian.ToUInt16(Data, 0x11); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x11); } + public override int EV_ATK { get => BigEndian.ToUInt16(Data, 0x13); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x13); } + public override int EV_DEF { get => BigEndian.ToUInt16(Data, 0x15); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x15); } + public override int EV_SPE { get => BigEndian.ToUInt16(Data, 0x17); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x17); } + public int EV_SPC { get => BigEndian.ToUInt16(Data, 0x19); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x19); } + public override int EV_SPA { get => EV_SPC; set => EV_SPC = value; } + public override int EV_SPD { get => EV_SPC; set { } } + public ushort DV16 { get => BigEndian.ToUInt16(Data, 0x1B); set => BigEndian.GetBytes(value).CopyTo(Data, 0x1B); } + public override int IV_HP { get => ((IV_ATK & 1) << 3) | ((IV_DEF & 1) << 2) | ((IV_SPE & 1) << 1) | ((IV_SPC & 1) << 0); set { } } + public override int IV_ATK { get => (DV16 >> 12) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 12)) | (ushort)((value > 0xF ? 0xF : value) << 12)); } + public override int IV_DEF { get => (DV16 >> 8) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 8)) | (ushort)((value > 0xF ? 0xF : value) << 8)); } + public override int IV_SPE { get => (DV16 >> 4) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 4)) | (ushort)((value > 0xF ? 0xF : value) << 4)); } + public int IV_SPC { get => (DV16 >> 0) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 0)) | (ushort)((value > 0xF ? 0xF : value) << 0)); } + public override int IV_SPA { get => IV_SPC; set => IV_SPC = value; } + public override int IV_SPD { get => IV_SPC; set { } } + public override int Move1_PP { get => Data[0x1D] & 0x3F; set => Data[0x1D] = (byte)((Data[0x1D] & 0xC0) | (value & 0x3F)); } + public override int Move2_PP { get => Data[0x1E] & 0x3F; set => Data[0x1E] = (byte)((Data[0x1E] & 0xC0) | (value & 0x3F)); } + public override int Move3_PP { get => Data[0x1F] & 0x3F; set => Data[0x1F] = (byte)((Data[0x1F] & 0xC0) | (value & 0x3F)); } + public override int Move4_PP { get => Data[0x20] & 0x3F; set => Data[0x20] = (byte)((Data[0x20] & 0xC0) | (value & 0x3F)); } + public override int Move1_PPUps { get => (Data[0x1D] & 0xC0) >> 6; set => Data[0x1D] = (byte)((Data[0x1D] & 0x3F) | ((value & 0x3) << 6)); } + public override int Move2_PPUps { get => (Data[0x1E] & 0xC0) >> 6; set => Data[0x1E] = (byte)((Data[0x1E] & 0x3F) | ((value & 0x3) << 6)); } + public override int Move3_PPUps { get => (Data[0x1F] & 0xC0) >> 6; set => Data[0x1F] = (byte)((Data[0x1F] & 0x3F) | ((value & 0x3) << 6)); } + public override int Move4_PPUps { get => (Data[0x20] & 0xC0) >> 6; set => Data[0x20] = (byte)((Data[0x20] & 0x3F) | ((value & 0x3) << 6)); } #endregion #region Party Attributes public override int Stat_Level { - get { return Data[0x21]; } + get => Data[0x21]; set { Data[0x21] = (byte)value; Data[0x3] = (byte)value; } } - public override int Stat_HPMax { get { return BigEndian.ToUInt16(Data, 0x22); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x22); } } - public override int Stat_ATK { get { return BigEndian.ToUInt16(Data, 0x24); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); } } - public override int Stat_DEF { get { return BigEndian.ToUInt16(Data, 0x26); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } } - public override int Stat_SPE { get { return BigEndian.ToUInt16(Data, 0x28); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } } - public int Stat_SPC { get { return BigEndian.ToUInt16(Data, 0x2A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } } + public override int Stat_HPMax { get => BigEndian.ToUInt16(Data, 0x22); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x22); } + public override int Stat_ATK { get => BigEndian.ToUInt16(Data, 0x24); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); } + public override int Stat_DEF { get => BigEndian.ToUInt16(Data, 0x26); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } + public override int Stat_SPE { get => BigEndian.ToUInt16(Data, 0x28); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } + public int Stat_SPC { get => BigEndian.ToUInt16(Data, 0x2A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } // Leave SPA and SPD as alias for SPC - public override int Stat_SPA { get { return Stat_SPC; } set { Stat_SPC = value; } } - public override int Stat_SPD { get { return Stat_SPC; } set { } } + public override int Stat_SPA { get => Stat_SPC; set => Stat_SPC = value; } + public override int Stat_SPD { get => Stat_SPC; set { } } #endregion public override ushort[] getStats(PersonalInfo p) @@ -229,48 +222,43 @@ public override bool getGenderIsValid() { return true; } - public override uint EncryptionConstant { get { return 0; } set { } } - public override uint PID { get { return 0; } set { } } - public override int Met_Level { get { return 0; } set { } } - public override int Nature { get { return 0; } set { } } - public override int AltForm { get { return 0; } set { } } - public override bool IsEgg { get { return false; } set { } } - public override int Gender { get { return 0; } set { } } - public override int HeldItem { get { return 0; } set { } } - - public override bool CanHoldItem(ushort[] ValidArray) - { - return false; - } - + public override uint EncryptionConstant { get => 0; set { } } + public override uint PID { get => 0; set { } } + public override int Met_Level { get => 0; set { } } + public override int Nature { get => 0; set { } } + public override int AltForm { get => 0; set { } } + public override bool IsEgg { get => false; set { } } + public override int Gender { get => 0; set { } } + public override int HeldItem { get => 0; set { } } + public override bool CanHoldItem(ushort[] ValidArray) => false; public override bool IsShiny => IV_ATK == 10 && IV_SPE == 10 && IV_SPC == 10 && (IV_DEF & 2) == 2; - public override ushort Sanity { get { return 0; } set { } } + public override ushort Sanity { get => 0; set { } } public override bool ChecksumValid => true; - public override ushort Checksum { get { return 0; } set { } } - public override int Language { get { return 0; } set { } } - public override bool FatefulEncounter { get { return false; } set { } } + public override ushort Checksum { get => 0; set { } } + public override int Language { get => 0; set { } } + public override bool FatefulEncounter { get => false; set { } } public override int TSV => 0x0000; public override int PSV => 0xFFFF; public override int Characteristic => -1; - public override int MarkValue { get { return 0; } protected set { } } - public override int CurrentFriendship { get { return 0; } set { } } - public override int Ability { get { return 0; } set { } } - public override int CurrentHandler { get { return 0; } set { } } - public override int Met_Location { get { return 0; } set { } } - public override int Egg_Location { get { return 0; } set { } } - public override int OT_Friendship { get { return 0; } set { } } - public override int OT_Gender { get { return 0; } set { } } - public override int Ball { get { return 0; } set { } } - public override int Version { get { return (int)GameVersion.RBY; } set { } } - public override int SID { get { return 0; } set { } } - public override int PKRS_Strain { get { return 0; } set { } } - public override int PKRS_Days { get { return 0; } set { } } - public override int CNT_Cool { get { return 0; } set { } } - public override int CNT_Beauty { get { return 0; } set { } } - public override int CNT_Cute { get { return 0; } set { } } - public override int CNT_Smart { get { return 0; } set { } } - public override int CNT_Tough { get { return 0; } set { } } - public override int CNT_Sheen { get { return 0; } set { } } + public override int MarkValue { get => 0; protected set { } } + public override int CurrentFriendship { get => 0; set { } } + public override int Ability { get => 0; set { } } + public override int CurrentHandler { get => 0; set { } } + public override int Met_Location { get => 0; set { } } + public override int Egg_Location { get => 0; set { } } + public override int OT_Friendship { get => 0; set { } } + public override int OT_Gender { get => 0; set { } } + public override int Ball { get => 0; set { } } + public override int Version { get => (int)GameVersion.RBY; set { } } + public override int SID { get => 0; set { } } + public override int PKRS_Strain { get => 0; set { } } + public override int PKRS_Days { get => 0; set { } } + public override int CNT_Cool { get => 0; set { } } + public override int CNT_Beauty { get => 0; set { } } + public override int CNT_Cute { get => 0; set { } } + public override int CNT_Smart { get => 0; set { } } + public override int CNT_Tough { get => 0; set { } } + public override int CNT_Sheen { get => 0; set { } } #endregion public bool CatchRateIsItem = false; @@ -427,19 +415,12 @@ public enum CapacityType Single } - public static int getEntrySize(CapacityType c) - { - return c == CapacityType.Single || c == CapacityType.Party - ? PKX.SIZE_1PARTY - : PKX.SIZE_1STORED; - } + private static int getEntrySize(CapacityType c) => c == CapacityType.Single || c == CapacityType.Party + ? PKX.SIZE_1PARTY + : PKX.SIZE_1STORED; + private static byte getCapacity(CapacityType c) => c == CapacityType.Single ? (byte)1 : (byte)c; - public static byte getCapacity(CapacityType c) - { - return c == CapacityType.Single ? (byte)1 : (byte)c; - } - - private byte[] getEmptyList(CapacityType c, bool is_JP = false) + private static byte[] getEmptyList(CapacityType c, bool is_JP = false) { int cap = getCapacity(c); return new[] { (byte)0 }.Concat(Enumerable.Repeat((byte)0xFF, cap + 1)).Concat(Enumerable.Repeat((byte)0, getEntrySize(c) * cap)).Concat(Enumerable.Repeat((byte)0x50, (is_JP ? PK1.STRLEN_J : PK1.STRLEN_U) * 2 * cap)).ToArray(); @@ -453,9 +434,7 @@ public PokemonList1(byte[] d, CapacityType c = CapacityType.Single, bool jp = fa Entry_Size = getEntrySize(c); if (Data.Length != DataSize) - { Array.Resize(ref Data, DataSize); - } Pokemon = new PK1[Capacity]; for (int i = 0; i < Capacity; i++) @@ -472,10 +451,7 @@ public PokemonList1(byte[] d, CapacityType c = CapacityType.Single, bool jp = fa } public PokemonList1(CapacityType c = CapacityType.Single, bool jp = false) - : this(null, c, jp) - { - Count = 1; - } + : this(null, c, jp) => Count = 1; public PokemonList1(PK1 pk) : this(CapacityType.Single, pk.Japanese) @@ -490,8 +466,8 @@ public PokemonList1(PK1 pk) public byte Count { - get { return Data[0]; } - set { Data[0] = value > Capacity ? Capacity : value; } + get => Data[0]; + set => Data[0] = value > Capacity ? Capacity : value; } public readonly PK1[] Pokemon; @@ -533,10 +509,6 @@ public byte[] GetBytes() } private int DataSize => Capacity * (Entry_Size + 1 + 2 * StringLength) + 2; - - public static int GetDataLength(CapacityType c, bool jp = false) - { - return getCapacity(c) * (getEntrySize(c) + 1 + 2 * (jp ? PK1.STRLEN_J : PK1.STRLEN_U)) + 2; - } + public static int GetDataLength(CapacityType c, bool jp = false) => getCapacity(c) * (getEntrySize(c) + 1 + 2 * (jp ? PK1.STRLEN_J : PK1.STRLEN_U)) + 2; } } diff --git a/PKHeX.Core/PKM/PK2.cs b/PKHeX.Core/PKM/PK2.cs index 6cca49593..d0335e54c 100644 --- a/PKHeX.Core/PKM/PK2.cs +++ b/PKHeX.Core/PKM/PK2.cs @@ -24,8 +24,8 @@ public class PK2 : PKM public override byte[] setString(string value, int maxLength) => PKX.setString1(value, maxLength, Japanese); // Trash Bytes - public override byte[] Nickname_Trash { get { return nick; } set { if (value?.Length == nick.Length) nick = value; } } - public override byte[] OT_Trash { get { return otname; } set { if (value?.Length == otname.Length) otname = value; } } + public override byte[] Nickname_Trash { get => nick; set { if (value?.Length == nick.Length) nick = value; } } + public override byte[] OT_Trash { get => otname; set { if (value?.Length == otname.Length) otname = value; } } public override int Format => 2; @@ -63,7 +63,7 @@ public override PKM Clone() } public override string Nickname { - get { return PKX.getString1(nick, 0, nick.Length, Japanese); } + get => PKX.getString1(nick, 0, nick.Length, Japanese); set { byte[] strdata = setString(value, StringLength); @@ -81,7 +81,7 @@ public override string Nickname public override string OT_Name { - get { return PKX.getString1(otname, 0, otname.Length, Japanese); } + get => PKX.getString1(otname, 0, otname.Length, Japanese); set { byte[] strdata = setString(value, StringLength); @@ -97,14 +97,7 @@ public override string OT_Name } } - public override byte[] Encrypt() - { - // Oh god this is such total abuse of what this method is meant to do - // Please forgive me - return new PokemonList2(this).GetBytes(); - } - - // Please forgive me. + public override byte[] Encrypt() => new PokemonList2(this).GetBytes(); public override byte[] EncryptedPartyData => Encrypt().ToArray(); public override byte[] EncryptedBoxData => Encrypt().ToArray(); public override byte[] DecryptedBoxData => Encrypt().ToArray(); @@ -137,76 +130,73 @@ public void setNotNicknamed() #region Stored Attributes public override int Species { - get { return Data[0]; } - set - { - Data[0] = (byte)value; - } + get => Data[0]; + set => Data[0] = (byte)value; } public override int SpriteItem => PKX.getG4Item((byte)HeldItem); - public override int HeldItem { get { return Data[0x1]; } set { Data[0x1] = (byte)value; } } - public override int Move1 { get { return Data[2]; } set { Data[2] = (byte) value; } } - public override int Move2 { get { return Data[3]; } set { Data[3] = (byte)value; } } - public override int Move3 { get { return Data[4]; } set { Data[4] = (byte)value; } } - public override int Move4 { get { return Data[5]; } set { Data[5] = (byte)value; } } - public override int TID { get { return BigEndian.ToUInt16(Data, 6); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 6); } } + public override int HeldItem { get => Data[0x1]; set => Data[0x1] = (byte)value; } + public override int Move1 { get => Data[2]; set => Data[2] = (byte)value; } + public override int Move2 { get => Data[3]; set => Data[3] = (byte)value; } + public override int Move3 { get => Data[4]; set => Data[4] = (byte)value; } + public override int Move4 { get => Data[5]; set => Data[5] = (byte)value; } + public override int TID { get => BigEndian.ToUInt16(Data, 6); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 6); } public override uint EXP { - get { return (BigEndian.ToUInt32(Data, 8) >> 8) & 0x00FFFFFF; } - set { Array.Copy(BigEndian.GetBytes((value << 8) & 0xFFFFFF00), 0, Data, 8, 3); } + get => (BigEndian.ToUInt32(Data, 8) >> 8) & 0x00FFFFFF; + set => Array.Copy(BigEndian.GetBytes((value << 8) & 0xFFFFFF00), 0, Data, 8, 3); } - public override int EV_HP { get { return BigEndian.ToUInt16(Data, 0xB); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xB); } } - public override int EV_ATK { get { return BigEndian.ToUInt16(Data, 0xD); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xD); } } - public override int EV_DEF { get { return BigEndian.ToUInt16(Data, 0xF); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xF); } } - public override int EV_SPE { get { return BigEndian.ToUInt16(Data, 0x11); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x11); } } - public int EV_SPC { get { return BigEndian.ToUInt16(Data, 0x13); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x13); } } - public override int EV_SPA { get { return EV_SPC; } set { EV_SPC = value; } } - public override int EV_SPD { get { return EV_SPC; } set { } } - public ushort DV16 { get { return BigEndian.ToUInt16(Data, 0x15); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x15); } } - public override int IV_HP { get { return ((IV_ATK & 1) << 3) | ((IV_DEF & 1) << 2) | ((IV_SPE & 1) << 1) | ((IV_SPC & 1) << 0); } set { } } - public override int IV_ATK { get { return (DV16 >> 12) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 12)) | (ushort)((value > 0xF ? 0xF : value) << 12)); } } - public override int IV_DEF { get { return (DV16 >> 8) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 8)) | (ushort)((value > 0xF ? 0xF : value) << 8)); } } - public override int IV_SPE { get { return (DV16 >> 4) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 4)) | (ushort)((value > 0xF ? 0xF : value) << 4)); } } - public int IV_SPC { get { return (DV16 >> 0) & 0xF; } set { DV16 = (ushort)((DV16 & ~(0xF << 0)) | (ushort)((value > 0xF ? 0xF : value) << 0)); } } - public override int IV_SPA { get { return IV_SPC; } set { IV_SPC = value; } } - public override int IV_SPD { get { return IV_SPC; } set { } } - public override int Move1_PP { get { return Data[0x17] & 0x3F; } set { Data[0x17] = (byte)((Data[0x17] & 0xC0) | (value & 0x3F)); } } - public override int Move2_PP { get { return Data[0x18] & 0x3F; } set { Data[0x18] = (byte)((Data[0x18] & 0xC0) | (value & 0x3F)); } } - public override int Move3_PP { get { return Data[0x19] & 0x3F; } set { Data[0x19] = (byte)((Data[0x19] & 0xC0) | (value & 0x3F)); } } - public override int Move4_PP { get { return Data[0x1A] & 0x3F; } set { Data[0x1A] = (byte)((Data[0x1A] & 0xC0) | (value & 0x3F)); } } - public override int Move1_PPUps { get { return (Data[0x17] & 0xC0) >> 6; } set { Data[0x17] = (byte)((Data[0x17] & 0x3F) | ((value & 0x3) << 6)); } } - public override int Move2_PPUps { get { return (Data[0x18] & 0xC0) >> 6; } set { Data[0x18] = (byte)((Data[0x18] & 0x3F) | ((value & 0x3) << 6)); } } - public override int Move3_PPUps { get { return (Data[0x19] & 0xC0) >> 6; } set { Data[0x19] = (byte)((Data[0x19] & 0x3F) | ((value & 0x3) << 6)); } } - public override int Move4_PPUps { get { return (Data[0x1A] & 0xC0) >> 6; } set { Data[0x1A] = (byte)((Data[0x1A] & 0x3F) | ((value & 0x3) << 6)); } } - public override int CurrentFriendship { get { return Data[0x1B]; } set { Data[0x1B] = (byte) value; } } - private byte PKRS { get { return Data[0x1C]; } set { Data[0x1C] = value; } } - public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } - public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } } + public override int EV_HP { get => BigEndian.ToUInt16(Data, 0xB); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xB); } + public override int EV_ATK { get => BigEndian.ToUInt16(Data, 0xD); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xD); } + public override int EV_DEF { get => BigEndian.ToUInt16(Data, 0xF); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xF); } + public override int EV_SPE { get => BigEndian.ToUInt16(Data, 0x11); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x11); } + public int EV_SPC { get => BigEndian.ToUInt16(Data, 0x13); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x13); } + public override int EV_SPA { get => EV_SPC; set => EV_SPC = value; } + public override int EV_SPD { get => EV_SPC; set { } } + public ushort DV16 { get => BigEndian.ToUInt16(Data, 0x15); set => BigEndian.GetBytes(value).CopyTo(Data, 0x15); } + public override int IV_HP { get => ((IV_ATK & 1) << 3) | ((IV_DEF & 1) << 2) | ((IV_SPE & 1) << 1) | ((IV_SPC & 1) << 0); set { } } + public override int IV_ATK { get => (DV16 >> 12) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 12)) | (ushort)((value > 0xF ? 0xF : value) << 12)); } + public override int IV_DEF { get => (DV16 >> 8) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 8)) | (ushort)((value > 0xF ? 0xF : value) << 8)); } + public override int IV_SPE { get => (DV16 >> 4) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 4)) | (ushort)((value > 0xF ? 0xF : value) << 4)); } + public int IV_SPC { get => (DV16 >> 0) & 0xF; set => DV16 = (ushort)((DV16 & ~(0xF << 0)) | (ushort)((value > 0xF ? 0xF : value) << 0)); } + public override int IV_SPA { get => IV_SPC; set => IV_SPC = value; } + public override int IV_SPD { get => IV_SPC; set { } } + public override int Move1_PP { get => Data[0x17] & 0x3F; set => Data[0x17] = (byte)((Data[0x17] & 0xC0) | (value & 0x3F)); } + public override int Move2_PP { get => Data[0x18] & 0x3F; set => Data[0x18] = (byte)((Data[0x18] & 0xC0) | (value & 0x3F)); } + public override int Move3_PP { get => Data[0x19] & 0x3F; set => Data[0x19] = (byte)((Data[0x19] & 0xC0) | (value & 0x3F)); } + public override int Move4_PP { get => Data[0x1A] & 0x3F; set => Data[0x1A] = (byte)((Data[0x1A] & 0xC0) | (value & 0x3F)); } + public override int Move1_PPUps { get => (Data[0x17] & 0xC0) >> 6; set => Data[0x17] = (byte)((Data[0x17] & 0x3F) | ((value & 0x3) << 6)); } + public override int Move2_PPUps { get => (Data[0x18] & 0xC0) >> 6; set => Data[0x18] = (byte)((Data[0x18] & 0x3F) | ((value & 0x3) << 6)); } + public override int Move3_PPUps { get => (Data[0x19] & 0xC0) >> 6; set => Data[0x19] = (byte)((Data[0x19] & 0x3F) | ((value & 0x3) << 6)); } + public override int Move4_PPUps { get => (Data[0x1A] & 0xC0) >> 6; set => Data[0x1A] = (byte)((Data[0x1A] & 0x3F) | ((value & 0x3) << 6)); } + public override int CurrentFriendship { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + private byte PKRS { get => Data[0x1C]; set => Data[0x1C] = value; } + public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)(PKRS & ~0xF | value); } + public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)(PKRS & 0xF | value << 4); } // Crystal only Caught Data - private int CaughtData { get { return BigEndian.ToUInt16(Data, 0x1D); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1D); } } - public int Met_TimeOfDay { get { return (CaughtData >> 14) & 0x3; } set { CaughtData = (CaughtData & 0x3FFF) | ((value & 0x3) << 14); } } - public override int Met_Level { get { return (CaughtData >> 8) & 0x3F; } set { CaughtData = (CaughtData & 0xC0FF) | ((value & 0x3F) << 8); } } - public override int OT_Gender { get { return (CaughtData >> 7) & 1; } set { CaughtData = (CaughtData & 0xFFEF) | ((value & 1) << 7); } } - public override int Met_Location { get { return CaughtData & 0x7F; } set { CaughtData = (CaughtData & 0xFF80) | (value & 0x7F); } } + private int CaughtData { get => BigEndian.ToUInt16(Data, 0x1D); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1D); } + public int Met_TimeOfDay { get => (CaughtData >> 14) & 0x3; set => CaughtData = (CaughtData & 0x3FFF) | ((value & 0x3) << 14); } + public override int Met_Level { get => (CaughtData >> 8) & 0x3F; set => CaughtData = (CaughtData & 0xC0FF) | ((value & 0x3F) << 8); } + public override int OT_Gender { get => (CaughtData >> 7) & 1; set => CaughtData = (CaughtData & 0xFFEF) | ((value & 1) << 7); } + public override int Met_Location { get => CaughtData & 0x7F; set => CaughtData = (CaughtData & 0xFF80) | (value & 0x7F); } public override int Stat_Level { - get { return Data[0x1F]; } - set { Data[0x1F] = (byte)value; } + get => Data[0x1F]; + set => Data[0x1F] = (byte)value; } #endregion #region Party Attributes - public int Status_Condition { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } + public int Status_Condition { get => Data[0x20]; set => Data[0x20] = (byte)value; } - public override int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x22); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x22); } } - public override int Stat_HPMax { get { return BigEndian.ToUInt16(Data, 0x24); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); } } - public override int Stat_ATK { get { return BigEndian.ToUInt16(Data, 0x26); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } } - public override int Stat_DEF { get { return BigEndian.ToUInt16(Data, 0x28); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } } - public override int Stat_SPE { get { return BigEndian.ToUInt16(Data, 0x2A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } } - public override int Stat_SPA { get { return BigEndian.ToUInt16(Data, 0x2C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2C); } } - public override int Stat_SPD { get { return BigEndian.ToUInt16(Data, 0x2E); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2E); } } + public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x22); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x22); } + public override int Stat_HPMax { get => BigEndian.ToUInt16(Data, 0x24); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); } + public override int Stat_ATK { get => BigEndian.ToUInt16(Data, 0x26); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } + public override int Stat_DEF { get => BigEndian.ToUInt16(Data, 0x28); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x28); } + public override int Stat_SPE { get => BigEndian.ToUInt16(Data, 0x2A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2A); } + public override int Stat_SPA { get => BigEndian.ToUInt16(Data, 0x2C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2C); } + public override int Stat_SPD { get => BigEndian.ToUInt16(Data, 0x2E); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x2E); } #endregion public override ushort[] getStats(PersonalInfo p) @@ -284,9 +274,9 @@ public override int Gender public override bool HasOriginalMetLocation => CaughtData != 0; #region Future, Unused Attributes - public override uint EncryptionConstant { get { return 0; } set { } } - public override uint PID { get { return 0; } set { } } - public override int Nature { get { return 0; } set { } } + public override uint EncryptionConstant { get => 0; set { } } + public override uint PID { get => 0; set { } } + public override int Nature { get => 0; set { } } public override int AltForm { @@ -311,36 +301,35 @@ public override int AltForm public override int HPPower => (5 * HPVal + IV_SPC % 4) / 2 + 31; public override int HPType { - get { return ((IV_ATK & 3) << 2) | (IV_DEF & 3); } - set + get => ((IV_ATK & 3) << 2) | (IV_DEF & 3); set { IV_DEF = ((IV_DEF >> 2) << 2) | (value & 3); IV_DEF = ((IV_ATK >> 2) << 2) | ((value >> 2) & 3); } } public override bool IsShiny => IV_DEF == 10 && IV_SPE == 10 && IV_SPC == 10 && (IV_ATK & 2) == 2; - public override ushort Sanity { get { return 0; } set { } } + public override ushort Sanity { get => 0; set { } } public override bool ChecksumValid => true; - public override ushort Checksum { get { return 0; } set { } } - public override int Language { get { return 0; } set { } } - public override bool FatefulEncounter { get { return false; } set { } } + public override ushort Checksum { get => 0; set { } } + public override int Language { get => 0; set { } } + public override bool FatefulEncounter { get => false; set { } } public override int TSV => 0x0000; public override int PSV => 0xFFFF; public override int Characteristic => -1; - public override int MarkValue { get { return 0; } protected set { } } - public override int Ability { get { return 0; } set { } } - public override int CurrentHandler { get { return 0; } set { } } - public override int Egg_Location { get { return 0; } set { } } - public override int OT_Friendship { get { return 0; } set { } } - public override int Ball { get { return 0; } set { } } - public override int Version { get { return (int)GameVersion.GSC; } set { } } - public override int SID { get { return 0; } set { } } - public override int CNT_Cool { get { return 0; } set { } } - public override int CNT_Beauty { get { return 0; } set { } } - public override int CNT_Cute { get { return 0; } set { } } - public override int CNT_Smart { get { return 0; } set { } } - public override int CNT_Tough { get { return 0; } set { } } - public override int CNT_Sheen { get { return 0; } set { } } + public override int MarkValue { get => 0; protected set { } } + public override int Ability { get => 0; set { } } + public override int CurrentHandler { get => 0; set { } } + public override int Egg_Location { get => 0; set { } } + public override int OT_Friendship { get => 0; set { } } + public override int Ball { get => 0; set { } } + public override int Version { get => (int)GameVersion.GSC; set { } } + public override int SID { get => 0; set { } } + public override int CNT_Cool { get => 0; set { } } + public override int CNT_Beauty { get => 0; set { } } + public override int CNT_Cute { get => 0; set { } } + public override int CNT_Smart { get => 0; set { } } + public override int CNT_Tough { get => 0; set { } } + public override int CNT_Sheen { get => 0; set { } } #endregion public PK1 convertToPK1() @@ -385,17 +374,11 @@ public enum CapacityType Single } - public static int getEntrySize(CapacityType c) - { - return c == CapacityType.Single || c == CapacityType.Party - ? PKX.SIZE_2PARTY - : PKX.SIZE_2STORED; - } + private static int getEntrySize(CapacityType c) => c == CapacityType.Single || c == CapacityType.Party + ? PKX.SIZE_2PARTY + : PKX.SIZE_2STORED; - public static byte getCapacity(CapacityType c) - { - return c == CapacityType.Single ? (byte)1 : (byte)c; - } + private static byte getCapacity(CapacityType c) => c == CapacityType.Single ? (byte)1 : (byte)c; private byte[] getEmptyList(CapacityType c, bool is_JP = false) { @@ -431,10 +414,7 @@ public PokemonList2(byte[] d, CapacityType c = CapacityType.Single, bool jp = fa } public PokemonList2(CapacityType c = CapacityType.Single, bool jp = false) - : this(null, c, jp) - { - Count = 1; - } + : this(null, c, jp) => Count = 1; public PokemonList2(PK2 pk) : this(CapacityType.Single, pk.Japanese) @@ -449,8 +429,8 @@ public PokemonList2(PK2 pk) public byte Count { - get { return Data[0]; } - set { Data[0] = value > Capacity ? Capacity : value; } + get => Data[0]; + set => Data[0] = value > Capacity ? Capacity : value; } public readonly PK2[] Pokemon; @@ -492,10 +472,6 @@ public byte[] GetBytes() } private int DataSize => Capacity * (Entry_Size + 1 + 2 * StringLength) + 2; - - public static int GetDataLength(CapacityType c, bool jp = false) - { - return getCapacity(c) * (getEntrySize(c) + 1 + 2 * (jp ? PK2.STRLEN_J : PK2.STRLEN_U)) + 2; - } + public static int GetDataLength(CapacityType c, bool jp = false) => getCapacity(c) * (getEntrySize(c) + 1 + 2 * (jp ? PK2.STRLEN_J : PK2.STRLEN_U)) + 2; } } diff --git a/PKHeX.Core/PKM/PK3.cs b/PKHeX.Core/PKM/PK3.cs index 11a242921..8b26ca3cd 100644 --- a/PKHeX.Core/PKM/PK3.cs +++ b/PKHeX.Core/PKM/PK3.cs @@ -28,132 +28,132 @@ public PK3(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setString3(value, maxLength, Japanese); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x08, 10); } set { if (value?.Length == 10) value.CopyTo(Data, 0x08); } } - public override byte[] OT_Trash { get { return getData(0x14, 7); } set { if (value?.Length == 7) value.CopyTo(Data, 0x14); } } + public override byte[] Nickname_Trash { get => getData(0x08, 10); set { if (value?.Length == 10) value.CopyTo(Data, 0x08); } } + public override byte[] OT_Trash { get => getData(0x14, 7); set { if (value?.Length == 7) value.CopyTo(Data, 0x14); } } // Future Attributes - public override uint EncryptionConstant { get { return PID; } set { } } - public override int Nature { get { return (int)(PID % 25); } set { } } - public override int AltForm { get { return Species == 201 ? PKX.getUnownForm(PID) : 0; } set { } } + public override uint EncryptionConstant { get => PID; set { } } + public override int Nature { get => (int)(PID % 25); set { } } + public override int AltForm { get => Species == 201 ? PKX.getUnownForm(PID) : 0; set { } } - public override bool IsNicknamed { get { return PKX.getIsNicknamedAnyLanguage(Species, Nickname, Format); } set { } } - public override int Gender { get { return PKX.getGender(Species, PID); } set { } } + public override bool IsNicknamed { get => PKX.getIsNicknamedAnyLanguage(Species, Nickname, Format); set { } } + public override int Gender { get => PKX.getGender(Species, PID); set { } } public override int Characteristic => -1; - public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } } + public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; } public override int Ability { get { int[] abils = PersonalInfo.Abilities; return abils[AbilityBit && abils[1] != 0 ? 1 : 0]; } set { } } - public override int CurrentHandler { get { return 0; } set { } } - public override int Egg_Location { get { return 0; } set { } } + public override int CurrentHandler { get => 0; set { } } + public override int Egg_Location { get => 0; set { } } // 0x20 Intro - public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } } - public override int TID { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x04); } } - public override int SID { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x06); } } - public override string Nickname { get { return getString(0x08, 10); } set { setString(IsEgg ? "タマゴ" : value, 10).CopyTo(Data, 0x08); } } - public override int Language { get { return BitConverter.ToUInt16(Data, 0x12) & 0xFF; } set { BitConverter.GetBytes((ushort)(IsEgg ? 0x601 : value | 0x200)).CopyTo(Data, 0x12); } } - public override string OT_Name { get { return getString(0x14, 7); } set { setString(value, 7).CopyTo(Data, 0x14); } } - public override int MarkValue { get { return Data[0x1B]; } protected set { Data[0x1B] = (byte)value; } } - public override ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1C); } } - public override ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1E); } } + public override uint PID { get => BitConverter.ToUInt32(Data, 0x00); set => BitConverter.GetBytes(value).CopyTo(Data, 0x00); } + public override int TID { get => BitConverter.ToUInt16(Data, 0x04); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x04); } + public override int SID { get => BitConverter.ToUInt16(Data, 0x06); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x06); } + public override string Nickname { get => getString(0x08, 10); set => setString(IsEgg ? "タマゴ" : value, 10).CopyTo(Data, 0x08); } + public override int Language { get => BitConverter.ToUInt16(Data, 0x12) & 0xFF; set => BitConverter.GetBytes((ushort)(IsEgg ? 0x601 : value | 0x200)).CopyTo(Data, 0x12); } + public override string OT_Name { get => getString(0x14, 7); set => setString(value, 7).CopyTo(Data, 0x14); } + public override int MarkValue { get => Data[0x1B]; protected set => Data[0x1B] = (byte)value; } + public override ushort Checksum { get => BitConverter.ToUInt16(Data, 0x1C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1C); } + public override ushort Sanity { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1E); } #region Block A - public override int Species { get { return PKX.getG4Species(BitConverter.ToUInt16(Data, 0x20)); } set { BitConverter.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x20); } } + public override int Species { get => PKX.getG4Species(BitConverter.ToUInt16(Data, 0x20)); set => BitConverter.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x20); } public override int SpriteItem => PKX.getG4Item((ushort)HeldItem); - public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes((ushort) value).CopyTo(Data, 0x22); } } + public override int HeldItem { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } - public override uint EXP { get { return BitConverter.ToUInt32(Data, 0x24); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x24); } } - private byte PPUps { get { return Data[0x28]; } set { Data[0x28] = value; } } - public override int Move1_PPUps { get { return (PPUps >> 0) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 0)) | value << 0); } } - public override int Move2_PPUps { get { return (PPUps >> 2) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 2)) | value << 2); } } - public override int Move3_PPUps { get { return (PPUps >> 4) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 4)) | value << 4); } } - public override int Move4_PPUps { get { return (PPUps >> 6) & 3; } set { PPUps = (byte)((PPUps & ~(3 << 6)) | value << 6); } } - public override int OT_Friendship { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } } + public override uint EXP { get => BitConverter.ToUInt32(Data, 0x24); set => BitConverter.GetBytes(value).CopyTo(Data, 0x24); } + private byte PPUps { get => Data[0x28]; set => Data[0x28] = value; } + public override int Move1_PPUps { get => (PPUps >> 0) & 3; set => PPUps = (byte)((PPUps & ~(3 << 0)) | value << 0); } + public override int Move2_PPUps { get => (PPUps >> 2) & 3; set => PPUps = (byte)((PPUps & ~(3 << 2)) | value << 2); } + public override int Move3_PPUps { get => (PPUps >> 4) & 3; set => PPUps = (byte)((PPUps & ~(3 << 4)) | value << 4); } + public override int Move4_PPUps { get => (PPUps >> 6) & 3; set => PPUps = (byte)((PPUps & ~(3 << 6)) | value << 6); } + public override int OT_Friendship { get => Data[0x29]; set => Data[0x29] = (byte)value; } // Unused 0x2A 0x2B #endregion #region Block B - public override int Move1 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } } - public override int Move2 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } } - public override int Move3 { get { return BitConverter.ToUInt16(Data, 0x30); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x30); } } - public override int Move4 { get { return BitConverter.ToUInt16(Data, 0x32); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x32); } } - public override int Move1_PP { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } } - public override int Move2_PP { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } } - public override int Move3_PP { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } } - public override int Move4_PP { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } } + public override int Move1 { get => BitConverter.ToUInt16(Data, 0x2C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } + public override int Move2 { get => BitConverter.ToUInt16(Data, 0x2E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } + public override int Move3 { get => BitConverter.ToUInt16(Data, 0x30); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x30); } + public override int Move4 { get => BitConverter.ToUInt16(Data, 0x32); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x32); } + public override int Move1_PP { get => Data[0x34]; set => Data[0x34] = (byte)value; } + public override int Move2_PP { get => Data[0x35]; set => Data[0x35] = (byte)value; } + public override int Move3_PP { get => Data[0x36]; set => Data[0x36] = (byte)value; } + public override int Move4_PP { get => Data[0x37]; set => Data[0x37] = (byte)value; } #endregion #region Block C - public override int EV_HP { get { return Data[0x38]; } set { Data[0x38] = (byte)value; } } - public override int EV_ATK { get { return Data[0x39]; } set { Data[0x39] = (byte)value; } } - public override int EV_DEF { get { return Data[0x3A]; } set { Data[0x3A] = (byte)value; } } - public override int EV_SPE { get { return Data[0x3B]; } set { Data[0x3B] = (byte)value; } } - public override int EV_SPA { get { return Data[0x3C]; } set { Data[0x3C] = (byte)value; } } - public override int EV_SPD { get { return Data[0x3D]; } set { Data[0x3D] = (byte)value; } } - public override int CNT_Cool { get { return Data[0x3E]; } set { Data[0x3E] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0x3F]; } set { Data[0x3F] = (byte)value; } } - public override int CNT_Cute { get { return Data[0x40]; } set { Data[0x40] = (byte)value; } } - public override int CNT_Smart { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } } - public override int CNT_Tough { get { return Data[0x42]; } set { Data[0x42] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0x43]; } set { Data[0x43] = (byte)value; } } + public override int EV_HP { get => Data[0x38]; set => Data[0x38] = (byte)value; } + public override int EV_ATK { get => Data[0x39]; set => Data[0x39] = (byte)value; } + public override int EV_DEF { get => Data[0x3A]; set => Data[0x3A] = (byte)value; } + public override int EV_SPE { get => Data[0x3B]; set => Data[0x3B] = (byte)value; } + public override int EV_SPA { get => Data[0x3C]; set => Data[0x3C] = (byte)value; } + public override int EV_SPD { get => Data[0x3D]; set => Data[0x3D] = (byte)value; } + public override int CNT_Cool { get => Data[0x3E]; set => Data[0x3E] = (byte)value; } + public override int CNT_Beauty { get => Data[0x3F]; set => Data[0x3F] = (byte)value; } + public override int CNT_Cute { get => Data[0x40]; set => Data[0x40] = (byte)value; } + public override int CNT_Smart { get => Data[0x41]; set => Data[0x41] = (byte)value; } + public override int CNT_Tough { get => Data[0x42]; set => Data[0x42] = (byte)value; } + public override int CNT_Sheen { get => Data[0x43]; set => Data[0x43] = (byte)value; } #endregion #region Block D - private byte PKRS { get { return Data[0x44]; } set { Data[0x44] = value; } } - public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } - public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } } - public override int Met_Location { get { return Data[0x45]; } set { Data[0x45] = (byte)value; } } + private byte PKRS { get => Data[0x44]; set => Data[0x44] = value; } + public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)(PKRS & ~0xF | value); } + public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)(PKRS & 0xF | value << 4); } + public override int Met_Location { get => Data[0x45]; set => Data[0x45] = (byte)value; } // Origins - private ushort Origins { get { return BitConverter.ToUInt16(Data, 0x46); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x46); } } - public override int Met_Level { get { return Origins & 0x7F; } set { Origins = (ushort)((Origins & ~0x7F) | value); } } - public override int Version { get { return (Origins >> 7) & 0xF; } set { Origins = (ushort)((Origins & ~0x780) | ((value & 0xF) << 7));} } - public override int Ball { get { return (Origins >> 11) & 0xF; } set { Origins = (ushort)((Origins & ~0x7800) | ((value & 0xF) << 11)); } } - public override int OT_Gender { get { return (Origins >> 15) & 1; } set { Origins = (ushort)(Origins & ~(1 << 15) | ((value & 1) << 15)); } } + private ushort Origins { get => BitConverter.ToUInt16(Data, 0x46); set => BitConverter.GetBytes(value).CopyTo(Data, 0x46); } + public override int Met_Level { get => Origins & 0x7F; set => Origins = (ushort)((Origins & ~0x7F) | value); } + public override int Version { get => (Origins >> 7) & 0xF; set => Origins = (ushort)((Origins & ~0x780) | ((value & 0xF) << 7)); } + public override int Ball { get => (Origins >> 11) & 0xF; set => Origins = (ushort)((Origins & ~0x7800) | ((value & 0xF) << 11)); } + public override int OT_Gender { get => (Origins >> 15) & 1; set => Origins = (ushort)(Origins & ~(1 << 15) | ((value & 1) << 15)); } - public uint IV32 { get { return BitConverter.ToUInt32(Data, 0x48); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x48); } } - public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } } - public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } } - public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } } - public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } } - public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } - public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } - public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } } - public bool AbilityBit { get { return (IV32 >> 31) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (uint)(value ? 1 << 31 : 0); } } + public uint IV32 { get => BitConverter.ToUInt32(Data, 0x48); set => BitConverter.GetBytes(value).CopyTo(Data, 0x48); } + public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } + public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } + public override int IV_DEF { get => (int)(IV32 >> 10) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } + public override int IV_SPE { get => (int)(IV32 >> 15) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } + public override int IV_SPA { get => (int)(IV32 >> 20) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } + public override int IV_SPD { get => (int)(IV32 >> 25) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } + public override bool IsEgg { get => ((IV32 >> 30) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } + public bool AbilityBit { get => IV32 >> 31 == 1; set => IV32 = (IV32 & 0x7FFFFFFF) | (uint)(value ? 1 << 31 : 0); } - private uint RIB0 { get { return BitConverter.ToUInt32(Data, 0x4C); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } } - public int RibbonCountG3Cool { get { return (int)(RIB0 >> 00) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7) << 00); } } - public int RibbonCountG3Beauty { get { return (int)(RIB0 >> 03) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 03)) | (uint)(value & 7) << 03); } } - public int RibbonCountG3Cute { get { return (int)(RIB0 >> 06) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 06)) | (uint)(value & 7) << 06); } } - public int RibbonCountG3Smart { get { return (int)(RIB0 >> 09) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 09)) | (uint)(value & 7) << 09); } } - public int RibbonCountG3Tough { get { return (int)(RIB0 >> 12) & 7; } set { RIB0 = (uint)((RIB0 & ~(7 << 12)) | (uint)(value & 7) << 12); } } - public bool RibbonChampionG3Hoenn { get { return (RIB0 & (1 << 15)) == 1 << 15; } set { RIB0 = (uint)(RIB0 & ~(1 << 15) | (uint)(value ? 1 << 15 : 0)); } } - public bool RibbonWinning { get { return (RIB0 & (1 << 16)) == 1 << 16; } set { RIB0 = (uint)(RIB0 & ~(1 << 16) | (uint)(value ? 1 << 16 : 0)); } } - public bool RibbonVictory { get { return (RIB0 & (1 << 17)) == 1 << 17; } set { RIB0 = (uint)(RIB0 & ~(1 << 17) | (uint)(value ? 1 << 17 : 0)); } } - public bool RibbonArtist { get { return (RIB0 & (1 << 18)) == 1 << 18; } set { RIB0 = (uint)(RIB0 & ~(1 << 18) | (uint)(value ? 1 << 18 : 0)); } } - public bool RibbonEffort { get { return (RIB0 & (1 << 19)) == 1 << 19; } set { RIB0 = (uint)(RIB0 & ~(1 << 19) | (uint)(value ? 1 << 19 : 0)); } } - public bool RibbonChampionBattle { get { return (RIB0 & (1 << 20)) == 1 << 20; } set { RIB0 = (uint)(RIB0 & ~(1 << 20) | (uint)(value ? 1 << 20 : 0)); } } - public bool RibbonChampionRegional { get { return (RIB0 & (1 << 21)) == 1 << 21; } set { RIB0 = (uint)(RIB0 & ~(1 << 21) | (uint)(value ? 1 << 21 : 0)); } } - public bool RibbonChampionNational { get { return (RIB0 & (1 << 22)) == 1 << 22; } set { RIB0 = (uint)(RIB0 & ~(1 << 22) | (uint)(value ? 1 << 22 : 0)); } } - public bool RibbonCountry { get { return (RIB0 & (1 << 23)) == 1 << 23; } set { RIB0 = (uint)(RIB0 & ~(1 << 23) | (uint)(value ? 1 << 23 : 0)); } } - public bool RibbonNational { get { return (RIB0 & (1 << 24)) == 1 << 24; } set { RIB0 = (uint)(RIB0 & ~(1 << 24) | (uint)(value ? 1 << 24 : 0)); } } - public bool RibbonEarth { get { return (RIB0 & (1 << 25)) == 1 << 25; } set { RIB0 = (uint)(RIB0 & ~(1 << 25) | (uint)(value ? 1 << 25 : 0)); } } - public bool RibbonWorld { get { return (RIB0 & (1 << 26)) == 1 << 26; } set { RIB0 = (uint)(RIB0 & ~(1 << 26) | (uint)(value ? 1 << 26 : 0)); } } - public bool Unused1 { get { return (RIB0 & (1 << 27)) == 1 << 27; } set { RIB0 = (uint)(RIB0 & ~(1 << 27) | (uint)(value ? 1 << 27 : 0)); } } - public bool Unused2 { get { return (RIB0 & (1 << 28)) == 1 << 28; } set { RIB0 = (uint)(RIB0 & ~(1 << 28) | (uint)(value ? 1 << 28 : 0)); } } - public bool Unused3 { get { return (RIB0 & (1 << 29)) == 1 << 29; } set { RIB0 = (uint)(RIB0 & ~(1 << 29) | (uint)(value ? 1 << 29 : 0)); } } - public bool Unused4 { get { return (RIB0 & (1 << 30)) == 1 << 30; } set { RIB0 = (uint)(RIB0 & ~(1 << 30) | (uint)(value ? 1 << 30 : 0)); } } - public override bool FatefulEncounter { get { return RIB0 >> 31 == 1; } set { RIB0 = (RIB0 & ~(1 << 31)) | (uint)(value ? 1 << 31 : 0); } } + private uint RIB0 { get => BitConverter.ToUInt32(Data, 0x4C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x4C); } + public int RibbonCountG3Cool { get => (int)(RIB0 >> 00) & 7; set => RIB0 = (uint)((RIB0 & ~(7 << 00)) | (uint)(value & 7) << 00); } + public int RibbonCountG3Beauty { get => (int)(RIB0 >> 03) & 7; set => RIB0 = (uint)((RIB0 & ~(7 << 03)) | (uint)(value & 7) << 03); } + public int RibbonCountG3Cute { get => (int)(RIB0 >> 06) & 7; set => RIB0 = (uint)((RIB0 & ~(7 << 06)) | (uint)(value & 7) << 06); } + public int RibbonCountG3Smart { get => (int)(RIB0 >> 09) & 7; set => RIB0 = (uint)((RIB0 & ~(7 << 09)) | (uint)(value & 7) << 09); } + public int RibbonCountG3Tough { get => (int)(RIB0 >> 12) & 7; set => RIB0 = (uint)((RIB0 & ~(7 << 12)) | (uint)(value & 7) << 12); } + public bool RibbonChampionG3Hoenn { get => (RIB0 & (1 << 15)) == 1 << 15; set => RIB0 = (uint)(RIB0 & ~(1 << 15) | (uint)(value ? 1 << 15 : 0)); } + public bool RibbonWinning { get => (RIB0 & (1 << 16)) == 1 << 16; set => RIB0 = (uint)(RIB0 & ~(1 << 16) | (uint)(value ? 1 << 16 : 0)); } + public bool RibbonVictory { get => (RIB0 & (1 << 17)) == 1 << 17; set => RIB0 = (uint)(RIB0 & ~(1 << 17) | (uint)(value ? 1 << 17 : 0)); } + public bool RibbonArtist { get => (RIB0 & (1 << 18)) == 1 << 18; set => RIB0 = (uint)(RIB0 & ~(1 << 18) | (uint)(value ? 1 << 18 : 0)); } + public bool RibbonEffort { get => (RIB0 & (1 << 19)) == 1 << 19; set => RIB0 = (uint)(RIB0 & ~(1 << 19) | (uint)(value ? 1 << 19 : 0)); } + public bool RibbonChampionBattle { get => (RIB0 & (1 << 20)) == 1 << 20; set => RIB0 = (uint)(RIB0 & ~(1 << 20) | (uint)(value ? 1 << 20 : 0)); } + public bool RibbonChampionRegional { get => (RIB0 & (1 << 21)) == 1 << 21; set => RIB0 = (uint)(RIB0 & ~(1 << 21) | (uint)(value ? 1 << 21 : 0)); } + public bool RibbonChampionNational { get => (RIB0 & (1 << 22)) == 1 << 22; set => RIB0 = (uint)(RIB0 & ~(1 << 22) | (uint)(value ? 1 << 22 : 0)); } + public bool RibbonCountry { get => (RIB0 & (1 << 23)) == 1 << 23; set => RIB0 = (uint)(RIB0 & ~(1 << 23) | (uint)(value ? 1 << 23 : 0)); } + public bool RibbonNational { get => (RIB0 & (1 << 24)) == 1 << 24; set => RIB0 = (uint)(RIB0 & ~(1 << 24) | (uint)(value ? 1 << 24 : 0)); } + public bool RibbonEarth { get => (RIB0 & (1 << 25)) == 1 << 25; set => RIB0 = (uint)(RIB0 & ~(1 << 25) | (uint)(value ? 1 << 25 : 0)); } + public bool RibbonWorld { get => (RIB0 & (1 << 26)) == 1 << 26; set => RIB0 = (uint)(RIB0 & ~(1 << 26) | (uint)(value ? 1 << 26 : 0)); } + public bool Unused1 { get => (RIB0 & (1 << 27)) == 1 << 27; set => RIB0 = (uint)(RIB0 & ~(1 << 27) | (uint)(value ? 1 << 27 : 0)); } + public bool Unused2 { get => (RIB0 & (1 << 28)) == 1 << 28; set => RIB0 = (uint)(RIB0 & ~(1 << 28) | (uint)(value ? 1 << 28 : 0)); } + public bool Unused3 { get => (RIB0 & (1 << 29)) == 1 << 29; set => RIB0 = (uint)(RIB0 & ~(1 << 29) | (uint)(value ? 1 << 29 : 0)); } + public bool Unused4 { get => (RIB0 & (1 << 30)) == 1 << 30; set => RIB0 = (uint)(RIB0 & ~(1 << 30) | (uint)(value ? 1 << 30 : 0)); } + public override bool FatefulEncounter { get => RIB0 >> 31 == 1; set => RIB0 = (RIB0 & ~(1 << 31)) | (uint)(value ? 1 << 31 : 0); } #endregion - public override int Stat_Level { get { return Data[0x54]; } set { Data[0x54] = (byte)value; } } - public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0x56); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x56); } } - public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0x58); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x58); } } - public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0x5A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } } - public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0x5C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); } } - public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0x5E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } } - public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0x60); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); } } - public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0x62); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x62); } } + public override int Stat_Level { get => Data[0x54]; set => Data[0x54] = (byte)value; } + public override int Stat_HPCurrent { get => BitConverter.ToUInt16(Data, 0x56); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x56); } + public override int Stat_HPMax { get => BitConverter.ToUInt16(Data, 0x58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x58); } + public override int Stat_ATK { get => BitConverter.ToUInt16(Data, 0x5A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } + public override int Stat_DEF { get => BitConverter.ToUInt16(Data, 0x5C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); } + public override int Stat_SPE { get => BitConverter.ToUInt16(Data, 0x5E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } + public override int Stat_SPA { get => BitConverter.ToUInt16(Data, 0x60); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); } + public override int Stat_SPD { get => BitConverter.ToUInt16(Data, 0x62); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x62); } // Generated Attributes - public override int AbilityNumber { get { return 1 << PIDAbility; } set { AbilityBit = value > 1; } } // 1/2 -> 0/1 + public override int AbilityNumber { get => 1 << PIDAbility; set => AbilityBit = value > 1; } // 1/2 -> 0/1 public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3); public override int TSV => (TID ^ SID) >> 3; public bool Japanese => IsEgg || Language == 1; @@ -165,6 +165,7 @@ public PK3(byte[] decryptedData = null, string ident = null) public override byte[] Encrypt() { + RefreshChecksum(); return PKX.encryptArray3(Data); } public PK4 convertToPK4() diff --git a/PKHeX.Core/PKM/PK4.cs b/PKHeX.Core/PKM/PK4.cs index aedc9d216..cc752694c 100644 --- a/PKHeX.Core/PKM/PK4.cs +++ b/PKHeX.Core/PKM/PK4.cs @@ -28,200 +28,199 @@ public PK4(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setString4(value, maxLength); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x48, 22); } set { if (value?.Length == 22) value.CopyTo(Data, 0x48); } } - public override byte[] OT_Trash { get { return getData(0x68, 16); } - set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } } + public override byte[] Nickname_Trash { get => getData(0x48, 22); set { if (value?.Length == 22) value.CopyTo(Data, 0x48); } } + public override byte[] OT_Trash { get => getData(0x68, 16); set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } } // Future Attributes - public override uint EncryptionConstant { get { return PID; } set { } } - public override int Nature { get { return (int)(PID%25); } set { } } - public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } } - public override int CurrentHandler { get { return 0; } set { } } - public override int AbilityNumber { get { return 1 << PIDAbility; } set { } } + public override uint EncryptionConstant { get => PID; set { } } + public override int Nature { get => (int)(PID % 25); set { } } + public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; } + public override int CurrentHandler { get => 0; set { } } + public override int AbilityNumber { get => 1 << PIDAbility; set { } } // Structure - public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } } - public override ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } } - public override ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } } + public override uint PID { get => BitConverter.ToUInt32(Data, 0x00); set => BitConverter.GetBytes(value).CopyTo(Data, 0x00); } + public override ushort Sanity { get => BitConverter.ToUInt16(Data, 0x04); set => BitConverter.GetBytes(value).CopyTo(Data, 0x04); } + public override ushort Checksum { get => BitConverter.ToUInt16(Data, 0x06); set => BitConverter.GetBytes(value).CopyTo(Data, 0x06); } #region Block A - public override int Species { get { return BitConverter.ToUInt16(Data, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } } - public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } } - public override int TID { get { return BitConverter.ToUInt16(Data, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } } - public override int SID { get { return BitConverter.ToUInt16(Data, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } } - public override uint EXP { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } } - public override int OT_Friendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } - public override int Ability { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } - public override int MarkValue { get { return Data[0x16]; } protected set { Data[0x16] = (byte)value; } } - public override int Language { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } } - public override int EV_HP { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } } - public override int EV_ATK { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } } - public override int EV_DEF { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } } - public override int EV_SPE { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } } - public override int EV_SPA { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } } - public override int EV_SPD { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } } - public override int CNT_Cool { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } } - public override int CNT_Cute { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } - public override int CNT_Smart { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } } - public override int CNT_Tough { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } } + public override int Species { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } + public override int HeldItem { get => BitConverter.ToUInt16(Data, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + public override int TID { get => BitConverter.ToUInt16(Data, 0x0C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } + public override int SID { get => BitConverter.ToUInt16(Data, 0x0E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } + public override uint EXP { get => BitConverter.ToUInt32(Data, 0x10); set => BitConverter.GetBytes(value).CopyTo(Data, 0x10); } + public override int OT_Friendship { get => Data[0x14]; set => Data[0x14] = (byte)value; } + public override int Ability { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public override int MarkValue { get => Data[0x16]; protected set => Data[0x16] = (byte)value; } + public override int Language { get => Data[0x17]; set => Data[0x17] = (byte)value; } + public override int EV_HP { get => Data[0x18]; set => Data[0x18] = (byte)value; } + public override int EV_ATK { get => Data[0x19]; set => Data[0x19] = (byte)value; } + public override int EV_DEF { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } + public override int EV_SPE { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + public override int EV_SPA { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public override int EV_SPD { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } + public override int CNT_Cool { get => Data[0x1E]; set => Data[0x1E] = (byte)value; } + public override int CNT_Beauty { get => Data[0x1F]; set => Data[0x1F] = (byte)value; } + public override int CNT_Cute { get => Data[0x20]; set => Data[0x20] = (byte)value; } + public override int CNT_Smart { get => Data[0x21]; set => Data[0x21] = (byte)value; } + public override int CNT_Tough { get => Data[0x22]; set => Data[0x22] = (byte)value; } + public override int CNT_Sheen { get => Data[0x23]; set => Data[0x23] = (byte)value; } - private byte RIB0 { get { return Data[0x24]; } set { Data[0x24] = value; } } // Sinnoh 1 - private byte RIB1 { get { return Data[0x25]; } set { Data[0x25] = value; } } // Sinnoh 2 - private byte RIB2 { get { return Data[0x26]; } set { Data[0x26] = value; } } // Unova 1 - private byte RIB3 { get { return Data[0x27]; } set { Data[0x27] = value; } } // Unova 2 - public bool RibbonChampionSinnoh { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonAbility { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonAbilityGreat { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonAbilityDouble { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonAbilityMulti { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonAbilityPair { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonAbilityWorld { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonAlert { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonShock { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonDowncast { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonCareless { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonRelax { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonSnooze { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonSmile { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonGorgeous { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonRoyal { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonGorgeousRoyal { get { return (RIB2 & (1 << 0)) == 1 << 0; } set { RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonFootprint { get { return (RIB2 & (1 << 1)) == 1 << 1; } set { RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonRecord { get { return (RIB2 & (1 << 2)) == 1 << 2; } set { RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonEvent { get { return (RIB2 & (1 << 3)) == 1 << 3; } set { RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonLegend { get { return (RIB2 & (1 << 4)) == 1 << 4; } set { RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonChampionWorld { get { return (RIB2 & (1 << 5)) == 1 << 5; } set { RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonBirthday { get { return (RIB2 & (1 << 6)) == 1 << 6; } set { RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonSpecial { get { return (RIB2 & (1 << 7)) == 1 << 7; } set { RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonSouvenir { get { return (RIB3 & (1 << 0)) == 1 << 0; } set { RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonWishing { get { return (RIB3 & (1 << 1)) == 1 << 1; } set { RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonClassic { get { return (RIB3 & (1 << 2)) == 1 << 2; } set { RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonPremier { get { return (RIB3 & (1 << 3)) == 1 << 3; } set { RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RIB3_4 { get { return (RIB3 & (1 << 4)) == 1 << 4; } set { RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIB3_5 { get { return (RIB3 & (1 << 5)) == 1 << 5; } set { RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIB3_6 { get { return (RIB3 & (1 << 6)) == 1 << 6; } set { RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIB3_7 { get { return (RIB3 & (1 << 7)) == 1 << 7; } set { RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused + private byte RIB0 { get => Data[0x24]; set => Data[0x24] = value; } // Sinnoh 1 + private byte RIB1 { get => Data[0x25]; set => Data[0x25] = value; } // Sinnoh 2 + private byte RIB2 { get => Data[0x26]; set => Data[0x26] = value; } // Unova 1 + private byte RIB3 { get => Data[0x27]; set => Data[0x27] = value; } // Unova 2 + public bool RibbonChampionSinnoh { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonAbility { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonAbilityGreat { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonAbilityDouble { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonAbilityMulti { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonAbilityPair { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonAbilityWorld { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonAlert { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonShock { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonDowncast { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonCareless { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonRelax { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonSnooze { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonSmile { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonGorgeous { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonRoyal { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonGorgeousRoyal { get => (RIB2 & (1 << 0)) == 1 << 0; set => RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonFootprint { get => (RIB2 & (1 << 1)) == 1 << 1; set => RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonRecord { get => (RIB2 & (1 << 2)) == 1 << 2; set => RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonEvent { get => (RIB2 & (1 << 3)) == 1 << 3; set => RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonLegend { get => (RIB2 & (1 << 4)) == 1 << 4; set => RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonChampionWorld { get => (RIB2 & (1 << 5)) == 1 << 5; set => RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonBirthday { get => (RIB2 & (1 << 6)) == 1 << 6; set => RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonSpecial { get => (RIB2 & (1 << 7)) == 1 << 7; set => RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonSouvenir { get => (RIB3 & (1 << 0)) == 1 << 0; set => RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonWishing { get => (RIB3 & (1 << 1)) == 1 << 1; set => RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonClassic { get => (RIB3 & (1 << 2)) == 1 << 2; set => RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonPremier { get => (RIB3 & (1 << 3)) == 1 << 3; set => RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RIB3_4 { get => (RIB3 & (1 << 4)) == 1 << 4; set => RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIB3_5 { get => (RIB3 & (1 << 5)) == 1 << 5; set => RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIB3_6 { get => (RIB3 & (1 << 6)) == 1 << 6; set => RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIB3_7 { get => (RIB3 & (1 << 7)) == 1 << 7; set => RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused #endregion #region Block B - public override int Move1 { get { return BitConverter.ToUInt16(Data, 0x28); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } } - public override int Move2 { get { return BitConverter.ToUInt16(Data, 0x2A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } } - public override int Move3 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } } - public override int Move4 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } } - public override int Move1_PP { get { return Data[0x30]; } set { Data[0x30] = (byte)value; } } - public override int Move2_PP { get { return Data[0x31]; } set { Data[0x31] = (byte)value; } } - public override int Move3_PP { get { return Data[0x32]; } set { Data[0x32] = (byte)value; } } - public override int Move4_PP { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } } - public override int Move1_PPUps { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } } - public override int Move2_PPUps { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } } - public override int Move3_PPUps { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } } - public override int Move4_PPUps { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } } - public uint IV32 { get { return BitConverter.ToUInt32(Data, 0x38); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x38); } } - public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } } - public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } } - public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } } - public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } } - public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } - public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } - public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } } - public override bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } } + public override int Move1 { get => BitConverter.ToUInt16(Data, 0x28); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } + public override int Move2 { get => BitConverter.ToUInt16(Data, 0x2A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } + public override int Move3 { get => BitConverter.ToUInt16(Data, 0x2C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } + public override int Move4 { get => BitConverter.ToUInt16(Data, 0x2E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } + public override int Move1_PP { get => Data[0x30]; set => Data[0x30] = (byte)value; } + public override int Move2_PP { get => Data[0x31]; set => Data[0x31] = (byte)value; } + public override int Move3_PP { get => Data[0x32]; set => Data[0x32] = (byte)value; } + public override int Move4_PP { get => Data[0x33]; set => Data[0x33] = (byte)value; } + public override int Move1_PPUps { get => Data[0x34]; set => Data[0x34] = (byte)value; } + public override int Move2_PPUps { get => Data[0x35]; set => Data[0x35] = (byte)value; } + public override int Move3_PPUps { get => Data[0x36]; set => Data[0x36] = (byte)value; } + public override int Move4_PPUps { get => Data[0x37]; set => Data[0x37] = (byte)value; } + public uint IV32 { get => BitConverter.ToUInt32(Data, 0x38); set => BitConverter.GetBytes(value).CopyTo(Data, 0x38); } + public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } + public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } + public override int IV_DEF { get => (int)(IV32 >> 10) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } + public override int IV_SPE { get => (int)(IV32 >> 15) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } + public override int IV_SPA { get => (int)(IV32 >> 20) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } + public override int IV_SPD { get => (int)(IV32 >> 25) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } + public override bool IsEgg { get => ((IV32 >> 30) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } + public override bool IsNicknamed { get => ((IV32 >> 31) & 1) == 1; set => IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } - private byte RIB4 { get { return Data[0x3C]; } set { Data[0x3C] = value; } } // Hoenn 1a - private byte RIB5 { get { return Data[0x3D]; } set { Data[0x3D] = value; } } // Hoenn 1b - private byte RIB6 { get { return Data[0x3E]; } set { Data[0x3E] = value; } } // Hoenn 2a - private byte RIB7 { get { return Data[0x3F]; } set { Data[0x3F] = value; } } // Hoenn 2b - public bool RibbonG3Cool { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3CoolSuper { get { return (RIB4 & (1 << 1)) == 1 << 1; } set { RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3CoolHyper { get { return (RIB4 & (1 << 2)) == 1 << 2; } set { RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3CoolMaster { get { return (RIB4 & (1 << 3)) == 1 << 3; } set { RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG3Beauty { get { return (RIB4 & (1 << 4)) == 1 << 4; } set { RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG3BeautySuper { get { return (RIB4 & (1 << 5)) == 1 << 5; } set { RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG3BeautyHyper { get { return (RIB4 & (1 << 6)) == 1 << 6; } set { RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG3BeautyMaster { get { return (RIB4 & (1 << 7)) == 1 << 7; } set { RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG3Cute { get { return (RIB5 & (1 << 0)) == 1 << 0; } set { RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3CuteSuper { get { return (RIB5 & (1 << 1)) == 1 << 1; } set { RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3CuteHyper { get { return (RIB5 & (1 << 2)) == 1 << 2; } set { RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3CuteMaster { get { return (RIB5 & (1 << 3)) == 1 << 3; } set { RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG3Smart { get { return (RIB5 & (1 << 4)) == 1 << 4; } set { RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG3SmartSuper { get { return (RIB5 & (1 << 5)) == 1 << 5; } set { RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG3SmartHyper { get { return (RIB5 & (1 << 6)) == 1 << 6; } set { RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG3SmartMaster { get { return (RIB5 & (1 << 7)) == 1 << 7; } set { RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG3Tough { get { return (RIB6 & (1 << 0)) == 1 << 0; } set { RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3ToughSuper { get { return (RIB6 & (1 << 1)) == 1 << 1; } set { RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3ToughHyper { get { return (RIB6 & (1 << 2)) == 1 << 2; } set { RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3ToughMaster { get { return (RIB6 & (1 << 3)) == 1 << 3; } set { RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonChampionG3Hoenn { get { return (RIB6 & (1 << 4)) == 1 << 4; } set { RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonWinning { get { return (RIB6 & (1 << 5)) == 1 << 5; } set { RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonVictory { get { return (RIB6 & (1 << 6)) == 1 << 6; } set { RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonArtist { get { return (RIB6 & (1 << 7)) == 1 << 7; } set { RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonEffort { get { return (RIB7 & (1 << 0)) == 1 << 0; } set { RIB7 = (byte)(RIB7 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonChampionBattle { get { return (RIB7 & (1 << 1)) == 1 << 1; } set { RIB7 = (byte)(RIB7 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonChampionRegional{ get { return (RIB7 & (1 << 2)) == 1 << 2; } set { RIB7 = (byte)(RIB7 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonChampionNational{ get { return (RIB7 & (1 << 3)) == 1 << 3; } set { RIB7 = (byte)(RIB7 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonCountry { get { return (RIB7 & (1 << 4)) == 1 << 4; } set { RIB7 = (byte)(RIB7 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonNational { get { return (RIB7 & (1 << 5)) == 1 << 5; } set { RIB7 = (byte)(RIB7 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonEarth { get { return (RIB7 & (1 << 6)) == 1 << 6; } set { RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonWorld { get { return (RIB7 & (1 << 7)) == 1 << 7; } set { RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } + private byte RIB4 { get => Data[0x3C]; set => Data[0x3C] = value; } // Hoenn 1a + private byte RIB5 { get => Data[0x3D]; set => Data[0x3D] = value; } // Hoenn 1b + private byte RIB6 { get => Data[0x3E]; set => Data[0x3E] = value; } // Hoenn 2a + private byte RIB7 { get => Data[0x3F]; set => Data[0x3F] = value; } // Hoenn 2b + public bool RibbonG3Cool { get => (RIB4 & (1 << 0)) == 1 << 0; set => RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3CoolSuper { get => (RIB4 & (1 << 1)) == 1 << 1; set => RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3CoolHyper { get => (RIB4 & (1 << 2)) == 1 << 2; set => RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3CoolMaster { get => (RIB4 & (1 << 3)) == 1 << 3; set => RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG3Beauty { get => (RIB4 & (1 << 4)) == 1 << 4; set => RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG3BeautySuper { get => (RIB4 & (1 << 5)) == 1 << 5; set => RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG3BeautyHyper { get => (RIB4 & (1 << 6)) == 1 << 6; set => RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG3BeautyMaster { get => (RIB4 & (1 << 7)) == 1 << 7; set => RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG3Cute { get => (RIB5 & (1 << 0)) == 1 << 0; set => RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3CuteSuper { get => (RIB5 & (1 << 1)) == 1 << 1; set => RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3CuteHyper { get => (RIB5 & (1 << 2)) == 1 << 2; set => RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3CuteMaster { get => (RIB5 & (1 << 3)) == 1 << 3; set => RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG3Smart { get => (RIB5 & (1 << 4)) == 1 << 4; set => RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG3SmartSuper { get => (RIB5 & (1 << 5)) == 1 << 5; set => RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG3SmartHyper { get => (RIB5 & (1 << 6)) == 1 << 6; set => RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG3SmartMaster { get => (RIB5 & (1 << 7)) == 1 << 7; set => RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG3Tough { get => (RIB6 & (1 << 0)) == 1 << 0; set => RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3ToughSuper { get => (RIB6 & (1 << 1)) == 1 << 1; set => RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3ToughHyper { get => (RIB6 & (1 << 2)) == 1 << 2; set => RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3ToughMaster { get => (RIB6 & (1 << 3)) == 1 << 3; set => RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonChampionG3Hoenn { get => (RIB6 & (1 << 4)) == 1 << 4; set => RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonWinning { get => (RIB6 & (1 << 5)) == 1 << 5; set => RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonVictory { get => (RIB6 & (1 << 6)) == 1 << 6; set => RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonArtist { get => (RIB6 & (1 << 7)) == 1 << 7; set => RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonEffort { get => (RIB7 & (1 << 0)) == 1 << 0; set => RIB7 = (byte)(RIB7 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonChampionBattle { get => (RIB7 & (1 << 1)) == 1 << 1; set => RIB7 = (byte)(RIB7 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonChampionRegional { get => (RIB7 & (1 << 2)) == 1 << 2; set => RIB7 = (byte)(RIB7 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonChampionNational { get => (RIB7 & (1 << 3)) == 1 << 3; set => RIB7 = (byte)(RIB7 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonCountry { get => (RIB7 & (1 << 4)) == 1 << 4; set => RIB7 = (byte)(RIB7 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonNational { get => (RIB7 & (1 << 5)) == 1 << 5; set => RIB7 = (byte)(RIB7 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonEarth { get => (RIB7 & (1 << 6)) == 1 << 6; set => RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonWorld { get => (RIB7 & (1 << 7)) == 1 << 7; set => RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } - public override bool FatefulEncounter { get { return (Data[0x40] & 1) == 1; } set { Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } } - public override int Gender { get { return (Data[0x40] >> 1) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } } - public override int AltForm { get { return Data[0x40] >> 3; } set { Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } } + public override bool FatefulEncounter { get => (Data[0x40] & 1) == 1; set => Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } + public override int Gender { get => (Data[0x40] >> 1) & 0x3; set => Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } + public override int AltForm { get => Data[0x40] >> 3; set => Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } // 0x43-0x47 Unused #endregion #region Block C - public override string Nickname { get { return getString(0x48, 22); } set { setString(value, 11).CopyTo(Data, 0x48); } } + public override string Nickname { get => getString(0x48, 22); set => setString(value, 11).CopyTo(Data, 0x48); } // 0x5E unused - public override int Version { get { return Data[0x5F]; } set { Data[0x5F] = (byte)value; } } - private byte RIB8 { get { return Data[0x60]; } set { Data[0x60] = value; } } // Sinnoh 3 - private byte RIB9 { get { return Data[0x61]; } set { Data[0x61] = value; } } // Sinnoh 4 - private byte RIBA { get { return Data[0x62]; } set { Data[0x62] = value; } } // Sinnoh 5 - private byte RIBB { get { return Data[0x63]; } set { Data[0x63] = value; } } // Sinnoh 6 - public bool RibbonG4Cool { get { return (RIB8 & (1 << 0)) == 1 << 0; } set { RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4CoolGreat { get { return (RIB8 & (1 << 1)) == 1 << 1; } set { RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4CoolUltra { get { return (RIB8 & (1 << 2)) == 1 << 2; } set { RIB8 = (byte)(RIB8 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4CoolMaster { get { return (RIB8 & (1 << 3)) == 1 << 3; } set { RIB8 = (byte)(RIB8 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG4Beauty { get { return (RIB8 & (1 << 4)) == 1 << 4; } set { RIB8 = (byte)(RIB8 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG4BeautyGreat { get { return (RIB8 & (1 << 5)) == 1 << 5; } set { RIB8 = (byte)(RIB8 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG4BeautyUltra { get { return (RIB8 & (1 << 6)) == 1 << 6; } set { RIB8 = (byte)(RIB8 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG4BeautyMaster { get { return (RIB8 & (1 << 7)) == 1 << 7; } set { RIB8 = (byte)(RIB8 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG4Cute { get { return (RIB9 & (1 << 0)) == 1 << 0; } set { RIB9 = (byte)(RIB9 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4CuteGreat { get { return (RIB9 & (1 << 1)) == 1 << 1; } set { RIB9 = (byte)(RIB9 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4CuteUltra { get { return (RIB9 & (1 << 2)) == 1 << 2; } set { RIB9 = (byte)(RIB9 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4CuteMaster { get { return (RIB9 & (1 << 3)) == 1 << 3; } set { RIB9 = (byte)(RIB9 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG4Smart { get { return (RIB9 & (1 << 4)) == 1 << 4; } set { RIB9 = (byte)(RIB9 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG4SmartGreat { get { return (RIB9 & (1 << 5)) == 1 << 5; } set { RIB9 = (byte)(RIB9 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG4SmartUltra { get { return (RIB9 & (1 << 6)) == 1 << 6; } set { RIB9 = (byte)(RIB9 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG4SmartMaster { get { return (RIB9 & (1 << 7)) == 1 << 7; } set { RIB9 = (byte)(RIB9 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG4Tough { get { return (RIBA & (1 << 0)) == 1 << 0; } set { RIBA = (byte)(RIBA & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4ToughGreat { get { return (RIBA & (1 << 1)) == 1 << 1; } set { RIBA = (byte)(RIBA & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4ToughUltra { get { return (RIBA & (1 << 2)) == 1 << 2; } set { RIBA = (byte)(RIBA & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4ToughMaster { get { return (RIBA & (1 << 3)) == 1 << 3; } set { RIBA = (byte)(RIBA & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RIBA_4 { get { return (RIBA & (1 << 4)) == 1 << 4; } set { RIBA = (byte)(RIBA & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIBA_5 { get { return (RIBA & (1 << 5)) == 1 << 5; } set { RIBA = (byte)(RIBA & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIBA_6 { get { return (RIBA & (1 << 6)) == 1 << 6; } set { RIBA = (byte)(RIBA & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIBA_7 { get { return (RIBA & (1 << 7)) == 1 << 7; } set { RIBA = (byte)(RIBA & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused - public bool RIBB_0 { get { return (RIBB & (1 << 0)) == 1 << 0; } set { RIBB = (byte)(RIBB & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Unused - public bool RIBB_1 { get { return (RIBB & (1 << 1)) == 1 << 1; } set { RIBB = (byte)(RIBB & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Unused - public bool RIBB_2 { get { return (RIBB & (1 << 2)) == 1 << 2; } set { RIBB = (byte)(RIBB & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Unused - public bool RIBB_3 { get { return (RIBB & (1 << 3)) == 1 << 3; } set { RIBB = (byte)(RIBB & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Unused - public bool RIBB_4 { get { return (RIBB & (1 << 4)) == 1 << 4; } set { RIBB = (byte)(RIBB & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIBB_5 { get { return (RIBB & (1 << 5)) == 1 << 5; } set { RIBB = (byte)(RIBB & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIBB_6 { get { return (RIBB & (1 << 6)) == 1 << 6; } set { RIBB = (byte)(RIBB & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIBB_7 { get { return (RIBB & (1 << 7)) == 1 << 7; } set { RIBB = (byte)(RIBB & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused + public override int Version { get => Data[0x5F]; set => Data[0x5F] = (byte)value; } + private byte RIB8 { get => Data[0x60]; set => Data[0x60] = value; } // Sinnoh 3 + private byte RIB9 { get => Data[0x61]; set => Data[0x61] = value; } // Sinnoh 4 + private byte RIBA { get => Data[0x62]; set => Data[0x62] = value; } // Sinnoh 5 + private byte RIBB { get => Data[0x63]; set => Data[0x63] = value; } // Sinnoh 6 + public bool RibbonG4Cool { get => (RIB8 & (1 << 0)) == 1 << 0; set => RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4CoolGreat { get => (RIB8 & (1 << 1)) == 1 << 1; set => RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4CoolUltra { get => (RIB8 & (1 << 2)) == 1 << 2; set => RIB8 = (byte)(RIB8 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4CoolMaster { get => (RIB8 & (1 << 3)) == 1 << 3; set => RIB8 = (byte)(RIB8 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG4Beauty { get => (RIB8 & (1 << 4)) == 1 << 4; set => RIB8 = (byte)(RIB8 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG4BeautyGreat { get => (RIB8 & (1 << 5)) == 1 << 5; set => RIB8 = (byte)(RIB8 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG4BeautyUltra { get => (RIB8 & (1 << 6)) == 1 << 6; set => RIB8 = (byte)(RIB8 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG4BeautyMaster { get => (RIB8 & (1 << 7)) == 1 << 7; set => RIB8 = (byte)(RIB8 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG4Cute { get => (RIB9 & (1 << 0)) == 1 << 0; set => RIB9 = (byte)(RIB9 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4CuteGreat { get => (RIB9 & (1 << 1)) == 1 << 1; set => RIB9 = (byte)(RIB9 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4CuteUltra { get => (RIB9 & (1 << 2)) == 1 << 2; set => RIB9 = (byte)(RIB9 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4CuteMaster { get => (RIB9 & (1 << 3)) == 1 << 3; set => RIB9 = (byte)(RIB9 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG4Smart { get => (RIB9 & (1 << 4)) == 1 << 4; set => RIB9 = (byte)(RIB9 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG4SmartGreat { get => (RIB9 & (1 << 5)) == 1 << 5; set => RIB9 = (byte)(RIB9 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG4SmartUltra { get => (RIB9 & (1 << 6)) == 1 << 6; set => RIB9 = (byte)(RIB9 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG4SmartMaster { get => (RIB9 & (1 << 7)) == 1 << 7; set => RIB9 = (byte)(RIB9 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG4Tough { get => (RIBA & (1 << 0)) == 1 << 0; set => RIBA = (byte)(RIBA & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4ToughGreat { get => (RIBA & (1 << 1)) == 1 << 1; set => RIBA = (byte)(RIBA & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4ToughUltra { get => (RIBA & (1 << 2)) == 1 << 2; set => RIBA = (byte)(RIBA & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4ToughMaster { get => (RIBA & (1 << 3)) == 1 << 3; set => RIBA = (byte)(RIBA & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RIBA_4 { get => (RIBA & (1 << 4)) == 1 << 4; set => RIBA = (byte)(RIBA & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIBA_5 { get => (RIBA & (1 << 5)) == 1 << 5; set => RIBA = (byte)(RIBA & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIBA_6 { get => (RIBA & (1 << 6)) == 1 << 6; set => RIBA = (byte)(RIBA & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIBA_7 { get => (RIBA & (1 << 7)) == 1 << 7; set => RIBA = (byte)(RIBA & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused + public bool RIBB_0 { get => (RIBB & (1 << 0)) == 1 << 0; set => RIBB = (byte)(RIBB & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Unused + public bool RIBB_1 { get => (RIBB & (1 << 1)) == 1 << 1; set => RIBB = (byte)(RIBB & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Unused + public bool RIBB_2 { get => (RIBB & (1 << 2)) == 1 << 2; set => RIBB = (byte)(RIBB & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Unused + public bool RIBB_3 { get => (RIBB & (1 << 3)) == 1 << 3; set => RIBB = (byte)(RIBB & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Unused + public bool RIBB_4 { get => (RIBB & (1 << 4)) == 1 << 4; set => RIBB = (byte)(RIBB & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIBB_5 { get => (RIBB & (1 << 5)) == 1 << 5; set => RIBB = (byte)(RIBB & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIBB_6 { get => (RIBB & (1 << 6)) == 1 << 6; set => RIBB = (byte)(RIBB & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIBB_7 { get => (RIBB & (1 << 7)) == 1 << 7; set => RIBB = (byte)(RIBB & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused // 0x64-0x67 Unused #endregion #region Block D - public override string OT_Name { get { return getString(0x68, 16); } set { setString(value, 7).CopyTo(Data, 0x68); } } - public override int Egg_Year { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } } - public override int Egg_Month { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } } - public override int Egg_Day { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } } - public override int Met_Year { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } } - public override int Met_Month { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } } - public override int Met_Day { get { return Data[0x7D]; } set { Data[0x7D] = (byte)value; } } + public override string OT_Name { get => getString(0x68, 16); set => setString(value, 7).CopyTo(Data, 0x68); } + public override int Egg_Year { get => Data[0x78]; set => Data[0x78] = (byte)value; } + public override int Egg_Month { get => Data[0x79]; set => Data[0x79] = (byte)value; } + public override int Egg_Day { get => Data[0x7A]; set => Data[0x7A] = (byte)value; } + public override int Met_Year { get => Data[0x7B]; set => Data[0x7B] = (byte)value; } + public override int Met_Month { get => Data[0x7C]; set => Data[0x7C] = (byte)value; } + public override int Met_Day { get => Data[0x7D]; set => Data[0x7D] = (byte)value; } public override int Egg_Location { @@ -291,21 +290,19 @@ public override int Met_Location } } } - private byte PKRS { get { return Data[0x82]; } set { Data[0x82] = value; } } - public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } - public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } } + private byte PKRS { get => Data[0x82]; set => Data[0x82] = value; } + public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)(PKRS & ~0xF | value); } + public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)(PKRS & 0xF | (value << 4)); } public override int Ball { - get - { + get => // Pokemon obtained in HGSS have the HGSS ball set (@0x86) // However, this info is not set when receiving a wondercard! // The PGT contains a preformatted PK4 file, which is slightly modified. // No HGSS balls were used, and no HGSS ball info is set. // Sneaky way = return the higher of the two values. - return Math.Max(Data[0x86], Data[0x83]); - } + Math.Max(Data[0x86], Data[0x83]); set { // Ball to display in DPPt @@ -318,20 +315,20 @@ public override int Ball Data[0x86] = 0; // Unused } } - public override int Met_Level { get { return Data[0x84] & ~0x80; } set { Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } } - public override int OT_Gender { get { return Data[0x84] >> 7; } set { Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } } - public override int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } } + public override int Met_Level { get => Data[0x84] & ~0x80; set => Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } + public override int OT_Gender { get => Data[0x84] >> 7; set => Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } + public override int EncounterType { get => Data[0x85]; set => Data[0x85] = (byte)value; } // Unused 0x87 #endregion - public override int Stat_Level { get { return Data[0x8C]; } set { Data[0x8C] = (byte)value; } } - public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0x8E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8E); } } - public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0x90); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x90); } } - public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0x92); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x92); } } - public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0x94); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x94); } } - public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0x96); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x96); } } - public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0x98); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x98); } } - public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0x9A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x9A); } } + public override int Stat_Level { get => Data[0x8C]; set => Data[0x8C] = (byte)value; } + public override int Stat_HPCurrent { get => BitConverter.ToUInt16(Data, 0x8E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8E); } + public override int Stat_HPMax { get => BitConverter.ToUInt16(Data, 0x90); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x90); } + public override int Stat_ATK { get => BitConverter.ToUInt16(Data, 0x92); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x92); } + public override int Stat_DEF { get => BitConverter.ToUInt16(Data, 0x94); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x94); } + public override int Stat_SPE { get => BitConverter.ToUInt16(Data, 0x96); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x96); } + public override int Stat_SPA { get => BitConverter.ToUInt16(Data, 0x98); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x98); } + public override int Stat_SPD { get => BitConverter.ToUInt16(Data, 0x9A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x9A); } public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3); public override int TSV => (TID ^ SID) >> 3; diff --git a/PKHeX.Core/PKM/PK5.cs b/PKHeX.Core/PKM/PK5.cs index 37f2c5fc1..98b31ced2 100644 --- a/PKHeX.Core/PKM/PK5.cs +++ b/PKHeX.Core/PKM/PK5.cs @@ -28,221 +28,221 @@ public PK5(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setString5(value, maxLength); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x48, 22); } set { if (value?.Length == 22) value.CopyTo(Data, 0x48); } } - public override byte[] OT_Trash { get { return getData(0x68, 16); } set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } } + public override byte[] Nickname_Trash { get => getData(0x48, 22); set { if (value?.Length == 22) value.CopyTo(Data, 0x48); } } + public override byte[] OT_Trash { get => getData(0x68, 16); set { if (value?.Length == 16) value.CopyTo(Data, 0x68); } } // Future Attributes - public override uint EncryptionConstant { get { return PID; } set { } } - public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } } - public override int CurrentHandler { get { return 0; } set { } } - public override int AbilityNumber { get { return HiddenAbility ? 4 : 1 << PIDAbility; } set { } } + public override uint EncryptionConstant { get => PID; set { } } + public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; } + public override int CurrentHandler { get => 0; set { } } + public override int AbilityNumber { get => HiddenAbility ? 4 : 1 << PIDAbility; set { } } // Structure - public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } } - public override ushort Sanity { get { return BitConverter.ToUInt16(Data, 0x04); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } } - public override ushort Checksum { get { return BitConverter.ToUInt16(Data, 0x06); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } } + public override uint PID { get => BitConverter.ToUInt32(Data, 0x00); set => BitConverter.GetBytes(value).CopyTo(Data, 0x00); } + public override ushort Sanity { get => BitConverter.ToUInt16(Data, 0x04); set => BitConverter.GetBytes(value).CopyTo(Data, 0x04); } + public override ushort Checksum { get => BitConverter.ToUInt16(Data, 0x06); set => BitConverter.GetBytes(value).CopyTo(Data, 0x06); } #region Block A - public override int Species { get { return BitConverter.ToUInt16(Data, 0x08); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } } - public override int HeldItem { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } } - public override int TID { get { return BitConverter.ToUInt16(Data, 0x0C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } } - public override int SID { get { return BitConverter.ToUInt16(Data, 0x0E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } } - public override uint EXP { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } } - public override int OT_Friendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } - public override int Ability { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } - public override int MarkValue { get { return Data[0x16]; } protected set { Data[0x16] = (byte)value; } } - public override int Language { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } } - public override int EV_HP { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } } - public override int EV_ATK { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } } - public override int EV_DEF { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } } - public override int EV_SPE { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } } - public override int EV_SPA { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } } - public override int EV_SPD { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } } - public override int CNT_Cool { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } } - public override int CNT_Cute { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } - public override int CNT_Smart { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } } - public override int CNT_Tough { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } } + public override int Species { get => BitConverter.ToUInt16(Data, 0x08); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } + public override int HeldItem { get => BitConverter.ToUInt16(Data, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + public override int TID { get => BitConverter.ToUInt16(Data, 0x0C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } + public override int SID { get => BitConverter.ToUInt16(Data, 0x0E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } + public override uint EXP { get => BitConverter.ToUInt32(Data, 0x10); set => BitConverter.GetBytes(value).CopyTo(Data, 0x10); } + public override int OT_Friendship { get => Data[0x14]; set => Data[0x14] = (byte)value; } + public override int Ability { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public override int MarkValue { get => Data[0x16]; protected set => Data[0x16] = (byte)value; } + public override int Language { get => Data[0x17]; set => Data[0x17] = (byte)value; } + public override int EV_HP { get => Data[0x18]; set => Data[0x18] = (byte)value; } + public override int EV_ATK { get => Data[0x19]; set => Data[0x19] = (byte)value; } + public override int EV_DEF { get => Data[0x1A]; set => Data[0x1A] = (byte)value; } + public override int EV_SPE { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + public override int EV_SPA { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public override int EV_SPD { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } + public override int CNT_Cool { get => Data[0x1E]; set => Data[0x1E] = (byte)value; } + public override int CNT_Beauty { get => Data[0x1F]; set => Data[0x1F] = (byte)value; } + public override int CNT_Cute { get => Data[0x20]; set => Data[0x20] = (byte)value; } + public override int CNT_Smart { get => Data[0x21]; set => Data[0x21] = (byte)value; } + public override int CNT_Tough { get => Data[0x22]; set => Data[0x22] = (byte)value; } + public override int CNT_Sheen { get => Data[0x23]; set => Data[0x23] = (byte)value; } - private byte RIB0 { get { return Data[0x24]; } set { Data[0x24] = value; } } // Sinnoh 1 - private byte RIB1 { get { return Data[0x25]; } set { Data[0x25] = value; } } // Sinnoh 2 - private byte RIB2 { get { return Data[0x26]; } set { Data[0x26] = value; } } // Unova 1 - private byte RIB3 { get { return Data[0x27]; } set { Data[0x27] = value; } } // Unova 2 - public bool RibbonChampionSinnoh { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonAbility { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonAbilityGreat { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonAbilityDouble { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonAbilityMulti { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonAbilityPair { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonAbilityWorld { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonAlert { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonShock { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonDowncast { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonCareless { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonRelax { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonSnooze { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonSmile { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonGorgeous { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonRoyal { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonGorgeousRoyal { get { return (RIB2 & (1 << 0)) == 1 << 0; } set { RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonFootprint { get { return (RIB2 & (1 << 1)) == 1 << 1; } set { RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonRecord { get { return (RIB2 & (1 << 2)) == 1 << 2; } set { RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonEvent { get { return (RIB2 & (1 << 3)) == 1 << 3; } set { RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonLegend { get { return (RIB2 & (1 << 4)) == 1 << 4; } set { RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonChampionWorld { get { return (RIB2 & (1 << 5)) == 1 << 5; } set { RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonBirthday { get { return (RIB2 & (1 << 6)) == 1 << 6; } set { RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonSpecial { get { return (RIB2 & (1 << 7)) == 1 << 7; } set { RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonSouvenir { get { return (RIB3 & (1 << 0)) == 1 << 0; } set { RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonWishing { get { return (RIB3 & (1 << 1)) == 1 << 1; } set { RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonClassic { get { return (RIB3 & (1 << 2)) == 1 << 2; } set { RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonPremier { get { return (RIB3 & (1 << 3)) == 1 << 3; } set { RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RIB3_4 { get { return (RIB3 & (1 << 4)) == 1 << 4; } set { RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIB3_5 { get { return (RIB3 & (1 << 5)) == 1 << 5; } set { RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIB3_6 { get { return (RIB3 & (1 << 6)) == 1 << 6; } set { RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIB3_7 { get { return (RIB3 & (1 << 7)) == 1 << 7; } set { RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused + private byte RIB0 { get => Data[0x24]; set => Data[0x24] = value; } // Sinnoh 1 + private byte RIB1 { get => Data[0x25]; set => Data[0x25] = value; } // Sinnoh 2 + private byte RIB2 { get => Data[0x26]; set => Data[0x26] = value; } // Unova 1 + private byte RIB3 { get => Data[0x27]; set => Data[0x27] = value; } // Unova 2 + public bool RibbonChampionSinnoh { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonAbility { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonAbilityGreat { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonAbilityDouble { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonAbilityMulti { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonAbilityPair { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonAbilityWorld { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonAlert { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonShock { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonDowncast { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonCareless { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonRelax { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonSnooze { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonSmile { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonGorgeous { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonRoyal { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonGorgeousRoyal { get => (RIB2 & (1 << 0)) == 1 << 0; set => RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonFootprint { get => (RIB2 & (1 << 1)) == 1 << 1; set => RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonRecord { get => (RIB2 & (1 << 2)) == 1 << 2; set => RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonEvent { get => (RIB2 & (1 << 3)) == 1 << 3; set => RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonLegend { get => (RIB2 & (1 << 4)) == 1 << 4; set => RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonChampionWorld { get => (RIB2 & (1 << 5)) == 1 << 5; set => RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonBirthday { get => (RIB2 & (1 << 6)) == 1 << 6; set => RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonSpecial { get => (RIB2 & (1 << 7)) == 1 << 7; set => RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonSouvenir { get => (RIB3 & (1 << 0)) == 1 << 0; set => RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonWishing { get => (RIB3 & (1 << 1)) == 1 << 1; set => RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonClassic { get => (RIB3 & (1 << 2)) == 1 << 2; set => RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonPremier { get => (RIB3 & (1 << 3)) == 1 << 3; set => RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RIB3_4 { get => (RIB3 & (1 << 4)) == 1 << 4; set => RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIB3_5 { get => (RIB3 & (1 << 5)) == 1 << 5; set => RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIB3_6 { get => (RIB3 & (1 << 6)) == 1 << 6; set => RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIB3_7 { get => (RIB3 & (1 << 7)) == 1 << 7; set => RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused #endregion #region Block B - public override int Move1 { get { return BitConverter.ToUInt16(Data, 0x28); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } } - public override int Move2 { get { return BitConverter.ToUInt16(Data, 0x2A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } } - public override int Move3 { get { return BitConverter.ToUInt16(Data, 0x2C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } } - public override int Move4 { get { return BitConverter.ToUInt16(Data, 0x2E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } } - public override int Move1_PP { get { return Data[0x30]; } set { Data[0x30] = (byte)value; } } - public override int Move2_PP { get { return Data[0x31]; } set { Data[0x31] = (byte)value; } } - public override int Move3_PP { get { return Data[0x32]; } set { Data[0x32] = (byte)value; } } - public override int Move4_PP { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } } - public override int Move1_PPUps { get { return Data[0x34]; } set { Data[0x34] = (byte)value; } } - public override int Move2_PPUps { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } } - public override int Move3_PPUps { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } } - public override int Move4_PPUps { get { return Data[0x37]; } set { Data[0x37] = (byte)value; } } - private uint IV32 { get { return BitConverter.ToUInt32(Data, 0x38); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x38); } } - public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } } - public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } } - public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } } - public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } } - public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } - public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } - public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } } - public override bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } } + public override int Move1 { get => BitConverter.ToUInt16(Data, 0x28); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x28); } + public override int Move2 { get => BitConverter.ToUInt16(Data, 0x2A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2A); } + public override int Move3 { get => BitConverter.ToUInt16(Data, 0x2C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2C); } + public override int Move4 { get => BitConverter.ToUInt16(Data, 0x2E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E); } + public override int Move1_PP { get => Data[0x30]; set => Data[0x30] = (byte)value; } + public override int Move2_PP { get => Data[0x31]; set => Data[0x31] = (byte)value; } + public override int Move3_PP { get => Data[0x32]; set => Data[0x32] = (byte)value; } + public override int Move4_PP { get => Data[0x33]; set => Data[0x33] = (byte)value; } + public override int Move1_PPUps { get => Data[0x34]; set => Data[0x34] = (byte)value; } + public override int Move2_PPUps { get => Data[0x35]; set => Data[0x35] = (byte)value; } + public override int Move3_PPUps { get => Data[0x36]; set => Data[0x36] = (byte)value; } + public override int Move4_PPUps { get => Data[0x37]; set => Data[0x37] = (byte)value; } + private uint IV32 { get => BitConverter.ToUInt32(Data, 0x38); set => BitConverter.GetBytes(value).CopyTo(Data, 0x38); } + public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } + public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } + public override int IV_DEF { get => (int)(IV32 >> 10) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } + public override int IV_SPE { get => (int)(IV32 >> 15) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } + public override int IV_SPA { get => (int)(IV32 >> 20) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } + public override int IV_SPD { get => (int)(IV32 >> 25) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } + public override bool IsEgg { get => ((IV32 >> 30) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } + public override bool IsNicknamed { get => ((IV32 >> 31) & 1) == 1; set => IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } - private byte RIB4 { get { return Data[0x3C]; } set { Data[0x3C] = value; } } // Hoenn 1a - private byte RIB5 { get { return Data[0x3D]; } set { Data[0x3D] = value; } } // Hoenn 1b - private byte RIB6 { get { return Data[0x3E]; } set { Data[0x3E] = value; } } // Hoenn 2a - private byte RIB7 { get { return Data[0x3F]; } set { Data[0x3F] = value; } } // Hoenn 2b - public bool RibbonG3Cool { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3CoolSuper { get { return (RIB4 & (1 << 1)) == 1 << 1; } set { RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3CoolHyper { get { return (RIB4 & (1 << 2)) == 1 << 2; } set { RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3CoolMaster { get { return (RIB4 & (1 << 3)) == 1 << 3; } set { RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG3Beauty { get { return (RIB4 & (1 << 4)) == 1 << 4; } set { RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG3BeautySuper { get { return (RIB4 & (1 << 5)) == 1 << 5; } set { RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG3BeautyHyper { get { return (RIB4 & (1 << 6)) == 1 << 6; } set { RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG3BeautyMaster { get { return (RIB4 & (1 << 7)) == 1 << 7; } set { RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG3Cute { get { return (RIB5 & (1 << 0)) == 1 << 0; } set { RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3CuteSuper { get { return (RIB5 & (1 << 1)) == 1 << 1; } set { RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3CuteHyper { get { return (RIB5 & (1 << 2)) == 1 << 2; } set { RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3CuteMaster { get { return (RIB5 & (1 << 3)) == 1 << 3; } set { RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG3Smart { get { return (RIB5 & (1 << 4)) == 1 << 4; } set { RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG3SmartSuper { get { return (RIB5 & (1 << 5)) == 1 << 5; } set { RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG3SmartHyper { get { return (RIB5 & (1 << 6)) == 1 << 6; } set { RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG3SmartMaster { get { return (RIB5 & (1 << 7)) == 1 << 7; } set { RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG3Tough { get { return (RIB6 & (1 << 0)) == 1 << 0; } set { RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG3ToughSuper { get { return (RIB6 & (1 << 1)) == 1 << 1; } set { RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG3ToughHyper { get { return (RIB6 & (1 << 2)) == 1 << 2; } set { RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG3ToughMaster { get { return (RIB6 & (1 << 3)) == 1 << 3; } set { RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonChampionG3Hoenn { get { return (RIB6 & (1 << 4)) == 1 << 4; } set { RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonWinning { get { return (RIB6 & (1 << 5)) == 1 << 5; } set { RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonVictory { get { return (RIB6 & (1 << 6)) == 1 << 6; } set { RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonArtist { get { return (RIB6 & (1 << 7)) == 1 << 7; } set { RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonEffort { get { return (RIB7 & (1 << 0)) == 1 << 0; } set { RIB7 = (byte)(RIB7 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonChampionBattle { get { return (RIB7 & (1 << 1)) == 1 << 1; } set { RIB7 = (byte)(RIB7 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonChampionRegional{ get { return (RIB7 & (1 << 2)) == 1 << 2; } set { RIB7 = (byte)(RIB7 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonChampionNational{ get { return (RIB7 & (1 << 3)) == 1 << 3; } set { RIB7 = (byte)(RIB7 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonCountry { get { return (RIB7 & (1 << 4)) == 1 << 4; } set { RIB7 = (byte)(RIB7 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonNational { get { return (RIB7 & (1 << 5)) == 1 << 5; } set { RIB7 = (byte)(RIB7 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonEarth { get { return (RIB7 & (1 << 6)) == 1 << 6; } set { RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonWorld { get { return (RIB7 & (1 << 7)) == 1 << 7; } set { RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } + private byte RIB4 { get => Data[0x3C]; set => Data[0x3C] = value; } // Hoenn 1a + private byte RIB5 { get => Data[0x3D]; set => Data[0x3D] = value; } // Hoenn 1b + private byte RIB6 { get => Data[0x3E]; set => Data[0x3E] = value; } // Hoenn 2a + private byte RIB7 { get => Data[0x3F]; set => Data[0x3F] = value; } // Hoenn 2b + public bool RibbonG3Cool { get => (RIB4 & (1 << 0)) == 1 << 0; set => RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3CoolSuper { get => (RIB4 & (1 << 1)) == 1 << 1; set => RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3CoolHyper { get => (RIB4 & (1 << 2)) == 1 << 2; set => RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3CoolMaster { get => (RIB4 & (1 << 3)) == 1 << 3; set => RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG3Beauty { get => (RIB4 & (1 << 4)) == 1 << 4; set => RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG3BeautySuper { get => (RIB4 & (1 << 5)) == 1 << 5; set => RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG3BeautyHyper { get => (RIB4 & (1 << 6)) == 1 << 6; set => RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG3BeautyMaster { get => (RIB4 & (1 << 7)) == 1 << 7; set => RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG3Cute { get => (RIB5 & (1 << 0)) == 1 << 0; set => RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3CuteSuper { get => (RIB5 & (1 << 1)) == 1 << 1; set => RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3CuteHyper { get => (RIB5 & (1 << 2)) == 1 << 2; set => RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3CuteMaster { get => (RIB5 & (1 << 3)) == 1 << 3; set => RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG3Smart { get => (RIB5 & (1 << 4)) == 1 << 4; set => RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG3SmartSuper { get => (RIB5 & (1 << 5)) == 1 << 5; set => RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG3SmartHyper { get => (RIB5 & (1 << 6)) == 1 << 6; set => RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG3SmartMaster { get => (RIB5 & (1 << 7)) == 1 << 7; set => RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG3Tough { get => (RIB6 & (1 << 0)) == 1 << 0; set => RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG3ToughSuper { get => (RIB6 & (1 << 1)) == 1 << 1; set => RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG3ToughHyper { get => (RIB6 & (1 << 2)) == 1 << 2; set => RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG3ToughMaster { get => (RIB6 & (1 << 3)) == 1 << 3; set => RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonChampionG3Hoenn { get => (RIB6 & (1 << 4)) == 1 << 4; set => RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonWinning { get => (RIB6 & (1 << 5)) == 1 << 5; set => RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonVictory { get => (RIB6 & (1 << 6)) == 1 << 6; set => RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonArtist { get => (RIB6 & (1 << 7)) == 1 << 7; set => RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonEffort { get => (RIB7 & (1 << 0)) == 1 << 0; set => RIB7 = (byte)(RIB7 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonChampionBattle { get => (RIB7 & (1 << 1)) == 1 << 1; set => RIB7 = (byte)(RIB7 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonChampionRegional { get => (RIB7 & (1 << 2)) == 1 << 2; set => RIB7 = (byte)(RIB7 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonChampionNational { get => (RIB7 & (1 << 3)) == 1 << 3; set => RIB7 = (byte)(RIB7 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonCountry { get => (RIB7 & (1 << 4)) == 1 << 4; set => RIB7 = (byte)(RIB7 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonNational { get => (RIB7 & (1 << 5)) == 1 << 5; set => RIB7 = (byte)(RIB7 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonEarth { get => (RIB7 & (1 << 6)) == 1 << 6; set => RIB7 = (byte)(RIB7 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonWorld { get => (RIB7 & (1 << 7)) == 1 << 7; set => RIB7 = (byte)(RIB7 & ~(1 << 7) | (value ? 1 << 7 : 0)); } - public override bool FatefulEncounter { get { return (Data[0x40] & 1) == 1; } set { Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } } - public override int Gender { get { return (Data[0x40] >> 1) & 0x3; } set { Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } } - public override int AltForm { get { return Data[0x40] >> 3; } set { Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } } - public override int Nature { get { return Data[0x41]; } set { Data[0x41] = (byte)value; } } - public bool HiddenAbility { get { return (Data[0x42] & 1) == 1; } set { Data[0x42] = (byte)(Data[0x42] & ~0x01 | (value ? 1 : 0)); } } - public bool NPokémon { get { return (Data[0x42] & 2) == 2; } set { Data[0x42] = (byte)(Data[0x42] & ~0x02 | (value ? 2 : 0)); } } + public override bool FatefulEncounter { get => (Data[0x40] & 1) == 1; set => Data[0x40] = (byte)(Data[0x40] & ~0x01 | (value ? 1 : 0)); } + public override int Gender { get => (Data[0x40] >> 1) & 0x3; set => Data[0x40] = (byte)(Data[0x40] & ~0x06 | (value << 1)); } + public override int AltForm { get => Data[0x40] >> 3; set => Data[0x40] = (byte)(Data[0x40] & 0x07 | (value << 3)); } + public override int Nature { get => Data[0x41]; set => Data[0x41] = (byte)value; } + public bool HiddenAbility { get => (Data[0x42] & 1) == 1; set => Data[0x42] = (byte)(Data[0x42] & ~0x01 | (value ? 1 : 0)); } + public bool NPokémon { get => (Data[0x42] & 2) == 2; set => Data[0x42] = (byte)(Data[0x42] & ~0x02 | (value ? 2 : 0)); } // 0x43-0x47 Unused #endregion #region Block C - public override string Nickname { get { return getString(0x48, 22); } set { setString(value, 11).CopyTo(Data, 0x48); } } + public override string Nickname { get => getString(0x48, 22); set => setString(value, 11).CopyTo(Data, 0x48); } // 0x5E unused - public override int Version { get { return Data[0x5F]; } set { Data[0x5F] = (byte)value; } } - private byte RIB8 { get { return Data[0x60]; } set { Data[0x60] = value; } } // Sinnoh 3 - private byte RIB9 { get { return Data[0x61]; } set { Data[0x61] = value; } } // Sinnoh 4 - private byte RIBA { get { return Data[0x62]; } set { Data[0x62] = value; } } // Sinnoh 5 - private byte RIBB { get { return Data[0x63]; } set { Data[0x63] = value; } } // Sinnoh 6 - public bool RibbonG4Cool { get { return (RIB8 & (1 << 0)) == 1 << 0; } set { RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4CoolGreat { get { return (RIB8 & (1 << 1)) == 1 << 1; } set { RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4CoolUltra { get { return (RIB8 & (1 << 2)) == 1 << 2; } set { RIB8 = (byte)(RIB8 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4CoolMaster { get { return (RIB8 & (1 << 3)) == 1 << 3; } set { RIB8 = (byte)(RIB8 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG4Beauty { get { return (RIB8 & (1 << 4)) == 1 << 4; } set { RIB8 = (byte)(RIB8 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG4BeautyGreat { get { return (RIB8 & (1 << 5)) == 1 << 5; } set { RIB8 = (byte)(RIB8 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG4BeautyUltra { get { return (RIB8 & (1 << 6)) == 1 << 6; } set { RIB8 = (byte)(RIB8 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG4BeautyMaster { get { return (RIB8 & (1 << 7)) == 1 << 7; } set { RIB8 = (byte)(RIB8 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG4Cute { get { return (RIB9 & (1 << 0)) == 1 << 0; } set { RIB9 = (byte)(RIB9 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4CuteGreat { get { return (RIB9 & (1 << 1)) == 1 << 1; } set { RIB9 = (byte)(RIB9 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4CuteUltra { get { return (RIB9 & (1 << 2)) == 1 << 2; } set { RIB9 = (byte)(RIB9 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4CuteMaster { get { return (RIB9 & (1 << 3)) == 1 << 3; } set { RIB9 = (byte)(RIB9 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonG4Smart { get { return (RIB9 & (1 << 4)) == 1 << 4; } set { RIB9 = (byte)(RIB9 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonG4SmartGreat { get { return (RIB9 & (1 << 5)) == 1 << 5; } set { RIB9 = (byte)(RIB9 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonG4SmartUltra { get { return (RIB9 & (1 << 6)) == 1 << 6; } set { RIB9 = (byte)(RIB9 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonG4SmartMaster { get { return (RIB9 & (1 << 7)) == 1 << 7; } set { RIB9 = (byte)(RIB9 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonG4Tough { get { return (RIBA & (1 << 0)) == 1 << 0; } set { RIBA = (byte)(RIBA & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonG4ToughGreat { get { return (RIBA & (1 << 1)) == 1 << 1; } set { RIBA = (byte)(RIBA & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonG4ToughUltra { get { return (RIBA & (1 << 2)) == 1 << 2; } set { RIBA = (byte)(RIBA & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonG4ToughMaster { get { return (RIBA & (1 << 3)) == 1 << 3; } set { RIBA = (byte)(RIBA & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RIBA_4 { get { return (RIBA & (1 << 4)) == 1 << 4; } set { RIBA = (byte)(RIBA & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIBA_5 { get { return (RIBA & (1 << 5)) == 1 << 5; } set { RIBA = (byte)(RIBA & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIBA_6 { get { return (RIBA & (1 << 6)) == 1 << 6; } set { RIBA = (byte)(RIBA & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIBA_7 { get { return (RIBA & (1 << 7)) == 1 << 7; } set { RIBA = (byte)(RIBA & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused - public bool RIBB_0 { get { return (RIBB & (1 << 0)) == 1 << 0; } set { RIBB = (byte)(RIBB & ~(1 << 0) | (value ? 1 << 0 : 0)); } } // Unused - public bool RIBB_1 { get { return (RIBB & (1 << 1)) == 1 << 1; } set { RIBB = (byte)(RIBB & ~(1 << 1) | (value ? 1 << 1 : 0)); } } // Unused - public bool RIBB_2 { get { return (RIBB & (1 << 2)) == 1 << 2; } set { RIBB = (byte)(RIBB & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Unused - public bool RIBB_3 { get { return (RIBB & (1 << 3)) == 1 << 3; } set { RIBB = (byte)(RIBB & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Unused - public bool RIBB_4 { get { return (RIBB & (1 << 4)) == 1 << 4; } set { RIBB = (byte)(RIBB & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIBB_5 { get { return (RIBB & (1 << 5)) == 1 << 5; } set { RIBB = (byte)(RIBB & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIBB_6 { get { return (RIBB & (1 << 6)) == 1 << 6; } set { RIBB = (byte)(RIBB & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIBB_7 { get { return (RIBB & (1 << 7)) == 1 << 7; } set { RIBB = (byte)(RIBB & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused + public override int Version { get => Data[0x5F]; set => Data[0x5F] = (byte)value; } + private byte RIB8 { get => Data[0x60]; set => Data[0x60] = value; } // Sinnoh 3 + private byte RIB9 { get => Data[0x61]; set => Data[0x61] = value; } // Sinnoh 4 + private byte RIBA { get => Data[0x62]; set => Data[0x62] = value; } // Sinnoh 5 + private byte RIBB { get => Data[0x63]; set => Data[0x63] = value; } // Sinnoh 6 + public bool RibbonG4Cool { get => (RIB8 & (1 << 0)) == 1 << 0; set => RIB8 = (byte)(RIB8 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4CoolGreat { get => (RIB8 & (1 << 1)) == 1 << 1; set => RIB8 = (byte)(RIB8 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4CoolUltra { get => (RIB8 & (1 << 2)) == 1 << 2; set => RIB8 = (byte)(RIB8 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4CoolMaster { get => (RIB8 & (1 << 3)) == 1 << 3; set => RIB8 = (byte)(RIB8 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG4Beauty { get => (RIB8 & (1 << 4)) == 1 << 4; set => RIB8 = (byte)(RIB8 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG4BeautyGreat { get => (RIB8 & (1 << 5)) == 1 << 5; set => RIB8 = (byte)(RIB8 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG4BeautyUltra { get => (RIB8 & (1 << 6)) == 1 << 6; set => RIB8 = (byte)(RIB8 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG4BeautyMaster { get => (RIB8 & (1 << 7)) == 1 << 7; set => RIB8 = (byte)(RIB8 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG4Cute { get => (RIB9 & (1 << 0)) == 1 << 0; set => RIB9 = (byte)(RIB9 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4CuteGreat { get => (RIB9 & (1 << 1)) == 1 << 1; set => RIB9 = (byte)(RIB9 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4CuteUltra { get => (RIB9 & (1 << 2)) == 1 << 2; set => RIB9 = (byte)(RIB9 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4CuteMaster { get => (RIB9 & (1 << 3)) == 1 << 3; set => RIB9 = (byte)(RIB9 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonG4Smart { get => (RIB9 & (1 << 4)) == 1 << 4; set => RIB9 = (byte)(RIB9 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonG4SmartGreat { get => (RIB9 & (1 << 5)) == 1 << 5; set => RIB9 = (byte)(RIB9 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonG4SmartUltra { get => (RIB9 & (1 << 6)) == 1 << 6; set => RIB9 = (byte)(RIB9 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonG4SmartMaster { get => (RIB9 & (1 << 7)) == 1 << 7; set => RIB9 = (byte)(RIB9 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonG4Tough { get => (RIBA & (1 << 0)) == 1 << 0; set => RIBA = (byte)(RIBA & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonG4ToughGreat { get => (RIBA & (1 << 1)) == 1 << 1; set => RIBA = (byte)(RIBA & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonG4ToughUltra { get => (RIBA & (1 << 2)) == 1 << 2; set => RIBA = (byte)(RIBA & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonG4ToughMaster { get => (RIBA & (1 << 3)) == 1 << 3; set => RIBA = (byte)(RIBA & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RIBA_4 { get => (RIBA & (1 << 4)) == 1 << 4; set => RIBA = (byte)(RIBA & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIBA_5 { get => (RIBA & (1 << 5)) == 1 << 5; set => RIBA = (byte)(RIBA & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIBA_6 { get => (RIBA & (1 << 6)) == 1 << 6; set => RIBA = (byte)(RIBA & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIBA_7 { get => (RIBA & (1 << 7)) == 1 << 7; set => RIBA = (byte)(RIBA & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused + public bool RIBB_0 { get => (RIBB & (1 << 0)) == 1 << 0; set => RIBB = (byte)(RIBB & ~(1 << 0) | (value ? 1 << 0 : 0)); } // Unused + public bool RIBB_1 { get => (RIBB & (1 << 1)) == 1 << 1; set => RIBB = (byte)(RIBB & ~(1 << 1) | (value ? 1 << 1 : 0)); } // Unused + public bool RIBB_2 { get => (RIBB & (1 << 2)) == 1 << 2; set => RIBB = (byte)(RIBB & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Unused + public bool RIBB_3 { get => (RIBB & (1 << 3)) == 1 << 3; set => RIBB = (byte)(RIBB & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Unused + public bool RIBB_4 { get => (RIBB & (1 << 4)) == 1 << 4; set => RIBB = (byte)(RIBB & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIBB_5 { get => (RIBB & (1 << 5)) == 1 << 5; set => RIBB = (byte)(RIBB & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIBB_6 { get => (RIBB & (1 << 6)) == 1 << 6; set => RIBB = (byte)(RIBB & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIBB_7 { get => (RIBB & (1 << 7)) == 1 << 7; set => RIBB = (byte)(RIBB & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused // 0x64-0x67 Unused #endregion #region Block D - public override string OT_Name { get { return getString(0x68, 0x16); } set { setString(value, 7).CopyTo(Data, 0x68); } } - public override int Egg_Year { get { return Data[0x78]; } set { Data[0x78] = (byte)value; } } - public override int Egg_Month { get { return Data[0x79]; } set { Data[0x79] = (byte)value; } } - public override int Egg_Day { get { return Data[0x7A]; } set { Data[0x7A] = (byte)value; } } - public override int Met_Year { get { return Data[0x7B]; } set { Data[0x7B] = (byte)value; } } - public override int Met_Month { get { return Data[0x7C]; } set { Data[0x7C] = (byte)value; } } - public override int Met_Day { get { return Data[0x7D]; } set { Data[0x7D] = (byte)value; } } - public override int Egg_Location { get { return BitConverter.ToUInt16(Data, 0x7E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } } - public override int Met_Location { get { return BitConverter.ToUInt16(Data, 0x80); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } } - private byte PKRS { get { return Data[0x82]; } set { Data[0x82] = value; } } - public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } - public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | (value << 4)); } } - public override int Ball { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } } - public override int Met_Level { get { return Data[0x84] & ~0x80; } set { Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } } - public override int OT_Gender { get { return Data[0x84] >> 7; } set { Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } } - public override int EncounterType { get { return Data[0x85]; } set { Data[0x85] = (byte)value; } } + public override string OT_Name { get => getString(0x68, 0x16); set => setString(value, 7).CopyTo(Data, 0x68); } + public override int Egg_Year { get => Data[0x78]; set => Data[0x78] = (byte)value; } + public override int Egg_Month { get => Data[0x79]; set => Data[0x79] = (byte)value; } + public override int Egg_Day { get => Data[0x7A]; set => Data[0x7A] = (byte)value; } + public override int Met_Year { get => Data[0x7B]; set => Data[0x7B] = (byte)value; } + public override int Met_Month { get => Data[0x7C]; set => Data[0x7C] = (byte)value; } + public override int Met_Day { get => Data[0x7D]; set => Data[0x7D] = (byte)value; } + public override int Egg_Location { get => BitConverter.ToUInt16(Data, 0x7E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x7E); } + public override int Met_Location { get => BitConverter.ToUInt16(Data, 0x80); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x80); } + private byte PKRS { get => Data[0x82]; set => Data[0x82] = value; } + public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)(PKRS & ~0xF | value); } + public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)(PKRS & 0xF | (value << 4)); } + public override int Ball { get => Data[0x83]; set => Data[0x83] = (byte)value; } + public override int Met_Level { get => Data[0x84] & ~0x80; set => Data[0x84] = (byte)((Data[0x84] & 0x80) | value); } + public override int OT_Gender { get => Data[0x84] >> 7; set => Data[0x84] = (byte)((Data[0x84] & ~0x80) | value << 7); } + public override int EncounterType { get => Data[0x85]; set => Data[0x85] = (byte)value; } // 0x86-0x87 Unused #endregion - public override int Stat_Level { get { return Data[0x8C]; } set { Data[0x8C] = (byte)value; } } - public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0x8E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8E); } } - public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0x90); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x90); } } - public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0x92); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x92); } } - public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0x94); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x94); } } - public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0x96); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x96); } } - public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0x98); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x98); } } - public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0x9A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x9A); } } + public override int Stat_Level { get => Data[0x8C]; set => Data[0x8C] = (byte)value; } + public override int Stat_HPCurrent { get => BitConverter.ToUInt16(Data, 0x8E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8E); } + public override int Stat_HPMax { get => BitConverter.ToUInt16(Data, 0x90); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x90); } + public override int Stat_ATK { get => BitConverter.ToUInt16(Data, 0x92); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x92); } + public override int Stat_DEF { get => BitConverter.ToUInt16(Data, 0x94); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x94); } + public override int Stat_SPE { get => BitConverter.ToUInt16(Data, 0x96); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x96); } + public override int Stat_SPA { get => BitConverter.ToUInt16(Data, 0x98); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x98); } + public override int Stat_SPD { get => BitConverter.ToUInt16(Data, 0x9A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x9A); } // Generated Attributes public override int PSV => (int)((PID >> 16 ^ PID & 0xFFFF) >> 3); diff --git a/PKHeX.Core/PKM/PK6.cs b/PKHeX.Core/PKM/PK6.cs index 8aacfae17..bfcd95b53 100644 --- a/PKHeX.Core/PKM/PK6.cs +++ b/PKHeX.Core/PKM/PK6.cs @@ -29,331 +29,332 @@ public PK6(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setString6(value, maxLength); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x40, 24); } set { if (value?.Length == 24) value.CopyTo(Data, 0x40); } } - public override byte[] HT_Trash { get { return getData(0x78, 24); } set { if (value?.Length == 24) value.CopyTo(Data, 0x78); } } - public override byte[] OT_Trash { get { return getData(0xB0, 24); } set { if (value?.Length == 24) value.CopyTo(Data, 0xB0); } } + public override byte[] Nickname_Trash { get => getData(0x40, 24); set { if (value?.Length == 24) value.CopyTo(Data, 0x40); } } + public override byte[] HT_Trash { get => getData(0x78, 24); set { if (value?.Length == 24) value.CopyTo(Data, 0x78); } } + public override byte[] OT_Trash { get => getData(0xB0, 24); set { if (value?.Length == 24) value.CopyTo(Data, 0xB0); } } // Structure #region Block A public override uint EncryptionConstant { - get { return BitConverter.ToUInt32(Data, 0x00); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } + get => BitConverter.ToUInt32(Data, 0x00); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x00); } public override ushort Sanity { - get { return BitConverter.ToUInt16(Data, 0x04); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } // Should always be zero... + get => BitConverter.ToUInt16(Data, 0x04); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x04); } public override ushort Checksum { - get { return BitConverter.ToUInt16(Data, 0x06); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } + get => BitConverter.ToUInt16(Data, 0x06); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x06); } public override int Species { - get { return BitConverter.ToUInt16(Data, 0x08); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } + get => BitConverter.ToUInt16(Data, 0x08); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } public override int HeldItem { - get { return BitConverter.ToUInt16(Data, 0x0A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + get => BitConverter.ToUInt16(Data, 0x0A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } public override int TID { - get { return BitConverter.ToUInt16(Data, 0x0C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } + get => BitConverter.ToUInt16(Data, 0x0C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } public override int SID { - get { return BitConverter.ToUInt16(Data, 0x0E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } + get => BitConverter.ToUInt16(Data, 0x0E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } public override uint EXP { - get { return BitConverter.ToUInt32(Data, 0x10); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } + get => BitConverter.ToUInt32(Data, 0x10); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x10); } - public override int Ability { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } - public override int AbilityNumber { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } - public int TrainingBagHits { get { return Data[0x16]; } set { Data[0x16] = (byte)value; } } - public int TrainingBag { get { return Data[0x17]; } set { Data[0x17] = (byte)value; } } + public override int Ability { get => Data[0x14]; set => Data[0x14] = (byte)value; } + public override int AbilityNumber { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public int TrainingBagHits { get => Data[0x16]; set => Data[0x16] = (byte)value; } + public int TrainingBag { get => Data[0x17]; set => Data[0x17] = (byte)value; } public override uint PID { - get { return BitConverter.ToUInt32(Data, 0x18); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x18); } + get => BitConverter.ToUInt32(Data, 0x18); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x18); } - public override int Nature { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } } - public override bool FatefulEncounter { get { return (Data[0x1D] & 1) == 1; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x01 | (value ? 1 : 0)); } } - public override int Gender { get { return (Data[0x1D] >> 1) & 0x3; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x06 | (value << 1)); } } - public override int AltForm { get { return Data[0x1D] >> 3; } set { Data[0x1D] = (byte)(Data[0x1D] & 0x07 | (value << 3)); } } - public override int EV_HP { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } } - public override int EV_ATK { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } } - public override int EV_DEF { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } - public override int EV_SPE { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } } - public override int EV_SPA { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } } - public override int EV_SPD { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } } - public override int CNT_Cool { get { return Data[0x24]; } set { Data[0x24] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0x25]; } set { Data[0x25] = (byte)value; } } - public override int CNT_Cute { get { return Data[0x26]; } set { Data[0x26] = (byte)value; } } - public override int CNT_Smart { get { return Data[0x27]; } set { Data[0x27] = (byte)value; } } - public override int CNT_Tough { get { return Data[0x28]; } set { Data[0x28] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } } - public override int MarkValue { get { return Data[0x2A]; } protected set { Data[0x2A] = (byte)value; } } - private byte PKRS { get { return Data[0x2B]; } set { Data[0x2B] = value; } } - public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } - public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } } - private byte ST1 { get { return Data[0x2C]; } set { Data[0x2C] = value; } } - public bool Unused0 { get { return (ST1 & (1 << 0)) == 1 << 0; } set { ST1 = (byte)(ST1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool Unused1 { get { return (ST1 & (1 << 1)) == 1 << 1; } set { ST1 = (byte)(ST1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain1_SPA { get { return (ST1 & (1 << 2)) == 1 << 2; } set { ST1 = (byte)(ST1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain1_HP { get { return (ST1 & (1 << 3)) == 1 << 3; } set { ST1 = (byte)(ST1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain1_ATK { get { return (ST1 & (1 << 4)) == 1 << 4; } set { ST1 = (byte)(ST1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain1_SPD { get { return (ST1 & (1 << 5)) == 1 << 5; } set { ST1 = (byte)(ST1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain1_SPE { get { return (ST1 & (1 << 6)) == 1 << 6; } set { ST1 = (byte)(ST1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain1_DEF { get { return (ST1 & (1 << 7)) == 1 << 7; } set { ST1 = (byte)(ST1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte ST2 { get { return Data[0x2D]; } set { Data[0x2D] = value; } } - public bool SuperTrain2_SPA { get { return (ST2 & (1 << 0)) == 1 << 0; } set { ST2 = (byte)(ST2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool SuperTrain2_HP { get { return (ST2 & (1 << 1)) == 1 << 1; } set { ST2 = (byte)(ST2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain2_ATK { get { return (ST2 & (1 << 2)) == 1 << 2; } set { ST2 = (byte)(ST2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain2_SPD { get { return (ST2 & (1 << 3)) == 1 << 3; } set { ST2 = (byte)(ST2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain2_SPE { get { return (ST2 & (1 << 4)) == 1 << 4; } set { ST2 = (byte)(ST2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain2_DEF { get { return (ST2 & (1 << 5)) == 1 << 5; } set { ST2 = (byte)(ST2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain3_SPA { get { return (ST2 & (1 << 6)) == 1 << 6; } set { ST2 = (byte)(ST2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain3_HP { get { return (ST2 & (1 << 7)) == 1 << 7; } set { ST2 = (byte)(ST2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte ST3 { get { return Data[0x2E]; } set { Data[0x2E] = value; } } - public bool SuperTrain3_ATK { get { return (ST3 & (1 << 0)) == 1 << 0; } set { ST3 = (byte)(ST3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool SuperTrain3_SPD { get { return (ST3 & (1 << 1)) == 1 << 1; } set { ST3 = (byte)(ST3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain3_SPE { get { return (ST3 & (1 << 2)) == 1 << 2; } set { ST3 = (byte)(ST3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain3_DEF { get { return (ST3 & (1 << 3)) == 1 << 3; } set { ST3 = (byte)(ST3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain4_1 { get { return (ST3 & (1 << 4)) == 1 << 4; } set { ST3 = (byte)(ST3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain5_1 { get { return (ST3 & (1 << 5)) == 1 << 5; } set { ST3 = (byte)(ST3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain5_2 { get { return (ST3 & (1 << 6)) == 1 << 6; } set { ST3 = (byte)(ST3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain5_3 { get { return (ST3 & (1 << 7)) == 1 << 7; } set { ST3 = (byte)(ST3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte ST4 { get { return Data[0x2F]; } set { Data[0x2F] = value; } } - public bool SuperTrain5_4 { get { return (ST4 & (1 << 0)) == 1 << 0; } set { ST4 = (byte)(ST4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool SuperTrain6_1 { get { return (ST4 & (1 << 1)) == 1 << 1; } set { ST4 = (byte)(ST4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain6_2 { get { return (ST4 & (1 << 2)) == 1 << 2; } set { ST4 = (byte)(ST4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain6_3 { get { return (ST4 & (1 << 3)) == 1 << 3; } set { ST4 = (byte)(ST4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain7_1 { get { return (ST4 & (1 << 4)) == 1 << 4; } set { ST4 = (byte)(ST4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain7_2 { get { return (ST4 & (1 << 5)) == 1 << 5; } set { ST4 = (byte)(ST4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain7_3 { get { return (ST4 & (1 << 6)) == 1 << 6; } set { ST4 = (byte)(ST4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain8_1 { get { return (ST4 & (1 << 7)) == 1 << 7; } set { ST4 = (byte)(ST4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte RIB0 { get { return Data[0x30]; } set { Data[0x30] = value; } } // Ribbons are read as uints, but let's keep them per byte. - private byte RIB1 { get { return Data[0x31]; } set { Data[0x31] = value; } } - private byte RIB2 { get { return Data[0x32]; } set { Data[0x32] = value; } } - private byte RIB3 { get { return Data[0x33]; } set { Data[0x33] = value; } } - private byte RIB4 { get { return Data[0x34]; } set { Data[0x34] = value; } } - private byte RIB5 { get { return Data[0x35]; } set { Data[0x35] = value; } } - private byte RIB6 { get { return Data[0x36]; } set { Data[0x36] = value; } } // Unused - private byte RIB7 { get { return Data[0x37]; } set { Data[0x37] = value; } } // Unused - public bool RibbonChampionKalos { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonChampionG3Hoenn { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonChampionSinnoh { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonBestFriends { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonTraining { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonBattlerSkillful { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonBattlerExpert { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonEffort { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonAlert { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonShock { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonDowncast { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonCareless { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonRelax { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonSnooze { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonSmile { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonGorgeous { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonRoyal { get { return (RIB2 & (1 << 0)) == 1 << 0; } set { RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonGorgeousRoyal { get { return (RIB2 & (1 << 1)) == 1 << 1; } set { RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonArtist { get { return (RIB2 & (1 << 2)) == 1 << 2; } set { RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonFootprint { get { return (RIB2 & (1 << 3)) == 1 << 3; } set { RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonRecord { get { return (RIB2 & (1 << 4)) == 1 << 4; } set { RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonLegend { get { return (RIB2 & (1 << 5)) == 1 << 5; } set { RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonCountry { get { return (RIB2 & (1 << 6)) == 1 << 6; } set { RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonNational { get { return (RIB2 & (1 << 7)) == 1 << 7; } set { RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonEarth { get { return (RIB3 & (1 << 0)) == 1 << 0; } set { RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonWorld { get { return (RIB3 & (1 << 1)) == 1 << 1; } set { RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonClassic { get { return (RIB3 & (1 << 2)) == 1 << 2; } set { RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonPremier { get { return (RIB3 & (1 << 3)) == 1 << 3; } set { RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonEvent { get { return (RIB3 & (1 << 4)) == 1 << 4; } set { RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonBirthday { get { return (RIB3 & (1 << 5)) == 1 << 5; } set { RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonSpecial { get { return (RIB3 & (1 << 6)) == 1 << 6; } set { RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonSouvenir { get { return (RIB3 & (1 << 7)) == 1 << 7; } set { RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonWishing { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonChampionBattle { get { return (RIB4 & (1 << 1)) == 1 << 1; } set { RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonChampionRegional { get { return (RIB4 & (1 << 2)) == 1 << 2; } set { RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonChampionNational { get { return (RIB4 & (1 << 3)) == 1 << 3; } set { RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonChampionWorld { get { return (RIB4 & (1 << 4)) == 1 << 4; } set { RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RIB4_5 { get { return (RIB4 & (1 << 5)) == 1 << 5; } set { RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIB4_6 { get { return (RIB4 & (1 << 6)) == 1 << 6; } set { RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RibbonChampionG6Hoenn { get { return (RIB4 & (1 << 7)) == 1 << 7; } set { RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonContestStar { get { return (RIB5 & (1 << 0)) == 1 << 0; } set { RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonMasterCoolness { get { return (RIB5 & (1 << 1)) == 1 << 1; } set { RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonMasterBeauty { get { return (RIB5 & (1 << 2)) == 1 << 2; } set { RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonMasterCuteness { get { return (RIB5 & (1 << 3)) == 1 << 3; } set { RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonMasterCleverness { get { return (RIB5 & (1 << 4)) == 1 << 4; } set { RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonMasterToughness { get { return (RIB5 & (1 << 5)) == 1 << 5; } set { RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RIB5_6 { get { return (RIB5 & (1 << 6)) == 1 << 6; } set { RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIB5_7 { get { return (RIB5 & (1 << 7)) == 1 << 7; } set { RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused - public int RibbonCountMemoryContest { get { return Data[0x38]; } set { Data[0x38] = (byte)value; } } - public int RibbonCountMemoryBattle { get { return Data[0x39]; } set { Data[0x39] = (byte)value; } } - private byte DistByte { get { return Data[0x3A]; } set { Data[0x3A] = value; } } - public bool DistSuperTrain1 { get { return (DistByte & (1 << 0)) == 1 << 0; } set { DistByte = (byte)(DistByte & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool DistSuperTrain2 { get { return (DistByte & (1 << 1)) == 1 << 1; } set { DistByte = (byte)(DistByte & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool DistSuperTrain3 { get { return (DistByte & (1 << 2)) == 1 << 2; } set { DistByte = (byte)(DistByte & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool DistSuperTrain4 { get { return (DistByte & (1 << 3)) == 1 << 3; } set { DistByte = (byte)(DistByte & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool DistSuperTrain5 { get { return (DistByte & (1 << 4)) == 1 << 4; } set { DistByte = (byte)(DistByte & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool DistSuperTrain6 { get { return (DistByte & (1 << 5)) == 1 << 5; } set { DistByte = (byte)(DistByte & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool Dist7 { get { return (DistByte & (1 << 6)) == 1 << 6; } set { DistByte = (byte)(DistByte & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool Dist8 { get { return (DistByte & (1 << 7)) == 1 << 7; } set { DistByte = (byte)(DistByte & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public byte _0x3B { get { return Data[0x3B]; } set { Data[0x3B] = value; } } - public byte _0x3C { get { return Data[0x3C]; } set { Data[0x3C] = value; } } - public byte _0x3D { get { return Data[0x3D]; } set { Data[0x3D] = value; } } - public byte _0x3E { get { return Data[0x3E]; } set { Data[0x3E] = value; } } - public byte _0x3F { get { return Data[0x3F]; } set { Data[0x3F] = value; } } + public override int Nature { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public override bool FatefulEncounter { get => (Data[0x1D] & 1) == 1; set => Data[0x1D] = (byte)(Data[0x1D] & ~0x01 | (value ? 1 : 0)); } + public override int Gender { get => (Data[0x1D] >> 1) & 0x3; set => Data[0x1D] = (byte)(Data[0x1D] & ~0x06 | (value << 1)); } + public override int AltForm { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)(Data[0x1D] & 0x07 | (value << 3)); } + public override int EV_HP { get => Data[0x1E]; set => Data[0x1E] = (byte)value; } + public override int EV_ATK { get => Data[0x1F]; set => Data[0x1F] = (byte)value; } + public override int EV_DEF { get => Data[0x20]; set => Data[0x20] = (byte)value; } + public override int EV_SPE { get => Data[0x21]; set => Data[0x21] = (byte)value; } + public override int EV_SPA { get => Data[0x22]; set => Data[0x22] = (byte)value; } + public override int EV_SPD { get => Data[0x23]; set => Data[0x23] = (byte)value; } + public override int CNT_Cool { get => Data[0x24]; set => Data[0x24] = (byte)value; } + public override int CNT_Beauty { get => Data[0x25]; set => Data[0x25] = (byte)value; } + public override int CNT_Cute { get => Data[0x26]; set => Data[0x26] = (byte)value; } + public override int CNT_Smart { get => Data[0x27]; set => Data[0x27] = (byte)value; } + public override int CNT_Tough { get => Data[0x28]; set => Data[0x28] = (byte)value; } + public override int CNT_Sheen { get => Data[0x29]; set => Data[0x29] = (byte)value; } + public override int MarkValue { get => Data[0x2A]; protected set => Data[0x2A] = (byte)value; } + private byte PKRS { get => Data[0x2B]; set => Data[0x2B] = value; } + public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)(PKRS & ~0xF | value); } + public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)(PKRS & 0xF | value << 4); } + private byte ST1 { get => Data[0x2C]; set => Data[0x2C] = value; } + public bool Unused0 { get => (ST1 & (1 << 0)) == 1 << 0; set => ST1 = (byte)(ST1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool Unused1 { get => (ST1 & (1 << 1)) == 1 << 1; set => ST1 = (byte)(ST1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain1_SPA { get => (ST1 & (1 << 2)) == 1 << 2; set => ST1 = (byte)(ST1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain1_HP { get => (ST1 & (1 << 3)) == 1 << 3; set => ST1 = (byte)(ST1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain1_ATK { get => (ST1 & (1 << 4)) == 1 << 4; set => ST1 = (byte)(ST1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain1_SPD { get => (ST1 & (1 << 5)) == 1 << 5; set => ST1 = (byte)(ST1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain1_SPE { get => (ST1 & (1 << 6)) == 1 << 6; set => ST1 = (byte)(ST1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain1_DEF { get => (ST1 & (1 << 7)) == 1 << 7; set => ST1 = (byte)(ST1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte ST2 { get => Data[0x2D]; set => Data[0x2D] = value; } + public bool SuperTrain2_SPA { get => (ST2 & (1 << 0)) == 1 << 0; set => ST2 = (byte)(ST2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool SuperTrain2_HP { get => (ST2 & (1 << 1)) == 1 << 1; set => ST2 = (byte)(ST2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain2_ATK { get => (ST2 & (1 << 2)) == 1 << 2; set => ST2 = (byte)(ST2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain2_SPD { get => (ST2 & (1 << 3)) == 1 << 3; set => ST2 = (byte)(ST2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain2_SPE { get => (ST2 & (1 << 4)) == 1 << 4; set => ST2 = (byte)(ST2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain2_DEF { get => (ST2 & (1 << 5)) == 1 << 5; set => ST2 = (byte)(ST2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain3_SPA { get => (ST2 & (1 << 6)) == 1 << 6; set => ST2 = (byte)(ST2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain3_HP { get => (ST2 & (1 << 7)) == 1 << 7; set => ST2 = (byte)(ST2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte ST3 { get => Data[0x2E]; set => Data[0x2E] = value; } + public bool SuperTrain3_ATK { get => (ST3 & (1 << 0)) == 1 << 0; set => ST3 = (byte)(ST3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool SuperTrain3_SPD { get => (ST3 & (1 << 1)) == 1 << 1; set => ST3 = (byte)(ST3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain3_SPE { get => (ST3 & (1 << 2)) == 1 << 2; set => ST3 = (byte)(ST3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain3_DEF { get => (ST3 & (1 << 3)) == 1 << 3; set => ST3 = (byte)(ST3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain4_1 { get => (ST3 & (1 << 4)) == 1 << 4; set => ST3 = (byte)(ST3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain5_1 { get => (ST3 & (1 << 5)) == 1 << 5; set => ST3 = (byte)(ST3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain5_2 { get => (ST3 & (1 << 6)) == 1 << 6; set => ST3 = (byte)(ST3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain5_3 { get => (ST3 & (1 << 7)) == 1 << 7; set => ST3 = (byte)(ST3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte ST4 { get => Data[0x2F]; set => Data[0x2F] = value; } + public bool SuperTrain5_4 { get => (ST4 & (1 << 0)) == 1 << 0; set => ST4 = (byte)(ST4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool SuperTrain6_1 { get => (ST4 & (1 << 1)) == 1 << 1; set => ST4 = (byte)(ST4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain6_2 { get => (ST4 & (1 << 2)) == 1 << 2; set => ST4 = (byte)(ST4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain6_3 { get => (ST4 & (1 << 3)) == 1 << 3; set => ST4 = (byte)(ST4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain7_1 { get => (ST4 & (1 << 4)) == 1 << 4; set => ST4 = (byte)(ST4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain7_2 { get => (ST4 & (1 << 5)) == 1 << 5; set => ST4 = (byte)(ST4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain7_3 { get => (ST4 & (1 << 6)) == 1 << 6; set => ST4 = (byte)(ST4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain8_1 { get => (ST4 & (1 << 7)) == 1 << 7; set => ST4 = (byte)(ST4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte RIB0 { get => Data[0x30]; set => Data[0x30] = value; } // Ribbons are read as uints, but let's keep them per byte. + private byte RIB1 { get => Data[0x31]; set => Data[0x31] = value; } + private byte RIB2 { get => Data[0x32]; set => Data[0x32] = value; } + private byte RIB3 { get => Data[0x33]; set => Data[0x33] = value; } + private byte RIB4 { get => Data[0x34]; set => Data[0x34] = value; } + private byte RIB5 { get => Data[0x35]; set => Data[0x35] = value; } + private byte RIB6 { get => Data[0x36]; set => Data[0x36] = value; } // Unused + private byte RIB7 { get => Data[0x37]; set => Data[0x37] = value; } // Unused + public bool RibbonChampionKalos { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonChampionG3Hoenn { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonChampionSinnoh { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonBestFriends { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonTraining { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonBattlerSkillful { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonBattlerExpert { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonEffort { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonAlert { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonShock { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonDowncast { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonCareless { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonRelax { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonSnooze { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonSmile { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonGorgeous { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonRoyal { get => (RIB2 & (1 << 0)) == 1 << 0; set => RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonGorgeousRoyal { get => (RIB2 & (1 << 1)) == 1 << 1; set => RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonArtist { get => (RIB2 & (1 << 2)) == 1 << 2; set => RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonFootprint { get => (RIB2 & (1 << 3)) == 1 << 3; set => RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonRecord { get => (RIB2 & (1 << 4)) == 1 << 4; set => RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonLegend { get => (RIB2 & (1 << 5)) == 1 << 5; set => RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonCountry { get => (RIB2 & (1 << 6)) == 1 << 6; set => RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonNational { get => (RIB2 & (1 << 7)) == 1 << 7; set => RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonEarth { get => (RIB3 & (1 << 0)) == 1 << 0; set => RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonWorld { get => (RIB3 & (1 << 1)) == 1 << 1; set => RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonClassic { get => (RIB3 & (1 << 2)) == 1 << 2; set => RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonPremier { get => (RIB3 & (1 << 3)) == 1 << 3; set => RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonEvent { get => (RIB3 & (1 << 4)) == 1 << 4; set => RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonBirthday { get => (RIB3 & (1 << 5)) == 1 << 5; set => RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonSpecial { get => (RIB3 & (1 << 6)) == 1 << 6; set => RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonSouvenir { get => (RIB3 & (1 << 7)) == 1 << 7; set => RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonWishing { get => (RIB4 & (1 << 0)) == 1 << 0; set => RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonChampionBattle { get => (RIB4 & (1 << 1)) == 1 << 1; set => RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonChampionRegional { get => (RIB4 & (1 << 2)) == 1 << 2; set => RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonChampionNational { get => (RIB4 & (1 << 3)) == 1 << 3; set => RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonChampionWorld { get => (RIB4 & (1 << 4)) == 1 << 4; set => RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RIB4_5 { get => (RIB4 & (1 << 5)) == 1 << 5; set => RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIB4_6 { get => (RIB4 & (1 << 6)) == 1 << 6; set => RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RibbonChampionG6Hoenn { get => (RIB4 & (1 << 7)) == 1 << 7; set => RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonContestStar { get => (RIB5 & (1 << 0)) == 1 << 0; set => RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonMasterCoolness { get => (RIB5 & (1 << 1)) == 1 << 1; set => RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonMasterBeauty { get => (RIB5 & (1 << 2)) == 1 << 2; set => RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonMasterCuteness { get => (RIB5 & (1 << 3)) == 1 << 3; set => RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonMasterCleverness { get => (RIB5 & (1 << 4)) == 1 << 4; set => RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonMasterToughness { get => (RIB5 & (1 << 5)) == 1 << 5; set => RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RIB5_6 { get => (RIB5 & (1 << 6)) == 1 << 6; set => RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIB5_7 { get => (RIB5 & (1 << 7)) == 1 << 7; set => RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused + public int RibbonCountMemoryContest { get => Data[0x38]; set => Data[0x38] = (byte)value; } + public int RibbonCountMemoryBattle { get => Data[0x39]; set => Data[0x39] = (byte)value; } + private byte DistByte { get => Data[0x3A]; set => Data[0x3A] = value; } + public bool DistSuperTrain1 { get => (DistByte & (1 << 0)) == 1 << 0; set => DistByte = (byte)(DistByte & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool DistSuperTrain2 { get => (DistByte & (1 << 1)) == 1 << 1; set => DistByte = (byte)(DistByte & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool DistSuperTrain3 { get => (DistByte & (1 << 2)) == 1 << 2; set => DistByte = (byte)(DistByte & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool DistSuperTrain4 { get => (DistByte & (1 << 3)) == 1 << 3; set => DistByte = (byte)(DistByte & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool DistSuperTrain5 { get => (DistByte & (1 << 4)) == 1 << 4; set => DistByte = (byte)(DistByte & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool DistSuperTrain6 { get => (DistByte & (1 << 5)) == 1 << 5; set => DistByte = (byte)(DistByte & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool Dist7 { get => (DistByte & (1 << 6)) == 1 << 6; set => DistByte = (byte)(DistByte & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool Dist8 { get => (DistByte & (1 << 7)) == 1 << 7; set => DistByte = (byte)(DistByte & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public byte _0x3B { get => Data[0x3B]; set => Data[0x3B] = value; } + public byte _0x3C { get => Data[0x3C]; set => Data[0x3C] = value; } + public byte _0x3D { get => Data[0x3D]; set => Data[0x3D] = value; } + public byte _0x3E { get => Data[0x3E]; set => Data[0x3E] = value; } + public byte _0x3F { get => Data[0x3F]; set => Data[0x3F] = value; } #endregion #region Block B - public override string Nickname { get { return getString(0x40, 24); } set { setString(value, 12).CopyTo(Data, 0x40); } } + public override string Nickname { get => getString(0x40, 24); set => setString(value, 12).CopyTo(Data, 0x40); } public override int Move1 { - get { return BitConverter.ToUInt16(Data, 0x5A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } + get => BitConverter.ToUInt16(Data, 0x5A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } public override int Move2 { - get { return BitConverter.ToUInt16(Data, 0x5C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); } + get => BitConverter.ToUInt16(Data, 0x5C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); } public override int Move3 { - get { return BitConverter.ToUInt16(Data, 0x5E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } + get => BitConverter.ToUInt16(Data, 0x5E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } public override int Move4 { - get { return BitConverter.ToUInt16(Data, 0x60); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); } + get => BitConverter.ToUInt16(Data, 0x60); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); } - public override int Move1_PP { get { return Data[0x62]; } set { Data[0x62] = (byte)value; } } - public override int Move2_PP { get { return Data[0x63]; } set { Data[0x63] = (byte)value; } } - public override int Move3_PP { get { return Data[0x64]; } set { Data[0x64] = (byte)value; } } - public override int Move4_PP { get { return Data[0x65]; } set { Data[0x65] = (byte)value; } } - public override int Move1_PPUps { get { return Data[0x66]; } set { Data[0x66] = (byte)value; } } - public override int Move2_PPUps { get { return Data[0x67]; } set { Data[0x67] = (byte)value; } } - public override int Move3_PPUps { get { return Data[0x68]; } set { Data[0x68] = (byte)value; } } - public override int Move4_PPUps { get { return Data[0x69]; } set { Data[0x69] = (byte)value; } } + public override int Move1_PP { get => Data[0x62]; set => Data[0x62] = (byte)value; } + public override int Move2_PP { get => Data[0x63]; set => Data[0x63] = (byte)value; } + public override int Move3_PP { get => Data[0x64]; set => Data[0x64] = (byte)value; } + public override int Move4_PP { get => Data[0x65]; set => Data[0x65] = (byte)value; } + public override int Move1_PPUps { get => Data[0x66]; set => Data[0x66] = (byte)value; } + public override int Move2_PPUps { get => Data[0x67]; set => Data[0x67] = (byte)value; } + public override int Move3_PPUps { get => Data[0x68]; set => Data[0x68] = (byte)value; } + public override int Move4_PPUps { get => Data[0x69]; set => Data[0x69] = (byte)value; } public override int RelearnMove1 { - get { return BitConverter.ToUInt16(Data, 0x6A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } + get => BitConverter.ToUInt16(Data, 0x6A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } public override int RelearnMove2 { - get { return BitConverter.ToUInt16(Data, 0x6C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6C); } + get => BitConverter.ToUInt16(Data, 0x6C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6C); } public override int RelearnMove3 { - get { return BitConverter.ToUInt16(Data, 0x6E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6E); } + get => BitConverter.ToUInt16(Data, 0x6E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6E); } public override int RelearnMove4 { - get { return BitConverter.ToUInt16(Data, 0x70); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } + get => BitConverter.ToUInt16(Data, 0x70); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } - public override bool SecretSuperTrainingUnlocked { get { return (Data[0x72] & 1) == 1; } set { Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); } } - public override bool SecretSuperTrainingComplete { get { return (Data[0x72] & 2) == 2; } set { Data[0x72] = (byte)((Data[0x72] & ~2) | (value ? 2 : 0)); } } - public byte _0x73 { get { return Data[0x73]; } set { Data[0x73] = value; } } - private uint IV32 { get { return BitConverter.ToUInt32(Data, 0x74); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x74); } } - public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } } - public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } } - public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } } - public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } } - public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } - public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } - public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } } - public override bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } } + public override bool SecretSuperTrainingUnlocked { get => (Data[0x72] & 1) == 1; set => Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); } + public override bool SecretSuperTrainingComplete { get => (Data[0x72] & 2) == 2; set => Data[0x72] = (byte)((Data[0x72] & ~2) | (value ? 2 : 0)); } + public byte _0x73 { get => Data[0x73]; set => Data[0x73] = value; } + private uint IV32 { get => BitConverter.ToUInt32(Data, 0x74); set => BitConverter.GetBytes(value).CopyTo(Data, 0x74); } + public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } + public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } + public override int IV_DEF { get => (int)(IV32 >> 10) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } + public override int IV_SPE { get => (int)(IV32 >> 15) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } + public override int IV_SPA { get => (int)(IV32 >> 20) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } + public override int IV_SPD { get => (int)(IV32 >> 25) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } + public override bool IsEgg { get => ((IV32 >> 30) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } + public override bool IsNicknamed { get => ((IV32 >> 31) & 1) == 1; set => IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } #endregion #region Block C - public override string HT_Name { get { return getString(0x78, 24); } set { setString(value, 12).CopyTo(Data, 0x78); } } - public override int HT_Gender { get { return Data[0x92]; } set { Data[0x92] = (byte)value; } } - public override int CurrentHandler { get { return Data[0x93]; } set { Data[0x93] = (byte)value; } } - public override int Geo1_Region { get { return Data[0x94]; } set { Data[0x94] = (byte)value; } } - public override int Geo1_Country { get { return Data[0x95]; } set { Data[0x95] = (byte)value; } } - public override int Geo2_Region { get { return Data[0x96]; } set { Data[0x96] = (byte)value; } } - public override int Geo2_Country { get { return Data[0x97]; } set { Data[0x97] = (byte)value; } } - public override int Geo3_Region { get { return Data[0x98]; } set { Data[0x98] = (byte)value; } } - public override int Geo3_Country { get { return Data[0x99]; } set { Data[0x99] = (byte)value; } } - public override int Geo4_Region { get { return Data[0x9A]; } set { Data[0x9A] = (byte)value; } } - public override int Geo4_Country { get { return Data[0x9B]; } set { Data[0x9B] = (byte)value; } } - public override int Geo5_Region { get { return Data[0x9C]; } set { Data[0x9C] = (byte)value; } } - public override int Geo5_Country { get { return Data[0x9D]; } set { Data[0x9D] = (byte)value; } } - public byte _0x9E { get { return Data[0x9E]; } set { Data[0x9E] = value; } } - public byte _0x9F { get { return Data[0x9F]; } set { Data[0x9F] = value; } } - public byte _0xA0 { get { return Data[0xA0]; } set { Data[0xA0] = value; } } - public byte _0xA1 { get { return Data[0xA1]; } set { Data[0xA1] = value; } } - public override int HT_Friendship { get { return Data[0xA2]; } set { Data[0xA2] = (byte)value; } } - public override int HT_Affection { get { return Data[0xA3]; } set { Data[0xA3] = (byte)value; } } - public override int HT_Intensity { get { return Data[0xA4]; } set { Data[0xA4] = (byte)value; } } - public override int HT_Memory { get { return Data[0xA5]; } set { Data[0xA5] = (byte)value; } } - public override int HT_Feeling { get { return Data[0xA6]; } set { Data[0xA6] = (byte)value; } } - public byte _0xA7 { get { return Data[0xA7]; } set { Data[0xA7] = value; } } - public override int HT_TextVar { get { return BitConverter.ToUInt16(Data, 0xA8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA8); } } - public byte _0xAA { get { return Data[0xAA]; } set { Data[0xAA] = value; } } - public byte _0xAB { get { return Data[0xAB]; } set { Data[0xAB] = value; } } - public byte _0xAC { get { return Data[0xAC]; } set { Data[0xAC] = value; } } - public byte _0xAD { get { return Data[0xAD]; } set { Data[0xAD] = value; } } - public override byte Fullness { get { return Data[0xAE]; } set { Data[0xAE] = value; } } - public override byte Enjoyment { get { return Data[0xAF]; } set { Data[0xAF] = value; } } + public override string HT_Name { get => getString(0x78, 24); set => setString(value, 12).CopyTo(Data, 0x78); } + public override int HT_Gender { get => Data[0x92]; set => Data[0x92] = (byte)value; } + public override int CurrentHandler { get => Data[0x93]; set => Data[0x93] = (byte)value; } + public override int Geo1_Region { get => Data[0x94]; set => Data[0x94] = (byte)value; } + public override int Geo1_Country { get => Data[0x95]; set => Data[0x95] = (byte)value; } + public override int Geo2_Region { get => Data[0x96]; set => Data[0x96] = (byte)value; } + public override int Geo2_Country { get => Data[0x97]; set => Data[0x97] = (byte)value; } + public override int Geo3_Region { get => Data[0x98]; set => Data[0x98] = (byte)value; } + public override int Geo3_Country { get => Data[0x99]; set => Data[0x99] = (byte)value; } + public override int Geo4_Region { get => Data[0x9A]; set => Data[0x9A] = (byte)value; } + public override int Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = (byte)value; } + public override int Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = (byte)value; } + public override int Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = (byte)value; } + public byte _0x9E { get => Data[0x9E]; set => Data[0x9E] = value; } + public byte _0x9F { get => Data[0x9F]; set => Data[0x9F] = value; } + public byte _0xA0 { get => Data[0xA0]; set => Data[0xA0] = value; } + public byte _0xA1 { get => Data[0xA1]; set => Data[0xA1] = value; } + public override int HT_Friendship { get => Data[0xA2]; set => Data[0xA2] = (byte)value; } + public override int HT_Affection { get => Data[0xA3]; set => Data[0xA3] = (byte)value; } + public override int HT_Intensity { get => Data[0xA4]; set => Data[0xA4] = (byte)value; } + public override int HT_Memory { get => Data[0xA5]; set => Data[0xA5] = (byte)value; } + public override int HT_Feeling { get => Data[0xA6]; set => Data[0xA6] = (byte)value; } + public byte _0xA7 { get => Data[0xA7]; set => Data[0xA7] = value; } + public override int HT_TextVar { get => BitConverter.ToUInt16(Data, 0xA8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA8); } + public byte _0xAA { get => Data[0xAA]; set => Data[0xAA] = value; } + public byte _0xAB { get => Data[0xAB]; set => Data[0xAB] = value; } + public byte _0xAC { get => Data[0xAC]; set => Data[0xAC] = value; } + public byte _0xAD { get => Data[0xAD]; set => Data[0xAD] = value; } + public override byte Fullness { get => Data[0xAE]; set => Data[0xAE] = value; } + public override byte Enjoyment { get => Data[0xAF]; set => Data[0xAF] = value; } #endregion #region Block D - public override string OT_Name { get { return getString(0xB0, 24); } set { setString(value, 12).CopyTo(Data, 0xB0); } } - public override int OT_Friendship { get { return Data[0xCA]; } set { Data[0xCA] = (byte)value; } } - public override int OT_Affection { get { return Data[0xCB]; } set { Data[0xCB] = (byte)value; } } - public override int OT_Intensity { get { return Data[0xCC]; } set { Data[0xCC] = (byte)value; } } - public override int OT_Memory { get { return Data[0xCD]; } set { Data[0xCD] = (byte)value; } } - public override int OT_TextVar { get { return BitConverter.ToUInt16(Data, 0xCE); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xCE); } } - public override int OT_Feeling { get { return Data[0xD0]; } set { Data[0xD0] = (byte)value; } } - public override int Egg_Year { get { return Data[0xD1]; } set { Data[0xD1] = (byte)value; } } - public override int Egg_Month { get { return Data[0xD2]; } set { Data[0xD2] = (byte)value; } } - public override int Egg_Day { get { return Data[0xD3]; } set { Data[0xD3] = (byte)value; } } - public override int Met_Year { get { return Data[0xD4]; } set { Data[0xD4] = (byte)value; } } - public override int Met_Month { get { return Data[0xD5]; } set { Data[0xD5] = (byte)value; } } - public override int Met_Day { get { return Data[0xD6]; } set { Data[0xD6] = (byte)value; } } - public byte _0xD7 { get { return Data[0xD7]; } set { Data[0xD7] = value; } } - public override int Egg_Location { get { return BitConverter.ToUInt16(Data, 0xD8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } } - public override int Met_Location { get { return BitConverter.ToUInt16(Data, 0xDA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } } - public override int Ball { get { return Data[0xDC]; } set { Data[0xDC] = (byte)value; } } - public override int Met_Level { get { return Data[0xDD] & ~0x80; } set { Data[0xDD] = (byte)((Data[0xDD] & 0x80) | value); } } - public override int OT_Gender { get { return Data[0xDD] >> 7; } set { Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | (value << 7)); } } - public override int EncounterType { get { return Data[0xDE]; } set { Data[0xDE] = (byte)value; } } - public override int Version { get { return Data[0xDF]; } set { Data[0xDF] = (byte)value; } } - public override int Country { get { return Data[0xE0]; } set { Data[0xE0] = (byte)value; } } - public override int Region { get { return Data[0xE1]; } set { Data[0xE1] = (byte)value; } } - public override int ConsoleRegion { get { return Data[0xE2]; } set { Data[0xE2] = (byte)value; } } - public override int Language { get { return Data[0xE3]; } set { Data[0xE3] = (byte)value; } } + public override string OT_Name { get => getString(0xB0, 24); set => setString(value, 12).CopyTo(Data, 0xB0); } + public override int OT_Friendship { get => Data[0xCA]; set => Data[0xCA] = (byte)value; } + public override int OT_Affection { get => Data[0xCB]; set => Data[0xCB] = (byte)value; } + public override int OT_Intensity { get => Data[0xCC]; set => Data[0xCC] = (byte)value; } + public override int OT_Memory { get => Data[0xCD]; set => Data[0xCD] = (byte)value; } + public override int OT_TextVar { get => BitConverter.ToUInt16(Data, 0xCE); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xCE); } + public override int OT_Feeling { get => Data[0xD0]; set => Data[0xD0] = (byte)value; } + public override int Egg_Year { get => Data[0xD1]; set => Data[0xD1] = (byte)value; } + public override int Egg_Month { get => Data[0xD2]; set => Data[0xD2] = (byte)value; } + public override int Egg_Day { get => Data[0xD3]; set => Data[0xD3] = (byte)value; } + public override int Met_Year { get => Data[0xD4]; set => Data[0xD4] = (byte)value; } + public override int Met_Month { get => Data[0xD5]; set => Data[0xD5] = (byte)value; } + public override int Met_Day { get => Data[0xD6]; set => Data[0xD6] = (byte)value; } + public byte _0xD7 { get => Data[0xD7]; set => Data[0xD7] = value; } + public override int Egg_Location { get => BitConverter.ToUInt16(Data, 0xD8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } + public override int Met_Location { get => BitConverter.ToUInt16(Data, 0xDA); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } + public override int Ball { get => Data[0xDC]; set => Data[0xDC] = (byte)value; } + public override int Met_Level { get => Data[0xDD] & ~0x80; set => Data[0xDD] = (byte)((Data[0xDD] & 0x80) | value); } + public override int OT_Gender { get => Data[0xDD] >> 7; set => Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | (value << 7)); } + public override int EncounterType { get => Data[0xDE]; set => Data[0xDE] = (byte)value; } + public override int Version { get => Data[0xDF]; set => Data[0xDF] = (byte)value; } + public override int Country { get => Data[0xE0]; set => Data[0xE0] = (byte)value; } + public override int Region { get => Data[0xE1]; set => Data[0xE1] = (byte)value; } + public override int ConsoleRegion { get => Data[0xE2]; set => Data[0xE2] = (byte)value; } + public override int Language { get => Data[0xE3]; set => Data[0xE3] = (byte)value; } #endregion #region Battle Stats - public override int Stat_Level { get { return Data[0xEC]; } set { Data[0xEC] = (byte)value; } } - public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0xF0); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF0); } } - public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0xF2); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF2); } } - public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0xF4); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF4); } } - public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0xF6); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF6); } } - public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0xF8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF8); } } - public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0xFA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFA); } } - public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0xFC); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFC); } } + public override int Stat_Level { get => Data[0xEC]; set => Data[0xEC] = (byte)value; } + public override int Stat_HPCurrent { get => BitConverter.ToUInt16(Data, 0xF0); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF0); } + public override int Stat_HPMax { get => BitConverter.ToUInt16(Data, 0xF2); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF2); } + public override int Stat_ATK { get => BitConverter.ToUInt16(Data, 0xF4); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF4); } + public override int Stat_DEF { get => BitConverter.ToUInt16(Data, 0xF6); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF6); } + public override int Stat_SPE { get => BitConverter.ToUInt16(Data, 0xF8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF8); } + public override int Stat_SPA { get => BitConverter.ToUInt16(Data, 0xFA); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFA); } + public override int Stat_SPD { get => BitConverter.ToUInt16(Data, 0xFC); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFC); } #endregion // Simple Generated Attributes - public override int CurrentFriendship { - get { return CurrentHandler == 0 ? OT_Friendship : HT_Friendship; } - set { if (CurrentHandler == 0) OT_Friendship = value; else HT_Friendship = value; } + public override int CurrentFriendship + { + get => CurrentHandler == 0 ? OT_Friendship : HT_Friendship; + set { if (CurrentHandler == 0) OT_Friendship = value; else HT_Friendship = value; } } public int OppositeFriendship { - get { return CurrentHandler == 1 ? OT_Friendship : HT_Friendship; } + get => CurrentHandler == 1 ? OT_Friendship : HT_Friendship; set { if (CurrentHandler == 1) OT_Friendship = value; else HT_Friendship = value; } } @@ -382,7 +383,7 @@ public override int Characteristic // Methods public override byte[] Encrypt() { - Checksum = CalculateChecksum(); + RefreshChecksum(); return PKX.encryptArray(Data); } diff --git a/PKHeX.Core/PKM/PK7.cs b/PKHeX.Core/PKM/PK7.cs index 87bbad0cc..9cfa05dcb 100644 --- a/PKHeX.Core/PKM/PK7.cs +++ b/PKHeX.Core/PKM/PK7.cs @@ -30,344 +30,345 @@ public PK7(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setString7(value, maxLength, Language); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x40, 24); } set { if (value?.Length == 24) value.CopyTo(Data, 0x40); } } - public override byte[] HT_Trash { get { return getData(0x78, 24); } set { if (value?.Length == 24) value.CopyTo(Data, 0x78); } } - public override byte[] OT_Trash { get { return getData(0xB0, 24); } set { if (value?.Length == 24) value.CopyTo(Data, 0xB0); } } + public override byte[] Nickname_Trash { get => getData(0x40, 24); set { if (value?.Length == 24) value.CopyTo(Data, 0x40); } } + public override byte[] HT_Trash { get => getData(0x78, 24); set { if (value?.Length == 24) value.CopyTo(Data, 0x78); } } + public override byte[] OT_Trash { get => getData(0xB0, 24); set { if (value?.Length == 24) value.CopyTo(Data, 0xB0); } } // Structure #region Block A public override uint EncryptionConstant { - get { return BitConverter.ToUInt32(Data, 0x00); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } + get => BitConverter.ToUInt32(Data, 0x00); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x00); } public override ushort Sanity { - get { return BitConverter.ToUInt16(Data, 0x04); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x04); } // Should always be zero... + get => BitConverter.ToUInt16(Data, 0x04); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x04); } public override ushort Checksum { - get { return BitConverter.ToUInt16(Data, 0x06); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x06); } + get => BitConverter.ToUInt16(Data, 0x06); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x06); } public override int Species { - get { return BitConverter.ToUInt16(Data, 0x08); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } + get => BitConverter.ToUInt16(Data, 0x08); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x08); } public override int HeldItem { - get { return BitConverter.ToUInt16(Data, 0x0A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + get => BitConverter.ToUInt16(Data, 0x0A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } public override int TID { - get { return BitConverter.ToUInt16(Data, 0x0C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } + get => BitConverter.ToUInt16(Data, 0x0C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } public override int SID { - get { return BitConverter.ToUInt16(Data, 0x0E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } + get => BitConverter.ToUInt16(Data, 0x0E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0E); } public override uint EXP { - get { return BitConverter.ToUInt32(Data, 0x10); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x10); } + get => BitConverter.ToUInt32(Data, 0x10); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x10); } - public override int Ability { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } - public override int AbilityNumber { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } - public override int MarkValue { get { return BitConverter.ToUInt16(Data, 0x16); } protected set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x16); } } + public override int Ability { get => Data[0x14]; set => Data[0x14] = (byte)value; } + public override int AbilityNumber { get => Data[0x15]; set => Data[0x15] = (byte)value; } + public override int MarkValue { get => BitConverter.ToUInt16(Data, 0x16); protected set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x16); } public override uint PID { - get { return BitConverter.ToUInt32(Data, 0x18); } - set { BitConverter.GetBytes(value).CopyTo(Data, 0x18); } + get => BitConverter.ToUInt32(Data, 0x18); + set => BitConverter.GetBytes(value).CopyTo(Data, 0x18); } - public override int Nature { get { return Data[0x1C]; } set { Data[0x1C] = (byte)value; } } - public override bool FatefulEncounter { get { return (Data[0x1D] & 1) == 1; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x01 | (value ? 1 : 0)); } } - public override int Gender { get { return (Data[0x1D] >> 1) & 0x3; } set { Data[0x1D] = (byte)(Data[0x1D] & ~0x06 | (value << 1)); } } - public override int AltForm { get { return Data[0x1D] >> 3; } set { Data[0x1D] = (byte)(Data[0x1D] & 0x07 | (value << 3)); } } - public override int EV_HP { get { return Data[0x1E]; } set { Data[0x1E] = (byte)value; } } - public override int EV_ATK { get { return Data[0x1F]; } set { Data[0x1F] = (byte)value; } } - public override int EV_DEF { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } - public override int EV_SPE { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } } - public override int EV_SPA { get { return Data[0x22]; } set { Data[0x22] = (byte)value; } } - public override int EV_SPD { get { return Data[0x23]; } set { Data[0x23] = (byte)value; } } - public override int CNT_Cool { get { return Data[0x24]; } set { Data[0x24] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0x25]; } set { Data[0x25] = (byte)value; } } - public override int CNT_Cute { get { return Data[0x26]; } set { Data[0x26] = (byte)value; } } - public override int CNT_Smart { get { return Data[0x27]; } set { Data[0x27] = (byte)value; } } - public override int CNT_Tough { get { return Data[0x28]; } set { Data[0x28] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0x29]; } set { Data[0x29] = (byte)value; } } - public byte PelagoEventStatus { get { return Data[0x2A]; } set { Data[0x2A] = value; } } - private byte PKRS { get { return Data[0x2B]; } set { Data[0x2B] = value; } } - public override int PKRS_Days { get { return PKRS & 0xF; } set { PKRS = (byte)(PKRS & ~0xF | value); } } - public override int PKRS_Strain { get { return PKRS >> 4; } set { PKRS = (byte)(PKRS & 0xF | value << 4); } } - private byte ST1 { get { return Data[0x2C]; } set { Data[0x2C] = value; } } - public bool Unused0 { get { return (ST1 & (1 << 0)) == 1 << 0; } set { ST1 = (byte)(ST1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool Unused1 { get { return (ST1 & (1 << 1)) == 1 << 1; } set { ST1 = (byte)(ST1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain1_SPA { get { return (ST1 & (1 << 2)) == 1 << 2; } set { ST1 = (byte)(ST1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain1_HP { get { return (ST1 & (1 << 3)) == 1 << 3; } set { ST1 = (byte)(ST1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain1_ATK { get { return (ST1 & (1 << 4)) == 1 << 4; } set { ST1 = (byte)(ST1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain1_SPD { get { return (ST1 & (1 << 5)) == 1 << 5; } set { ST1 = (byte)(ST1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain1_SPE { get { return (ST1 & (1 << 6)) == 1 << 6; } set { ST1 = (byte)(ST1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain1_DEF { get { return (ST1 & (1 << 7)) == 1 << 7; } set { ST1 = (byte)(ST1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte ST2 { get { return Data[0x2D]; } set { Data[0x2D] = value; } } - public bool SuperTrain2_SPA { get { return (ST2 & (1 << 0)) == 1 << 0; } set { ST2 = (byte)(ST2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool SuperTrain2_HP { get { return (ST2 & (1 << 1)) == 1 << 1; } set { ST2 = (byte)(ST2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain2_ATK { get { return (ST2 & (1 << 2)) == 1 << 2; } set { ST2 = (byte)(ST2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain2_SPD { get { return (ST2 & (1 << 3)) == 1 << 3; } set { ST2 = (byte)(ST2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain2_SPE { get { return (ST2 & (1 << 4)) == 1 << 4; } set { ST2 = (byte)(ST2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain2_DEF { get { return (ST2 & (1 << 5)) == 1 << 5; } set { ST2 = (byte)(ST2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain3_SPA { get { return (ST2 & (1 << 6)) == 1 << 6; } set { ST2 = (byte)(ST2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain3_HP { get { return (ST2 & (1 << 7)) == 1 << 7; } set { ST2 = (byte)(ST2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte ST3 { get { return Data[0x2E]; } set { Data[0x2E] = value; } } - public bool SuperTrain3_ATK { get { return (ST3 & (1 << 0)) == 1 << 0; } set { ST3 = (byte)(ST3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool SuperTrain3_SPD { get { return (ST3 & (1 << 1)) == 1 << 1; } set { ST3 = (byte)(ST3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain3_SPE { get { return (ST3 & (1 << 2)) == 1 << 2; } set { ST3 = (byte)(ST3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain3_DEF { get { return (ST3 & (1 << 3)) == 1 << 3; } set { ST3 = (byte)(ST3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain4_1 { get { return (ST3 & (1 << 4)) == 1 << 4; } set { ST3 = (byte)(ST3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain5_1 { get { return (ST3 & (1 << 5)) == 1 << 5; } set { ST3 = (byte)(ST3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain5_2 { get { return (ST3 & (1 << 6)) == 1 << 6; } set { ST3 = (byte)(ST3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain5_3 { get { return (ST3 & (1 << 7)) == 1 << 7; } set { ST3 = (byte)(ST3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte ST4 { get { return Data[0x2F]; } set { Data[0x2F] = value; } } - public bool SuperTrain5_4 { get { return (ST4 & (1 << 0)) == 1 << 0; } set { ST4 = (byte)(ST4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool SuperTrain6_1 { get { return (ST4 & (1 << 1)) == 1 << 1; } set { ST4 = (byte)(ST4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool SuperTrain6_2 { get { return (ST4 & (1 << 2)) == 1 << 2; } set { ST4 = (byte)(ST4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool SuperTrain6_3 { get { return (ST4 & (1 << 3)) == 1 << 3; } set { ST4 = (byte)(ST4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool SuperTrain7_1 { get { return (ST4 & (1 << 4)) == 1 << 4; } set { ST4 = (byte)(ST4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool SuperTrain7_2 { get { return (ST4 & (1 << 5)) == 1 << 5; } set { ST4 = (byte)(ST4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool SuperTrain7_3 { get { return (ST4 & (1 << 6)) == 1 << 6; } set { ST4 = (byte)(ST4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool SuperTrain8_1 { get { return (ST4 & (1 << 7)) == 1 << 7; } set { ST4 = (byte)(ST4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - private byte RIB0 { get { return Data[0x30]; } set { Data[0x30] = value; } } // Ribbons are read as uints, but let's keep them per byte. - private byte RIB1 { get { return Data[0x31]; } set { Data[0x31] = value; } } - private byte RIB2 { get { return Data[0x32]; } set { Data[0x32] = value; } } - private byte RIB3 { get { return Data[0x33]; } set { Data[0x33] = value; } } - private byte RIB4 { get { return Data[0x34]; } set { Data[0x34] = value; } } - private byte RIB5 { get { return Data[0x35]; } set { Data[0x35] = value; } } - private byte RIB6 { get { return Data[0x36]; } set { Data[0x36] = value; } } // Unused - private byte RIB7 { get { return Data[0x37]; } set { Data[0x37] = value; } } // Unused - public bool RibbonChampionKalos { get { return (RIB0 & (1 << 0)) == 1 << 0; } set { RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonChampionG3Hoenn { get { return (RIB0 & (1 << 1)) == 1 << 1; } set { RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonChampionSinnoh { get { return (RIB0 & (1 << 2)) == 1 << 2; } set { RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonBestFriends { get { return (RIB0 & (1 << 3)) == 1 << 3; } set { RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonTraining { get { return (RIB0 & (1 << 4)) == 1 << 4; } set { RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonBattlerSkillful { get { return (RIB0 & (1 << 5)) == 1 << 5; } set { RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonBattlerExpert { get { return (RIB0 & (1 << 6)) == 1 << 6; } set { RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonEffort { get { return (RIB0 & (1 << 7)) == 1 << 7; } set { RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonAlert { get { return (RIB1 & (1 << 0)) == 1 << 0; } set { RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonShock { get { return (RIB1 & (1 << 1)) == 1 << 1; } set { RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonDowncast { get { return (RIB1 & (1 << 2)) == 1 << 2; } set { RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonCareless { get { return (RIB1 & (1 << 3)) == 1 << 3; } set { RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonRelax { get { return (RIB1 & (1 << 4)) == 1 << 4; } set { RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonSnooze { get { return (RIB1 & (1 << 5)) == 1 << 5; } set { RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonSmile { get { return (RIB1 & (1 << 6)) == 1 << 6; } set { RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonGorgeous { get { return (RIB1 & (1 << 7)) == 1 << 7; } set { RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonRoyal { get { return (RIB2 & (1 << 0)) == 1 << 0; } set { RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonGorgeousRoyal { get { return (RIB2 & (1 << 1)) == 1 << 1; } set { RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonArtist { get { return (RIB2 & (1 << 2)) == 1 << 2; } set { RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonFootprint { get { return (RIB2 & (1 << 3)) == 1 << 3; } set { RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonRecord { get { return (RIB2 & (1 << 4)) == 1 << 4; } set { RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonLegend { get { return (RIB2 & (1 << 5)) == 1 << 5; } set { RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonCountry { get { return (RIB2 & (1 << 6)) == 1 << 6; } set { RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonNational { get { return (RIB2 & (1 << 7)) == 1 << 7; } set { RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonEarth { get { return (RIB3 & (1 << 0)) == 1 << 0; } set { RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonWorld { get { return (RIB3 & (1 << 1)) == 1 << 1; } set { RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonClassic { get { return (RIB3 & (1 << 2)) == 1 << 2; } set { RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonPremier { get { return (RIB3 & (1 << 3)) == 1 << 3; } set { RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonEvent { get { return (RIB3 & (1 << 4)) == 1 << 4; } set { RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonBirthday { get { return (RIB3 & (1 << 5)) == 1 << 5; } set { RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonSpecial { get { return (RIB3 & (1 << 6)) == 1 << 6; } set { RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonSouvenir { get { return (RIB3 & (1 << 7)) == 1 << 7; } set { RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonWishing { get { return (RIB4 & (1 << 0)) == 1 << 0; } set { RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonChampionBattle { get { return (RIB4 & (1 << 1)) == 1 << 1; } set { RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonChampionRegional { get { return (RIB4 & (1 << 2)) == 1 << 2; } set { RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonChampionNational { get { return (RIB4 & (1 << 3)) == 1 << 3; } set { RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonChampionWorld { get { return (RIB4 & (1 << 4)) == 1 << 4; } set { RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RIB4_5 { get { return (RIB4 & (1 << 5)) == 1 << 5; } set { RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIB4_6 { get { return (RIB4 & (1 << 6)) == 1 << 6; } set { RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RibbonChampionG6Hoenn { get { return (RIB4 & (1 << 7)) == 1 << 7; } set { RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonContestStar { get { return (RIB5 & (1 << 0)) == 1 << 0; } set { RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonMasterCoolness { get { return (RIB5 & (1 << 1)) == 1 << 1; } set { RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RibbonMasterBeauty { get { return (RIB5 & (1 << 2)) == 1 << 2; } set { RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool RibbonMasterCuteness { get { return (RIB5 & (1 << 3)) == 1 << 3; } set { RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool RibbonMasterCleverness { get { return (RIB5 & (1 << 4)) == 1 << 4; } set { RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool RibbonMasterToughness { get { return (RIB5 & (1 << 5)) == 1 << 5; } set { RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool RibbonChampionAlola { get { return (RIB5 & (1 << 6)) == 1 << 6; } set { RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool RibbonBattleRoyale { get { return (RIB5 & (1 << 7)) == 1 << 7; } set { RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public bool RibbonBattleTreeGreat { get { return (RIB6 & (1 << 0)) == 1 << 0; } set { RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool RibbonBattleTreeMaster { get { return (RIB6 & (1 << 1)) == 1 << 1; } set { RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool RIB6_2 { get { return (RIB6 & (1 << 2)) == 1 << 2; } set { RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } } // Unused - public bool RIB6_3 { get { return (RIB6 & (1 << 3)) == 1 << 3; } set { RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } } // Unused - public bool RIB6_4 { get { return (RIB6 & (1 << 4)) == 1 << 4; } set { RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } } // Unused - public bool RIB6_5 { get { return (RIB6 & (1 << 5)) == 1 << 5; } set { RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } } // Unused - public bool RIB6_6 { get { return (RIB6 & (1 << 6)) == 1 << 6; } set { RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } } // Unused - public bool RIB6_7 { get { return (RIB6 & (1 << 7)) == 1 << 7; } set { RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } } // Unused - public int RibbonCountMemoryContest { get { return Data[0x38]; } set { Data[0x38] = (byte)value; } } - public int RibbonCountMemoryBattle { get { return Data[0x39]; } set { Data[0x39] = (byte)value; } } - private byte DistByte { get { return Data[0x3A]; } set { Data[0x3A] = value; } } - public bool DistSuperTrain1 { get { return (DistByte & (1 << 0)) == 1 << 0; } set { DistByte = (byte)(DistByte & ~(1 << 0) | (value ? 1 << 0 : 0)); } } - public bool DistSuperTrain2 { get { return (DistByte & (1 << 1)) == 1 << 1; } set { DistByte = (byte)(DistByte & ~(1 << 1) | (value ? 1 << 1 : 0)); } } - public bool DistSuperTrain3 { get { return (DistByte & (1 << 2)) == 1 << 2; } set { DistByte = (byte)(DistByte & ~(1 << 2) | (value ? 1 << 2 : 0)); } } - public bool DistSuperTrain4 { get { return (DistByte & (1 << 3)) == 1 << 3; } set { DistByte = (byte)(DistByte & ~(1 << 3) | (value ? 1 << 3 : 0)); } } - public bool DistSuperTrain5 { get { return (DistByte & (1 << 4)) == 1 << 4; } set { DistByte = (byte)(DistByte & ~(1 << 4) | (value ? 1 << 4 : 0)); } } - public bool DistSuperTrain6 { get { return (DistByte & (1 << 5)) == 1 << 5; } set { DistByte = (byte)(DistByte & ~(1 << 5) | (value ? 1 << 5 : 0)); } } - public bool Dist7 { get { return (DistByte & (1 << 6)) == 1 << 6; } set { DistByte = (byte)(DistByte & ~(1 << 6) | (value ? 1 << 6 : 0)); } } - public bool Dist8 { get { return (DistByte & (1 << 7)) == 1 << 7; } set { DistByte = (byte)(DistByte & ~(1 << 7) | (value ? 1 << 7 : 0)); } } - public byte _0x3B { get { return Data[0x3B]; } set { Data[0x3B] = value; } } - public byte _0x3C { get { return Data[0x3C]; } set { Data[0x3C] = value; } } - public byte _0x3D { get { return Data[0x3D]; } set { Data[0x3D] = value; } } - public byte _0x3E { get { return Data[0x3E]; } set { Data[0x3E] = value; } } - public byte _0x3F { get { return Data[0x3F]; } set { Data[0x3F] = value; } } + public override int Nature { get => Data[0x1C]; set => Data[0x1C] = (byte)value; } + public override bool FatefulEncounter { get => (Data[0x1D] & 1) == 1; set => Data[0x1D] = (byte)(Data[0x1D] & ~0x01 | (value ? 1 : 0)); } + public override int Gender { get => (Data[0x1D] >> 1) & 0x3; set => Data[0x1D] = (byte)(Data[0x1D] & ~0x06 | (value << 1)); } + public override int AltForm { get => Data[0x1D] >> 3; set => Data[0x1D] = (byte)(Data[0x1D] & 0x07 | (value << 3)); } + public override int EV_HP { get => Data[0x1E]; set => Data[0x1E] = (byte)value; } + public override int EV_ATK { get => Data[0x1F]; set => Data[0x1F] = (byte)value; } + public override int EV_DEF { get => Data[0x20]; set => Data[0x20] = (byte)value; } + public override int EV_SPE { get => Data[0x21]; set => Data[0x21] = (byte)value; } + public override int EV_SPA { get => Data[0x22]; set => Data[0x22] = (byte)value; } + public override int EV_SPD { get => Data[0x23]; set => Data[0x23] = (byte)value; } + public override int CNT_Cool { get => Data[0x24]; set => Data[0x24] = (byte)value; } + public override int CNT_Beauty { get => Data[0x25]; set => Data[0x25] = (byte)value; } + public override int CNT_Cute { get => Data[0x26]; set => Data[0x26] = (byte)value; } + public override int CNT_Smart { get => Data[0x27]; set => Data[0x27] = (byte)value; } + public override int CNT_Tough { get => Data[0x28]; set => Data[0x28] = (byte)value; } + public override int CNT_Sheen { get => Data[0x29]; set => Data[0x29] = (byte)value; } + public byte PelagoEventStatus { get => Data[0x2A]; set => Data[0x2A] = value; } + private byte PKRS { get => Data[0x2B]; set => Data[0x2B] = value; } + public override int PKRS_Days { get => PKRS & 0xF; set => PKRS = (byte)(PKRS & ~0xF | value); } + public override int PKRS_Strain { get => PKRS >> 4; set => PKRS = (byte)(PKRS & 0xF | value << 4); } + private byte ST1 { get => Data[0x2C]; set => Data[0x2C] = value; } + public bool Unused0 { get => (ST1 & (1 << 0)) == 1 << 0; set => ST1 = (byte)(ST1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool Unused1 { get => (ST1 & (1 << 1)) == 1 << 1; set => ST1 = (byte)(ST1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain1_SPA { get => (ST1 & (1 << 2)) == 1 << 2; set => ST1 = (byte)(ST1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain1_HP { get => (ST1 & (1 << 3)) == 1 << 3; set => ST1 = (byte)(ST1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain1_ATK { get => (ST1 & (1 << 4)) == 1 << 4; set => ST1 = (byte)(ST1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain1_SPD { get => (ST1 & (1 << 5)) == 1 << 5; set => ST1 = (byte)(ST1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain1_SPE { get => (ST1 & (1 << 6)) == 1 << 6; set => ST1 = (byte)(ST1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain1_DEF { get => (ST1 & (1 << 7)) == 1 << 7; set => ST1 = (byte)(ST1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte ST2 { get => Data[0x2D]; set => Data[0x2D] = value; } + public bool SuperTrain2_SPA { get => (ST2 & (1 << 0)) == 1 << 0; set => ST2 = (byte)(ST2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool SuperTrain2_HP { get => (ST2 & (1 << 1)) == 1 << 1; set => ST2 = (byte)(ST2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain2_ATK { get => (ST2 & (1 << 2)) == 1 << 2; set => ST2 = (byte)(ST2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain2_SPD { get => (ST2 & (1 << 3)) == 1 << 3; set => ST2 = (byte)(ST2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain2_SPE { get => (ST2 & (1 << 4)) == 1 << 4; set => ST2 = (byte)(ST2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain2_DEF { get => (ST2 & (1 << 5)) == 1 << 5; set => ST2 = (byte)(ST2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain3_SPA { get => (ST2 & (1 << 6)) == 1 << 6; set => ST2 = (byte)(ST2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain3_HP { get => (ST2 & (1 << 7)) == 1 << 7; set => ST2 = (byte)(ST2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte ST3 { get => Data[0x2E]; set => Data[0x2E] = value; } + public bool SuperTrain3_ATK { get => (ST3 & (1 << 0)) == 1 << 0; set => ST3 = (byte)(ST3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool SuperTrain3_SPD { get => (ST3 & (1 << 1)) == 1 << 1; set => ST3 = (byte)(ST3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain3_SPE { get => (ST3 & (1 << 2)) == 1 << 2; set => ST3 = (byte)(ST3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain3_DEF { get => (ST3 & (1 << 3)) == 1 << 3; set => ST3 = (byte)(ST3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain4_1 { get => (ST3 & (1 << 4)) == 1 << 4; set => ST3 = (byte)(ST3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain5_1 { get => (ST3 & (1 << 5)) == 1 << 5; set => ST3 = (byte)(ST3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain5_2 { get => (ST3 & (1 << 6)) == 1 << 6; set => ST3 = (byte)(ST3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain5_3 { get => (ST3 & (1 << 7)) == 1 << 7; set => ST3 = (byte)(ST3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte ST4 { get => Data[0x2F]; set => Data[0x2F] = value; } + public bool SuperTrain5_4 { get => (ST4 & (1 << 0)) == 1 << 0; set => ST4 = (byte)(ST4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool SuperTrain6_1 { get => (ST4 & (1 << 1)) == 1 << 1; set => ST4 = (byte)(ST4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool SuperTrain6_2 { get => (ST4 & (1 << 2)) == 1 << 2; set => ST4 = (byte)(ST4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool SuperTrain6_3 { get => (ST4 & (1 << 3)) == 1 << 3; set => ST4 = (byte)(ST4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool SuperTrain7_1 { get => (ST4 & (1 << 4)) == 1 << 4; set => ST4 = (byte)(ST4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool SuperTrain7_2 { get => (ST4 & (1 << 5)) == 1 << 5; set => ST4 = (byte)(ST4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool SuperTrain7_3 { get => (ST4 & (1 << 6)) == 1 << 6; set => ST4 = (byte)(ST4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool SuperTrain8_1 { get => (ST4 & (1 << 7)) == 1 << 7; set => ST4 = (byte)(ST4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + private byte RIB0 { get => Data[0x30]; set => Data[0x30] = value; } // Ribbons are read as uints, but let's keep them per byte. + private byte RIB1 { get => Data[0x31]; set => Data[0x31] = value; } + private byte RIB2 { get => Data[0x32]; set => Data[0x32] = value; } + private byte RIB3 { get => Data[0x33]; set => Data[0x33] = value; } + private byte RIB4 { get => Data[0x34]; set => Data[0x34] = value; } + private byte RIB5 { get => Data[0x35]; set => Data[0x35] = value; } + private byte RIB6 { get => Data[0x36]; set => Data[0x36] = value; } // Unused + private byte RIB7 { get => Data[0x37]; set => Data[0x37] = value; } // Unused + public bool RibbonChampionKalos { get => (RIB0 & (1 << 0)) == 1 << 0; set => RIB0 = (byte)(RIB0 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonChampionG3Hoenn { get => (RIB0 & (1 << 1)) == 1 << 1; set => RIB0 = (byte)(RIB0 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonChampionSinnoh { get => (RIB0 & (1 << 2)) == 1 << 2; set => RIB0 = (byte)(RIB0 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonBestFriends { get => (RIB0 & (1 << 3)) == 1 << 3; set => RIB0 = (byte)(RIB0 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonTraining { get => (RIB0 & (1 << 4)) == 1 << 4; set => RIB0 = (byte)(RIB0 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonBattlerSkillful { get => (RIB0 & (1 << 5)) == 1 << 5; set => RIB0 = (byte)(RIB0 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonBattlerExpert { get => (RIB0 & (1 << 6)) == 1 << 6; set => RIB0 = (byte)(RIB0 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonEffort { get => (RIB0 & (1 << 7)) == 1 << 7; set => RIB0 = (byte)(RIB0 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonAlert { get => (RIB1 & (1 << 0)) == 1 << 0; set => RIB1 = (byte)(RIB1 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonShock { get => (RIB1 & (1 << 1)) == 1 << 1; set => RIB1 = (byte)(RIB1 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonDowncast { get => (RIB1 & (1 << 2)) == 1 << 2; set => RIB1 = (byte)(RIB1 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonCareless { get => (RIB1 & (1 << 3)) == 1 << 3; set => RIB1 = (byte)(RIB1 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonRelax { get => (RIB1 & (1 << 4)) == 1 << 4; set => RIB1 = (byte)(RIB1 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonSnooze { get => (RIB1 & (1 << 5)) == 1 << 5; set => RIB1 = (byte)(RIB1 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonSmile { get => (RIB1 & (1 << 6)) == 1 << 6; set => RIB1 = (byte)(RIB1 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonGorgeous { get => (RIB1 & (1 << 7)) == 1 << 7; set => RIB1 = (byte)(RIB1 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonRoyal { get => (RIB2 & (1 << 0)) == 1 << 0; set => RIB2 = (byte)(RIB2 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonGorgeousRoyal { get => (RIB2 & (1 << 1)) == 1 << 1; set => RIB2 = (byte)(RIB2 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonArtist { get => (RIB2 & (1 << 2)) == 1 << 2; set => RIB2 = (byte)(RIB2 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonFootprint { get => (RIB2 & (1 << 3)) == 1 << 3; set => RIB2 = (byte)(RIB2 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonRecord { get => (RIB2 & (1 << 4)) == 1 << 4; set => RIB2 = (byte)(RIB2 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonLegend { get => (RIB2 & (1 << 5)) == 1 << 5; set => RIB2 = (byte)(RIB2 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonCountry { get => (RIB2 & (1 << 6)) == 1 << 6; set => RIB2 = (byte)(RIB2 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonNational { get => (RIB2 & (1 << 7)) == 1 << 7; set => RIB2 = (byte)(RIB2 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonEarth { get => (RIB3 & (1 << 0)) == 1 << 0; set => RIB3 = (byte)(RIB3 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonWorld { get => (RIB3 & (1 << 1)) == 1 << 1; set => RIB3 = (byte)(RIB3 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonClassic { get => (RIB3 & (1 << 2)) == 1 << 2; set => RIB3 = (byte)(RIB3 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonPremier { get => (RIB3 & (1 << 3)) == 1 << 3; set => RIB3 = (byte)(RIB3 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonEvent { get => (RIB3 & (1 << 4)) == 1 << 4; set => RIB3 = (byte)(RIB3 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonBirthday { get => (RIB3 & (1 << 5)) == 1 << 5; set => RIB3 = (byte)(RIB3 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonSpecial { get => (RIB3 & (1 << 6)) == 1 << 6; set => RIB3 = (byte)(RIB3 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonSouvenir { get => (RIB3 & (1 << 7)) == 1 << 7; set => RIB3 = (byte)(RIB3 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonWishing { get => (RIB4 & (1 << 0)) == 1 << 0; set => RIB4 = (byte)(RIB4 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonChampionBattle { get => (RIB4 & (1 << 1)) == 1 << 1; set => RIB4 = (byte)(RIB4 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonChampionRegional { get => (RIB4 & (1 << 2)) == 1 << 2; set => RIB4 = (byte)(RIB4 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonChampionNational { get => (RIB4 & (1 << 3)) == 1 << 3; set => RIB4 = (byte)(RIB4 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonChampionWorld { get => (RIB4 & (1 << 4)) == 1 << 4; set => RIB4 = (byte)(RIB4 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RIB4_5 { get => (RIB4 & (1 << 5)) == 1 << 5; set => RIB4 = (byte)(RIB4 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIB4_6 { get => (RIB4 & (1 << 6)) == 1 << 6; set => RIB4 = (byte)(RIB4 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RibbonChampionG6Hoenn { get => (RIB4 & (1 << 7)) == 1 << 7; set => RIB4 = (byte)(RIB4 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonContestStar { get => (RIB5 & (1 << 0)) == 1 << 0; set => RIB5 = (byte)(RIB5 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonMasterCoolness { get => (RIB5 & (1 << 1)) == 1 << 1; set => RIB5 = (byte)(RIB5 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RibbonMasterBeauty { get => (RIB5 & (1 << 2)) == 1 << 2; set => RIB5 = (byte)(RIB5 & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool RibbonMasterCuteness { get => (RIB5 & (1 << 3)) == 1 << 3; set => RIB5 = (byte)(RIB5 & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool RibbonMasterCleverness { get => (RIB5 & (1 << 4)) == 1 << 4; set => RIB5 = (byte)(RIB5 & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool RibbonMasterToughness { get => (RIB5 & (1 << 5)) == 1 << 5; set => RIB5 = (byte)(RIB5 & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool RibbonChampionAlola { get => (RIB5 & (1 << 6)) == 1 << 6; set => RIB5 = (byte)(RIB5 & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool RibbonBattleRoyale { get => (RIB5 & (1 << 7)) == 1 << 7; set => RIB5 = (byte)(RIB5 & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public bool RibbonBattleTreeGreat { get => (RIB6 & (1 << 0)) == 1 << 0; set => RIB6 = (byte)(RIB6 & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool RibbonBattleTreeMaster { get => (RIB6 & (1 << 1)) == 1 << 1; set => RIB6 = (byte)(RIB6 & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool RIB6_2 { get => (RIB6 & (1 << 2)) == 1 << 2; set => RIB6 = (byte)(RIB6 & ~(1 << 2) | (value ? 1 << 2 : 0)); } // Unused + public bool RIB6_3 { get => (RIB6 & (1 << 3)) == 1 << 3; set => RIB6 = (byte)(RIB6 & ~(1 << 3) | (value ? 1 << 3 : 0)); } // Unused + public bool RIB6_4 { get => (RIB6 & (1 << 4)) == 1 << 4; set => RIB6 = (byte)(RIB6 & ~(1 << 4) | (value ? 1 << 4 : 0)); } // Unused + public bool RIB6_5 { get => (RIB6 & (1 << 5)) == 1 << 5; set => RIB6 = (byte)(RIB6 & ~(1 << 5) | (value ? 1 << 5 : 0)); } // Unused + public bool RIB6_6 { get => (RIB6 & (1 << 6)) == 1 << 6; set => RIB6 = (byte)(RIB6 & ~(1 << 6) | (value ? 1 << 6 : 0)); } // Unused + public bool RIB6_7 { get => (RIB6 & (1 << 7)) == 1 << 7; set => RIB6 = (byte)(RIB6 & ~(1 << 7) | (value ? 1 << 7 : 0)); } // Unused + public int RibbonCountMemoryContest { get => Data[0x38]; set => Data[0x38] = (byte)value; } + public int RibbonCountMemoryBattle { get => Data[0x39]; set => Data[0x39] = (byte)value; } + private byte DistByte { get => Data[0x3A]; set => Data[0x3A] = value; } + public bool DistSuperTrain1 { get => (DistByte & (1 << 0)) == 1 << 0; set => DistByte = (byte)(DistByte & ~(1 << 0) | (value ? 1 << 0 : 0)); } + public bool DistSuperTrain2 { get => (DistByte & (1 << 1)) == 1 << 1; set => DistByte = (byte)(DistByte & ~(1 << 1) | (value ? 1 << 1 : 0)); } + public bool DistSuperTrain3 { get => (DistByte & (1 << 2)) == 1 << 2; set => DistByte = (byte)(DistByte & ~(1 << 2) | (value ? 1 << 2 : 0)); } + public bool DistSuperTrain4 { get => (DistByte & (1 << 3)) == 1 << 3; set => DistByte = (byte)(DistByte & ~(1 << 3) | (value ? 1 << 3 : 0)); } + public bool DistSuperTrain5 { get => (DistByte & (1 << 4)) == 1 << 4; set => DistByte = (byte)(DistByte & ~(1 << 4) | (value ? 1 << 4 : 0)); } + public bool DistSuperTrain6 { get => (DistByte & (1 << 5)) == 1 << 5; set => DistByte = (byte)(DistByte & ~(1 << 5) | (value ? 1 << 5 : 0)); } + public bool Dist7 { get => (DistByte & (1 << 6)) == 1 << 6; set => DistByte = (byte)(DistByte & ~(1 << 6) | (value ? 1 << 6 : 0)); } + public bool Dist8 { get => (DistByte & (1 << 7)) == 1 << 7; set => DistByte = (byte)(DistByte & ~(1 << 7) | (value ? 1 << 7 : 0)); } + public byte _0x3B { get => Data[0x3B]; set => Data[0x3B] = value; } + public byte _0x3C { get => Data[0x3C]; set => Data[0x3C] = value; } + public byte _0x3D { get => Data[0x3D]; set => Data[0x3D] = value; } + public byte _0x3E { get => Data[0x3E]; set => Data[0x3E] = value; } + public byte _0x3F { get => Data[0x3F]; set => Data[0x3F] = value; } #endregion #region Block B - public override string Nickname { get { return getString(0x40, 24); } set { setString(value, 12).CopyTo(Data, 0x40); } } + public override string Nickname { get => getString(0x40, 24); set => setString(value, 12).CopyTo(Data, 0x40); } public override int Move1 { - get { return BitConverter.ToUInt16(Data, 0x5A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } + get => BitConverter.ToUInt16(Data, 0x5A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } public override int Move2 { - get { return BitConverter.ToUInt16(Data, 0x5C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); } + get => BitConverter.ToUInt16(Data, 0x5C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); } public override int Move3 { - get { return BitConverter.ToUInt16(Data, 0x5E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } + get => BitConverter.ToUInt16(Data, 0x5E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } public override int Move4 { - get { return BitConverter.ToUInt16(Data, 0x60); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); } + get => BitConverter.ToUInt16(Data, 0x60); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x60); } - public override int Move1_PP { get { return Data[0x62]; } set { Data[0x62] = (byte)value; } } - public override int Move2_PP { get { return Data[0x63]; } set { Data[0x63] = (byte)value; } } - public override int Move3_PP { get { return Data[0x64]; } set { Data[0x64] = (byte)value; } } - public override int Move4_PP { get { return Data[0x65]; } set { Data[0x65] = (byte)value; } } - public override int Move1_PPUps { get { return Data[0x66]; } set { Data[0x66] = (byte)value; } } - public override int Move2_PPUps { get { return Data[0x67]; } set { Data[0x67] = (byte)value; } } - public override int Move3_PPUps { get { return Data[0x68]; } set { Data[0x68] = (byte)value; } } - public override int Move4_PPUps { get { return Data[0x69]; } set { Data[0x69] = (byte)value; } } + public override int Move1_PP { get => Data[0x62]; set => Data[0x62] = (byte)value; } + public override int Move2_PP { get => Data[0x63]; set => Data[0x63] = (byte)value; } + public override int Move3_PP { get => Data[0x64]; set => Data[0x64] = (byte)value; } + public override int Move4_PP { get => Data[0x65]; set => Data[0x65] = (byte)value; } + public override int Move1_PPUps { get => Data[0x66]; set => Data[0x66] = (byte)value; } + public override int Move2_PPUps { get => Data[0x67]; set => Data[0x67] = (byte)value; } + public override int Move3_PPUps { get => Data[0x68]; set => Data[0x68] = (byte)value; } + public override int Move4_PPUps { get => Data[0x69]; set => Data[0x69] = (byte)value; } public override int RelearnMove1 { - get { return BitConverter.ToUInt16(Data, 0x6A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } + get => BitConverter.ToUInt16(Data, 0x6A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6A); } public override int RelearnMove2 { - get { return BitConverter.ToUInt16(Data, 0x6C); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6C); } + get => BitConverter.ToUInt16(Data, 0x6C); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6C); } public override int RelearnMove3 { - get { return BitConverter.ToUInt16(Data, 0x6E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6E); } + get => BitConverter.ToUInt16(Data, 0x6E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x6E); } public override int RelearnMove4 { - get { return BitConverter.ToUInt16(Data, 0x70); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } + get => BitConverter.ToUInt16(Data, 0x70); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); } - public override bool SecretSuperTrainingUnlocked { get { return (Data[0x72] & 1) == 1; } set { Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); } } - public override bool SecretSuperTrainingComplete { get { return (Data[0x72] & 2) == 2; } set { Data[0x72] = (byte)((Data[0x72] & ~2) | (value ? 2 : 0)); } } - public byte _0x73 { get { return Data[0x73]; } set { Data[0x73] = value; } } - private uint IV32 { get { return BitConverter.ToUInt32(Data, 0x74); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x74); } } - public override int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } } - public override int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } } - public override int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } } - public override int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } } - public override int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } - public override int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } - public override bool IsEgg { get { return ((IV32 >> 30) & 1) == 1; } set { IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } } - public override bool IsNicknamed { get { return ((IV32 >> 31) & 1) == 1; } set { IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } } + public override bool SecretSuperTrainingUnlocked { get => (Data[0x72] & 1) == 1; set => Data[0x72] = (byte)((Data[0x72] & ~1) | (value ? 1 : 0)); } + public override bool SecretSuperTrainingComplete { get => (Data[0x72] & 2) == 2; set => Data[0x72] = (byte)((Data[0x72] & ~2) | (value ? 2 : 0)); } + public byte _0x73 { get => Data[0x73]; set => Data[0x73] = value; } + private uint IV32 { get => BitConverter.ToUInt32(Data, 0x74); set => BitConverter.GetBytes(value).CopyTo(Data, 0x74); } + public override int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } + public override int IV_ATK { get => (int)(IV32 >> 05) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } + public override int IV_DEF { get => (int)(IV32 >> 10) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } + public override int IV_SPE { get => (int)(IV32 >> 15) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } + public override int IV_SPA { get => (int)(IV32 >> 20) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } + public override int IV_SPD { get => (int)(IV32 >> 25) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } + public override bool IsEgg { get => ((IV32 >> 30) & 1) == 1; set => IV32 = (uint)((IV32 & ~0x40000000) | (uint)(value ? 0x40000000 : 0)); } + public override bool IsNicknamed { get => ((IV32 >> 31) & 1) == 1; set => IV32 = (IV32 & 0x7FFFFFFF) | (value ? 0x80000000 : 0); } #endregion #region Block C - public override string HT_Name { get { return getString(0x78, 24); } set { setString(value, 12).CopyTo(Data, 0x78); } } - public override int HT_Gender { get { return Data[0x92]; } set { Data[0x92] = (byte)value; } } - public override int CurrentHandler { get { return Data[0x93]; } set { Data[0x93] = (byte)value; } } - public override int Geo1_Region { get { return Data[0x94]; } set { Data[0x94] = (byte)value; } } - public override int Geo1_Country { get { return Data[0x95]; } set { Data[0x95] = (byte)value; } } - public override int Geo2_Region { get { return Data[0x96]; } set { Data[0x96] = (byte)value; } } - public override int Geo2_Country { get { return Data[0x97]; } set { Data[0x97] = (byte)value; } } - public override int Geo3_Region { get { return Data[0x98]; } set { Data[0x98] = (byte)value; } } - public override int Geo3_Country { get { return Data[0x99]; } set { Data[0x99] = (byte)value; } } - public override int Geo4_Region { get { return Data[0x9A]; } set { Data[0x9A] = (byte)value; } } - public override int Geo4_Country { get { return Data[0x9B]; } set { Data[0x9B] = (byte)value; } } - public override int Geo5_Region { get { return Data[0x9C]; } set { Data[0x9C] = (byte)value; } } - public override int Geo5_Country { get { return Data[0x9D]; } set { Data[0x9D] = (byte)value; } } - public byte _0x9E { get { return Data[0x9E]; } set { Data[0x9E] = value; } } - public byte _0x9F { get { return Data[0x9F]; } set { Data[0x9F] = value; } } - public byte _0xA0 { get { return Data[0xA0]; } set { Data[0xA0] = value; } } - public byte _0xA1 { get { return Data[0xA1]; } set { Data[0xA1] = value; } } - public override int HT_Friendship { get { return Data[0xA2]; } set { Data[0xA2] = (byte)value; } } - public override int HT_Affection { get { return Data[0xA3]; } set { Data[0xA3] = (byte)value; } } - public override int HT_Intensity { get { return Data[0xA4]; } set { Data[0xA4] = (byte)value; } } - public override int HT_Memory { get { return Data[0xA5]; } set { Data[0xA5] = (byte)value; } } - public override int HT_Feeling { get { return Data[0xA6]; } set { Data[0xA6] = (byte)value; } } - public byte _0xA7 { get { return Data[0xA7]; } set { Data[0xA7] = value; } } - public override int HT_TextVar { get { return BitConverter.ToUInt16(Data, 0xA8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA8); } } - public byte _0xAA { get { return Data[0xAA]; } set { Data[0xAA] = value; } } - public byte _0xAB { get { return Data[0xAB]; } set { Data[0xAB] = value; } } - public byte _0xAC { get { return Data[0xAC]; } set { Data[0xAC] = value; } } - public byte _0xAD { get { return Data[0xAD]; } set { Data[0xAD] = value; } } - public override byte Fullness { get { return Data[0xAE]; } set { Data[0xAE] = value; } } - public override byte Enjoyment { get { return Data[0xAF]; } set { Data[0xAF] = value; } } + public override string HT_Name { get => getString(0x78, 24); set => setString(value, 12).CopyTo(Data, 0x78); } + public override int HT_Gender { get => Data[0x92]; set => Data[0x92] = (byte)value; } + public override int CurrentHandler { get => Data[0x93]; set => Data[0x93] = (byte)value; } + public override int Geo1_Region { get => Data[0x94]; set => Data[0x94] = (byte)value; } + public override int Geo1_Country { get => Data[0x95]; set => Data[0x95] = (byte)value; } + public override int Geo2_Region { get => Data[0x96]; set => Data[0x96] = (byte)value; } + public override int Geo2_Country { get => Data[0x97]; set => Data[0x97] = (byte)value; } + public override int Geo3_Region { get => Data[0x98]; set => Data[0x98] = (byte)value; } + public override int Geo3_Country { get => Data[0x99]; set => Data[0x99] = (byte)value; } + public override int Geo4_Region { get => Data[0x9A]; set => Data[0x9A] = (byte)value; } + public override int Geo4_Country { get => Data[0x9B]; set => Data[0x9B] = (byte)value; } + public override int Geo5_Region { get => Data[0x9C]; set => Data[0x9C] = (byte)value; } + public override int Geo5_Country { get => Data[0x9D]; set => Data[0x9D] = (byte)value; } + public byte _0x9E { get => Data[0x9E]; set => Data[0x9E] = value; } + public byte _0x9F { get => Data[0x9F]; set => Data[0x9F] = value; } + public byte _0xA0 { get => Data[0xA0]; set => Data[0xA0] = value; } + public byte _0xA1 { get => Data[0xA1]; set => Data[0xA1] = value; } + public override int HT_Friendship { get => Data[0xA2]; set => Data[0xA2] = (byte)value; } + public override int HT_Affection { get => Data[0xA3]; set => Data[0xA3] = (byte)value; } + public override int HT_Intensity { get => Data[0xA4]; set => Data[0xA4] = (byte)value; } + public override int HT_Memory { get => Data[0xA5]; set => Data[0xA5] = (byte)value; } + public override int HT_Feeling { get => Data[0xA6]; set => Data[0xA6] = (byte)value; } + public byte _0xA7 { get => Data[0xA7]; set => Data[0xA7] = value; } + public override int HT_TextVar { get => BitConverter.ToUInt16(Data, 0xA8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xA8); } + public byte _0xAA { get => Data[0xAA]; set => Data[0xAA] = value; } + public byte _0xAB { get => Data[0xAB]; set => Data[0xAB] = value; } + public byte _0xAC { get => Data[0xAC]; set => Data[0xAC] = value; } + public byte _0xAD { get => Data[0xAD]; set => Data[0xAD] = value; } + public override byte Fullness { get => Data[0xAE]; set => Data[0xAE] = value; } + public override byte Enjoyment { get => Data[0xAF]; set => Data[0xAF] = value; } #endregion #region Block D - public override string OT_Name { get { return getString(0xB0, 24); } set { setString(value, 12).CopyTo(Data, 0xB0); } } - public override int OT_Friendship { get { return Data[0xCA]; } set { Data[0xCA] = (byte)value; } } - public override int OT_Affection { get { return Data[0xCB]; } set { Data[0xCB] = (byte)value; } } - public override int OT_Intensity { get { return Data[0xCC]; } set { Data[0xCC] = (byte)value; } } - public override int OT_Memory { get { return Data[0xCD]; } set { Data[0xCD] = (byte)value; } } - public override int OT_TextVar { get { return BitConverter.ToUInt16(Data, 0xCE); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xCE); } } - public override int OT_Feeling { get { return Data[0xD0]; } set { Data[0xD0] = (byte)value; } } - public override int Egg_Year { get { return Data[0xD1]; } set { Data[0xD1] = (byte)value; } } - public override int Egg_Month { get { return Data[0xD2]; } set { Data[0xD2] = (byte)value; } } - public override int Egg_Day { get { return Data[0xD3]; } set { Data[0xD3] = (byte)value; } } - public override int Met_Year { get { return Data[0xD4]; } set { Data[0xD4] = (byte)value; } } - public override int Met_Month { get { return Data[0xD5]; } set { Data[0xD5] = (byte)value; } } - public override int Met_Day { get { return Data[0xD6]; } set { Data[0xD6] = (byte)value; } } - public byte _0xD7 { get { return Data[0xD7]; } set { Data[0xD7] = value; } } - public override int Egg_Location { get { return BitConverter.ToUInt16(Data, 0xD8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } } - public override int Met_Location { get { return BitConverter.ToUInt16(Data, 0xDA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } } - public override int Ball { get { return Data[0xDC]; } set { Data[0xDC] = (byte)value; } } - public override int Met_Level { get { return Data[0xDD] & ~0x80; } set { Data[0xDD] = (byte)((Data[0xDD] & 0x80) | value); } } - public override int OT_Gender { get { return Data[0xDD] >> 7; } set { Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | (value << 7)); } } - public override int HyperTrainFlags { get { return Data[0xDE]; } set { Data[0xDE] = (byte)value; } } - public override bool HT_HP { get { return ((HyperTrainFlags >> 0) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 0)) | ((value ? 1 : 0) << 0); } } - public override bool HT_ATK { get { return ((HyperTrainFlags >> 1) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 1)) | ((value ? 1 : 0) << 1); } } - public override bool HT_DEF { get { return ((HyperTrainFlags >> 2) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 2)) | ((value ? 1 : 0) << 2); } } - public override bool HT_SPA { get { return ((HyperTrainFlags >> 3) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 3)) | ((value ? 1 : 0) << 3); } } - public override bool HT_SPD { get { return ((HyperTrainFlags >> 4) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 4)) | ((value ? 1 : 0) << 4); } } - public override bool HT_SPE { get { return ((HyperTrainFlags >> 5) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 5)) | ((value ? 1 : 0) << 5); } } - public override int Version { get { return Data[0xDF]; } set { Data[0xDF] = (byte)value; } } - public override int Country { get { return Data[0xE0]; } set { Data[0xE0] = (byte)value; } } - public override int Region { get { return Data[0xE1]; } set { Data[0xE1] = (byte)value; } } - public override int ConsoleRegion { get { return Data[0xE2]; } set { Data[0xE2] = (byte)value; } } - public override int Language { get { return Data[0xE3]; } set { Data[0xE3] = (byte)value; } } + public override string OT_Name { get => getString(0xB0, 24); set => setString(value, 12).CopyTo(Data, 0xB0); } + public override int OT_Friendship { get => Data[0xCA]; set => Data[0xCA] = (byte)value; } + public override int OT_Affection { get => Data[0xCB]; set => Data[0xCB] = (byte)value; } + public override int OT_Intensity { get => Data[0xCC]; set => Data[0xCC] = (byte)value; } + public override int OT_Memory { get => Data[0xCD]; set => Data[0xCD] = (byte)value; } + public override int OT_TextVar { get => BitConverter.ToUInt16(Data, 0xCE); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xCE); } + public override int OT_Feeling { get => Data[0xD0]; set => Data[0xD0] = (byte)value; } + public override int Egg_Year { get => Data[0xD1]; set => Data[0xD1] = (byte)value; } + public override int Egg_Month { get => Data[0xD2]; set => Data[0xD2] = (byte)value; } + public override int Egg_Day { get => Data[0xD3]; set => Data[0xD3] = (byte)value; } + public override int Met_Year { get => Data[0xD4]; set => Data[0xD4] = (byte)value; } + public override int Met_Month { get => Data[0xD5]; set => Data[0xD5] = (byte)value; } + public override int Met_Day { get => Data[0xD6]; set => Data[0xD6] = (byte)value; } + public byte _0xD7 { get => Data[0xD7]; set => Data[0xD7] = value; } + public override int Egg_Location { get => BitConverter.ToUInt16(Data, 0xD8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); } + public override int Met_Location { get => BitConverter.ToUInt16(Data, 0xDA); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xDA); } + public override int Ball { get => Data[0xDC]; set => Data[0xDC] = (byte)value; } + public override int Met_Level { get => Data[0xDD] & ~0x80; set => Data[0xDD] = (byte)((Data[0xDD] & 0x80) | value); } + public override int OT_Gender { get => Data[0xDD] >> 7; set => Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | (value << 7)); } + public override int HyperTrainFlags { get => Data[0xDE]; set => Data[0xDE] = (byte)value; } + public override bool HT_HP { get => ((HyperTrainFlags >> 0) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 0)) | ((value ? 1 : 0) << 0); } + public override bool HT_ATK { get => ((HyperTrainFlags >> 1) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 1)) | ((value ? 1 : 0) << 1); } + public override bool HT_DEF { get => ((HyperTrainFlags >> 2) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 2)) | ((value ? 1 : 0) << 2); } + public override bool HT_SPA { get => ((HyperTrainFlags >> 3) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 3)) | ((value ? 1 : 0) << 3); } + public override bool HT_SPD { get => ((HyperTrainFlags >> 4) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 4)) | ((value ? 1 : 0) << 4); } + public override bool HT_SPE { get => ((HyperTrainFlags >> 5) & 1) == 1; set => HyperTrainFlags = (HyperTrainFlags & ~(1 << 5)) | ((value ? 1 : 0) << 5); } + public override int Version { get => Data[0xDF]; set => Data[0xDF] = (byte)value; } + public override int Country { get => Data[0xE0]; set => Data[0xE0] = (byte)value; } + public override int Region { get => Data[0xE1]; set => Data[0xE1] = (byte)value; } + public override int ConsoleRegion { get => Data[0xE2]; set => Data[0xE2] = (byte)value; } + public override int Language { get => Data[0xE3]; set => Data[0xE3] = (byte)value; } #endregion #region Battle Stats - public override int Stat_Level { get { return Data[0xEC]; } set { Data[0xEC] = (byte)value; } } - public override int Stat_HPCurrent { get { return BitConverter.ToUInt16(Data, 0xF0); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF0); } } - public override int Stat_HPMax { get { return BitConverter.ToUInt16(Data, 0xF2); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF2); } } - public override int Stat_ATK { get { return BitConverter.ToUInt16(Data, 0xF4); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF4); } } - public override int Stat_DEF { get { return BitConverter.ToUInt16(Data, 0xF6); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF6); } } - public override int Stat_SPE { get { return BitConverter.ToUInt16(Data, 0xF8); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF8); } } - public override int Stat_SPA { get { return BitConverter.ToUInt16(Data, 0xFA); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFA); } } - public override int Stat_SPD { get { return BitConverter.ToUInt16(Data, 0xFC); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFC); } } + public override int Stat_Level { get => Data[0xEC]; set => Data[0xEC] = (byte)value; } + public override int Stat_HPCurrent { get => BitConverter.ToUInt16(Data, 0xF0); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF0); } + public override int Stat_HPMax { get => BitConverter.ToUInt16(Data, 0xF2); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF2); } + public override int Stat_ATK { get => BitConverter.ToUInt16(Data, 0xF4); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF4); } + public override int Stat_DEF { get => BitConverter.ToUInt16(Data, 0xF6); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF6); } + public override int Stat_SPE { get => BitConverter.ToUInt16(Data, 0xF8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xF8); } + public override int Stat_SPA { get => BitConverter.ToUInt16(Data, 0xFA); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFA); } + public override int Stat_SPD { get => BitConverter.ToUInt16(Data, 0xFC); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFC); } #endregion // Simple Generated Attributes - public override int CurrentFriendship { - get { return CurrentHandler == 0 ? OT_Friendship : HT_Friendship; } + public override int CurrentFriendship + { + get => CurrentHandler == 0 ? OT_Friendship : HT_Friendship; set { if (CurrentHandler == 0) OT_Friendship = value; else HT_Friendship = value; } } public int OppositeFriendship { - get { return CurrentHandler == 1 ? OT_Friendship : HT_Friendship; } + get => CurrentHandler == 1 ? OT_Friendship : HT_Friendship; set { if (CurrentHandler == 1) OT_Friendship = value; else HT_Friendship = value; } } @@ -416,7 +417,7 @@ public override int[] Markings // Methods public override byte[] Encrypt() { - Checksum = CalculateChecksum(); + RefreshChecksum(); return PKX.encryptArray(Data); } diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs index d33782662..d4f68151a 100644 --- a/PKHeX.Core/PKM/PKM.cs +++ b/PKHeX.Core/PKM/PKM.cs @@ -21,7 +21,7 @@ public abstract class PKM public virtual byte[] EncryptedBoxData => Encrypt().Take(SIZE_STORED).ToArray(); public virtual byte[] DecryptedPartyData => Write().Take(SIZE_PARTY).ToArray(); public virtual byte[] DecryptedBoxData => Write().Take(SIZE_STORED).ToArray(); - public virtual bool Valid { get { return ChecksumValid && Sanity == 0; } set { if (!value) return; Sanity = 0; RefreshChecksum(); } } + public virtual bool Valid { get => ChecksumValid && Sanity == 0; set { if (!value) return; Sanity = 0; RefreshChecksum(); } } public abstract string getString(int Offset, int Length); public abstract byte[] setString(string value, int maxLength); @@ -144,9 +144,9 @@ public byte[] Write() public abstract int OT_Friendship { get; set; } // Future Properties - public virtual int Met_Year { get { return 0; } set { } } - public virtual int Met_Month { get { return 0; } set { } } - public virtual int Met_Day { get { return 0; } set { } } + public virtual int Met_Year { get => 0; set { } } + public virtual int Met_Month { get => 0; set { } } + public virtual int Met_Day { get => 0; set { } } public virtual string HT_Name { get; set; } public virtual int HT_Gender { get; set; } public virtual int HT_Affection { get; set; } @@ -189,13 +189,8 @@ public byte[] Write() { // Check to see if date is valid if (!Util.IsDateValid(2000 + Met_Year, Met_Month, Met_Day)) - { return null; - } - else - { - return new DateTime(2000 + Met_Year, Met_Month, Met_Day); - } + return new DateTime(2000 + Met_Year, Met_Month, Met_Day); } set { @@ -217,9 +212,9 @@ public byte[] Write() } } - public virtual int Egg_Year { get { return 0; } set { } } - public virtual int Egg_Month { get { return 0; } set { } } - public virtual int Egg_Day { get { return 0; } set { } } + public virtual int Egg_Year { get => 0; set { } } + public virtual int Egg_Month { get => 0; set { } } + public virtual int Egg_Day { get => 0; set { } } /// /// The date a Pokémon was met as an egg. @@ -262,21 +257,21 @@ public byte[] Write() } } - public virtual int OT_Affection { get { return 0; } set { } } - public virtual int RelearnMove1 { get { return 0; } set { } } - public virtual int RelearnMove2 { get { return 0; } set { } } - public virtual int RelearnMove3 { get { return 0; } set { } } - public virtual int RelearnMove4 { get { return 0; } set { } } - public virtual int EncounterType { get { return 0; } set { } } + public virtual int OT_Affection { get => 0; set { } } + public virtual int RelearnMove1 { get => 0; set { } } + public virtual int RelearnMove2 { get => 0; set { } } + public virtual int RelearnMove3 { get => 0; set { } } + public virtual int RelearnMove4 { get => 0; set { } } + public virtual int EncounterType { get => 0; set { } } // Exposed but not Present in all public abstract int CurrentHandler { get; set; } // Derived - public int SpecForm { get { return Species + (AltForm << 11); } set { Species = value & 0x7FF; AltForm = value >> 11; } } + public int SpecForm { get => Species + (AltForm << 11); set { Species = value & 0x7FF; AltForm = value >> 11; } } public virtual int SpriteItem => HeldItem; public virtual bool IsShiny => TSV == PSV; - public virtual bool Locked { get { return false; } set { } } + public virtual bool Locked { get => false; set { } } public int TrainerID7 => (int)((uint)(TID | (SID << 16)) % 1000000); public bool VC2 => Version >= 39 && Version <= 41; public bool VC1 => Version >= 35 && Version <= 38; @@ -318,13 +313,13 @@ public int GenNumber public bool PKRS_Infected => PKRS_Strain > 0; public bool PKRS_Cured => PKRS_Days == 0 && PKRS_Strain > 0; public virtual bool ChecksumValid => Checksum == CalculateChecksum(); - public int CurrentLevel { get { return PKX.getLevel(Species, EXP); } set { EXP = PKX.getEXP(value, Species); } } - public int MarkCircle { get { return Markings[0]; } set { var marks = Markings; marks[0] = value; Markings = marks; } } - public int MarkTriangle { get { return Markings[1]; } set { var marks = Markings; marks[1] = value; Markings = marks; } } - public int MarkSquare { get { return Markings[2]; } set { var marks = Markings; marks[2] = value; Markings = marks; } } - public int MarkHeart { get { return Markings[3]; } set { var marks = Markings; marks[3] = value; Markings = marks; } } - public int MarkStar { get { return Markings[4]; } set { var marks = Markings; marks[4] = value; Markings = marks; } } - public int MarkDiamond { get { return Markings[5]; } set { var marks = Markings; marks[5] = value; Markings = marks; } } + public int CurrentLevel { get => PKX.getLevel(Species, EXP); set => EXP = PKX.getEXP(value, Species); } + public int MarkCircle { get => Markings[0]; set { var marks = Markings; marks[0] = value; Markings = marks; } } + public int MarkTriangle { get => Markings[1]; set { var marks = Markings; marks[1] = value; Markings = marks; } } + public int MarkSquare { get => Markings[2]; set { var marks = Markings; marks[2] = value; Markings = marks; } } + public int MarkHeart { get => Markings[3]; set { var marks = Markings; marks[3] = value; Markings = marks; } } + public int MarkStar { get => Markings[4]; set { var marks = Markings; marks[4] = value; Markings = marks; } } + public int MarkDiamond { get => Markings[5]; set { var marks = Markings; marks[5] = value; Markings = marks; } } public string ShowdownText => ShowdownSet.getShowdownText(this); public string[] QRText => this.getQRText(); @@ -339,7 +334,7 @@ public virtual string FileName } public int[] IVs { - get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; } + get => new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; set { if (value?.Length != 6) return; @@ -349,7 +344,7 @@ public int[] IVs } public int[] EVs { - get { return new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; } + get => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; set { if (value?.Length != 6) return; @@ -359,12 +354,12 @@ public int[] EVs } public int[] Moves { - get { return new[] { Move1, Move2, Move3, Move4 }; } + get => new[] { Move1, Move2, Move3, Move4 }; set { if (value?.Length != 4) return; Move1 = value[0]; Move2 = value[1]; Move3 = value[2]; Move4 = value[3]; } } public int[] RelearnMoves { - get { return new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; } + get => new[] { RelearnMove1, RelearnMove2, RelearnMove3, RelearnMove4 }; set { if (value.Length > 0) RelearnMove1 = value[0]; @@ -408,7 +403,7 @@ public virtual int[] Markings public int[] CNTs { - get { return new[] { CNT_Cool, CNT_Beauty, CNT_Cute, CNT_Smart, CNT_Tough, CNT_Sheen }; } + get => new[] { CNT_Cool, CNT_Beauty, CNT_Cute, CNT_Smart, CNT_Tough, CNT_Sheen }; set { if (value?.Length != 6) return; CNT_Cool = value[0]; CNT_Beauty = value[1]; CNT_Cute = value[2]; CNT_Smart = value[3]; CNT_Tough = value[4]; CNT_Sheen = value[5]; } } @@ -423,7 +418,7 @@ protected static int getHiddenPowerBitVal(int[] ivs) public virtual int HPPower => Format < 6 ? 40*HPVal/63 + 30 : 60; public virtual int HPType { - get { return 15*HPVal/63; } + get => 15 * HPVal / 63; set { IV_HP = (IV_HP & ~1) + PKX.hpivs[value, 0]; @@ -455,7 +450,7 @@ public virtual bool WasEgg // Gen 1/2 and pal park Gen 3 return _WasEgg; } - set { _WasEgg = value; } + set => _WasEgg = value; } public virtual bool WasGiftEgg { @@ -479,16 +474,16 @@ public virtual bool WasGiftEgg public virtual bool IsNative => GenNumber == Format; public virtual bool IsOriginValid => Species <= Legal.getMaxSpeciesOrigin(Format); - public virtual bool SecretSuperTrainingUnlocked { get { return false; } set { } } - public virtual bool SecretSuperTrainingComplete { get { return false; } set { } } + public virtual bool SecretSuperTrainingUnlocked { get => false; set { } } + public virtual bool SecretSuperTrainingComplete { get => false; set { } } - public virtual int HyperTrainFlags { get { return 0; } set { } } - public virtual bool HT_HP { get { return false; } set { } } - public virtual bool HT_ATK { get { return false; } set { } } - public virtual bool HT_DEF { get { return false; } set { } } - public virtual bool HT_SPA { get { return false; } set { } } - public virtual bool HT_SPD { get { return false; } set { } } - public virtual bool HT_SPE { get { return false; } set { } } + public virtual int HyperTrainFlags { get => 0; set { } } + public virtual bool HT_HP { get => false; set { } } + public virtual bool HT_ATK { get => false; set { } } + public virtual bool HT_DEF { get => false; set { } } + public virtual bool HT_SPA { get => false; set { } } + public virtual bool HT_SPD { get => false; set { } } + public virtual bool HT_SPE { get => false; set { } } /// /// Toggles the Hyper Training flag for a given stat. @@ -588,7 +583,7 @@ public virtual bool getGenderIsValid() /// /// Updates the checksum of the . /// - public void RefreshChecksum() { Checksum = CalculateChecksum(); } + public void RefreshChecksum() => Checksum = CalculateChecksum(); /// /// Reorders moves and fixes PP if necessary. diff --git a/PKHeX.Core/PKM/XK3.cs b/PKHeX.Core/PKM/XK3.cs index 949e8e546..ceec3ea54 100644 --- a/PKHeX.Core/PKM/XK3.cs +++ b/PKHeX.Core/PKM/XK3.cs @@ -29,165 +29,165 @@ public XK3(byte[] decryptedData = null, string ident = null) public override byte[] setString(string value, int maxLength) => PKX.setBEString3(value, maxLength); // Trash Bytes - public override byte[] Nickname_Trash { get { return getData(0x4E, 20); } set { if (value?.Length == 20) value.CopyTo(Data, 0x4E); } } - public override byte[] OT_Trash { get { return getData(0x38, 20); } set { if (value?.Length == 20) value.CopyTo(Data, 0x38); } } + public override byte[] Nickname_Trash { get => getData(0x4E, 20); set { if (value?.Length == 20) value.CopyTo(Data, 0x4E); } } + public override byte[] OT_Trash { get => getData(0x38, 20); set { if (value?.Length == 20) value.CopyTo(Data, 0x38); } } // Future Attributes - public override uint EncryptionConstant { get { return PID; } set { } } - public override int Nature { get { return (int)(PID % 25); } set { } } - public override int AltForm { get { return Species == 201 ? PKX.getUnownForm(PID) : 0; } set { } } + public override uint EncryptionConstant { get => PID; set { } } + public override int Nature { get => (int)(PID % 25); set { } } + public override int AltForm { get => Species == 201 ? PKX.getUnownForm(PID) : 0; set { } } - public override bool IsNicknamed { get { return PKX.getIsNicknamedAnyLanguage(Species, Nickname, Format); } set { } } - public override int Gender { get { return PKX.getGender(Species, PID); } set { } } + public override bool IsNicknamed { get => PKX.getIsNicknamedAnyLanguage(Species, Nickname, Format); set { } } + public override int Gender { get => PKX.getGender(Species, PID); set { } } public override int Characteristic => -1; - public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } } + public override int CurrentFriendship { get => OT_Friendship; set => OT_Friendship = value; } public override int Ability { get { int[] abils = PersonalTable.RS.getAbilities(Species, 0); return abils[abils[1] == 0 ? 0 : AbilityNumber >> 1]; } set { } } - public override int CurrentHandler { get { return 0; } set { } } - public override int Egg_Location { get { return 0; } set { } } + public override int CurrentHandler { get => 0; set { } } + public override int Egg_Location { get => 0; set { } } // Silly Attributes - public override ushort Sanity { get { return 0; } set { } } // valid flag set in pkm structure. - public override ushort Checksum { get { return SaveUtil.ccitt16(Data); } set { } } // totally false, just a way to get a 'random' ident for the pkm. + public override ushort Sanity { get => 0; set { } } // valid flag set in pkm structure. + public override ushort Checksum { get => SaveUtil.ccitt16(Data); set { } } // totally false, just a way to get a 'random' ident for the pkm. public override bool ChecksumValid => Valid; - public override int Species { get { return PKX.getG4Species(BigEndian.ToUInt16(Data, 0x00)); } set { BigEndian.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x00); } } + public override int Species { get => PKX.getG4Species(BigEndian.ToUInt16(Data, 0x00)); set => BigEndian.GetBytes((ushort)PKX.getG3Species(value)).CopyTo(Data, 0x00); } public override int SpriteItem => PKX.getG4Item((ushort)HeldItem); - public override int HeldItem { get { return BigEndian.ToUInt16(Data, 0x02); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x02); } } - public override int Stat_HPCurrent { get { return BigEndian.ToUInt16(Data, 0x04); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x04); } } - public override int OT_Friendship { get { return Data[0x06]; } set { Data[0x06] = (byte)value; } } - public override int Met_Location { get { return BigEndian.ToUInt16(Data, 0x08); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x08); } } + public override int HeldItem { get => BigEndian.ToUInt16(Data, 0x02); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x02); } + public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x04); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x04); } + public override int OT_Friendship { get => Data[0x06]; set => Data[0x06] = (byte)value; } + public override int Met_Location { get => BigEndian.ToUInt16(Data, 0x08); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x08); } // 0x0A-0x0B Unknown // 0x0C-0x0D Unknown - public override int Met_Level { get { return Data[0x0E]; } set { Data[0x0E] = (byte)value; } } - public override int Ball { get { return Data[0x0F]; } set { Data[0x0F] = (byte)value; } } - public override int OT_Gender { get { return Data[0x10]; } set { Data[0x10] = (byte)value; } } - public override int Stat_Level { get { return Data[0x11]; } set { Data[0x11] = (byte)value; } } - public override int CNT_Sheen { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } } - public override int PKRS_Strain { get { return Data[0x13] & 0xF; } set { Data[0x13] = (byte)(value & 0xF); } } - public override int MarkValue { get { return Data[0x14]; } protected set { Data[0x14] = (byte)value; } } - public override int PKRS_Days { get { return Math.Max((sbyte)Data[0x15], (sbyte)0); } set { Data[0x15] = (byte)(value == 0 ? 0xFF : value & 0xF); } } + public override int Met_Level { get => Data[0x0E]; set => Data[0x0E] = (byte)value; } + public override int Ball { get => Data[0x0F]; set => Data[0x0F] = (byte)value; } + public override int OT_Gender { get => Data[0x10]; set => Data[0x10] = (byte)value; } + public override int Stat_Level { get => Data[0x11]; set => Data[0x11] = (byte)value; } + public override int CNT_Sheen { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public override int PKRS_Strain { get => Data[0x13] & 0xF; set => Data[0x13] = (byte)(value & 0xF); } + public override int MarkValue { get => Data[0x14]; protected set => Data[0x14] = (byte)value; } + public override int PKRS_Days { get => Math.Max((sbyte)Data[0x15], (sbyte)0); set => Data[0x15] = (byte)(value == 0 ? 0xFF : value & 0xF); } // 0x16-0x1C Battle Related - private int XDPKMFLAGS { get { return Data[0x1D]; } set { Data[0x1D] = (byte)value; } } - public bool UnusedFlag0 { get { return (XDPKMFLAGS & (1 << 0)) == 1 << 0; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 0) | (value ? 1 << 0 : 0); } } - public bool UnusedFlag1 { get { return (XDPKMFLAGS & (1 << 1)) == 1 << 1; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 1) | (value ? 1 << 1 : 0); } } - public bool CapturedFlag { get { return (XDPKMFLAGS & (1 << 2)) == 1 << 2; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 2) | (value ? 1 << 2 : 0); } } - public bool UnusedFlag3 { get { return (XDPKMFLAGS & (1 << 3)) == 1 << 3; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 3) | (value ? 1 << 3 : 0); } } - public bool BlockTrades { get { return (XDPKMFLAGS & (1 << 4)) == 1 << 4; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 4) | (value ? 1 << 4 : 0); } } - public override bool Valid { get { return (XDPKMFLAGS & (1 << 5)) == 0; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 5) | (value ? 0 : 1 << 5); } } // invalid flag - public override int AbilityNumber { get { return 1 << ((XDPKMFLAGS >> 6) & 1); }set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 6) | (((value >> 1) & 1) << 6); } } - public override bool IsEgg { get { return (XDPKMFLAGS & (1 << 7)) == 1 << 7; } set { XDPKMFLAGS = XDPKMFLAGS & ~(1 << 7) | (value ? 1 << 7 : 0); } } + private int XDPKMFLAGS { get => Data[0x1D]; set => Data[0x1D] = (byte)value; } + public bool UnusedFlag0 { get => (XDPKMFLAGS & (1 << 0)) == 1 << 0; set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 0) | (value ? 1 << 0 : 0); } + public bool UnusedFlag1 { get => (XDPKMFLAGS & (1 << 1)) == 1 << 1; set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 1) | (value ? 1 << 1 : 0); } + public bool CapturedFlag { get => (XDPKMFLAGS & (1 << 2)) == 1 << 2; set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 2) | (value ? 1 << 2 : 0); } + public bool UnusedFlag3 { get => (XDPKMFLAGS & (1 << 3)) == 1 << 3; set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 3) | (value ? 1 << 3 : 0); } + public bool BlockTrades { get => (XDPKMFLAGS & (1 << 4)) == 1 << 4; set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 4) | (value ? 1 << 4 : 0); } + public override bool Valid { get => (XDPKMFLAGS & (1 << 5)) == 0; set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 5) | (value ? 0 : 1 << 5); } // invalid flag + public override int AbilityNumber { get => 1 << ((XDPKMFLAGS >> 6) & 1); set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 6) | (((value >> 1) & 1) << 6); } + public override bool IsEgg { get => (XDPKMFLAGS & (1 << 7)) == 1 << 7; set => XDPKMFLAGS = XDPKMFLAGS & ~(1 << 7) | (value ? 1 << 7 : 0); } // 0x1E-0x1F Unknown - public override uint EXP { get { return BigEndian.ToUInt32(Data, 0x20); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x20); } } - public override int SID { get { return BigEndian.ToUInt16(Data, 0x24); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); } } - public override int TID { get { return BigEndian.ToUInt16(Data, 0x26); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } } - public override uint PID { get { return BigEndian.ToUInt32(Data, 0x28); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x28); } } + public override uint EXP { get => BigEndian.ToUInt32(Data, 0x20); set => BigEndian.GetBytes(value).CopyTo(Data, 0x20); } + public override int SID { get => BigEndian.ToUInt16(Data, 0x24); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x24); } + public override int TID { get => BigEndian.ToUInt16(Data, 0x26); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x26); } + public override uint PID { get => BigEndian.ToUInt32(Data, 0x28); set => BigEndian.GetBytes(value).CopyTo(Data, 0x28); } // 0x2A-0x2B Unknown // 0x2C-0x2F Battle Related - public override bool FatefulEncounter { get { return Data[0x30] == 1; } set { Data[0x30] = (byte)(value ? 1 : 0); } } + public override bool FatefulEncounter { get => Data[0x30] == 1; set => Data[0x30] = (byte)(value ? 1 : 0); } // 0x31-0x32 Unknown - public new int EncounterType { get { return Data[0x33]; } set { Data[0x33] = (byte)value; } } - public override int Version { get { return SaveUtil.getG3VersionID(Data[0x34]); } set { Data[0x34] = (byte)SaveUtil.getCXDVersionID(value); } } - public int CurrentRegion { get { return Data[0x35]; } set { Data[0x35] = (byte)value; } } - public int OriginalRegion { get { return Data[0x36]; } set { Data[0x36] = (byte)value; } } - public override int Language { get { return PKX.getMainLangIDfromGC(Data[0x37]); } set { Data[0x37] = PKX.getGCLangIDfromMain((byte)value); } } - public override string OT_Name { get { return getString(0x38, 20); } set { setString(value, 10).CopyTo(Data, 0x38); } } // +2 terminator - public override string Nickname { get { return getString(0x4E, 20); } set { setString(value, 10).CopyTo(Data, 0x4E); Nickname2 = value; } } // +2 terminator - private string Nickname2 { get { return getString(0x64, 20); } set { setString(value, 10).CopyTo(Data, 0x64); } } // +2 terminator + public new int EncounterType { get => Data[0x33]; set => Data[0x33] = (byte)value; } + public override int Version { get => SaveUtil.getG3VersionID(Data[0x34]); set => Data[0x34] = (byte)SaveUtil.getCXDVersionID(value); } + public int CurrentRegion { get => Data[0x35]; set => Data[0x35] = (byte)value; } + public int OriginalRegion { get => Data[0x36]; set => Data[0x36] = (byte)value; } + public override int Language { get => PKX.getMainLangIDfromGC(Data[0x37]); set => Data[0x37] = PKX.getGCLangIDfromMain((byte)value); } + public override string OT_Name { get => getString(0x38, 20); set => setString(value, 10).CopyTo(Data, 0x38); } // +2 terminator + public override string Nickname { get => getString(0x4E, 20); set { setString(value, 10).CopyTo(Data, 0x4E); Nickname2 = value; } } // +2 terminator + private string Nickname2 { get => getString(0x64, 20); set => setString(value, 10).CopyTo(Data, 0x64); } // +2 terminator // 0x7A-0x7B Unknown - private ushort RIB0 { get { return BigEndian.ToUInt16(Data, 0x7C); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x7C); } } - public bool RibbonChampionG3Hoenn { get { return (RIB0 & (1 << 15)) == 1 << 15; } set { RIB0 = (ushort)(RIB0 & ~(1 << 15) | (ushort)(value ? 1 << 15 : 0)); } } - public bool RibbonWinning { get { return (RIB0 & (1 << 14)) == 1 << 14; } set { RIB0 = (ushort)(RIB0 & ~(1 << 14) | (ushort)(value ? 1 << 14 : 0)); } } - public bool RibbonVictory { get { return (RIB0 & (1 << 13)) == 1 << 13; } set { RIB0 = (ushort)(RIB0 & ~(1 << 13) | (ushort)(value ? 1 << 13 : 0)); } } - public bool RibbonArtist { get { return (RIB0 & (1 << 12)) == 1 << 12; } set { RIB0 = (ushort)(RIB0 & ~(1 << 12) | (ushort)(value ? 1 << 12 : 0)); } } - public bool RibbonEffort { get { return (RIB0 & (1 << 11)) == 1 << 11; } set { RIB0 = (ushort)(RIB0 & ~(1 << 11) | (ushort)(value ? 1 << 11 : 0)); } } - public bool RibbonChampionBattle { get { return (RIB0 & (1 << 10)) == 1 << 10; } set { RIB0 = (ushort)(RIB0 & ~(1 << 10) | (ushort)(value ? 1 << 10 : 0)); } } - public bool RibbonChampionRegional { get { return (RIB0 & (1 << 09)) == 1 << 09; } set { RIB0 = (ushort)(RIB0 & ~(1 << 09) | (ushort)(value ? 1 << 09 : 0)); } } - public bool RibbonChampionNational { get { return (RIB0 & (1 << 08)) == 1 << 08; } set { RIB0 = (ushort)(RIB0 & ~(1 << 08) | (ushort)(value ? 1 << 08 : 0)); } } - public bool RibbonCountry { get { return (RIB0 & (1 << 07)) == 1 << 07; } set { RIB0 = (ushort)(RIB0 & ~(1 << 07) | (ushort)(value ? 1 << 07 : 0)); } } - public bool RibbonNational { get { return (RIB0 & (1 << 06)) == 1 << 06; } set { RIB0 = (ushort)(RIB0 & ~(1 << 06) | (ushort)(value ? 1 << 06 : 0)); } } - public bool RibbonEarth { get { return (RIB0 & (1 << 05)) == 1 << 05; } set { RIB0 = (ushort)(RIB0 & ~(1 << 05) | (ushort)(value ? 1 << 05 : 0)); } } - public bool RibbonWorld { get { return (RIB0 & (1 << 04)) == 1 << 04; } set { RIB0 = (ushort)(RIB0 & ~(1 << 04) | (ushort)(value ? 1 << 04 : 0)); } } - public bool Unused1 { get { return (RIB0 & (1 << 03)) == 1 << 03; } set { RIB0 = (ushort)(RIB0 & ~(1 << 03) | (ushort)(value ? 1 << 03 : 0)); } } - public bool Unused2 { get { return (RIB0 & (1 << 02)) == 1 << 02; } set { RIB0 = (ushort)(RIB0 & ~(1 << 02) | (ushort)(value ? 1 << 02 : 0)); } } - public bool Unused3 { get { return (RIB0 & (1 << 01)) == 1 << 01; } set { RIB0 = (ushort)(RIB0 & ~(1 << 01) | (ushort)(value ? 1 << 01 : 0)); } } - public bool Unused4 { get { return (RIB0 & (1 << 00)) == 1 << 00; } set { RIB0 = (ushort)(RIB0 & ~(1 << 00) | (ushort)(value ? 1 << 00 : 0)); } } + private ushort RIB0 { get => BigEndian.ToUInt16(Data, 0x7C); set => BigEndian.GetBytes(value).CopyTo(Data, 0x7C); } + public bool RibbonChampionG3Hoenn { get => (RIB0 & (1 << 15)) == 1 << 15; set => RIB0 = (ushort)(RIB0 & ~(1 << 15) | (ushort)(value ? 1 << 15 : 0)); } + public bool RibbonWinning { get => (RIB0 & (1 << 14)) == 1 << 14; set => RIB0 = (ushort)(RIB0 & ~(1 << 14) | (ushort)(value ? 1 << 14 : 0)); } + public bool RibbonVictory { get => (RIB0 & (1 << 13)) == 1 << 13; set => RIB0 = (ushort)(RIB0 & ~(1 << 13) | (ushort)(value ? 1 << 13 : 0)); } + public bool RibbonArtist { get => (RIB0 & (1 << 12)) == 1 << 12; set => RIB0 = (ushort)(RIB0 & ~(1 << 12) | (ushort)(value ? 1 << 12 : 0)); } + public bool RibbonEffort { get => (RIB0 & (1 << 11)) == 1 << 11; set => RIB0 = (ushort)(RIB0 & ~(1 << 11) | (ushort)(value ? 1 << 11 : 0)); } + public bool RibbonChampionBattle { get => (RIB0 & (1 << 10)) == 1 << 10; set => RIB0 = (ushort)(RIB0 & ~(1 << 10) | (ushort)(value ? 1 << 10 : 0)); } + public bool RibbonChampionRegional { get => (RIB0 & (1 << 09)) == 1 << 09; set => RIB0 = (ushort)(RIB0 & ~(1 << 09) | (ushort)(value ? 1 << 09 : 0)); } + public bool RibbonChampionNational { get => (RIB0 & (1 << 08)) == 1 << 08; set => RIB0 = (ushort)(RIB0 & ~(1 << 08) | (ushort)(value ? 1 << 08 : 0)); } + public bool RibbonCountry { get => (RIB0 & (1 << 07)) == 1 << 07; set => RIB0 = (ushort)(RIB0 & ~(1 << 07) | (ushort)(value ? 1 << 07 : 0)); } + public bool RibbonNational { get => (RIB0 & (1 << 06)) == 1 << 06; set => RIB0 = (ushort)(RIB0 & ~(1 << 06) | (ushort)(value ? 1 << 06 : 0)); } + public bool RibbonEarth { get => (RIB0 & (1 << 05)) == 1 << 05; set => RIB0 = (ushort)(RIB0 & ~(1 << 05) | (ushort)(value ? 1 << 05 : 0)); } + public bool RibbonWorld { get => (RIB0 & (1 << 04)) == 1 << 04; set => RIB0 = (ushort)(RIB0 & ~(1 << 04) | (ushort)(value ? 1 << 04 : 0)); } + public bool Unused1 { get => (RIB0 & (1 << 03)) == 1 << 03; set => RIB0 = (ushort)(RIB0 & ~(1 << 03) | (ushort)(value ? 1 << 03 : 0)); } + public bool Unused2 { get => (RIB0 & (1 << 02)) == 1 << 02; set => RIB0 = (ushort)(RIB0 & ~(1 << 02) | (ushort)(value ? 1 << 02 : 0)); } + public bool Unused3 { get => (RIB0 & (1 << 01)) == 1 << 01; set => RIB0 = (ushort)(RIB0 & ~(1 << 01) | (ushort)(value ? 1 << 01 : 0)); } + public bool Unused4 { get => (RIB0 & (1 << 00)) == 1 << 00; set => RIB0 = (ushort)(RIB0 & ~(1 << 00) | (ushort)(value ? 1 << 00 : 0)); } // 0x7E-0x7F Unknown // Moves - public override int Move1 { get { return BigEndian.ToUInt16(Data, 0x80); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x80); } } - public override int Move1_PP { get { return Data[0x82]; } set { Data[0x82] = (byte)value; } } - public override int Move1_PPUps { get { return Data[0x83]; } set { Data[0x83] = (byte)value; } } - public override int Move2 { get { return BigEndian.ToUInt16(Data, 0x84); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x84); } } - public override int Move2_PP { get { return Data[0x86]; } set { Data[0x86] = (byte)value; } } - public override int Move2_PPUps { get { return Data[0x87]; } set { Data[0x87] = (byte)value; } } - public override int Move3 { get { return BigEndian.ToUInt16(Data, 0x88); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x88); } } - public override int Move3_PP { get { return Data[0x8A]; } set { Data[0x8A] = (byte)value; } } - public override int Move3_PPUps { get { return Data[0x8B]; } set { Data[0x8B] = (byte)value; } } - public override int Move4 { get { return BigEndian.ToUInt16(Data, 0x8C); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8C); } } - public override int Move4_PP { get { return Data[0x8E]; } set { Data[0x8E] = (byte)value; } } - public override int Move4_PPUps { get { return Data[0x8F]; } set { Data[0x8F] = (byte)value; } } + public override int Move1 { get => BigEndian.ToUInt16(Data, 0x80); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x80); } + public override int Move1_PP { get => Data[0x82]; set => Data[0x82] = (byte)value; } + public override int Move1_PPUps { get => Data[0x83]; set => Data[0x83] = (byte)value; } + public override int Move2 { get => BigEndian.ToUInt16(Data, 0x84); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x84); } + public override int Move2_PP { get => Data[0x86]; set => Data[0x86] = (byte)value; } + public override int Move2_PPUps { get => Data[0x87]; set => Data[0x87] = (byte)value; } + public override int Move3 { get => BigEndian.ToUInt16(Data, 0x88); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x88); } + public override int Move3_PP { get => Data[0x8A]; set => Data[0x8A] = (byte)value; } + public override int Move3_PPUps { get => Data[0x8B]; set => Data[0x8B] = (byte)value; } + public override int Move4 { get => BigEndian.ToUInt16(Data, 0x8C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8C); } + public override int Move4_PP { get => Data[0x8E]; set => Data[0x8E] = (byte)value; } + public override int Move4_PPUps { get => Data[0x8F]; set => Data[0x8F] = (byte)value; } // More party stats - public override int Stat_HPMax { get { return BigEndian.ToUInt16(Data, 0x90); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x90); } } - public override int Stat_ATK { get { return BigEndian.ToUInt16(Data, 0x92); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x92); } } - public override int Stat_DEF { get { return BigEndian.ToUInt16(Data, 0x94); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x94); } } - public override int Stat_SPA { get { return BigEndian.ToUInt16(Data, 0x96); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x96); } } - public override int Stat_SPD { get { return BigEndian.ToUInt16(Data, 0x98); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x98); } } - public override int Stat_SPE { get { return BigEndian.ToUInt16(Data, 0x9A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x9A); } } + public override int Stat_HPMax { get => BigEndian.ToUInt16(Data, 0x90); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x90); } + public override int Stat_ATK { get => BigEndian.ToUInt16(Data, 0x92); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x92); } + public override int Stat_DEF { get => BigEndian.ToUInt16(Data, 0x94); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x94); } + public override int Stat_SPA { get => BigEndian.ToUInt16(Data, 0x96); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x96); } + public override int Stat_SPD { get => BigEndian.ToUInt16(Data, 0x98); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x98); } + public override int Stat_SPE { get => BigEndian.ToUInt16(Data, 0x9A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x9A); } // EVs public override int EV_HP { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9C)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9C); } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9C)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9C); } public override int EV_ATK { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9E)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9E); } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9E)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9E); } public override int EV_DEF { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA0)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA0); } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA0)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA0); } public override int EV_SPA { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA2)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA2); } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA2)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA2); } public override int EV_SPD { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA4)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA4); } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA4)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA4); } public override int EV_SPE { - get { return Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA6)); } - set { BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA6); } + get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA6)); + set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA6); } // IVs - public override int IV_HP { get { return Data[0xA8]; } set { Data[0xA8] = (byte)(value & 0x1F); } } - public override int IV_ATK { get { return Data[0xA9]; } set { Data[0xA9] = (byte)(value & 0x1F); } } - public override int IV_DEF { get { return Data[0xAA]; } set { Data[0xAA] = (byte)(value & 0x1F); } } - public override int IV_SPA { get { return Data[0xAB]; } set { Data[0xAB] = (byte)(value & 0x1F); } } - public override int IV_SPD { get { return Data[0xAC]; } set { Data[0xAC] = (byte)(value & 0x1F); } } - public override int IV_SPE { get { return Data[0xAD]; } set { Data[0xAD] = (byte)(value & 0x1F); } } + public override int IV_HP { get => Data[0xA8]; set => Data[0xA8] = (byte)(value & 0x1F); } + public override int IV_ATK { get => Data[0xA9]; set => Data[0xA9] = (byte)(value & 0x1F); } + public override int IV_DEF { get => Data[0xAA]; set => Data[0xAA] = (byte)(value & 0x1F); } + public override int IV_SPA { get => Data[0xAB]; set => Data[0xAB] = (byte)(value & 0x1F); } + public override int IV_SPD { get => Data[0xAC]; set => Data[0xAC] = (byte)(value & 0x1F); } + public override int IV_SPE { get => Data[0xAD]; set => Data[0xAD] = (byte)(value & 0x1F); } // Contest - public override int CNT_Cool { get { return Data[0xAE]; } set { Data[0xAE] = (byte)value; } } - public override int CNT_Beauty { get { return Data[0xAF]; } set { Data[0xAF] = (byte)value; } } - public override int CNT_Cute { get { return Data[0xB0]; } set { Data[0xB0] = (byte)value; } } - public override int CNT_Smart { get { return Data[0xB1]; } set { Data[0xB1] = (byte)value; } } - public override int CNT_Tough { get { return Data[0xB2]; } set { Data[0xB2] = (byte)value; } } - public int RibbonCountG3Cool { get { return Data[0xB3]; } set { Data[0xB3] = (byte)value; } } - public int RibbonCountG3Beauty { get { return Data[0xB4]; } set { Data[0xB4] = (byte)value; } } - public int RibbonCountG3Cute { get { return Data[0xB5]; } set { Data[0xB5] = (byte)value; } } - public int RibbonCountG3Smart { get { return Data[0xB6]; } set { Data[0xB6] = (byte)value; } } - public int RibbonCountG3Tough { get { return Data[0xB7]; } set { Data[0xB7] = (byte)value; } } + public override int CNT_Cool { get => Data[0xAE]; set => Data[0xAE] = (byte)value; } + public override int CNT_Beauty { get => Data[0xAF]; set => Data[0xAF] = (byte)value; } + public override int CNT_Cute { get => Data[0xB0]; set => Data[0xB0] = (byte)value; } + public override int CNT_Smart { get => Data[0xB1]; set => Data[0xB1] = (byte)value; } + public override int CNT_Tough { get => Data[0xB2]; set => Data[0xB2] = (byte)value; } + public int RibbonCountG3Cool { get => Data[0xB3]; set => Data[0xB3] = (byte)value; } + public int RibbonCountG3Beauty { get => Data[0xB4]; set => Data[0xB4] = (byte)value; } + public int RibbonCountG3Cute { get => Data[0xB5]; set => Data[0xB5] = (byte)value; } + public int RibbonCountG3Smart { get => Data[0xB6]; set => Data[0xB6] = (byte)value; } + public int RibbonCountG3Tough { get => Data[0xB7]; set => Data[0xB7] = (byte)value; } - public int ShadowID { get { return BigEndian.ToUInt16(Data, 0xBA); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xBA); } } + public int ShadowID { get => BigEndian.ToUInt16(Data, 0xBA); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xBA); } // Purification information is stored in the save file and accessed based on the Shadow ID. public int Purification { get; set; } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs b/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs index 1ed2edff8..5ba4d7a45 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoBW.cs @@ -24,15 +24,15 @@ public override byte[] Write() return Data; } - public override int HP { get { return Data[0x00]; } set { Data[0x00] = (byte)value; } } - public override int ATK { get { return Data[0x01]; } set { Data[0x01] = (byte)value; } } - public override int DEF { get { return Data[0x02]; } set { Data[0x02] = (byte)value; } } - public override int SPE { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } } - public override int SPA { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } } - public override int SPD { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } } + public override int HP { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public override int ATK { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public override int DEF { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public override int SPE { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public override int SPA { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public override int SPD { get => Data[0x05]; set => Data[0x05] = (byte)value; } public override int[] Types { - get { return new int[] { Data[0x06], Data[0x07] }; } + get => new int[] { Data[0x06], Data[0x07] }; set { if (value?.Length != 2) return; @@ -40,18 +40,18 @@ public override int[] Types Data[0x07] = (byte)value[1]; } } - public override int CatchRate { get { return Data[0x08]; } set { Data[0x08] = (byte)value; } } - public override int EvoStage { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } } - private int EVYield { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } } - public override int EV_HP { get { return EVYield >> 0 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 0)) | (value & 0x3) << 0; } } - public override int EV_ATK { get { return EVYield >> 2 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 2)) | (value & 0x3) << 2; } } - public override int EV_DEF { get { return EVYield >> 4 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 4)) | (value & 0x3) << 4; } } - public override int EV_SPE { get { return EVYield >> 6 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } } - public override int EV_SPA { get { return EVYield >> 8 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } } - public override int EV_SPD { get { return EVYield >> 10 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } } + public override int CatchRate { get => Data[0x08]; set => Data[0x08] = (byte)value; } + public override int EvoStage { get => Data[0x09]; set => Data[0x09] = (byte)value; } + private int EVYield { get => BitConverter.ToUInt16(Data, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + public override int EV_HP { get => EVYield >> 0 & 0x3; set => EVYield = (EVYield & ~(0x3 << 0)) | (value & 0x3) << 0; } + public override int EV_ATK { get => EVYield >> 2 & 0x3; set => EVYield = (EVYield & ~(0x3 << 2)) | (value & 0x3) << 2; } + public override int EV_DEF { get => EVYield >> 4 & 0x3; set => EVYield = (EVYield & ~(0x3 << 4)) | (value & 0x3) << 4; } + public override int EV_SPE { get => EVYield >> 6 & 0x3; set => EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } + public override int EV_SPA { get => EVYield >> 8 & 0x3; set => EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } + public override int EV_SPD { get => EVYield >> 10 & 0x3; set => EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } public override int[] Items { - get { return new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE), BitConverter.ToInt16(Data, 0x10) }; } + get => new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE), BitConverter.ToInt16(Data, 0x10) }; set { if (value?.Length != 3) return; @@ -60,13 +60,13 @@ public override int[] Items BitConverter.GetBytes((short)value[2]).CopyTo(Data, 0x10); } } - public override int Gender { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } } - public override int HatchCycles { get { return Data[0x13]; } set { Data[0x13] = (byte)value; } } - public override int BaseFriendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } } - public override int EXPGrowth { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } } + public override int Gender { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public override int HatchCycles { get => Data[0x13]; set => Data[0x13] = (byte)value; } + public override int BaseFriendship { get => Data[0x14]; set => Data[0x14] = (byte)value; } + public override int EXPGrowth { get => Data[0x15]; set => Data[0x15] = (byte)value; } public override int[] EggGroups { - get { return new int[] { Data[0x16], Data[0x17] }; } + get => new int[] { Data[0x16], Data[0x17] }; set { if (value?.Length != 2) return; @@ -76,7 +76,7 @@ public override int[] EggGroups } public override int[] Abilities { - get { return new int[] { Data[0x18], Data[0x19], Data[0x1A] }; } + get => new int[] { Data[0x18], Data[0x19], Data[0x1A] }; set { if (value?.Length != 3) return; @@ -85,13 +85,13 @@ public override int[] Abilities Data[0x1A] = (byte)value[2]; } } - public override int EscapeRate { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } } - protected internal override int FormStatsIndex { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } } - public override int FormeSprite { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } } - public override int FormeCount { get { return Data[0x20]; } set { Data[0x20] = (byte)value; } } - public override int Color { get { return Data[0x21]; } set { Data[0x21] = (byte)value; } } - public override int BaseEXP { get { return BitConverter.ToUInt16(Data, 0x22); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } } - public override int Height { get { return BitConverter.ToUInt16(Data, 0x24); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); } } - public override int Weight { get { return BitConverter.ToUInt16(Data, 0x26); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); } } + public override int EscapeRate { get => Data[0x1B]; set => Data[0x1B] = (byte)value; } + protected internal override int FormStatsIndex { get => BitConverter.ToUInt16(Data, 0x1C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } + public override int FormeSprite { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } + public override int FormeCount { get => Data[0x20]; set => Data[0x20] = (byte)value; } + public override int Color { get => Data[0x21]; set => Data[0x21] = (byte)value; } + public override int BaseEXP { get => BitConverter.ToUInt16(Data, 0x22); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x22); } + public override int Height { get => BitConverter.ToUInt16(Data, 0x24); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x24); } + public override int Weight { get => BitConverter.ToUInt16(Data, 0x26); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x26); } } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs index 0e3a1c44a..36d577671 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG1.cs @@ -20,17 +20,17 @@ public override byte[] Write() return Data; } - public int DEX_ID { get { return Data[0x00]; } set { Data[0x00] = (byte)value; } } - public override int HP { get { return Data[0x01]; } set { Data[0x01] = (byte)value; } } - public override int ATK { get { return Data[0x02]; } set { Data[0x02] = (byte)value; } } - public override int DEF { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } } - public override int SPE { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } } - public int SPC { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } } - public override int SPA { get { return SPC; } set { SPC = value; } } - public override int SPD { get { return SPC; } set { SPC = value; } } + public int DEX_ID { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public override int HP { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public override int ATK { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public override int DEF { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public override int SPE { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public int SPC { get => Data[0x05]; set => Data[0x05] = (byte)value; } + public override int SPA { get => SPC; set => SPC = value; } + public override int SPD { get => SPC; set => SPC = value; } public override int[] Types { - get { return new int[] { Data[0x06], Data[0x07] }; } + get => new int[] { Data[0x06], Data[0x07] }; set { if (value?.Length != 2) return; @@ -38,36 +38,36 @@ public override int[] Types Data[0x07] = (byte)value[1]; } } - public override int CatchRate { get { return Data[0x08]; } set { Data[0x08] = (byte)value; } } - public override int BaseEXP { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } } - public int Move1 { get { return Data[0x0F]; } set { Data[0x0F] = (byte)value; } } - public int Move2 { get { return Data[0x10]; } set { Data[0x10] = (byte)value; } } - public int Move3 { get { return Data[0x11]; } set { Data[0x11] = (byte)value; } } - public int Move4 { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } } - public override int EXPGrowth { get { return Data[0x13]; } set { Data[0x13] = (byte)value; } } + public override int CatchRate { get => Data[0x08]; set => Data[0x08] = (byte)value; } + public override int BaseEXP { get => Data[0x09]; set => Data[0x09] = (byte)value; } + public int Move1 { get => Data[0x0F]; set => Data[0x0F] = (byte)value; } + public int Move2 { get => Data[0x10]; set => Data[0x10] = (byte)value; } + public int Move3 { get => Data[0x11]; set => Data[0x11] = (byte)value; } + public int Move4 { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public override int EXPGrowth { get => Data[0x13]; set => Data[0x13] = (byte)value; } // EV Yields are just aliases for base stats in Gen I - public override int EV_HP { get { return HP; } set { } } - public override int EV_ATK { get { return ATK; } set { } } - public override int EV_DEF { get { return DEF; } set { } } - public override int EV_SPE { get { return SPE; } set { } } - public int EV_SPC { get { return SPC; } set { } } - public override int EV_SPA { get { return EV_SPC; } set { } } - public override int EV_SPD { get { return EV_SPC; } set { } } + public override int EV_HP { get => HP; set { } } + public override int EV_ATK { get => ATK; set { } } + public override int EV_DEF { get => DEF; set { } } + public override int EV_SPE { get => SPE; set { } } + public int EV_SPC { get => SPC; set { } } + public override int EV_SPA { get => EV_SPC; set { } } + public override int EV_SPD { get => EV_SPC; set { } } // Future game values, unused - public override int[] Items { get { return new[] { 0, 0 }; } set { } } - public override int[] EggGroups { get { return new[] { 0, 0 }; } set { } } - public override int[] Abilities { get { return new[] { 0, 0 }; } set { } } - public override int Gender { get { return 0; } set { } } - public override int HatchCycles { get { return 0; } set { } } - public override int BaseFriendship { get { return 0; } set { } } - public override int EscapeRate { get { return 0; } set { } } - public override int Color { get { return 0; } set { } } + public override int[] Items { get => new[] { 0, 0 }; set { } } + public override int[] EggGroups { get => new[] { 0, 0 }; set { } } + public override int[] Abilities { get => new[] { 0, 0 }; set { } } + public override int Gender { get => 0; set { } } + public override int HatchCycles { get => 0; set { } } + public override int BaseFriendship { get => 0; set { } } + public override int EscapeRate { get => 0; set { } } + public override int Color { get => 0; set { } } public int[] Moves { - get { return new[] { Move1, Move2, Move3, Move4 }; } + get => new[] { Move1, Move2, Move3, Move4 }; set { if (value?.Length != 4) return; Move1 = value[0]; Move2 = value[1]; Move3 = value[2]; Move4 = value[3]; } } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs index 82f155190..114941063 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs @@ -20,16 +20,16 @@ public override byte[] Write() return Data; } - public int DEX_ID { get { return Data[0x00]; } set { Data[0x00] = (byte)value; } } - public override int HP { get { return Data[0x01]; } set { Data[0x01] = (byte)value; } } - public override int ATK { get { return Data[0x02]; } set { Data[0x02] = (byte)value; } } - public override int DEF { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } } - public override int SPE { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } } - public override int SPA { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } } - public override int SPD { get { return Data[0x06]; } set { Data[0x06] = (byte)value; } } + public int DEX_ID { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public override int HP { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public override int ATK { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public override int DEF { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public override int SPE { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public override int SPA { get => Data[0x05]; set => Data[0x05] = (byte)value; } + public override int SPD { get => Data[0x06]; set => Data[0x06] = (byte)value; } public override int[] Types { - get { return new int[] { Data[0x07], Data[0x08] }; } + get => new int[] { Data[0x07], Data[0x08] }; set { if (value?.Length != 2) return; @@ -37,12 +37,12 @@ public override int[] Types Data[0x08] = (byte)value[1]; } } - public override int CatchRate { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } } - public override int BaseEXP { get { return Data[0x0A]; } set { Data[0x0A] = (byte)value; } } + public override int CatchRate { get => Data[0x09]; set => Data[0x09] = (byte)value; } + public override int BaseEXP { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } public override int[] Items { - get { return new int[] { Data[0xB], Data[0xC] }; } + get => new int[] { Data[0xB], Data[0xC] }; set { if (value?.Length != 2) return; @@ -50,12 +50,12 @@ public override int[] Items Data[0xC] = (byte) value[1]; } } - public override int Gender { get { return Data[0xD]; } set { Data[0xD] = (byte)value; } } - public override int HatchCycles { get { return Data[0xF]; } set { Data[0xF] = (byte)value; } } - public override int EXPGrowth { get { return Data[0x16]; } set { Data[0x16] = (byte)value; } } + public override int Gender { get => Data[0xD]; set => Data[0xD] = (byte)value; } + public override int HatchCycles { get => Data[0xF]; set => Data[0xF] = (byte)value; } + public override int EXPGrowth { get => Data[0x16]; set => Data[0x16] = (byte)value; } public override int[] EggGroups { - get { return new[] { Data[0x17] >> 4, Data[0x17] & 0xF }; } + get => new[] { Data[0x17] >> 4, Data[0x17] & 0xF }; set { if (value?.Length != 2) return; @@ -64,17 +64,17 @@ public override int[] EggGroups } // EV Yields are just aliases for base stats in Gen I - public override int EV_HP { get { return HP; } set { } } - public override int EV_ATK { get { return ATK; } set { } } - public override int EV_DEF { get { return DEF; } set { } } - public override int EV_SPE { get { return SPE; } set { } } - public override int EV_SPA { get { return SPA; } set { } } - public override int EV_SPD { get { return SPD; } set { } } + public override int EV_HP { get => HP; set { } } + public override int EV_ATK { get => ATK; set { } } + public override int EV_DEF { get => DEF; set { } } + public override int EV_SPE { get => SPE; set { } } + public override int EV_SPA { get => SPA; set { } } + public override int EV_SPD { get => SPD; set { } } // Future game values, unused - public override int[] Abilities { get { return new[] { 0, 0 }; } set { } } - public override int BaseFriendship { get { return 70; } set { } } - public override int EscapeRate { get { return 0; } set { } } - public override int Color { get { return 0; } set { } } + public override int[] Abilities { get => new[] { 0, 0 }; set { } } + public override int BaseFriendship { get => 70; set { } } + public override int EscapeRate { get => 0; set { } } + public override int Color { get => 0; set { } } } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs index b58941ed7..f0236e345 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG3.cs @@ -18,15 +18,15 @@ public override byte[] Write() return Data; } - public override int HP { get { return Data[0x00]; } set { Data[0x00] = (byte)value; } } - public override int ATK { get { return Data[0x01]; } set { Data[0x01] = (byte)value; } } - public override int DEF { get { return Data[0x02]; } set { Data[0x02] = (byte)value; } } - public override int SPE { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } } - public override int SPA { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } } - public override int SPD { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } } + public override int HP { get => Data[0x00]; set => Data[0x00] = (byte)value; } + public override int ATK { get => Data[0x01]; set => Data[0x01] = (byte)value; } + public override int DEF { get => Data[0x02]; set => Data[0x02] = (byte)value; } + public override int SPE { get => Data[0x03]; set => Data[0x03] = (byte)value; } + public override int SPA { get => Data[0x04]; set => Data[0x04] = (byte)value; } + public override int SPD { get => Data[0x05]; set => Data[0x05] = (byte)value; } public override int[] Types { - get { return new int[] { Data[0x06], Data[0x07] }; } + get => new int[] { Data[0x06], Data[0x07] }; set { if (value?.Length != 2) return; @@ -34,19 +34,19 @@ public override int[] Types Data[0x07] = (byte)value[1]; } } - public override int CatchRate { get { return Data[0x08]; } set { Data[0x08] = (byte)value; } } - public override int BaseEXP { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } } - private int EVYield { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } } - public override int EV_HP { get { return EVYield >> 0 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 0)) | (value & 0x3) << 0; } } - public override int EV_ATK { get { return EVYield >> 2 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 2)) | (value & 0x3) << 2; } } - public override int EV_DEF { get { return EVYield >> 4 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 4)) | (value & 0x3) << 4; } } - public override int EV_SPE { get { return EVYield >> 6 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } } - public override int EV_SPA { get { return EVYield >> 8 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } } - public override int EV_SPD { get { return EVYield >> 10 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } } + public override int CatchRate { get => Data[0x08]; set => Data[0x08] = (byte)value; } + public override int BaseEXP { get => Data[0x09]; set => Data[0x09] = (byte)value; } + private int EVYield { get => BitConverter.ToUInt16(Data, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } + public override int EV_HP { get => EVYield >> 0 & 0x3; set => EVYield = (EVYield & ~(0x3 << 0)) | (value & 0x3) << 0; } + public override int EV_ATK { get => EVYield >> 2 & 0x3; set => EVYield = (EVYield & ~(0x3 << 2)) | (value & 0x3) << 2; } + public override int EV_DEF { get => EVYield >> 4 & 0x3; set => EVYield = (EVYield & ~(0x3 << 4)) | (value & 0x3) << 4; } + public override int EV_SPE { get => EVYield >> 6 & 0x3; set => EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } + public override int EV_SPA { get => EVYield >> 8 & 0x3; set => EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } + public override int EV_SPD { get => EVYield >> 10 & 0x3; set => EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } public override int[] Items { - get { return new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE) }; } + get => new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE) }; set { if (value?.Length != 2) return; @@ -54,13 +54,13 @@ public override int[] Items BitConverter.GetBytes((short)value[1]).CopyTo(Data, 0xE); } } - public override int Gender { get { return Data[0x10]; } set { Data[0x10] = (byte)value; } } - public override int HatchCycles { get { return Data[0x11]; } set { Data[0x11] = (byte)value; } } - public override int BaseFriendship { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } } - public override int EXPGrowth { get { return Data[0x13]; } set { Data[0x13] = (byte)value; } } + public override int Gender { get => Data[0x10]; set => Data[0x10] = (byte)value; } + public override int HatchCycles { get => Data[0x11]; set => Data[0x11] = (byte)value; } + public override int BaseFriendship { get => Data[0x12]; set => Data[0x12] = (byte)value; } + public override int EXPGrowth { get => Data[0x13]; set => Data[0x13] = (byte)value; } public override int[] EggGroups { - get { return new int[] { Data[0x14], Data[0x15] }; } + get => new int[] { Data[0x14], Data[0x15] }; set { if (value?.Length != 2) return; @@ -70,7 +70,7 @@ public override int[] EggGroups } public override int[] Abilities { - get { return new int[] { Data[0x16], Data[0x17] }; } + get => new int[] { Data[0x16], Data[0x17] }; set { if (value?.Length != 2) return; @@ -78,7 +78,7 @@ public override int[] Abilities Data[0x17] = (byte)value[1]; } } - public override int EscapeRate { get { return Data[0x18]; } set { Data[0x18] = (byte)value; } } - public override int Color { get { return Data[0x19]; } set { Data[0x19] = (byte)value; } } + public override int EscapeRate { get => Data[0x18]; set => Data[0x18] = (byte)value; } + public override int Color { get => Data[0x19]; set => Data[0x19] = (byte)value; } } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs index 72749092d..43e207ca6 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG4.cs @@ -24,7 +24,7 @@ public override byte[] Write() } // Manually added attributes - public override int FormeCount { get { return Data[0x29]; } set {} } - protected internal override int FormStatsIndex { get { return BitConverter.ToUInt16(Data, 0x2A); } set {} } + public override int FormeCount { get => Data[0x29]; set {} } + protected internal override int FormStatsIndex { get => BitConverter.ToUInt16(Data, 0x2A); set {} } } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs b/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs index cc887e01b..e8142ffc9 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs @@ -22,9 +22,9 @@ public override byte[] Write() // No accessing for 3C-4B - public int SpecialZ_Item { get { return BitConverter.ToUInt16(Data, 0x4C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); } } - public int SpecialZ_BaseMove { get { return BitConverter.ToUInt16(Data, 0x4E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4E); } } - public int SpecialZ_ZMove { get { return BitConverter.ToUInt16(Data, 0x50); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x50); } } - public bool LocalVariant { get { return Data[0x52] == 1; } set { Data[0x52] = (byte)(value ? 1 : 0); } } + public int SpecialZ_Item { get => BitConverter.ToUInt16(Data, 0x4C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); } + public int SpecialZ_BaseMove { get => BitConverter.ToUInt16(Data, 0x4E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4E); } + public int SpecialZ_ZMove { get => BitConverter.ToUInt16(Data, 0x50); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x50); } + public bool LocalVariant { get => Data[0x52] == 1; set => Data[0x52] = (byte)(value ? 1 : 0); } } } diff --git a/PKHeX.Core/Saves/SAV1.cs b/PKHeX.Core/Saves/SAV1.cs index 7d777b83c..5e49de4d2 100644 --- a/PKHeX.Core/Saves/SAV1.cs +++ b/PKHeX.Core/Saves/SAV1.cs @@ -172,8 +172,8 @@ public override byte[] Write(bool DSV) public override int MaxSpeciesID => Legal.MaxSpeciesID_1; public override int MaxAbilityID => Legal.MaxAbilityID_1; public override int MaxItemID => Legal.MaxItemID_1; - public override int MaxBallID => 0; - public override int MaxGameID => 99; // What do I set this to...? + public override int MaxBallID => 0; // unused + public override int MaxGameID => 99; // unused public override int MaxMoney => 999999; public override int MaxCoins => 9999; @@ -224,69 +224,69 @@ public override bool ChecksumsValid public override string OT { - get { return getString(0x2598, OTLength); } - set { setString(value, OTLength).CopyTo(Data, 0x2598); } + get => getString(0x2598, OTLength); + set => setString(value, OTLength).CopyTo(Data, 0x2598); } public override int Gender { - get { return 0; } + get => 0; set { } } public override ushort TID { - get { return BigEndian.ToUInt16(Data, Japanese ? 0x25FB : 0x2605); } - set { BigEndian.GetBytes(value).CopyTo(Data, Japanese ? 0x25FB : 0x2605); } + get => BigEndian.ToUInt16(Data, Japanese ? 0x25FB : 0x2605); + set => BigEndian.GetBytes(value).CopyTo(Data, Japanese ? 0x25FB : 0x2605); } public override ushort SID { - get { return 0; } + get => 0; set { } } public byte PikaFriendship { - get { return Data[Japanese ? 0x2712 : 0x271C]; } - set { Data[Japanese ? 0x2712 : 0x271C] = value; } + get => Data[Japanese ? 0x2712 : 0x271C]; + set => Data[Japanese ? 0x2712 : 0x271C] = value; } public override int PlayedHours { - get { return BitConverter.ToUInt16(Data, Japanese ? 0x2CA0 : 0x2CED); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Japanese ? 0x2CA0 : 0x2CED); } + get => BitConverter.ToUInt16(Data, Japanese ? 0x2CA0 : 0x2CED); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Japanese ? 0x2CA0 : 0x2CED); } public override int PlayedMinutes { - get { return Data[Japanese ? 0x2CA2 : 0x2CEF]; } - set { Data[Japanese ? 0x2CA2 : 0x2CEF] = (byte)value; } + get => Data[Japanese ? 0x2CA2 : 0x2CEF]; + set => Data[Japanese ? 0x2CA2 : 0x2CEF] = (byte)value; } public override int PlayedSeconds { - get { return Data[Japanese ? 0x2CA3 : 0x2CF0]; } - set { Data[Japanese ? 0x2CA3 : 0x2CF0] = (byte)value; } + get => Data[Japanese ? 0x2CA3 : 0x2CF0]; + set => Data[Japanese ? 0x2CA3 : 0x2CF0] = (byte)value; } public int Badges { - get { return Data[Japanese ? 0x25F8 : 0x2602]; } + get => Data[Japanese ? 0x25F8 : 0x2602]; set { if (value < 0) return; Data[Japanese ? 0x25F8 : 0x2602] = (byte)value; } } private byte Options { - get { return Data[Japanese ? 0x25F7 : 0x2601]; } - set { Data[Japanese ? 0x25F7 : 0x2601] = value; } + get => Data[Japanese ? 0x25F7 : 0x2601]; + set => Data[Japanese ? 0x25F7 : 0x2601] = value; } public bool BattleEffects { - get { return (Options & 0x80) == 0; } - set { Options = (byte)((Options & 0x7F) | (value ? 0 : 0x80)); } + get => (Options & 0x80) == 0; + set => Options = (byte)((Options & 0x7F) | (value ? 0 : 0x80)); } public bool BattleStyleSwitch { - get { return (Options & 0x40) == 0; } - set { Options = (byte)((Options & 0xBF) | (value ? 0 : 0x40)); } + get => (Options & 0x40) == 0; + set => Options = (byte)((Options & 0xBF) | (value ? 0 : 0x40)); } public int Sound { - get { return (Options & 0x30) >> 4; } + get => (Options & 0x30) >> 4; set { var new_sound = value; @@ -299,7 +299,7 @@ public int Sound } public int TextSpeed { - get { return Options & 0x7; } + get => Options & 0x7; set { var new_speed = value; @@ -312,7 +312,7 @@ public int TextSpeed } public override uint Money { - get { return (uint)BigEndian.BCDToInt32(Data, Japanese ? 0x25EE : 0x25F3, 3); } + get => (uint)BigEndian.BCDToInt32(Data, Japanese ? 0x25EE : 0x25F3, 3); set { value = (uint)Math.Min(value, MaxMoney); @@ -321,10 +321,7 @@ public override uint Money } public uint Coin { - get - { - return (uint)BigEndian.BCDToInt32(Data, Japanese ? 0x2846 : 0x2850, 2); - } + get => (uint)BigEndian.BCDToInt32(Data, Japanese ? 0x2846 : 0x2850, 2); set { value = (ushort)Math.Min(value, MaxCoins); @@ -390,11 +387,8 @@ public override void setDaycareOccupied(int loc, int slot, bool occupied) // Storage public override int PartyCount { - get { return Data[Japanese ? 0x2ED5 : 0x2F2C]; } - protected set - { - Data[Japanese ? 0x2ED5 : 0x2F2C] = (byte)value; - } + get => Data[Japanese ? 0x2ED5 : 0x2F2C]; + protected set => Data[Japanese ? 0x2ED5 : 0x2F2C] = (byte)value; } public override int getBoxOffset(int box) { @@ -406,8 +400,8 @@ public override int getPartyOffset(int slot) } public override int CurrentBox { - get { return Data[Japanese ? 0x2842 : 0x284C] & 0x7F; } - set { Data[Japanese ? 0x2842 : 0x284C] = (byte)((Data[Japanese ? 0x2842 : 0x284C] & 0x80) | (value & 0x7F)); } + get => Data[Japanese ? 0x2842 : 0x284C] & 0x7F; + set => Data[Japanese ? 0x2842 : 0x284C] = (byte)((Data[Japanese ? 0x2842 : 0x284C] & 0x80) | (value & 0x7F)); } public override string getBoxName(int box) { diff --git a/PKHeX.Core/Saves/SAV2.cs b/PKHeX.Core/Saves/SAV2.cs index 69cba406c..e08f87bc1 100644 --- a/PKHeX.Core/Saves/SAV2.cs +++ b/PKHeX.Core/Saves/SAV2.cs @@ -223,8 +223,8 @@ private void getSAVOffsets() public override int MaxSpeciesID => Legal.MaxSpeciesID_2; public override int MaxAbilityID => Legal.MaxAbilityID_2; public override int MaxItemID => Legal.MaxItemID_2; - public override int MaxBallID => 0; - public override int MaxGameID => 99; // What do I set this to...? + public override int MaxBallID => 0; // unused + public override int MaxGameID => 99; // unused public override int MaxMoney => 999999; public override int MaxCoins => 9999; @@ -301,12 +301,12 @@ public override bool ChecksumsValid public override string OT { - get { return getString(0x200B, OTLength); } - set { setString(value, OTLength).CopyTo(Data, 0x200B); } + get => getString(0x200B, OTLength); + set => setString(value, OTLength).CopyTo(Data, 0x200B); } public override int Gender { - get { return Version == GameVersion.C ? Data[GenderOffset] : 0; } + get => Version == GameVersion.C ? Data[GenderOffset] : 0; set { if (Version != GameVersion.C) @@ -317,53 +317,52 @@ public override int Gender } public override ushort TID { - get { return BigEndian.ToUInt16(Data, 0x2009); } - set { BigEndian.GetBytes(value).CopyTo(Data, 0x2009); } + get => BigEndian.ToUInt16(Data, 0x2009); set => BigEndian.GetBytes(value).CopyTo(Data, 0x2009); } public override ushort SID { - get { return 0; } + get => 0; set { } } public override int PlayedHours { - get { return BigEndian.ToUInt16(Data, TimePlayedOffset); } - set { BigEndian.GetBytes((ushort)value).CopyTo(Data,TimePlayedOffset); } + get => BigEndian.ToUInt16(Data, TimePlayedOffset); + set => BigEndian.GetBytes((ushort)value).CopyTo(Data, TimePlayedOffset); } public override int PlayedMinutes { - get { return Data[TimePlayedOffset+2]; } - set { Data[TimePlayedOffset+2] = (byte)value; } + get => Data[TimePlayedOffset + 2]; + set => Data[TimePlayedOffset + 2] = (byte)value; } public override int PlayedSeconds { - get { return Data[TimePlayedOffset + 3]; } - set { Data[TimePlayedOffset + 3] = (byte)value; } + get => Data[TimePlayedOffset + 3]; + set => Data[TimePlayedOffset + 3] = (byte)value; } public int Badges { - get { return BitConverter.ToUInt16(Data, JohtoBadgesOffset); } + get => BitConverter.ToUInt16(Data, JohtoBadgesOffset); set { if (value < 0) return; BitConverter.GetBytes(value).CopyTo(Data, JohtoBadgesOffset); } } private byte Options { - get { return Data[0x2000]; } - set { Data[0x2000] = value; } + get => Data[0x2000]; + set => Data[0x2000] = value; } public bool BattleEffects { - get { return (Options & 0x80) == 0; } - set { Options = (byte)((Options & 0x7F) | (value ? 0 : 0x80)); } + get => (Options & 0x80) == 0; + set => Options = (byte)((Options & 0x7F) | (value ? 0 : 0x80)); } public bool BattleStyleSwitch { - get { return (Options & 0x40) == 0; } - set { Options = (byte)((Options & 0xBF) | (value ? 0 : 0x40)); } + get => (Options & 0x40) == 0; + set => Options = (byte)((Options & 0xBF) | (value ? 0 : 0x40)); } public int Sound { - get { return (Options & 0x30) >> 4; } + get => (Options & 0x30) >> 4; set { var new_sound = value; @@ -376,8 +375,7 @@ public int Sound } public int TextSpeed { - get { return Options & 0x7; } - set + get => Options & 0x7; set { var new_speed = value; if (new_speed > 7) @@ -389,7 +387,7 @@ public int TextSpeed } public override uint Money { - get { return BigEndian.ToUInt32(Data, MoneyOffset-1) & 0xFFFFFF; } + get => BigEndian.ToUInt32(Data, MoneyOffset - 1) & 0xFFFFFF; set { byte[] data = BigEndian.GetBytes((uint) Math.Min(value, MaxMoney)); @@ -398,10 +396,7 @@ public override uint Money } public uint Coin { - get - { - return BigEndian.ToUInt16(Data, MoneyOffset + 7); - } + get => BigEndian.ToUInt16(Data, MoneyOffset + 7); set { value = (ushort)Math.Min(value, MaxCoins); @@ -484,11 +479,7 @@ public override void setDaycareOccupied(int loc, int slot, bool occupied) // Storage public override int PartyCount { - get { return Data[PartyOffset]; } - protected set - { - Data[PartyOffset] = (byte)value; - } + get => Data[PartyOffset]; protected set => Data[PartyOffset] = (byte)value; } public override int getBoxOffset(int box) { @@ -500,8 +491,7 @@ public override int getPartyOffset(int slot) } public override int CurrentBox { - get { return Data[CurrentBoxIndexOffset] & 0x7F; } - set { Data[CurrentBoxIndexOffset] = (byte)((Data[Japanese ? 0x2842 : 0x284C] & 0x80) | (value & 0x7F)); } + get => Data[CurrentBoxIndexOffset] & 0x7F; set => Data[CurrentBoxIndexOffset] = (byte)((Data[Japanese ? 0x2842 : 0x284C] & 0x80) | (value & 0x7F)); } public override string getBoxName(int box) { diff --git a/PKHeX.Core/Saves/SAV3.cs b/PKHeX.Core/Saves/SAV3.cs index 5fa57e88c..46800d4f7 100644 --- a/PKHeX.Core/Saves/SAV3.cs +++ b/PKHeX.Core/Saves/SAV3.cs @@ -256,43 +256,43 @@ private uint SecurityKey } public override string OT { - get { return getString(BlockOfs[0], 0x10); } - set { setString(value, 7).CopyTo(Data, BlockOfs[0]); } + get => getString(BlockOfs[0], 0x10); + set => setString(value, 7).CopyTo(Data, BlockOfs[0]); } public override int Gender { - get { return Data[BlockOfs[0] + 8]; } - set { Data[BlockOfs[0] + 8] = (byte)value; } + get => Data[BlockOfs[0] + 8]; + set => Data[BlockOfs[0] + 8] = (byte)value; } public override ushort TID { - get { return BitConverter.ToUInt16(Data, BlockOfs[0] + 0xA + 0); } - set { BitConverter.GetBytes(value).CopyTo(Data, BlockOfs[0] + 0xA + 0); } + get => BitConverter.ToUInt16(Data, BlockOfs[0] + 0xA + 0); + set => BitConverter.GetBytes(value).CopyTo(Data, BlockOfs[0] + 0xA + 0); } public override ushort SID { - get { return BitConverter.ToUInt16(Data, BlockOfs[0] + 0xC); } - set { BitConverter.GetBytes(value).CopyTo(Data, BlockOfs[0] + 0xC); } + get => BitConverter.ToUInt16(Data, BlockOfs[0] + 0xC); + set => BitConverter.GetBytes(value).CopyTo(Data, BlockOfs[0] + 0xC); } public override int PlayedHours { - get { return BitConverter.ToUInt16(Data, BlockOfs[0] + 0xE); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, BlockOfs[0] + 0xE); } + get => BitConverter.ToUInt16(Data, BlockOfs[0] + 0xE); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, BlockOfs[0] + 0xE); } public override int PlayedMinutes { - get { return Data[BlockOfs[0] + 0x10]; } - set { Data[BlockOfs[0] + 0x10] = (byte)value; } + get => Data[BlockOfs[0] + 0x10]; + set => Data[BlockOfs[0] + 0x10] = (byte)value; } public override int PlayedSeconds { - get { return Data[BlockOfs[0] + 0x11]; } - set { Data[BlockOfs[0] + 0x11] = (byte)value; } + get => Data[BlockOfs[0] + 0x11]; + set => Data[BlockOfs[0] + 0x11] = (byte)value; } public int PlayedFrames { - get { return Data[BlockOfs[0] + 0x12]; } - set { Data[BlockOfs[0] + 0x12] = (byte)value; } + get => Data[BlockOfs[0] + 0x12]; + set => Data[BlockOfs[0] + 0x12] = (byte)value; } public int Badges { @@ -365,7 +365,7 @@ public uint Coin } public uint BP { - get { return BitConverter.ToUInt16(Data, BlockOfs[0] + 0xEB8); } + get => BitConverter.ToUInt16(Data, BlockOfs[0] + 0xEB8); set { if (value > 9999) @@ -460,8 +460,8 @@ public override int getPartyOffset(int slot) } public override int CurrentBox { - get { return Data[Box]; } - set { Data[Box] = (byte)value; } + get => Data[Box]; + set => Data[Box] = (byte)value; } protected override int getBoxWallpaperOffset(int box) { @@ -661,10 +661,10 @@ public RTC3(byte[] data = null) Data = data; } - public int Day { get { return BitConverter.ToUInt16(Data, 0x00); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } } - public int Hour { get { return Data[2]; } set { Data[2] = (byte)value; } } - public int Minute { get { return Data[3]; } set { Data[3] = (byte)value; } } - public int Second { get { return Data[4]; } set { Data[4] = (byte)value; } } + public int Day { get => BitConverter.ToUInt16(Data, 0x00); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } + public int Hour { get => Data[2]; set => Data[2] = (byte)value; } + public int Minute { get => Data[3]; set => Data[3] = (byte)value; } + public int Second { get => Data[4]; set => Data[4] = (byte)value; } } public RTC3 ClockInitial { diff --git a/PKHeX.Core/Saves/SAV3Colosseum.cs b/PKHeX.Core/Saves/SAV3Colosseum.cs index 1ca50001a..93ff987f7 100644 --- a/PKHeX.Core/Saves/SAV3Colosseum.cs +++ b/PKHeX.Core/Saves/SAV3Colosseum.cs @@ -268,7 +268,7 @@ public override string ChecksumInfo } // Trainer Info - public override GameVersion Version { get { return GameVersion.COLO; } protected set { } } + public override GameVersion Version { get => GameVersion.COLO; protected set { } } // Storage public override int getPartyOffset(int slot) @@ -328,35 +328,35 @@ protected override void setDex(PKM pkm) private TimeSpan PlayedSpan { - get { return TimeSpan.FromSeconds((double)(BigEndian.ToUInt32(Data, 40) - 0x47000000) / 128); } - set { BigEndian.GetBytes((uint)(value.TotalSeconds * 128) + 0x47000000).CopyTo(Data, 40); } + get => TimeSpan.FromSeconds((double)(BigEndian.ToUInt32(Data, 40) - 0x47000000) / 128); + set => BigEndian.GetBytes((uint)(value.TotalSeconds * 128) + 0x47000000).CopyTo(Data, 40); } public override int PlayedHours { - get { return (ushort)PlayedSpan.Hours; } + get => (ushort)PlayedSpan.Hours; set { var time = PlayedSpan; PlayedSpan = time - TimeSpan.FromHours(time.Hours) + TimeSpan.FromHours(value); } } public override int PlayedMinutes { - get { return (byte)PlayedSpan.Minutes; } + get => (byte)PlayedSpan.Minutes; set { var time = PlayedSpan; PlayedSpan = time - TimeSpan.FromMinutes(time.Minutes) + TimeSpan.FromMinutes(value); } } public override int PlayedSeconds { - get { return (byte)PlayedSpan.Seconds; } + get => (byte)PlayedSpan.Seconds; set { var time = PlayedSpan; PlayedSpan = time - TimeSpan.FromSeconds(time.Seconds) + TimeSpan.FromSeconds(value); } } // Trainer Info (offset 0x78, length 0xB18, end @ 0xB90) - public override string OT { get { return getString(0x78, 20); } set { setString(value, 10).CopyTo(Data, 0x78); OT2 = value; } } - private string OT2 { get { return getString(0x8C, 20); } set { setString(value, 10).CopyTo(Data, 0x8C); } } - public override ushort SID { get { return BigEndian.ToUInt16(Data, 0xA4); } set { BigEndian.GetBytes(value).CopyTo(Data, 0xA4); } } - public override ushort TID { get { return BigEndian.ToUInt16(Data, 0xA6); } set { BigEndian.GetBytes(value).CopyTo(Data, 0xA6); } } + public override string OT { get => getString(0x78, 20); set { setString(value, 10).CopyTo(Data, 0x78); OT2 = value; } } + private string OT2 { get => getString(0x8C, 20); set => setString(value, 10).CopyTo(Data, 0x8C); } + public override ushort SID { get => BigEndian.ToUInt16(Data, 0xA4); set => BigEndian.GetBytes(value).CopyTo(Data, 0xA4); } + public override ushort TID { get => BigEndian.ToUInt16(Data, 0xA6); set => BigEndian.GetBytes(value).CopyTo(Data, 0xA6); } - public override int Gender { get { return Data[0xAF8]; } set { Data[0xAF8] = (byte)value; } } - public override uint Money { get { return BigEndian.ToUInt32(Data, 0xAFC); } set { BigEndian.GetBytes(value).CopyTo(Data, 0xAFC); } } - public uint Coupons { get { return BigEndian.ToUInt32(Data, 0xB00); } set { BigEndian.GetBytes(value).CopyTo(Data, 0xB00); } } - public string RUI_Name { get { return getString(0xB3A, 20); } set { setString(value, 10).CopyTo(Data, 0xB3A); } } + public override int Gender { get => Data[0xAF8]; set => Data[0xAF8] = (byte)value; } + public override uint Money { get => BigEndian.ToUInt32(Data, 0xAFC); set => BigEndian.GetBytes(value).CopyTo(Data, 0xAFC); } + public uint Coupons { get => BigEndian.ToUInt32(Data, 0xB00); set => BigEndian.GetBytes(value).CopyTo(Data, 0xB00); } + public string RUI_Name { get => getString(0xB3A, 20); set => setString(value, 10).CopyTo(Data, 0xB3A); } public override InventoryPouch[] Inventory { diff --git a/PKHeX.Core/Saves/SAV3GCMemoryCard.cs b/PKHeX.Core/Saves/SAV3GCMemoryCard.cs index 71961a6f9..159a0d983 100644 --- a/PKHeX.Core/Saves/SAV3GCMemoryCard.cs +++ b/PKHeX.Core/Saves/SAV3GCMemoryCard.cs @@ -271,7 +271,7 @@ public void SelectSaveGame(GameVersion Game) } public string GCISaveName => getGCISaveGameName(); - public byte[] SelectedSaveData { get { return ReadSaveGameData(); } set { WriteSaveGameData(value); } } + public byte[] SelectedSaveData { get => ReadSaveGameData(); set => WriteSaveGameData(value); } public byte[] Data { get; private set; } private string getGCISaveGameName() diff --git a/PKHeX.Core/Saves/SAV3RSBox.cs b/PKHeX.Core/Saves/SAV3RSBox.cs index 01bb7fc66..d622de68c 100644 --- a/PKHeX.Core/Saves/SAV3RSBox.cs +++ b/PKHeX.Core/Saves/SAV3RSBox.cs @@ -133,21 +133,15 @@ public override string ChecksumInfo } // Trainer Info - public override GameVersion Version { get { return GameVersion.RSBOX; } protected set { } } + public override GameVersion Version { get => GameVersion.RSBOX; protected set { } } // Storage - public override int getPartyOffset(int slot) - { - return -1; - } - public override int getBoxOffset(int box) - { - return Box + 8 + SIZE_STORED * box * 30; - } + public override int getPartyOffset(int slot) => -1; + public override int getBoxOffset(int box) => Box + 8 + SIZE_STORED * box * 30; public override int CurrentBox { - get { return Data[Box + 4]*2; } - set { Data[Box + 4] = (byte)(value/2); } + get => Data[Box + 4] * 2; + set => Data[Box + 4] = (byte)(value / 2); } protected override int getBoxWallpaperOffset(int box) { diff --git a/PKHeX.Core/Saves/SAV3XD.cs b/PKHeX.Core/Saves/SAV3XD.cs index 8928dc587..f9f3cf12e 100644 --- a/PKHeX.Core/Saves/SAV3XD.cs +++ b/PKHeX.Core/Saves/SAV3XD.cs @@ -233,14 +233,14 @@ private static byte[] setXDChecksums(byte[] input, int subOffset0) return data; } // Trainer Info - public override GameVersion Version { get { return GameVersion.XD; } protected set { } } - public override string OT { get { return getString(Trainer1 + 0x00, 20); } set { setString(value, 10).CopyTo(Data, Trainer1 + 0x00); } } - public override ushort SID { get { return BigEndian.ToUInt16(Data, Trainer1 + 0x2C); } set { BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x2C); } } - public override ushort TID { get { return BigEndian.ToUInt16(Data, Trainer1 + 0x2E); } set { BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x2E); } } + public override GameVersion Version { get => GameVersion.XD; protected set { } } + public override string OT { get => getString(Trainer1 + 0x00, 20); set => setString(value, 10).CopyTo(Data, Trainer1 + 0x00); } + public override ushort SID { get => BigEndian.ToUInt16(Data, Trainer1 + 0x2C); set => BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x2C); } + public override ushort TID { get => BigEndian.ToUInt16(Data, Trainer1 + 0x2E); set => BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x2E); } - public override int Gender { get { return Data[Trainer1 + 0x8E0]; } set { Data[Trainer1 + 0x8E0] = (byte)value; } } - public override uint Money { get { return BigEndian.ToUInt32(Data, Trainer1 + 0x8E4); } set { BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x8E4); } } - public uint Coupons { get { return BigEndian.ToUInt32(Data, Trainer1 + 0x8E8); } set { BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x8E8); } } + public override int Gender { get => Data[Trainer1 + 0x8E0]; set => Data[Trainer1 + 0x8E0] = (byte)value; } + public override uint Money { get => BigEndian.ToUInt32(Data, Trainer1 + 0x8E4); set => BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x8E4); } + public uint Coupons { get => BigEndian.ToUInt32(Data, Trainer1 + 0x8E8); set => BigEndian.GetBytes(value).CopyTo(Data, Trainer1 + 0x8E8); } // Storage public override int getPartyOffset(int slot) diff --git a/PKHeX.Core/Saves/SAV4.cs b/PKHeX.Core/Saves/SAV4.cs index 840556468..9db0b3439 100644 --- a/PKHeX.Core/Saves/SAV4.cs +++ b/PKHeX.Core/Saves/SAV4.cs @@ -305,8 +305,8 @@ public override InventoryPouch[] Inventory // Storage public override int PartyCount { - get { return Data[Party - 4]; } - protected set { Data[Party - 4] = (byte)value; } + get => Data[Party - 4]; + protected set => Data[Party - 4] = (byte)value; } public override int getBoxOffset(int box) { @@ -320,42 +320,42 @@ public override int getPartyOffset(int slot) // Trainer Info public override string OT { - get { return getString(Trainer1, 16); } - set { setString(value, OTLength).CopyTo(Data, Trainer1); } + get => getString(Trainer1, 16); + set => setString(value, OTLength).CopyTo(Data, Trainer1); } public override ushort TID { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x10 + 0); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x10 + 0); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x10 + 0); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x10 + 0); } public override ushort SID { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x12); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x12); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x12); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x12); } public override uint Money { - get { return BitConverter.ToUInt32(Data, Trainer1 + 0x14); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14); } + get => BitConverter.ToUInt32(Data, Trainer1 + 0x14); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14); } public override int Gender { - get { return Data[Trainer1 + 0x18]; } - set { Data[Trainer1 + 0x18] = (byte)value; } + get => Data[Trainer1 + 0x18]; + set => Data[Trainer1 + 0x18] = (byte)value; } public override int Language { - get { return Data[Trainer1 + 0x19]; } - set { Data[Trainer1 + 0x19] = (byte)value; } + get => Data[Trainer1 + 0x19]; + set => Data[Trainer1 + 0x19] = (byte)value; } public int Badges { - get { return Data[Trainer1 + 0x1A]; } + get => Data[Trainer1 + 0x1A]; set { if (value < 0) return; Data[Trainer1 + 0x1A] = (byte)value; } } public int Sprite { - get { return Data[Trainer1 + 0x1B]; } + get => Data[Trainer1 + 0x1B]; set { if (value < 0) return; Data[Trainer1 + 0x1B] = (byte)value; } } public int Badges16 @@ -377,18 +377,18 @@ public int Badges16 } public override int PlayedHours { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x22); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x22); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x22); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x22); } public override int PlayedMinutes { - get { return Data[Trainer1 + 0x24]; } - set { Data[Trainer1 + 0x24] = (byte)value; } + get => Data[Trainer1 + 0x24]; + set => Data[Trainer1 + 0x24] = (byte)value; } public override int PlayedSeconds { - get { return Data[Trainer1 + 0x25]; } - set { Data[Trainer1 + 0x25] = (byte)value; } + get => Data[Trainer1 + 0x25]; + set => Data[Trainer1 + 0x25] = (byte)value; } public int M { @@ -500,14 +500,14 @@ public int Y BitConverter.GetBytes((ushort)value).CopyTo(Data, ofs2); } } - public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } } - public override int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } } + public override int SecondsToStart { get => BitConverter.ToInt32(Data, AdventureInfo + 0x34); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } + public override int SecondsToFame { get => BitConverter.ToInt32(Data, AdventureInfo + 0x3C); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } // Storage public override int CurrentBox { - get { return Data[Version == GameVersion.HGSS ? getBoxOffset(BoxCount) : Box - 4]; } - set { Data[Version == GameVersion.HGSS ? getBoxOffset(BoxCount) : Box - 4] = (byte)value; } + get => Data[Version == GameVersion.HGSS ? getBoxOffset(BoxCount) : Box - 4]; + set => Data[Version == GameVersion.HGSS ? getBoxOffset(BoxCount) : Box - 4] = (byte)value; } protected override int getBoxWallpaperOffset(int box) { @@ -565,7 +565,7 @@ public override void setDaycareOccupied(int loc, int slot, bool occupied) } // Mystery Gift - public bool MysteryGiftActive { get { return (Data[GBO + 72] & 1) == 1; } set { Data[GBO + 72] = (byte)((Data[GBO + 72] & 0xFE) | (value ? 1 : 0)); } } + public bool MysteryGiftActive { get => (Data[GBO + 72] & 1) == 1; set => Data[GBO + 72] = (byte)((Data[GBO + 72] & 0xFE) | (value ? 1 : 0)); } private static bool getIsMysteryGiftAvailable(MysteryGift[] value) { if (value == null) diff --git a/PKHeX.Core/Saves/SAV4BR.cs b/PKHeX.Core/Saves/SAV4BR.cs index 1df85a00a..5a81ffb4f 100644 --- a/PKHeX.Core/Saves/SAV4BR.cs +++ b/PKHeX.Core/Saves/SAV4BR.cs @@ -67,7 +67,7 @@ public override byte[] Write(bool DSV) public readonly string[] SaveNames; public int CurrentSlot; protected override int Box { // 4 save slots, data reading depends on current slot - get { return 0x978 + 0x6FF00*CurrentSlot; } + get => 0x978 + 0x6FF00 * CurrentSlot; set { } } @@ -114,7 +114,7 @@ public override bool ChecksumsValid public override string ChecksumInfo => $"Checksums valid: {ChecksumsValid}."; // Trainer Info - public override GameVersion Version { get { return GameVersion.BATREV; } protected set { } } + public override GameVersion Version { get => GameVersion.BATREV; protected set { } } // Storage public override int getPartyOffset(int slot) // TODO diff --git a/PKHeX.Core/Saves/SAV5.cs b/PKHeX.Core/Saves/SAV5.cs index 90ad9ca64..2d95ad02f 100644 --- a/PKHeX.Core/Saves/SAV5.cs +++ b/PKHeX.Core/Saves/SAV5.cs @@ -429,8 +429,8 @@ public override InventoryPouch[] Inventory // Storage public override int PartyCount { - get { return Data[Party + 4]; } - protected set { Data[Party + 4] = (byte)value; } + get => Data[Party + 4]; + protected set => Data[Party + 4] = (byte)value; } public override int getBoxOffset(int box) { @@ -460,12 +460,12 @@ protected override int getBoxWallpaperOffset(int box) } public override int CurrentBox { - get { return Data[PCLayout]; } - set { Data[PCLayout] = (byte)value; } + get => Data[PCLayout]; + set => Data[PCLayout] = (byte)value; } - public override bool BattleBoxLocked // TODO + public override bool BattleBoxLocked { - get { return false; } + get => BattleBox >= 0 && Data[BattleBox + 0x358] != 0; // wifi/live set { } } public override PKM getPKM(byte[] data) @@ -520,88 +520,88 @@ public override MysteryGiftAlbum GiftAlbum BitConverter.GetBytes(value.Seed).CopyTo(Data, wcSeed); } } - protected override bool[] MysteryGiftReceivedFlags { get { return null; } set { } } - protected override MysteryGift[] MysteryGiftCards { get { return new MysteryGift[0]; } set { } } + protected override bool[] MysteryGiftReceivedFlags { get => null; set { } } + protected override MysteryGift[] MysteryGiftCards { get => new MysteryGift[0]; set { } } // Trainer Info public override string OT { - get { return getString(Trainer1 + 0x4, 16); } - set { setString(value, OTLength).CopyTo(Data, Trainer1 + 0x4); } + get => getString(Trainer1 + 0x4, 16); + set => setString(value, OTLength).CopyTo(Data, Trainer1 + 0x4); } public override ushort TID { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x14 + 0); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14 + 0); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x14 + 0); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14 + 0); } public override ushort SID { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x14 + 2); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14 + 2); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x14 + 2); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14 + 2); } public override uint Money { - get { return BitConverter.ToUInt32(Data, Trainer2); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer2); } + get => BitConverter.ToUInt32(Data, Trainer2); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer2); } public override int Gender { - get { return Data[Trainer1 + 0x21]; } - set { Data[Trainer1 + 0x21] = (byte)value; } + get => Data[Trainer1 + 0x21]; + set => Data[Trainer1 + 0x21] = (byte)value; } public override int Language { - get { return Data[Trainer1 + 0x1E]; } - set { Data[Trainer1 + 0x1E] = (byte)value; } + get => Data[Trainer1 + 0x1E]; + set => Data[Trainer1 + 0x1E] = (byte)value; } public override int Game { - get { return Data[Trainer1 + 0x1F]; } - set { Data[Trainer1 + 0x1F] = (byte)value; } + get => Data[Trainer1 + 0x1F]; + set => Data[Trainer1 + 0x1F] = (byte)value; } public int Badges { - get { return Data[Trainer2 + 0x4]; } - set { Data[Trainer2 + 0x4] = (byte)value; } + get => Data[Trainer2 + 0x4]; + set => Data[Trainer2 + 0x4] = (byte)value; } public int M { - get { return BitConverter.ToInt32(Data, Trainer1 + 0x180); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x180); } + get => BitConverter.ToInt32(Data, Trainer1 + 0x180); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x180); } public int X { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x186); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x186); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x186); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x186); } public int Z { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x18A); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x18A); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x18A); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x18A); } public int Y { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x18E); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x18E); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x18E); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x18E); } public override int PlayedHours { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x24); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x24); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x24); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x24); } public override int PlayedMinutes { - get { return Data[Trainer1 + 0x24 + 2]; } - set { Data[Trainer1 + 0x24 + 2] = (byte)value; } + get => Data[Trainer1 + 0x24 + 2]; + set => Data[Trainer1 + 0x24 + 2] = (byte)value; } public override int PlayedSeconds { - get { return Data[Trainer1 + 0x24 + 3]; } - set { Data[Trainer1 + 0x24 + 3] = (byte)value; } + get => Data[Trainer1 + 0x24 + 3]; + set => Data[Trainer1 + 0x24 + 3] = (byte)value; } - public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x34); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } } - public override int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x3C); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } } + public override int SecondsToStart { get => BitConverter.ToInt32(Data, AdventureInfo + 0x34); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x34); } + public override int SecondsToFame { get => BitConverter.ToInt32(Data, AdventureInfo + 0x3C); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x3C); } protected override void setDex(PKM pkm) { diff --git a/PKHeX.Core/Saves/SAV6.cs b/PKHeX.Core/Saves/SAV6.cs index a0ee8d800..065cab30b 100644 --- a/PKHeX.Core/Saves/SAV6.cs +++ b/PKHeX.Core/Saves/SAV6.cs @@ -146,13 +146,13 @@ public override string ChecksumInfo } public override ulong? Secure1 { - get { return BitConverter.ToUInt64(Data, BlockInfoOffset - 0x14); } - set { BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0x14); } + get => BitConverter.ToUInt64(Data, BlockInfoOffset - 0x14); + set => BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0x14); } public override ulong? Secure2 { - get { return BitConverter.ToUInt64(Data, BlockInfoOffset - 0xC); } - set { BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0xC); } + get => BitConverter.ToUInt64(Data, BlockInfoOffset - 0xC); + set => BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0xC); } private void getSAVOffsets() @@ -329,28 +329,28 @@ public override GameVersion Version // Player Information public override ushort TID { - get { return BitConverter.ToUInt16(Data, TrainerCard + 0); } - set { BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 0); } + get => BitConverter.ToUInt16(Data, TrainerCard + 0); + set => BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 0); } public override ushort SID { - get { return BitConverter.ToUInt16(Data, TrainerCard + 2); } - set { BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 2); } + get => BitConverter.ToUInt16(Data, TrainerCard + 2); + set => BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 2); } public override int Game { - get { return Data[TrainerCard + 4]; } - set { Data[TrainerCard + 4] = (byte)value; } + get => Data[TrainerCard + 4]; + set => Data[TrainerCard + 4] = (byte)value; } public override int Gender { - get { return Data[TrainerCard + 5]; } - set { Data[TrainerCard + 5] = (byte)value; } + get => Data[TrainerCard + 5]; + set => Data[TrainerCard + 5] = (byte)value; } public override int MultiplayerSpriteID { - get { return Data[TrainerCard + 7]; } - set { Data[TrainerCard + 7] = (byte)value; } + get => Data[TrainerCard + 7]; + set => Data[TrainerCard + 7] = (byte)value; } public override int GameSyncIDSize => 16; // 64 bits public override string GameSyncID @@ -375,94 +375,94 @@ public override string GameSyncID } public override int SubRegion { - get { return Data[TrainerCard + 0x26]; } - set { Data[TrainerCard + 0x26] = (byte)value; } + get => Data[TrainerCard + 0x26]; + set => Data[TrainerCard + 0x26] = (byte)value; } public override int Country { - get { return Data[TrainerCard + 0x27]; } - set { Data[TrainerCard + 0x27] = (byte)value; } + get => Data[TrainerCard + 0x27]; + set => Data[TrainerCard + 0x27] = (byte)value; } public override int ConsoleRegion { - get { return Data[TrainerCard + 0x2C]; } - set { Data[TrainerCard + 0x2C] = (byte)value; } + get => Data[TrainerCard + 0x2C]; + set => Data[TrainerCard + 0x2C] = (byte)value; } public override int Language { - get { return Data[TrainerCard + 0x2D]; } - set { Data[TrainerCard + 0x2D] = (byte)value; } + get => Data[TrainerCard + 0x2D]; + set => Data[TrainerCard + 0x2D] = (byte)value; } public override string OT { - get { return getString(TrainerCard + 0x48, 0x1A); } - set { setString(value, OTLength).CopyTo(Data, TrainerCard + 0x48); } + get => getString(TrainerCard + 0x48, 0x1A); + set => setString(value, OTLength).CopyTo(Data, TrainerCard + 0x48); } public string OT_Nick { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x62, 0x1A)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x62); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x62, 0x1A)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x62); } public string Saying1 { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 0, 0x22)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 0); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 0, 0x22)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 0); } public string Saying2 { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 1, 0x22)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 1); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 1, 0x22)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 1); } public string Saying3 { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 2, 0x22)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 2); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 2, 0x22)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 2); } public string Saying4 { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 3, 0x22)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 3); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 3, 0x22)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 3); } public string Saying5 { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 4, 0x22)); } - set { Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 4); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, TrainerCard + 0x7C + 0x22 * 4, 0x22)); + set => Encoding.Unicode.GetBytes(value.PadRight(value.Length + 1, '\0')).CopyTo(Data, TrainerCard + 0x7C + 0x22 * 4); } public int M { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x02); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x02); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x02); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x02); } public float X { - get { return BitConverter.ToSingle(Data, Trainer1 + 0x10) / 18; } - set { BitConverter.GetBytes(value * 18).CopyTo(Data, Trainer1 + 0x10); } + get => BitConverter.ToSingle(Data, Trainer1 + 0x10) / 18; + set => BitConverter.GetBytes(value * 18).CopyTo(Data, Trainer1 + 0x10); } public float Z { - get { return BitConverter.ToSingle(Data, Trainer1 + 0x14); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14); } + get => BitConverter.ToSingle(Data, Trainer1 + 0x14); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x14); } public float Y { - get { return BitConverter.ToSingle(Data, Trainer1 + 0x18) / 18; } - set { BitConverter.GetBytes(value * 18).CopyTo(Data, Trainer1 + 0x18); } + get => BitConverter.ToSingle(Data, Trainer1 + 0x18) / 18; + set => BitConverter.GetBytes(value * 18).CopyTo(Data, Trainer1 + 0x18); } public int Style { - get { return Data[Trainer1 + 0x14D]; } - set { Data[Trainer1 + 0x14D] = (byte)value; } + get => Data[Trainer1 + 0x14D]; + set => Data[Trainer1 + 0x14D] = (byte)value; } public override uint Money { - get { return BitConverter.ToUInt32(Data, Trainer2 + 0x8); } - set { BitConverter.GetBytes(value).CopyTo(Data, Trainer2 + 0x8); } + get => BitConverter.ToUInt32(Data, Trainer2 + 0x8); + set => BitConverter.GetBytes(value).CopyTo(Data, Trainer2 + 0x8); } public int Badges { - get { return Data[Trainer2 + 0xC]; } - set { Data[Trainer2 + 0xC] = (byte)value; } + get => Data[Trainer2 + 0xC]; + set => Data[Trainer2 + 0xC] = (byte)value; } public int BP { @@ -496,35 +496,32 @@ public int Vivillon } public override int PlayedHours - { - get { return BitConverter.ToUInt16(Data, PlayTime); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, PlayTime); } + { + get => BitConverter.ToUInt16(Data, PlayTime); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, PlayTime); } public override int PlayedMinutes { - get { return Data[PlayTime + 2]; } - set { Data[PlayTime + 2] = (byte)value; } + get => Data[PlayTime + 2]; + set => Data[PlayTime + 2] = (byte)value; } public override int PlayedSeconds { - get { return Data[PlayTime + 3]; } - set { Data[PlayTime + 3] = (byte)value; } + get => Data[PlayTime + 3]; + set => Data[PlayTime + 3] = (byte)value; } - private uint LastSaved { get { return BitConverter.ToUInt32(Data, PlayTime + 0x4); } set { BitConverter.GetBytes(value).CopyTo(Data, PlayTime + 0x4); } } - private int LastSavedYear { get { return (int)(LastSaved & 0xFFF); } set { LastSaved = LastSaved & 0xFFFFF000 | (uint)value; } } - private int LastSavedMonth { get { return (int)(LastSaved >> 12 & 0xF); } set { LastSaved = LastSaved & 0xFFFF0FFF | ((uint)value & 0xF) << 12; } } - private int LastSavedDay { get { return (int)(LastSaved >> 16 & 0x1F); } set { LastSaved = LastSaved & 0xFFE0FFFF | ((uint)value & 0x1F) << 16; } } - private int LastSavedHour { get { return (int)(LastSaved >> 21 & 0x1F); } set { LastSaved = LastSaved & 0xFC1FFFFF | ((uint)value & 0x1F) << 21; } } - private int LastSavedMinute { get { return (int)(LastSaved >> 26 & 0x3F); } set { LastSaved = LastSaved & 0x03FFFFFF | ((uint)value & 0x3F) << 26; } } + private uint LastSaved { get => BitConverter.ToUInt32(Data, PlayTime + 0x4); set => BitConverter.GetBytes(value).CopyTo(Data, PlayTime + 0x4); } + private int LastSavedYear { get => (int)(LastSaved & 0xFFF); set => LastSaved = LastSaved & 0xFFFFF000 | (uint)value; } + private int LastSavedMonth { get => (int)(LastSaved >> 12 & 0xF); set => LastSaved = LastSaved & 0xFFFF0FFF | ((uint)value & 0xF) << 12; } + private int LastSavedDay { get => (int)(LastSaved >> 16 & 0x1F); set => LastSaved = LastSaved & 0xFFE0FFFF | ((uint)value & 0x1F) << 16; } + private int LastSavedHour { get => (int)(LastSaved >> 21 & 0x1F); set => LastSaved = LastSaved & 0xFC1FFFFF | ((uint)value & 0x1F) << 21; } + private int LastSavedMinute { get => (int)(LastSaved >> 26 & 0x3F); set => LastSaved = LastSaved & 0x03FFFFFF | ((uint)value & 0x3F) << 26; } private string LastSavedTime => $"{LastSavedYear:0000}{LastSavedMonth:00}{LastSavedDay:00}{LastSavedHour:00}{LastSavedMinute:00}"; public DateTime? LastSavedDate { - get - { - return !Util.IsDateValid(LastSavedYear, LastSavedMonth, LastSavedDay) + get => !Util.IsDateValid(LastSavedYear, LastSavedMonth, LastSavedDay) ? (DateTime?)null : new DateTime(LastSavedYear, LastSavedMonth, LastSavedDay, LastSavedHour, LastSavedMinute, 0); - } set { // Only update the properties if a value is provided. @@ -549,14 +546,14 @@ public override int PlayedSeconds } } - public int ResumeYear { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x4); } set { BitConverter.GetBytes(value).CopyTo(Data,AdventureInfo + 0x4); } } - public int ResumeMonth { get { return Data[AdventureInfo + 0x8]; } set { Data[AdventureInfo + 0x8] = (byte)value; } } - public int ResumeDay { get { return Data[AdventureInfo + 0x9]; } set { Data[AdventureInfo + 0x9] = (byte)value; } } - public int ResumeHour { get { return Data[AdventureInfo + 0xB]; } set { Data[AdventureInfo + 0xB] = (byte)value; } } - public int ResumeMinute { get { return Data[AdventureInfo + 0xC]; } set { Data[AdventureInfo + 0xC] = (byte)value; } } - public int ResumeSeconds { get { return Data[AdventureInfo + 0xD]; } set { Data[AdventureInfo + 0xD] = (byte)value; } } - public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x18); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x18); } } - public override int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x20); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x20); } } + public int ResumeYear { get => BitConverter.ToInt32(Data, AdventureInfo + 0x4); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x4); } + public int ResumeMonth { get => Data[AdventureInfo + 0x8]; set => Data[AdventureInfo + 0x8] = (byte)value; } + public int ResumeDay { get => Data[AdventureInfo + 0x9]; set => Data[AdventureInfo + 0x9] = (byte)value; } + public int ResumeHour { get => Data[AdventureInfo + 0xB]; set => Data[AdventureInfo + 0xB] = (byte)value; } + public int ResumeMinute { get => Data[AdventureInfo + 0xC]; set => Data[AdventureInfo + 0xC] = (byte)value; } + public int ResumeSeconds { get => Data[AdventureInfo + 0xD]; set => Data[AdventureInfo + 0xD] = (byte)value; } + public override int SecondsToStart { get => BitConverter.ToInt32(Data, AdventureInfo + 0x18); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x18); } + public override int SecondsToFame { get => BitConverter.ToInt32(Data, AdventureInfo + 0x20); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x20); } public uint getPSSStat(int index) { return BitConverter.ToUInt32(Data, PSSStats + 4*index); } public void setPSSStat(int index, uint value) { BitConverter.GetBytes(value).CopyTo(Data, PSSStats + 4*index); } @@ -640,8 +637,8 @@ public override void setDaycareHasEgg(int loc, bool hasEgg) Data[ofs + 0x1E0] = (byte)(hasEgg ? 1 : 0); } - public byte[] Puffs { get { return getData(Puff, 100); } set { value.CopyTo(Data, Puff); } } - public int PuffCount { get { return BitConverter.ToInt32(Data, Puff + 100); } set { BitConverter.GetBytes(value).CopyTo(Data, Puff + 100); } } + public byte[] Puffs { get => getData(Puff, 100); set => value.CopyTo(Data, Puff); } + public int PuffCount { get => BitConverter.ToInt32(Data, Puff + 100); set => BitConverter.GetBytes(value).CopyTo(Data, Puff + 100); } public int[] SelectItems { @@ -712,7 +709,7 @@ public override InventoryPouch[] Inventory } // Storage - public override int CurrentBox { get { return Data[LastViewedBox]; } set { Data[LastViewedBox] = (byte)value; } } + public override int CurrentBox { get => Data[LastViewedBox]; set => Data[LastViewedBox] = (byte)value; } public override int getPartyOffset(int slot) { return Party + SIZE_PARTY * slot; @@ -872,18 +869,18 @@ public override byte[] decryptPKM(byte[] data) } public override int PartyCount { - get { return Data[Party + 6 * SIZE_PARTY]; } - protected set { Data[Party + 6 * SIZE_PARTY] = (byte)value; } + get => Data[Party + 6 * SIZE_PARTY]; + protected set => Data[Party + 6 * SIZE_PARTY] = (byte)value; } public override bool BattleBoxLocked { - get { return Data[BattleBox + 6 * SIZE_STORED] != 0; } - set { Data[BattleBox + 6 * SIZE_STORED] = (byte)(value ? 1 : 0); } + get => Data[BattleBox + 6 * SIZE_STORED] != 0; + set => Data[BattleBox + 6 * SIZE_STORED] = (byte)(value ? 1 : 0); } - public override int BoxesUnlocked { get { return Data[PCFlags + 1] - 1; } set { Data[PCFlags + 1] = (byte)(value + 1); } } + public override int BoxesUnlocked { get => Data[PCFlags + 1] - 1; set => Data[PCFlags + 1] = (byte)(value + 1); } public override byte[] BoxFlags { - get { return new[] { Data[PCFlags], Data[PCFlags + 2] }; } + get => new[] { Data[PCFlags], Data[PCFlags + 2] }; set { if (value.Length != 2) return; diff --git a/PKHeX.Core/Saves/SAV7.cs b/PKHeX.Core/Saves/SAV7.cs index 394a0cb75..a26da9c88 100644 --- a/PKHeX.Core/Saves/SAV7.cs +++ b/PKHeX.Core/Saves/SAV7.cs @@ -186,13 +186,13 @@ public override string ChecksumInfo } public override ulong? Secure1 { - get { return BitConverter.ToUInt64(Data, BlockInfoOffset - 0x14); } - set { BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0x14); } + get => BitConverter.ToUInt64(Data, BlockInfoOffset - 0x14); + set => BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0x14); } public override ulong? Secure2 { - get { return BitConverter.ToUInt64(Data, BlockInfoOffset - 0xC); } - set { BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0xC); } + get => BitConverter.ToUInt64(Data, BlockInfoOffset - 0xC); + set => BitConverter.GetBytes(value ?? 0).CopyTo(Data, BlockInfoOffset - 0xC); } private void getSAVOffsets() @@ -338,23 +338,23 @@ public override GameVersion Version // Player Information public override ushort TID { - get { return BitConverter.ToUInt16(Data, TrainerCard + 0); } - set { BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 0); } + get => BitConverter.ToUInt16(Data, TrainerCard + 0); + set => BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 0); } public override ushort SID { - get { return BitConverter.ToUInt16(Data, TrainerCard + 2); } - set { BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 2); } + get => BitConverter.ToUInt16(Data, TrainerCard + 2); + set => BitConverter.GetBytes(value).CopyTo(Data, TrainerCard + 2); } public override int Game { - get { return Data[TrainerCard + 4]; } - set { Data[TrainerCard + 4] = (byte)value; } + get => Data[TrainerCard + 4]; + set => Data[TrainerCard + 4] = (byte)value; } public override int Gender { - get { return Data[TrainerCard + 5]; } - set { Data[TrainerCard + 5] = (byte)value; } + get => Data[TrainerCard + 5]; + set => Data[TrainerCard + 5] = (byte)value; } public override int GameSyncIDSize => 16; // 64 bits public override string GameSyncID @@ -402,47 +402,47 @@ public string NexUniqueID } public override int SubRegion { - get { return Data[TrainerCard + 0x2E]; } - set { Data[TrainerCard + 0x2E] = (byte)value; } + get => Data[TrainerCard + 0x2E]; + set => Data[TrainerCard + 0x2E] = (byte)value; } public override int Country { - get { return Data[TrainerCard + 0x2F]; } - set { Data[TrainerCard + 0x2F] = (byte)value; } + get => Data[TrainerCard + 0x2F]; + set => Data[TrainerCard + 0x2F] = (byte)value; } public override int ConsoleRegion { - get { return Data[TrainerCard + 0x34]; } - set { Data[TrainerCard + 0x34] = (byte)value; } + get => Data[TrainerCard + 0x34]; + set => Data[TrainerCard + 0x34] = (byte)value; } public override int Language { - get { return Data[TrainerCard + 0x35]; } - set { Data[TrainerCard + 0x35] = (byte)value; } + get => Data[TrainerCard + 0x35]; + set => Data[TrainerCard + 0x35] = (byte)value; } public override string OT { - get { return getString(TrainerCard + 0x38, 0x1A); } - set { setString(value, OTLength).CopyTo(Data, TrainerCard + 0x38); } + get => getString(TrainerCard + 0x38, 0x1A); + set => setString(value, OTLength).CopyTo(Data, TrainerCard + 0x38); } public int DressUpSkinColor { - get { return (Data[TrainerCard + 0x54] >> 2) & 7; } - set { Data[TrainerCard + 0x54] = (byte)((Data[TrainerCard + 0x54] & ~(7 << 2)) | (value << 2)); } + get => (Data[TrainerCard + 0x54] >> 2) & 7; + set => Data[TrainerCard + 0x54] = (byte)((Data[TrainerCard + 0x54] & ~(7 << 2)) | (value << 2)); } public int BallThrowType { - get { return Data[TrainerCard + 0x7A]; } - set { Data[TrainerCard + 0x7A] = (byte)(value > 8 ? 0 : value); } + get => Data[TrainerCard + 0x7A]; + set => Data[TrainerCard + 0x7A] = (byte)(value > 8 ? 0 : value); } public int M { - get { return BitConverter.ToUInt16(Data, Trainer1 + 0x00); } // could be anywhere 0x0-0x7 - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x00); } + get => BitConverter.ToUInt16(Data, Trainer1 + 0x00); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, Trainer1 + 0x00); } public float X { - get { return BitConverter.ToSingle(Data, Trainer1 + 0x08); } + get => BitConverter.ToSingle(Data, Trainer1 + 0x08); set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x08); @@ -451,7 +451,7 @@ public float X } public float Z { - get { return BitConverter.ToSingle(Data, Trainer1 + 0x10); } + get => BitConverter.ToSingle(Data, Trainer1 + 0x10); set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x10); @@ -460,7 +460,7 @@ public float Z } public float Y { - get { return (int)BitConverter.ToSingle(Data, Trainer1 + 0x18); } + get => (int)BitConverter.ToSingle(Data, Trainer1 + 0x18); set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x18); @@ -469,7 +469,7 @@ public float Y } public float R { - get { return (int)BitConverter.ToSingle(Data, Trainer1 + 0x20); } + get => (int)BitConverter.ToSingle(Data, Trainer1 + 0x20); set { BitConverter.GetBytes(value).CopyTo(Data, Trainer1 + 0x20); @@ -479,7 +479,7 @@ public float R public override uint Money { - get { return BitConverter.ToUInt32(Data, Misc + 0x4); } + get => BitConverter.ToUInt32(Data, Misc + 0x4); set { if (value > 9999999) value = 9999999; @@ -488,10 +488,7 @@ public override uint Money } public uint Stamps { - get // 15 stamps - { - return (BitConverter.ToUInt32(Data, Misc + 0x08) << 13) >> 17; // discard top13, lowest4 - } + get => (BitConverter.ToUInt32(Data, Misc + 0x08) << 13) >> 17; // 15 stamps; discard top13, lowest4 set { uint flags = BitConverter.ToUInt32(Data, Misc + 0x08) & 0xFFF8000F; @@ -501,7 +498,7 @@ public uint Stamps } public uint BP { - get { return BitConverter.ToUInt32(Data, Misc + 0x11C); } + get => BitConverter.ToUInt32(Data, Misc + 0x11C); set { if (value > 9999) value = 9999; @@ -510,17 +507,17 @@ public uint BP } public int Vivillon { - get { return Data[Misc + 0x130] & 0x1F; } - set { Data[Misc + 0x130] = (byte)((Data[Misc + 0x130] & ~0x1F) | (value & 0x1F)); } + get => Data[Misc + 0x130] & 0x1F; + set => Data[Misc + 0x130] = (byte)((Data[Misc + 0x130] & ~0x1F) | (value & 0x1F)); } public int DaysFromRefreshed { - get { return Data[Misc + 0x123]; } - set { Data[Misc + 0x123] = (byte)value; } + get => Data[Misc + 0x123]; + set => Data[Misc + 0x123] = (byte)value; } public uint UsedFestaCoins { - get { return BitConverter.ToUInt32(Data, 0x69C98); } + get => BitConverter.ToUInt32(Data, 0x69C98); set { if (value > 9999999) value = 9999999; @@ -529,7 +526,7 @@ public uint UsedFestaCoins } public uint FestaCoins { - get { return BitConverter.ToUInt32(Data, JoinFestaData + 0x508); } + get => BitConverter.ToUInt32(Data, JoinFestaData + 0x508); set { if (value > 9999999) value = 9999999; @@ -540,7 +537,7 @@ public uint FestaCoins } private uint TotalFestaCoins { - get { return BitConverter.ToUInt32(Data, JoinFestaData + 0x50C); } + get => BitConverter.ToUInt32(Data, JoinFestaData + 0x50C); set { if (value > 9999999) value = 9999999; @@ -549,7 +546,7 @@ private uint TotalFestaCoins } public string FestivalPlazaName { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, JoinFestaData + 0x510, 0x2A)); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, JoinFestaData + 0x510, 0x2A)); set { const int max = 20; @@ -578,35 +575,32 @@ public FashionItem[] Wardrobe } public override int PlayedHours - { - get { return BitConverter.ToUInt16(Data, PlayTime); } - set { BitConverter.GetBytes((ushort)value).CopyTo(Data, PlayTime); } + { + get => BitConverter.ToUInt16(Data, PlayTime); + set => BitConverter.GetBytes((ushort)value).CopyTo(Data, PlayTime); } public override int PlayedMinutes { - get { return Data[PlayTime + 2]; } - set { Data[PlayTime + 2] = (byte)value; } + get => Data[PlayTime + 2]; + set => Data[PlayTime + 2] = (byte)value; } public override int PlayedSeconds { - get { return Data[PlayTime + 3]; } - set { Data[PlayTime + 3] = (byte)value; } + get => Data[PlayTime + 3]; + set => Data[PlayTime + 3] = (byte)value; } - private uint LastSaved { get { return BitConverter.ToUInt32(Data, PlayTime + 0x4); } set { BitConverter.GetBytes(value).CopyTo(Data, PlayTime + 0x4); } } - private int LastSavedYear { get { return (int)(LastSaved & 0xFFF); } set { LastSaved = LastSaved & 0xFFFFF000 | (uint)value; } } - private int LastSavedMonth { get { return (int)(LastSaved >> 12 & 0xF); } set { LastSaved = LastSaved & 0xFFFF0FFF | ((uint)value & 0xF) << 12; } } - private int LastSavedDay { get { return (int)(LastSaved >> 16 & 0x1F); } set { LastSaved = LastSaved & 0xFFE0FFFF | ((uint)value & 0x1F) << 16; } } - private int LastSavedHour { get { return (int)(LastSaved >> 21 & 0x1F); } set { LastSaved = LastSaved & 0xFC1FFFFF | ((uint)value & 0x1F) << 21; } } - private int LastSavedMinute { get { return (int)(LastSaved >> 26 & 0x3F); } set { LastSaved = LastSaved & 0x03FFFFFF | ((uint)value & 0x3F) << 26; } } + private uint LastSaved { get => BitConverter.ToUInt32(Data, PlayTime + 0x4); set => BitConverter.GetBytes(value).CopyTo(Data, PlayTime + 0x4); } + private int LastSavedYear { get => (int)(LastSaved & 0xFFF); set => LastSaved = LastSaved & 0xFFFFF000 | (uint)value; } + private int LastSavedMonth { get => (int)(LastSaved >> 12 & 0xF); set => LastSaved = LastSaved & 0xFFFF0FFF | ((uint)value & 0xF) << 12; } + private int LastSavedDay { get => (int)(LastSaved >> 16 & 0x1F); set => LastSaved = LastSaved & 0xFFE0FFFF | ((uint)value & 0x1F) << 16; } + private int LastSavedHour { get => (int)(LastSaved >> 21 & 0x1F); set => LastSaved = LastSaved & 0xFC1FFFFF | ((uint)value & 0x1F) << 21; } + private int LastSavedMinute { get => (int)(LastSaved >> 26 & 0x3F); set => LastSaved = LastSaved & 0x03FFFFFF | ((uint)value & 0x3F) << 26; } private string LastSavedTime => $"{LastSavedYear:0000}{LastSavedMonth:00}{LastSavedDay:00}{LastSavedHour:00}{LastSavedMinute:00}"; public DateTime? LastSavedDate { - get - { - return !Util.IsDateValid(LastSavedYear, LastSavedMonth, LastSavedDay) - ? (DateTime?)null + get => !Util.IsDateValid(LastSavedYear, LastSavedMonth, LastSavedDay) + ? (DateTime?)null : new DateTime(LastSavedYear, LastSavedMonth, LastSavedDay, LastSavedHour, LastSavedMinute, 0); - } set { // Only update the properties if a value is provided. @@ -631,16 +625,16 @@ public override int PlayedSeconds } } - public int ResumeYear { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x4); } set { BitConverter.GetBytes(value).CopyTo(Data,AdventureInfo + 0x4); } } - public int ResumeMonth { get { return Data[AdventureInfo + 0x8]; } set { Data[AdventureInfo + 0x8] = (byte)value; } } - public int ResumeDay { get { return Data[AdventureInfo + 0x9]; } set { Data[AdventureInfo + 0x9] = (byte)value; } } - public int ResumeHour { get { return Data[AdventureInfo + 0xB]; } set { Data[AdventureInfo + 0xB] = (byte)value; } } - public int ResumeMinute { get { return Data[AdventureInfo + 0xC]; } set { Data[AdventureInfo + 0xC] = (byte)value; } } - public int ResumeSeconds { get { return Data[AdventureInfo + 0xD]; } set { Data[AdventureInfo + 0xD] = (byte)value; } } - public override int SecondsToStart { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x28); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x28); } } - public override int SecondsToFame { get { return BitConverter.ToInt32(Data, AdventureInfo + 0x30); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x30); } } + public int ResumeYear { get => BitConverter.ToInt32(Data, AdventureInfo + 0x4); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x4); } + public int ResumeMonth { get => Data[AdventureInfo + 0x8]; set => Data[AdventureInfo + 0x8] = (byte)value; } + public int ResumeDay { get => Data[AdventureInfo + 0x9]; set => Data[AdventureInfo + 0x9] = (byte)value; } + public int ResumeHour { get => Data[AdventureInfo + 0xB]; set => Data[AdventureInfo + 0xB] = (byte)value; } + public int ResumeMinute { get => Data[AdventureInfo + 0xC]; set => Data[AdventureInfo + 0xC] = (byte)value; } + public int ResumeSeconds { get => Data[AdventureInfo + 0xD]; set => Data[AdventureInfo + 0xD] = (byte)value; } + public override int SecondsToStart { get => BitConverter.ToInt32(Data, AdventureInfo + 0x28); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x28); } + public override int SecondsToFame { get => BitConverter.ToInt32(Data, AdventureInfo + 0x30); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x30); } - public ulong AlolaTime { get { return BitConverter.ToUInt64(Data, AdventureInfo + 0x48); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo+0x48);} } + public ulong AlolaTime { get => BitConverter.ToUInt64(Data, AdventureInfo + 0x48); set => BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo + 0x48); } // Stat Records public int getRecord(int recordID) @@ -701,17 +695,17 @@ public int getRecordOffset(int recordID) public ushort PokeFinderCameraVersion { - get { return BitConverter.ToUInt16(Data, PokeFinderSave + 0x00); } - set { BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x00); } + get => BitConverter.ToUInt16(Data, PokeFinderSave + 0x00); + set => BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x00); } public bool PokeFinderGyroFlag { - get { return BitConverter.ToUInt16(Data, PokeFinderSave + 0x02) == 1; } - set { BitConverter.GetBytes((ushort)(value ? 1 : 0)).CopyTo(Data, PokeFinderSave + 0x02); } + get => BitConverter.ToUInt16(Data, PokeFinderSave + 0x02) == 1; + set => BitConverter.GetBytes((ushort)(value ? 1 : 0)).CopyTo(Data, PokeFinderSave + 0x02); } public uint PokeFinderSnapCount { - get { return BitConverter.ToUInt32(Data, PokeFinderSave + 0x04); } + get => BitConverter.ToUInt32(Data, PokeFinderSave + 0x04); set { if (value > 9999999) // Top bound is unchecked, check anyway @@ -721,16 +715,12 @@ public uint PokeFinderSnapCount } public uint PokeFinderThumbsTotalValue { - get { return BitConverter.ToUInt32(Data, PokeFinderSave + 0x0C); } - set - { - BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x0C); - - } + get => BitConverter.ToUInt32(Data, PokeFinderSave + 0x0C); + set => BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x0C); } public uint PokeFinderThumbsHighValue { - get { return BitConverter.ToUInt32(Data, PokeFinderSave + 0x10); } + get => BitConverter.ToUInt32(Data, PokeFinderSave + 0x10); set { if (value > 9999999) // 9mil; @@ -743,8 +733,8 @@ public uint PokeFinderThumbsHighValue } public ushort PokeFinderTutorialFlags { - get { return BitConverter.ToUInt16(Data, PokeFinderSave + 0x14); } - set { BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x14); } + get => BitConverter.ToUInt16(Data, PokeFinderSave + 0x14); + set => BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x14); } // Inventory @@ -822,7 +812,7 @@ public void SetPokebeanCount(int bean_id, int count) } // Storage - public override int CurrentBox { get { return Data[LastViewedBox]; } set { Data[LastViewedBox] = (byte)value; } } + public override int CurrentBox { get => Data[LastViewedBox]; set => Data[LastViewedBox] = (byte)value; } public override int getPartyOffset(int slot) { return Party + SIZE_PARTY * slot; @@ -1069,10 +1059,10 @@ public override byte[] decryptPKM(byte[] data) } public override int PartyCount { - get { return Data[Party + 6 * SIZE_PARTY]; } - protected set { Data[Party + 6 * SIZE_PARTY] = (byte)value; } + get => Data[Party + 6 * SIZE_PARTY]; + protected set => Data[Party + 6 * SIZE_PARTY] = (byte)value; } - public override int BoxesUnlocked { get { return Data[PCFlags + 1]; } set { Data[PCFlags + 1] = (byte)value; } } + public override int BoxesUnlocked { get => Data[PCFlags + 1]; set => Data[PCFlags + 1] = (byte)value; } public override bool getIsSlotLocked(int box, int slot) { if (slot >= 30 || box >= BoxCount) @@ -1284,7 +1274,7 @@ public override string MiscSaveInfo() } public byte BallThrowTypeUnlocked { - get { return (byte)(((BitConverter.ToUInt16(Data, 0x23F4) << 4) >> 10) << 2); } + get => (byte)(((BitConverter.ToUInt16(Data, 0x23F4) << 4) >> 10) << 2); set { ushort flags = (ushort)(BitConverter.ToUInt16(Data, 0x23F4) & 0xF03F); @@ -1294,22 +1284,19 @@ public byte BallThrowTypeUnlocked } public byte BallThrowTypeLearned { - get { return (byte)((Data[0x2583] & 0x7F) << 1); } - set { Data[0x2583] = (byte)((Data[0x2583] & 0x80) | ((value & 0xFE) >> 1)); } + get => (byte)((Data[0x2583] & 0x7F) << 1); + set => Data[0x2583] = (byte)((Data[0x2583] & 0x80) | ((value & 0xFE) >> 1)); } public byte BattleTreeSuperUnlocked { - get { return (byte)(Data[0x23F9] >> 5); } - set { Data[0x23F9] = (byte)((Data[0x23F9] & 0x1F) | ((value & 0x07) << 5)); } + get => (byte)(Data[0x23F9] >> 5); + set => Data[0x23F9] = (byte)((Data[0x23F9] & 0x1F) | ((value & 0x07) << 5)); } public bool MegaUnlocked { - get { return (Data[0x1278] & 0x01) != 0; } - set - { - Data[0x1278] = (byte)((Data[0x1278] & 0xFE) | (value ? 1 : 0)); // in battle - // Data[0x1F22] = (byte)((Data[0x1F22] & 0xFE) | (value ? 1 : 0)); // event - } + get => (Data[0x1278] & 0x01) != 0; + set => Data[0x1278] = (byte)((Data[0x1278] & 0xFE) | (value ? 1 : 0)); // in battle + // Data[0x1F22] = (byte)((Data[0x1F22] & 0xFE) | (value ? 1 : 0)); // event } public override bool RequiresMemeCrypto => true; diff --git a/PKHeX.Core/Saves/SaveFile.cs b/PKHeX.Core/Saves/SaveFile.cs index a65a2ff5a..4f8464f57 100644 --- a/PKHeX.Core/Saves/SaveFile.cs +++ b/PKHeX.Core/Saves/SaveFile.cs @@ -291,18 +291,15 @@ public ushort[] EventConsts protected int OFS_PouchZCrystals { get; set; } = int.MinValue; // Mystery Gift - protected virtual bool[] MysteryGiftReceivedFlags { get { return null; } set { } } - protected virtual MysteryGift[] MysteryGiftCards { get { return null; } set { } } + protected virtual bool[] MysteryGiftReceivedFlags { get => null; set { } } + protected virtual MysteryGift[] MysteryGiftCards { get => null; set { } } public virtual MysteryGiftAlbum GiftAlbum { - get + get => new MysteryGiftAlbum { - return new MysteryGiftAlbum - { - Flags = MysteryGiftReceivedFlags, - Gifts = MysteryGiftCards - }; - } + Flags = MysteryGiftReceivedFlags, + Gifts = MysteryGiftCards + }; set { MysteryGiftReceivedFlags = value.Flags; @@ -310,17 +307,17 @@ public virtual MysteryGiftAlbum GiftAlbum } } - public virtual bool BattleBoxLocked { get { return false; } set { } } + public virtual bool BattleBoxLocked { get => false; set { } } public virtual string JPEGTitle => null; public virtual byte[] JPEGData => null; - public virtual int Country { get { return -1; } set { } } - public virtual int ConsoleRegion { get { return -1; } set { } } - public virtual int SubRegion { get { return -1; } set { } } + public virtual int Country { get => -1; set { } } + public virtual int ConsoleRegion { get => -1; set { } } + public virtual int SubRegion { get => -1; set { } } // Trainer Info public virtual int Gender { get; set; } - public virtual int Language { get { return -1; } set { } } - public virtual int Game { get { return -1; } set { } } + public virtual int Language { get => -1; set { } } + public virtual int Game { get => -1; set { } } public virtual ushort TID { get; set; } public virtual ushort SID { get; set; } public int TrainerID7 => (int)((uint)(TID | (SID << 16)) % 1000000); @@ -333,7 +330,7 @@ public virtual MysteryGiftAlbum GiftAlbum public virtual uint Money { get; set; } public abstract int BoxCount { get; } public virtual int PartyCount { get; protected set; } - public virtual int MultiplayerSpriteID { get { return 0; } set { } } + public virtual int MultiplayerSpriteID { get => 0; set { } } // Varied Methods protected abstract void setChecksums(); @@ -342,9 +339,9 @@ public virtual MysteryGiftAlbum GiftAlbum public abstract string getBoxName(int box); public abstract void setBoxName(int box, string val); public virtual int GameSyncIDSize { get; } = 8; - public virtual string GameSyncID { get { return null; } set { } } - public virtual ulong? Secure1 { get { return null; } set { } } - public virtual ulong? Secure2 { get { return null; } set { } } + public virtual string GameSyncID { get => null; set { } } + public virtual ulong? Secure1 { get => null; set { } } + public virtual ulong? Secure2 { get => null; set { } } // Daycare public int DaycareIndex = 0; @@ -362,9 +359,9 @@ public virtual MysteryGiftAlbum GiftAlbum // Storage public virtual int BoxSlotCount => 30; - public virtual int BoxesUnlocked { get { return -1; } set { } } - public virtual byte[] BoxFlags { get { return null; } set { } } - public virtual int CurrentBox { get { return 0; } set { } } + public virtual int BoxesUnlocked { get => -1; set { } } + public virtual byte[] BoxFlags { get => null; set { } } + public virtual int CurrentBox { get => 0; set { } } protected int[] LockedSlots = new int[0]; protected int[] TeamSlots = new int[0]; public bool MoveBox(int box, int insertBeforeBox) diff --git a/PKHeX.Core/Saves/Substructures/BV6.cs b/PKHeX.Core/Saves/Substructures/BV6.cs index 78e63062b..00ae7462f 100644 --- a/PKHeX.Core/Saves/Substructures/BV6.cs +++ b/PKHeX.Core/Saves/Substructures/BV6.cs @@ -21,33 +21,33 @@ public BV6(byte[] data) private readonly byte[] Data; - private int Mode { get { return Data[0x00]; } set { Data[0x00] = (byte)value; } } + private int Mode { get => Data[0x00]; set => Data[0x00] = (byte)value; } private string[] BVmode = { "Link", "Maison", "Super Maison", "Battle Spot - Free", "Battle Spot - Rating", "Battle Spot - Special", "UNUSED", "JP-1", "JP-2", "BROKEN", }; - private int Style { get { return Data[0x01]; } set { Data[0x01] = (byte)value; } } + private int Style { get => Data[0x01]; set => Data[0x01] = (byte)value; } private string[] BVstyle = { "Single", "Double", "Triple", "Rotation", "Multi", }; private string Debug1 { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x6, 24)); } - set { Encoding.Unicode.GetBytes(value.PadRight(12, '\0')).CopyTo(Data, 0x6); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x6, 24)); + set => Encoding.Unicode.GetBytes(value.PadRight(12, '\0')).CopyTo(Data, 0x6); } private string Debug2 { - get { return Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x50, 24)); } - set { Encoding.Unicode.GetBytes(value.PadRight(12, '\0')).CopyTo(Data, 0x50); } + get => Util.TrimFromZero(Encoding.Unicode.GetString(Data, 0x50, 24)); + set => Encoding.Unicode.GetBytes(value.PadRight(12, '\0')).CopyTo(Data, 0x50); } - private ulong RNGConst1 { get { return BitConverter.ToUInt64(Data, 0x1A0); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1A0); } } - private ulong RNGConst2 { get { return BitConverter.ToUInt64(Data, 0x1A4); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1A4); } } - private ulong RNGSeed1 { get { return BitConverter.ToUInt64(Data, 0x1A8); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1A8); } } - private ulong RNGSeed2 { get { return BitConverter.ToUInt64(Data, 0x1B0); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1B0); } } + private ulong RNGConst1 { get => BitConverter.ToUInt64(Data, 0x1A0); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1A0); } + private ulong RNGConst2 { get => BitConverter.ToUInt64(Data, 0x1A4); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1A4); } + private ulong RNGSeed1 { get => BitConverter.ToUInt64(Data, 0x1A8); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1A8); } + private ulong RNGSeed2 { get => BitConverter.ToUInt64(Data, 0x1B0); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1B0); } - private int Background { get { return BitConverter.ToInt32(Data, 0x1BC); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x1BC); } } - private int _1CE { get { return BitConverter.ToUInt16(Data, 0x1CE); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1CE); } } - private int IntroID { get { return BitConverter.ToUInt16(Data, 0x1E4); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E4); } } - private int MusicID { get { return BitConverter.ToUInt16(Data, 0x1F0); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1F0); } } + private int Background { get => BitConverter.ToInt32(Data, 0x1BC); set => BitConverter.GetBytes(value).CopyTo(Data, 0x1BC); } + private int _1CE { get => BitConverter.ToUInt16(Data, 0x1CE); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1CE); } + private int IntroID { get => BitConverter.ToUInt16(Data, 0x1E4); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E4); } + private int MusicID { get => BitConverter.ToUInt16(Data, 0x1F0); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1F0); } public override PKM[] BattlePKMs => PlayerTeams.SelectMany(t => t).ToArray(); @@ -113,28 +113,28 @@ private PKM[][] PlayerTeams } } - private int MatchYear { get { return BitConverter.ToUInt16(Data, 0x2E50); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E50); } } - private int MatchDay { get { return Data[0x2E52]; } set { Data[0x2E52] = (byte)value; } } - private int MatchMonth { get { return Data[0x2E53]; } set { Data[0x2E53] = (byte)value; } } - private int MatchHour { get { return Data[0x2E54]; } set { Data[0x2E54] = (byte)value; } } - private int MatchMinute { get { return Data[0x2E55]; } set { Data[0x2E55] = (byte)value; } } - private int MatchSecond { get { return Data[0x2E56]; } set { Data[0x2E56] = (byte)value; } } - private int MatchFlags { get { return Data[0x2E57]; } set { Data[0x2E57] = (byte)value; } } + private int MatchYear { get => BitConverter.ToUInt16(Data, 0x2E50); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E50); } + private int MatchDay { get => Data[0x2E52]; set => Data[0x2E52] = (byte)value; } + private int MatchMonth { get => Data[0x2E53]; set => Data[0x2E53] = (byte)value; } + private int MatchHour { get => Data[0x2E54]; set => Data[0x2E54] = (byte)value; } + private int MatchMinute { get => Data[0x2E55]; set => Data[0x2E55] = (byte)value; } + private int MatchSecond { get => Data[0x2E56]; set => Data[0x2E56] = (byte)value; } + private int MatchFlags { get => Data[0x2E57]; set => Data[0x2E57] = (byte)value; } public DateTime MatchStamp { - get { return new DateTime(MatchYear, MatchMonth, MatchDay, MatchHour, MatchMinute, MatchSecond); } + get => new DateTime(MatchYear, MatchMonth, MatchDay, MatchHour, MatchMinute, MatchSecond); set { MatchYear = value.Year; MatchDay = value.Day; MatchMonth = value.Month; MatchHour = value.Hour; MatchMinute = value.Minute; MatchSecond = value.Second; } } - private int UploadYear { get { return BitConverter.ToUInt16(Data, 0x2E58); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E58); } } - private int UploadDay { get { return Data[0x2E5A]; } set { Data[0x2E5A] = (byte)value; } } - private int UploadMonth { get { return Data[0x2E5B]; } set { Data[0x2E5B] = (byte)value; } } - private int UploadHour { get { return Data[0x2E5C]; } set { Data[0x2E5C] = (byte)value; } } - private int UploadMinute { get { return Data[0x2E5D]; } set { Data[0x2E5D] = (byte)value; } } - private int UploadSecond { get { return Data[0x2E5E]; } set { Data[0x2E5E] = (byte)value; } } - private int UploadFlags { get { return Data[0x2E5F]; } set { Data[0x2E5F] = (byte)value; } } + private int UploadYear { get => BitConverter.ToUInt16(Data, 0x2E58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2E58); } + private int UploadDay { get => Data[0x2E5A]; set => Data[0x2E5A] = (byte)value; } + private int UploadMonth { get => Data[0x2E5B]; set => Data[0x2E5B] = (byte)value; } + private int UploadHour { get => Data[0x2E5C]; set => Data[0x2E5C] = (byte)value; } + private int UploadMinute { get => Data[0x2E5D]; set => Data[0x2E5D] = (byte)value; } + private int UploadSecond { get => Data[0x2E5E]; set => Data[0x2E5E] = (byte)value; } + private int UploadFlags { get => Data[0x2E5F]; set => Data[0x2E5F] = (byte)value; } public DateTime UploadStamp { - get { return new DateTime(UploadYear, UploadMonth, UploadDay, UploadHour, UploadMinute, UploadSecond); } + get => new DateTime(UploadYear, UploadMonth, UploadDay, UploadHour, UploadMinute, UploadSecond); set { UploadYear = value.Year; UploadDay = value.Day; UploadMonth = value.Month; UploadHour = value.Hour; UploadMinute = value.Minute; UploadSecond = value.Second; } } diff --git a/PKHeX.Core/Saves/Substructures/BV7.cs b/PKHeX.Core/Saves/Substructures/BV7.cs index 778c4363f..32771f1bb 100644 --- a/PKHeX.Core/Saves/Substructures/BV7.cs +++ b/PKHeX.Core/Saves/Substructures/BV7.cs @@ -51,7 +51,7 @@ private PKM[][] PlayerTeams } } - public int MusicID { get { return Data[0x21C]; } set { Data[0x21C] = (byte)value; } } - public bool SilentBGM { get { return MusicID == 0xFF; } set { MusicID = (byte)(value ? 0xFF : MusicID); } } + public int MusicID { get => Data[0x21C]; set => Data[0x21C] = (byte)value; } + public bool SilentBGM { get => MusicID == 0xFF; set => MusicID = (byte)(value ? 0xFF : MusicID); } } } diff --git a/PKHeX.Core/Saves/Substructures/HoneyTree.cs b/PKHeX.Core/Saves/Substructures/HoneyTree.cs index 8a44f247a..40823e621 100644 --- a/PKHeX.Core/Saves/Substructures/HoneyTree.cs +++ b/PKHeX.Core/Saves/Substructures/HoneyTree.cs @@ -8,11 +8,11 @@ public class HoneyTree public readonly byte[] Data; - public uint Time { get { return BitConverter.ToUInt32(Data, 0); } set { BitConverter.GetBytes(value).CopyTo(Data, 0); } } - public int Slot { get { return Data[4]; } set { Data[4] = (byte)value; } } - public int Group { get { return Data[5]; } set { Data[5] = (byte)value; X = Group+1; } } - public int X { get { return Data[6]; } set { Data[6] = (byte)value; } } - public int Shake { get { return Data[7]; } set { Data[7] = (byte)value; } } + public uint Time { get => BitConverter.ToUInt32(Data, 0); set => BitConverter.GetBytes(value).CopyTo(Data, 0); } + public int Slot { get => Data[4]; set => Data[4] = (byte)value; } + public int Group { get => Data[5]; set { Data[5] = (byte)value; X = Group+1; } } + public int X { get => Data[6]; set => Data[6] = (byte)value; } + public int Shake { get => Data[7]; set => Data[7] = (byte)value; } public HoneyTree(byte[] data) { diff --git a/PKHeX.Core/Saves/Substructures/ShadowInfo.cs b/PKHeX.Core/Saves/Substructures/ShadowInfo.cs index e6d1be4e9..3aabc278a 100644 --- a/PKHeX.Core/Saves/Substructures/ShadowInfo.cs +++ b/PKHeX.Core/Saves/Substructures/ShadowInfo.cs @@ -41,7 +41,7 @@ public void SetEntry(ShadowInfoEntryXD Entry) else Entries.Add(entry); } - public ShadowInfoEntryXD this[int index] { get { return Entries[index]; } set { Entries[index] = value; } } + public ShadowInfoEntryXD this[int index] { get => Entries[index]; set => Entries[index] = value; } public int Count => Entries.Count; } @@ -55,12 +55,12 @@ public ShadowInfoEntryXD(byte[] data = null) } public bool IsSnagged => Data[0] >> 6 != 0; - public bool IsPurified { get { return Data[0] >> 7 == 1; } set { Data[0] &= 0x7F; if (value) Data[0] |= 0x80; } } - public int Species { get { return BigEndian.ToUInt16(Data, 0x1A); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1A); } } - public uint PID { get { return BigEndian.ToUInt32(Data, 0x1C); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x1C); } } - public int Purification { get { return BigEndian.ToInt32(Data, 0x24); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x24); } } + public bool IsPurified { get => Data[0] >> 7 == 1; set { Data[0] &= 0x7F; if (value) Data[0] |= 0x80; } } + public int Species { get => BigEndian.ToUInt16(Data, 0x1A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x1A); } + public uint PID { get => BigEndian.ToUInt32(Data, 0x1C); set => BigEndian.GetBytes(value).CopyTo(Data, 0x1C); } + public int Purification { get => BigEndian.ToInt32(Data, 0x24); set => BigEndian.GetBytes(value).CopyTo(Data, 0x24); } - public uint EXP { get { return BigEndian.ToUInt32(Data, 0x04) >> 12; } set { BigEndian.GetBytes((BigEndian.ToUInt32(Data, 0x04) & 0xFFF) | (value << 12)).CopyTo(Data, 0x04); } } + public uint EXP { get => BigEndian.ToUInt32(Data, 0x04) >> 12; set => BigEndian.GetBytes((BigEndian.ToUInt32(Data, 0x04) & 0xFFF) | (value << 12)).CopyTo(Data, 0x04); } public bool IsEmpty => Species == 0; } @@ -72,8 +72,8 @@ public ShadowInfoEntryColo(byte[] data = null) { Data = (byte[])(data?.Clone() ?? new byte[SIZE_ENTRY]); } - public uint PID { get { return BigEndian.ToUInt32(Data, 0x00); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x00); } } - public int Met_Location { get { return BigEndian.ToUInt16(Data, 0x06); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x06); } } - public uint _0x08 { get { return BigEndian.ToUInt32(Data, 0x08); } set { BigEndian.GetBytes(value).CopyTo(Data, 0x08); } } + public uint PID { get => BigEndian.ToUInt32(Data, 0x00); set => BigEndian.GetBytes(value).CopyTo(Data, 0x00); } + public int Met_Location { get => BigEndian.ToUInt16(Data, 0x06); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x06); } + public uint _0x08 { get => BigEndian.ToUInt32(Data, 0x08); set => BigEndian.GetBytes(value).CopyTo(Data, 0x08); } } } \ No newline at end of file diff --git a/PKHeX.Core/Saves/Substructures/StrategyMemo.cs b/PKHeX.Core/Saves/Substructures/StrategyMemo.cs index ac35f1ae3..9b926ba4c 100644 --- a/PKHeX.Core/Saves/Substructures/StrategyMemo.cs +++ b/PKHeX.Core/Saves/Substructures/StrategyMemo.cs @@ -64,11 +64,11 @@ public int Species BigEndian.GetBytes((ushort)cval).CopyTo(Data, 0); } } - private bool Flag0 { get { return Data[0] >> 6 == 1; } set { Data[0] &= 0xBF; if (value) Data[0] |= 0x40; } } // Unused - private bool Flag1 { get { return Data[0] >> 7 == 1; } set { Data[0] &= 0x7F; if (value) Data[0] |= 0x80; } } // Complete Entry - public int SID { get { return BigEndian.ToUInt16(Data, 4); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 4); } } - public int TID { get { return BigEndian.ToUInt16(Data, 6); } set { BigEndian.GetBytes((ushort)value).CopyTo(Data, 6); } } - public uint PID { get { return BigEndian.ToUInt32(Data, 8); } set { BigEndian.GetBytes(value).CopyTo(Data, 8); } } + private bool Flag0 { get => Data[0] >> 6 == 1; set { Data[0] &= 0xBF; if (value) Data[0] |= 0x40; } } // Unused + private bool Flag1 { get => Data[0] >> 7 == 1; set { Data[0] &= 0x7F; if (value) Data[0] |= 0x80; } } // Complete Entry + public int SID { get => BigEndian.ToUInt16(Data, 4); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 4); } + public int TID { get => BigEndian.ToUInt16(Data, 6); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 6); } + public uint PID { get => BigEndian.ToUInt32(Data, 8); set => BigEndian.GetBytes(value).CopyTo(Data, 8); } public bool Seen { diff --git a/PKHeX.WinForms/Misc/ErrorWindow.cs b/PKHeX.WinForms/Misc/ErrorWindow.cs index c1497a43e..de256a173 100644 --- a/PKHeX.WinForms/Misc/ErrorWindow.cs +++ b/PKHeX.WinForms/Misc/ErrorWindow.cs @@ -40,14 +40,8 @@ public ErrorWindow(string lang) : this() /// For application exceptions, continuing is not possible, so the button should not be shown. public bool ShowContinue { - get - { - return B_Continue.Visible; - } - set - { - B_Continue.Visible = value; - } + get => B_Continue.Visible; + set => B_Continue.Visible = value; } /// @@ -57,22 +51,13 @@ public bool ShowContinue /// For example: "An error occurred while attempting to automatically load the save file." public string Message { - get - { - return L_Message.Text; - } - set - { - L_Message.Text = value; - } + get => L_Message.Text; + set => L_Message.Text = value; } public Exception Error { - get - { - return _error; - } + get => _error; set { _error = value; diff --git a/Tests/PKHeX.Tests/PKM/DateTestPKM.cs b/Tests/PKHeX.Tests/PKM/DateTestPKM.cs index e4a5913de..722176982 100644 --- a/Tests/PKHeX.Tests/PKM/DateTestPKM.cs +++ b/Tests/PKHeX.Tests/PKM/DateTestPKM.cs @@ -21,91 +21,53 @@ internal class DateTestPKM : Core.PKM public override byte[] Nickname_Trash { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } + get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public override byte[] OT_Trash { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } + get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public override int Met_Year { - get - { - return MetYear; - } + get => MetYear; - set - { - MetYear = value; - } + set => MetYear = value; } public override int Met_Month { - get - { - return MetMonth; - } + get => MetMonth; - set - { - MetMonth = value; - } + set => MetMonth = value; } public override int Met_Day { - get - { - return MetDay; - } + get => MetDay; - set - { - MetDay = value; - } + set => MetDay = value; } public override int Egg_Year { - get - { - return EggMetYear; - } + get => EggMetYear; - set - { - EggMetYear = value; - } + set => EggMetYear = value; } public override int Egg_Month { - get - { - return EggMetMonth; - } + get => EggMetMonth; - set - { - EggMetMonth = value; - } + set => EggMetMonth = value; } public override int Egg_Day { - get - { - return EggMetDay; - } + get => EggMetDay; - set - { - EggMetDay = value; - } + set => EggMetDay = value; } @@ -113,41 +75,23 @@ public override int Egg_Day public override int Ability { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int AltForm { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Ball { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Characteristic @@ -160,249 +104,135 @@ public override int Characteristic public override ushort Checksum { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CNT_Beauty { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CNT_Cool { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CNT_Cute { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CNT_Sheen { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CNT_Smart { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CNT_Tough { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CurrentFriendship { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int CurrentHandler { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Egg_Location { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override uint EncryptionConstant { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int EV_ATK { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int EV_DEF { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int EV_HP { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int EV_SPA { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int EV_SPD { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int EV_SPE { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override uint EXP { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override bool FatefulEncounter { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Format @@ -415,444 +245,240 @@ public override int Format public override int Gender { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int HeldItem { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override bool IsEgg { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override bool IsNicknamed { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int IV_ATK { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int IV_DEF { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int IV_HP { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int IV_SPA { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int IV_SPD { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int IV_SPE { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Language { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int MarkValue { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - protected set - { - throw new NotImplementedException(); - } + protected set => throw new NotImplementedException(); } public override int Met_Level { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Met_Location { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move1 { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move1_PP { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move1_PPUps { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move2 { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move2_PP { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move2_PPUps { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move3 { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move3_PP { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move3_PPUps { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move4 { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move4_PP { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Move4_PPUps { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Nature { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override string Nickname { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int OT_Friendship { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int OT_Gender { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override string OT_Name { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override uint PID { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int PKRS_Days { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int PKRS_Strain { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int PSV @@ -865,28 +491,16 @@ public override int PSV public override ushort Sanity { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int SID { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int SIZE_PARTY @@ -907,132 +521,72 @@ public override int SIZE_STORED public override int Species { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_ATK { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_DEF { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_HPCurrent { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_HPMax { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_Level { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_SPA { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_SPD { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int Stat_SPE { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int TID { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override int TSV @@ -1045,15 +599,9 @@ public override int TSV public override int Version { - get - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); - set - { - throw new NotImplementedException(); - } + set => throw new NotImplementedException(); } public override Core.PKM Clone()