mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Simplify ternary byte casts
No longer needed to explicitly cast, thanks c#9 !
This commit is contained in:
parent
6d030831ab
commit
5729718d68
33 changed files with 97 additions and 97 deletions
|
@ -246,7 +246,7 @@ namespace PKHeX.Core
|
|||
if (pk is IGigantamax c)
|
||||
c.CanGigantamax = Set.CanGigantamax;
|
||||
if (pk is IDynamaxLevel d)
|
||||
d.DynamaxLevel = (byte)(d.CanHaveDynamaxLevel(pk) ? 10 : 0);
|
||||
d.DynamaxLevel = d.CanHaveDynamaxLevel(pk) ? 10 : 0;
|
||||
|
||||
pk.ClearRecordFlags();
|
||||
pk.SetRecordFlags(Set.Moves);
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace PKHeX.Core
|
|||
|
||||
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); }
|
||||
public override bool IsEgg { get => Data[0x5C] == 1; set => Data[0x5C] = value ? 1 : 0; }
|
||||
// Unused 0x5D 0x5E 0x5F
|
||||
public override string CardTitle
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ namespace PKHeX.Core
|
|||
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); }
|
||||
public bool MultiObtain { get => Data[0xB4] == 1; set => Data[0xB4] = value ? 1 : 0; }
|
||||
|
||||
// Meta Accessible Properties
|
||||
public override int[] IVs
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace PKHeX.Core
|
|||
get => Data[0x00]; set => Data[0x00] = value;
|
||||
}
|
||||
|
||||
public bool PL_enabled { get => PL_Flag != 0; set => PL_Flag = (byte)(value ? 1 << 7 : 0); }
|
||||
public bool PL_enabled { get => PL_Flag != 0; set => PL_Flag = value ? 1 << 7 : 0; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of data source
|
||||
|
@ -136,7 +136,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
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 bool IsEgg { get => Data[0x69] == 1; set => Data[0x69] = value ? 1 : 0; }
|
||||
public uint PID { get => BitConverter.ToUInt32(Data, 0x6C); set => BitConverter.GetBytes(value).CopyTo(Data, 0x6C); }
|
||||
public int RelearnMove1 { get => BitConverter.ToUInt16(Data, 0x70); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x70); }
|
||||
public int RelearnMove2 { get => BitConverter.ToUInt16(Data, 0x72); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x72); }
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace PKHeX.Core
|
|||
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 => Data[CardStart + 0x53] == 1; set => Data[CardStart + 0x53] = (byte)(value ? 1 : 0); }
|
||||
public bool MultiObtain { get => Data[CardStart + 0x53] == 1; set => Data[CardStart + 0x53] = value ? 1 : 0; }
|
||||
|
||||
// Item Properties
|
||||
public override bool IsItem { get => CardType == 1; set { if (value) CardType = 1; } }
|
||||
|
@ -206,7 +206,7 @@ namespace PKHeX.Core
|
|||
// }
|
||||
|
||||
public override int Level { get => Data[CardStart + 0xD0]; set => Data[CardStart + 0xD0] = (byte)value; }
|
||||
public override bool IsEgg { get => Data[CardStart + 0xD1] == 1; set => Data[CardStart + 0xD1] = (byte)(value ? 1 : 0); }
|
||||
public override bool IsEgg { get => Data[CardStart + 0xD1] == 1; set => Data[CardStart + 0xD1] = value ? 1 : 0; }
|
||||
public ushort AdditionalItem { get => BitConverter.ToUInt16(Data, CardStart + 0xD2); set => BitConverter.GetBytes(value).CopyTo(Data, CardStart + 0xD2); }
|
||||
|
||||
public uint PID { get => BitConverter.ToUInt32(Data, 0xD4); set => BitConverter.GetBytes(value).CopyTo(Data, 0xD4); }
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace PKHeX.Core
|
|||
|
||||
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); }
|
||||
public bool MultiObtain { get => Data[0x53] == 1; set => Data[0x53] = value ? 1 : 0; }
|
||||
|
||||
// Item Properties
|
||||
public override bool IsItem { get => CardType == 1; set { if (value) CardType = 1; } }
|
||||
|
@ -176,7 +176,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
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 override bool IsEgg { get => Data[0xD1] == 1; set => Data[0xD1] = value ? 1 : 0; }
|
||||
public uint PID { get => BitConverter.ToUInt32(Data, 0xD4); set => BitConverter.GetBytes(value).CopyTo(Data, 0xD4); }
|
||||
|
||||
public int RelearnMove1 { get => BitConverter.ToUInt16(Data, 0xD8); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xD8); }
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace PKHeX.Core
|
|||
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 => Data[0x53] == 1; set => Data[0x53] = (byte)(value ? 1 : 0); }
|
||||
public bool MultiObtain { get => Data[0x53] == 1; set => Data[0x53] = value ? 1 : 0; }
|
||||
|
||||
// BP Properties
|
||||
public override bool IsBP { get => CardType == 3; set { if (value) CardType = 3; } }
|
||||
|
@ -218,7 +218,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
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 override bool IsEgg { get => Data[0xD1] == 1; set => Data[0xD1] = value ? 1 : 0; }
|
||||
public ushort AdditionalItem { get => BitConverter.ToUInt16(Data, 0xD2); set => BitConverter.GetBytes(value).CopyTo(Data, 0xD2); }
|
||||
|
||||
public uint PID { get => BitConverter.ToUInt32(Data, 0xD4); set => BitConverter.GetBytes(value).CopyTo(Data, 0xD4); }
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace PKHeX.Core
|
|||
public override int Form { get => Data[CardStart + 0x242]; set => Data[CardStart + 0x242] = (byte)value; }
|
||||
public override int Gender { get => Data[CardStart + 0x243]; set => Data[CardStart + 0x243] = (byte)value; }
|
||||
public override int Level { get => Data[CardStart + 0x244]; set => Data[CardStart + 0x244] = (byte)value; }
|
||||
public override bool IsEgg { get => Data[CardStart + 0x245] == 1; set => Data[CardStart + 0x245] = (byte)(value ? 1 : 0); }
|
||||
public override bool IsEgg { get => Data[CardStart + 0x245] == 1; set => Data[CardStart + 0x245] = value ? 1 : 0; }
|
||||
public int Nature { get => (sbyte)Data[CardStart + 0x246]; set => Data[CardStart + 0x246] = (byte)value; }
|
||||
public override int AbilityType { get => Data[CardStart + 0x247]; set => Data[CardStart + 0x247] = (byte)value; }
|
||||
|
||||
|
@ -186,7 +186,7 @@ namespace PKHeX.Core
|
|||
|
||||
public int MetLevel { get => Data[CardStart + 0x249]; set => Data[CardStart + 0x249] = (byte)value; }
|
||||
public byte DynamaxLevel { get => Data[CardStart + 0x24A]; set => Data[CardStart + 0x24A] = value; }
|
||||
public bool CanGigantamax { get => Data[CardStart + 0x24B] != 0; set => Data[CardStart + 0x24B] = (byte)(value ? 1 : 0); }
|
||||
public bool CanGigantamax { get => Data[CardStart + 0x24B] != 0; set => Data[CardStart + 0x24B] = value ? 1 : 0; }
|
||||
|
||||
// Ribbons 0x24C-0x26C
|
||||
private const int RibbonBytesOffset = 0x24C;
|
||||
|
|
|
@ -155,27 +155,27 @@ namespace PKHeX.Core
|
|||
public override int CNT_Sheen { get => Data[0xBC]; set => Data[0xBC] = (byte)value; }
|
||||
|
||||
// Ribbons
|
||||
public override bool RibbonChampionG3Hoenn { get => Data[0xBD] == 1; set => Data[0xBD] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonWinning { get => Data[0xBE] == 1; set => Data[0xBE] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonVictory { get => Data[0xBF] == 1; set => Data[0xBF] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonArtist { get => Data[0xC0] == 1; set => Data[0xC0] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonEffort { get => Data[0xC1] == 1; set => Data[0xC1] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonChampionBattle { get => Data[0xC2] == 1; set => Data[0xC2] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonChampionRegional { get => Data[0xC3] == 1; set => Data[0xC3] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonChampionNational { get => Data[0xC4] == 1; set => Data[0xC4] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonCountry { get => Data[0xC5] == 1; set => Data[0xC5] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonNational { get => Data[0xC6] == 1; set => Data[0xC6] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonEarth { get => Data[0xC7] == 1; set => Data[0xC7] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonWorld { get => Data[0xC8] == 1; set => Data[0xC8] = (byte)(value ? 1 : 0); }
|
||||
public override bool RibbonChampionG3Hoenn { get => Data[0xBD] == 1; set => Data[0xBD] = value ? 1 : 0; }
|
||||
public override bool RibbonWinning { get => Data[0xBE] == 1; set => Data[0xBE] = value ? 1 : 0; }
|
||||
public override bool RibbonVictory { get => Data[0xBF] == 1; set => Data[0xBF] = value ? 1 : 0; }
|
||||
public override bool RibbonArtist { get => Data[0xC0] == 1; set => Data[0xC0] = value ? 1 : 0; }
|
||||
public override bool RibbonEffort { get => Data[0xC1] == 1; set => Data[0xC1] = value ? 1 : 0; }
|
||||
public override bool RibbonChampionBattle { get => Data[0xC2] == 1; set => Data[0xC2] = value ? 1 : 0; }
|
||||
public override bool RibbonChampionRegional { get => Data[0xC3] == 1; set => Data[0xC3] = value ? 1 : 0; }
|
||||
public override bool RibbonChampionNational { get => Data[0xC4] == 1; set => Data[0xC4] = value ? 1 : 0; }
|
||||
public override bool RibbonCountry { get => Data[0xC5] == 1; set => Data[0xC5] = value ? 1 : 0; }
|
||||
public override bool RibbonNational { get => Data[0xC6] == 1; set => Data[0xC6] = value ? 1 : 0; }
|
||||
public override bool RibbonEarth { get => Data[0xC7] == 1; set => Data[0xC7] = value ? 1 : 0; }
|
||||
public override bool RibbonWorld { get => Data[0xC8] == 1; set => Data[0xC8] = value ? 1 : 0; }
|
||||
public override bool Unused1 { get => ((Data[0xC9] >> 0) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~1) | (value ? 1 : 0)); }
|
||||
public override bool Unused2 { get => ((Data[0xC9] >> 1) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~2) | (value ? 2 : 0)); }
|
||||
public override bool Unused3 { get => ((Data[0xC9] >> 2) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~4) | (value ? 4 : 0)); }
|
||||
public override bool Unused4 { get => ((Data[0xC9] >> 3) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~8) | (value ? 8 : 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 bool AbilityBit { get => Data[0xCC] == 1; set => Data[0xCC] = (byte)(value ? 1 : 0); }
|
||||
private bool Invalid { get => Data[0xCD] != 0; set => Data[0xCD] = (byte)(value ? 1 : 0); }
|
||||
public override bool IsEgg { get => Data[0xCB] == 1; set => Data[0xCB] = value ? 1 : 0; }
|
||||
public override bool AbilityBit { get => Data[0xCC] == 1; set => Data[0xCC] = value ? 1 : 0; }
|
||||
private bool Invalid { get => Data[0xCD] != 0; set => Data[0xCD] = value ? 1 : 0; }
|
||||
|
||||
public override int MarkValue { get => SwapBits(Data[0xCF], 1, 2); protected set => Data[0xCF] = (byte)SwapBits(value, 1, 2); }
|
||||
public override int PKRS_Days { get => Math.Max((sbyte)Data[0xD0], (sbyte)0); set => Data[0xD0] = (byte)(value == 0 ? 0xFF : value & 0xF); }
|
||||
|
|
|
@ -289,7 +289,7 @@ namespace PKHeX.Core
|
|||
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); }
|
||||
public int Stat_CP { get => BitConverter.ToUInt16(Data, 0xFE); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xFE); }
|
||||
public bool Stat_Mega { get => Data[0x100] != 0; set => Data[0x100] = (byte)(value ? 1 : 0); }
|
||||
public bool Stat_Mega { get => Data[0x100] != 0; set => Data[0x100] = value ? 1 : 0; }
|
||||
public int Stat_MegaForm { get => Data[0x101]; set => Data[0x101] = (byte)value; }
|
||||
// 102/103 unused
|
||||
#endregion
|
||||
|
|
|
@ -245,7 +245,7 @@ namespace PKHeX.Core
|
|||
public override int EncounterType { get => Data[0x85]; set => Data[0x85] = (byte)value; }
|
||||
// 0x86 Unused
|
||||
public byte PokeStarFame { get => Data[0x87]; set => Data[0x87] = value; }
|
||||
public bool IsPokeStar { get => PokeStarFame > 250; set => PokeStarFame = (byte)(value ? 255 : 0); }
|
||||
public bool IsPokeStar { get => PokeStarFame > 250; set => PokeStarFame = value ? 255 : 0; }
|
||||
#endregion
|
||||
|
||||
#region Battle Stats
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace PKHeX.Core
|
|||
public override uint PID { get => BigEndian.ToUInt32(Data, 0x28); set => BigEndian.GetBytes(value).CopyTo(Data, 0x28); }
|
||||
// 0x2A-0x2B Unknown
|
||||
// 0x2C-0x2F Battle Related
|
||||
public bool Obedient { get => Data[0x30] == 1; set => Data[0x30] = (byte)(value ? 1 : 0); }
|
||||
public bool Obedient { get => Data[0x30] == 1; set => Data[0x30] = value ? 1 : 0; }
|
||||
// 0x31-0x32 Unknown
|
||||
public int EncounterInfo { get => Data[0x33]; set => Data[0x33] = (byte)value; }
|
||||
|
||||
|
@ -97,22 +97,22 @@ namespace PKHeX.Core
|
|||
public string NicknameCopy { get => GetString(0x64, 20); set => SetString(value, 10).CopyTo(Data, 0x64); } // +2 terminator
|
||||
// 0x7A-0x7B Unknown
|
||||
private ushort RIB0 { get => BigEndian.ToUInt16(Data, 0x7C); set => BigEndian.GetBytes(value).CopyTo(Data, 0x7C); }
|
||||
public override bool RibbonChampionG3Hoenn { get => (RIB0 & (1 << 15)) == 1 << 15; set => RIB0 = (ushort)((RIB0 & ~(1 << 15)) | (ushort)(value ? 1 << 15 : 0)); }
|
||||
public override bool RibbonWinning { get => (RIB0 & (1 << 14)) == 1 << 14; set => RIB0 = (ushort)((RIB0 & ~(1 << 14)) | (ushort)(value ? 1 << 14 : 0)); }
|
||||
public override bool RibbonVictory { get => (RIB0 & (1 << 13)) == 1 << 13; set => RIB0 = (ushort)((RIB0 & ~(1 << 13)) | (ushort)(value ? 1 << 13 : 0)); }
|
||||
public override bool RibbonArtist { get => (RIB0 & (1 << 12)) == 1 << 12; set => RIB0 = (ushort)((RIB0 & ~(1 << 12)) | (ushort)(value ? 1 << 12 : 0)); }
|
||||
public override bool RibbonEffort { get => (RIB0 & (1 << 11)) == 1 << 11; set => RIB0 = (ushort)((RIB0 & ~(1 << 11)) | (ushort)(value ? 1 << 11 : 0)); }
|
||||
public override bool RibbonChampionBattle { get => (RIB0 & (1 << 10)) == 1 << 10; set => RIB0 = (ushort)((RIB0 & ~(1 << 10)) | (ushort)(value ? 1 << 10 : 0)); }
|
||||
public override bool RibbonChampionRegional { get => (RIB0 & (1 << 09)) == 1 << 09; set => RIB0 = (ushort)((RIB0 & ~(1 << 09)) | (ushort)(value ? 1 << 09 : 0)); }
|
||||
public override bool RibbonChampionNational { get => (RIB0 & (1 << 08)) == 1 << 08; set => RIB0 = (ushort)((RIB0 & ~(1 << 08)) | (ushort)(value ? 1 << 08 : 0)); }
|
||||
public override bool RibbonCountry { get => (RIB0 & (1 << 07)) == 1 << 07; set => RIB0 = (ushort)((RIB0 & ~(1 << 07)) | (ushort)(value ? 1 << 07 : 0)); }
|
||||
public override bool RibbonNational { get => (RIB0 & (1 << 06)) == 1 << 06; set => RIB0 = (ushort)((RIB0 & ~(1 << 06)) | (ushort)(value ? 1 << 06 : 0)); }
|
||||
public override bool RibbonEarth { get => (RIB0 & (1 << 05)) == 1 << 05; set => RIB0 = (ushort)((RIB0 & ~(1 << 05)) | (ushort)(value ? 1 << 05 : 0)); }
|
||||
public override bool RibbonWorld { get => (RIB0 & (1 << 04)) == 1 << 04; set => RIB0 = (ushort)((RIB0 & ~(1 << 04)) | (ushort)(value ? 1 << 04 : 0)); }
|
||||
public override bool Unused1 { get => (RIB0 & (1 << 03)) == 1 << 03; set => RIB0 = (ushort)((RIB0 & ~(1 << 03)) | (ushort)(value ? 1 << 03 : 0)); }
|
||||
public override bool Unused2 { get => (RIB0 & (1 << 02)) == 1 << 02; set => RIB0 = (ushort)((RIB0 & ~(1 << 02)) | (ushort)(value ? 1 << 02 : 0)); }
|
||||
public override bool Unused3 { get => (RIB0 & (1 << 01)) == 1 << 01; set => RIB0 = (ushort)((RIB0 & ~(1 << 01)) | (ushort)(value ? 1 << 01 : 0)); }
|
||||
public override bool Unused4 { get => (RIB0 & (1 << 00)) == 1 << 00; set => RIB0 = (ushort)((RIB0 & ~(1 << 00)) | (ushort)(value ? 1 << 00 : 0)); }
|
||||
public override bool RibbonChampionG3Hoenn { get => (RIB0 & (1 << 15)) == 1 << 15; set => RIB0 = (ushort)((RIB0 & ~(1 << 15)) | (value ? 1 << 15 : 0)); }
|
||||
public override bool RibbonWinning { get => (RIB0 & (1 << 14)) == 1 << 14; set => RIB0 = (ushort)((RIB0 & ~(1 << 14)) | (value ? 1 << 14 : 0)); }
|
||||
public override bool RibbonVictory { get => (RIB0 & (1 << 13)) == 1 << 13; set => RIB0 = (ushort)((RIB0 & ~(1 << 13)) | (value ? 1 << 13 : 0)); }
|
||||
public override bool RibbonArtist { get => (RIB0 & (1 << 12)) == 1 << 12; set => RIB0 = (ushort)((RIB0 & ~(1 << 12)) | (value ? 1 << 12 : 0)); }
|
||||
public override bool RibbonEffort { get => (RIB0 & (1 << 11)) == 1 << 11; set => RIB0 = (ushort)((RIB0 & ~(1 << 11)) | (value ? 1 << 11 : 0)); }
|
||||
public override bool RibbonChampionBattle { get => (RIB0 & (1 << 10)) == 1 << 10; set => RIB0 = (ushort)((RIB0 & ~(1 << 10)) | (value ? 1 << 10 : 0)); }
|
||||
public override bool RibbonChampionRegional { get => (RIB0 & (1 << 09)) == 1 << 09; set => RIB0 = (ushort)((RIB0 & ~(1 << 09)) | (value ? 1 << 09 : 0)); }
|
||||
public override bool RibbonChampionNational { get => (RIB0 & (1 << 08)) == 1 << 08; set => RIB0 = (ushort)((RIB0 & ~(1 << 08)) | (value ? 1 << 08 : 0)); }
|
||||
public override bool RibbonCountry { get => (RIB0 & (1 << 07)) == 1 << 07; set => RIB0 = (ushort)((RIB0 & ~(1 << 07)) | (value ? 1 << 07 : 0)); }
|
||||
public override bool RibbonNational { get => (RIB0 & (1 << 06)) == 1 << 06; set => RIB0 = (ushort)((RIB0 & ~(1 << 06)) | (value ? 1 << 06 : 0)); }
|
||||
public override bool RibbonEarth { get => (RIB0 & (1 << 05)) == 1 << 05; set => RIB0 = (ushort)((RIB0 & ~(1 << 05)) | (value ? 1 << 05 : 0)); }
|
||||
public override bool RibbonWorld { get => (RIB0 & (1 << 04)) == 1 << 04; set => RIB0 = (ushort)((RIB0 & ~(1 << 04)) | (value ? 1 << 04 : 0)); }
|
||||
public override bool Unused1 { get => (RIB0 & (1 << 03)) == 1 << 03; set => RIB0 = (ushort)((RIB0 & ~(1 << 03)) | (value ? 1 << 03 : 0)); }
|
||||
public override bool Unused2 { get => (RIB0 & (1 << 02)) == 1 << 02; set => RIB0 = (ushort)((RIB0 & ~(1 << 02)) | (value ? 1 << 02 : 0)); }
|
||||
public override bool Unused3 { get => (RIB0 & (1 << 01)) == 1 << 01; set => RIB0 = (ushort)((RIB0 & ~(1 << 01)) | (value ? 1 << 01 : 0)); }
|
||||
public override bool Unused4 { get => (RIB0 & (1 << 00)) == 1 << 00; set => RIB0 = (ushort)((RIB0 & ~(1 << 00)) | (value ? 1 << 00 : 0)); }
|
||||
// 0x7E-0x7F Unknown
|
||||
|
||||
// Moves
|
||||
|
|
|
@ -31,6 +31,6 @@ namespace PKHeX.Core
|
|||
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); }
|
||||
public bool LocalVariant { get => Data[0x52] == 1; set => Data[0x52] = value ? 1 : 0; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace PKHeX.Core
|
|||
// Daycare is read-only, but in case it ever becomes editable, copy it back in.
|
||||
byte[] rawDC = GetData(GetDaycareSlotOffset(loc: 0, slot: 0), SIZE_STORED);
|
||||
byte[] dc = new byte[1 + (2 * StringLength) + PokeCrypto.SIZE_1STORED];
|
||||
dc[0] = (byte)(IsDaycareOccupied(0, 0) == true ? 1 : 0);
|
||||
dc[0] = IsDaycareOccupied(0, 0) == true ? 1 : 0;
|
||||
Array.Copy(rawDC, 2 + 1 + PokeCrypto.SIZE_1PARTY + StringLength, dc, 1, StringLength);
|
||||
Array.Copy(rawDC, 2 + 1 + PokeCrypto.SIZE_1PARTY, dc, 1 + StringLength, StringLength);
|
||||
Array.Copy(rawDC, 2 + 1, dc, 1 + (2 * StringLength), PokeCrypto.SIZE_1STORED);
|
||||
|
@ -291,7 +291,7 @@ namespace PKHeX.Core
|
|||
public bool PlayedMaximum
|
||||
{
|
||||
get => Data[Offsets.PlayTime + 1] != 0;
|
||||
set => Data[Offsets.PlayTime + 1] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offsets.PlayTime + 1] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public override int PlayedMinutes
|
||||
|
|
|
@ -404,7 +404,7 @@ namespace PKHeX.Core
|
|||
public bool SaveFileExists
|
||||
{
|
||||
get => Data[Offsets.Options + 1] == 1;
|
||||
set => Data[Offsets.Options + 1] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offsets.Options + 1] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public int TextBoxFrame // 3bits
|
||||
|
@ -432,7 +432,7 @@ namespace PKHeX.Core
|
|||
public bool MenuAccountOn
|
||||
{
|
||||
get => Data[Offsets.Options + 5] == 1;
|
||||
set => Data[Offsets.Options + 5] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offsets.Options + 5] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public override uint Money
|
||||
|
|
|
@ -852,24 +852,24 @@ namespace PKHeX.Core
|
|||
switch (Version)
|
||||
{
|
||||
case GameVersion.RS:
|
||||
Data[PokeDex + 1] = (byte)(value ? 1 : 0); // mode
|
||||
Data[PokeDex + 2] = (byte)(value ? 0xDA : 0); // magic
|
||||
Data[PokeDex + 1] = value ? 1 : 0; // mode
|
||||
Data[PokeDex + 2] = value ? 0xDA : 0; // magic
|
||||
Data[BlockOfs[2] + 0x3A6] &= 0xBF;
|
||||
Data[BlockOfs[2] + 0x3A6] |= (byte)(value ? 1 << 6 : 0); // B
|
||||
Data[BlockOfs[2] + 0x3A6] |= value ? 1 << 6 : 0; // B
|
||||
BitConverter.GetBytes((ushort)(value ? 0x0302 : 0)).CopyTo(Data, BlockOfs[2] + 0x44C); // C
|
||||
break;
|
||||
case GameVersion.E:
|
||||
Data[PokeDex + 1] = (byte)(value ? 1 : 0); // mode
|
||||
Data[PokeDex + 2] = (byte)(value ? 0xDA : 0); // magic
|
||||
Data[PokeDex + 1] = value ? 1 : 0; // mode
|
||||
Data[PokeDex + 2] = value ? 0xDA : 0; // magic
|
||||
Data[BlockOfs[2] + 0x402] &= 0xBF; // Bit6
|
||||
Data[BlockOfs[2] + 0x402] |= (byte)(value ? 1 << 6 : 0); // B
|
||||
Data[BlockOfs[2] + 0x402] |= value ? 1 << 6 : 0; // B
|
||||
BitConverter.GetBytes((ushort)(value ? 0x6258 : 0)).CopyTo(Data, BlockOfs[2] + 0x4A8); // C
|
||||
break;
|
||||
case GameVersion.FRLG:
|
||||
Data[PokeDex + 2] = (byte)(value ? 0xDA : 0); // magic
|
||||
Data[PokeDex + 3] = (byte)(value ? 0xB9 : 0); // magic
|
||||
Data[PokeDex + 2] = value ? 0xDA : 0; // magic
|
||||
Data[PokeDex + 3] = value ? 0xB9 : 0; // magic
|
||||
Data[BlockOfs[2] + 0x68] &= 0xFE;
|
||||
Data[BlockOfs[2] + 0x68] |= (byte)(value ? 1 : 0); // B
|
||||
Data[BlockOfs[2] + 0x68] |= value ? 1 : 0; // B
|
||||
BitConverter.GetBytes((ushort)(value ? 0x6258 : 0)).CopyTo(Data, BlockOfs[2] + 0x11C); // C
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -896,22 +896,22 @@ namespace PKHeX.Core
|
|||
switch (Version)
|
||||
{
|
||||
case GameVersion.DP:
|
||||
General[0x1413] = (byte)(value == 4 ? 1 : 0);
|
||||
General[0x1415] = (byte)(value >= 3 ? 1 : 0);
|
||||
General[0x1404] = (byte)(value >= 2 ? 1 : 0);
|
||||
General[0x1414] = (byte)(value >= 1 ? 1 : 0);
|
||||
General[0x1413] = value == 4 ? 1 : 0;
|
||||
General[0x1415] = value >= 3 ? 1 : 0;
|
||||
General[0x1404] = value >= 2 ? 1 : 0;
|
||||
General[0x1414] = value >= 1 ? 1 : 0;
|
||||
break;
|
||||
case GameVersion.HGSS:
|
||||
General[0x15ED] = (byte)(value == 3 ? 1 : 0);
|
||||
General[0x15EF] = (byte)(value >= 2 ? 1 : 0);
|
||||
General[0x15EE] = (byte)(value >= 1 ? 1 : 0);
|
||||
General[0x15ED] = value == 3 ? 1 : 0;
|
||||
General[0x15EF] = value >= 2 ? 1 : 0;
|
||||
General[0x15EE] = value >= 1 ? 1 : 0;
|
||||
General[0x10D1] = (byte)((General[0x10D1] & ~8) | (value >= 1 ? 8 : 0));
|
||||
break;
|
||||
case GameVersion.Pt:
|
||||
General[0x1641] = (byte)(value == 4 ? 1 : 0);
|
||||
General[0x1643] = (byte)(value >= 3 ? 1 : 0);
|
||||
General[0x1640] = (byte)(value >= 2 ? 1 : 0);
|
||||
General[0x1642] = (byte)(value >= 1 ? 1 : 0);
|
||||
General[0x1641] = value == 4 ? 1 : 0;
|
||||
General[0x1643] = value >= 3 ? 1 : 0;
|
||||
General[0x1640] = value >= 2 ? 1 : 0;
|
||||
General[0x1642] = value >= 1 ? 1 : 0;
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace PKHeX.Core
|
|||
|
||||
protected override void SetPartyValues(PKM pkm, bool isParty)
|
||||
{
|
||||
pkm.Sanity = (ushort)(isParty ? 0xC000 : 0x4000);
|
||||
pkm.Sanity = isParty ? 0xC000 : 0x4000;
|
||||
}
|
||||
|
||||
public static byte[] DecryptPBRSaveData(byte[] input)
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace PKHeX.Core
|
|||
public bool BattleBoxLocked
|
||||
{
|
||||
get => Data[BattleBoxOffset + 0x358] != 0; // wifi/live
|
||||
set => Data[BattleBoxOffset + 0x358] = (byte)(value ? 1 : 0);
|
||||
set => Data[BattleBoxOffset + 0x358] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
protected override void SetPKM(PKM pkm)
|
||||
|
@ -148,7 +148,7 @@ namespace PKHeX.Core
|
|||
private bool CGearSkinPresent
|
||||
{
|
||||
get => Data[CGearSkinInfoOffset + 2] == 1;
|
||||
set => Data[CGearSkinInfoOffset + 2] = Data[PlayerData.Offset + (this is SAV5B2W2 ? 0x6C : 0x54)] = (byte) (value ? 1 : 0);
|
||||
set => Data[CGearSkinInfoOffset + 2] = Data[PlayerData.Offset + (this is SAV5B2W2 ? 0x6C : 0x54)] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public byte[] CGearSkinData
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace PKHeX.Core
|
|||
public override void SetDaycareOccupied(int loc, int slot, bool occupied)
|
||||
{
|
||||
int ofs = loc == 0 ? DaycareOffset : Daycare2;
|
||||
Data[ofs + ((SIZE_STORED + 8) * slot)] = (byte)(occupied ? 1 : 0);
|
||||
Data[ofs + ((SIZE_STORED + 8) * slot)] = occupied ? 1 : 0;
|
||||
}
|
||||
|
||||
public override void SetDaycareRNGSeed(int loc, string seed)
|
||||
|
@ -182,7 +182,7 @@ namespace PKHeX.Core
|
|||
public override void SetDaycareHasEgg(int loc, bool hasEgg)
|
||||
{
|
||||
int ofs = loc == 0 ? DaycareOffset : Daycare2;
|
||||
Data[ofs + 0x1E0] = (byte)(hasEgg ? 1 : 0);
|
||||
Data[ofs + 0x1E0] = hasEgg ? 1 : 0;
|
||||
}
|
||||
|
||||
public override string JPEGTitle => HasJPPEGData ? string.Empty : Util.TrimFromZero(Encoding.Unicode.GetString(Data, JPEG, 0x1A));
|
||||
|
|
|
@ -94,8 +94,8 @@ namespace PKHeX.Core
|
|||
|
||||
public override int GetDaycareSlotOffset(int loc, int slot) => DaycareOffset + 8 + (slot * (SIZE_STORED + 8));
|
||||
public override bool? IsDaycareHasEgg(int loc) => Data[DaycareOffset + 0x1E0] == 1;
|
||||
public override void SetDaycareHasEgg(int loc, bool hasEgg) => Data[DaycareOffset + 0x1E0] = (byte)(hasEgg ? 1 : 0);
|
||||
public override void SetDaycareOccupied(int loc, int slot, bool occupied) => Data[DaycareOffset + ((SIZE_STORED + 8) * slot)] = (byte)(occupied ? 1 : 0);
|
||||
public override void SetDaycareHasEgg(int loc, bool hasEgg) => Data[DaycareOffset + 0x1E0] = hasEgg ? 1 : 0;
|
||||
public override void SetDaycareOccupied(int loc, int slot, bool occupied) => Data[DaycareOffset + ((SIZE_STORED + 8) * slot)] = occupied ? 1 : 0;
|
||||
public override void SetDaycareEXP(int loc, int slot, uint EXP) => BitConverter.GetBytes(EXP).CopyTo(Data, DaycareOffset + 4 + ((SIZE_STORED + 8) * slot));
|
||||
|
||||
public override string GetDaycareRNGSeed(int loc)
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace PKHeX.Core
|
|||
public int CNT_Smart { get => SAV.Data[Offset + 0x11]; set => SAV.Data[Offset + 0x11] = (byte)value; }
|
||||
public int CNT_Tough { get => SAV.Data[Offset + 0x12]; set => SAV.Data[Offset + 0x12] = (byte)value; }
|
||||
public int CNT_Sheen { get => 0; set { } }
|
||||
public bool Active { get => SAV.Data[Offset + 0x13] == 1; set => SAV.Data[Offset + 0x13] = (byte)(value ? 1 : 0); }
|
||||
public bool Active { get => SAV.Data[Offset + 0x13] == 1; set => SAV.Data[Offset + 0x13] = value ? 1 : 0; }
|
||||
|
||||
// Derived Properties
|
||||
private int IV_HP { get => (int)(IV32 >> 00) & 0x1F; set => IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); }
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace PKHeX.Core
|
|||
public bool Unlock9thArea
|
||||
{
|
||||
get => Data[0x848] == 1;
|
||||
set => Data[0x848] = (byte)(value ? 1 : 0);
|
||||
set => Data[0x848] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
public bool GetIsTeamLocked(int team) => Data[Offset + PCBackgrounds - TeamCount - team] == 1;
|
||||
public void SetIsTeamLocked(int team, bool value) => Data[Offset + PCBackgrounds - TeamCount - team] = (byte)(value ? 1 : 0);
|
||||
public void SetIsTeamLocked(int team, bool value) => Data[Offset + PCBackgrounds - TeamCount - team] = value ? 1 : 0;
|
||||
|
||||
public string this[int i]
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
public void SetOccupied(int slot, bool occupied)
|
||||
{
|
||||
Data[Offset + ((PokeCrypto.SIZE_6STORED + 1) * slot)] = (byte)(occupied ? 1 : 0);
|
||||
Data[Offset + ((PokeCrypto.SIZE_6STORED + 1) * slot)] = occupied ? 1 : 0;
|
||||
}
|
||||
|
||||
public int GetDaycareSlotOffset(int slot)
|
||||
|
@ -25,7 +25,7 @@
|
|||
public bool HasEgg
|
||||
{
|
||||
get => Data[Offset + 0x1D8] == 1;
|
||||
set => Data[Offset + 0x1D8] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offset + 0x1D8] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public string RNGSeed
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace PKHeX.Core
|
|||
|
||||
public int Type { get => Data[0x00]; set => Data[0x00] = (byte)value; }
|
||||
public int Color { get => Data[0x01]; set => Data[0x01] = (byte)value; }
|
||||
public bool IsIntroduced { get => Data[0x02] != 0; set => Data[0x02] = (byte)(value ? 1 : 0); }
|
||||
public bool IsIntroduced { get => Data[0x02] != 0; set => Data[0x02] = value ? 1 : 0; }
|
||||
public int Gender { get => Data[0x03]; set => Data[0x03] = (byte)value; }
|
||||
public string OT_Name { get => StringConverter.GetString7(Data, 0x04, 0x1A); set => StringConverter.SetString7(value, 12, Language).CopyTo(Data, 0x04); }
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace PKHeX.Core
|
|||
public void SetFestaPhraseUnlocked(int index, bool value)
|
||||
{
|
||||
if (GetFestaPhraseUnlocked(index) != value)
|
||||
Data[Offset + 0x2A50 + index] = (byte)(value ? 1 : 0);
|
||||
Data[Offset + 0x2A50 + index] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public byte GetFestPrizeReceived(int index) => Data[Offset + 0x53C + index];
|
||||
|
|
|
@ -62,8 +62,8 @@ namespace PKHeX.Core
|
|||
|
||||
basedata[0x2A] = (byte)formnum;
|
||||
basedata[0x2B] = (byte)gender;
|
||||
basedata[0x2C] = (byte)(shiny ? 1 : 0);
|
||||
basedata[0x2D] = (byte)(biGender ? 1 : 0);
|
||||
basedata[0x2C] = shiny ? 1 : 0;
|
||||
basedata[0x2D] = biGender ? 1 : 0;
|
||||
return basedata;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace PKHeX.Core
|
|||
public bool WormholeShininess // 0x4535 = Misc (0x4400 in USUM) + 0x0135
|
||||
{
|
||||
get => SAV.Data[SAV.Misc.Offset + 0x0135] == 1;
|
||||
set => SAV.Data[SAV.Misc.Offset + 0x0135] = (byte)(value ? 1 : 0);
|
||||
set => SAV.Data[SAV.Misc.Offset + 0x0135] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public const int WormholeSlotMax = 15;
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace PKHeX.Core
|
|||
public bool IsShiny
|
||||
{
|
||||
get => Data[Offset + 0xC] != 0;
|
||||
set => Data[Offset + 0xC] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offset + 0xC] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public uint EncryptionConstant
|
||||
|
|
|
@ -89,19 +89,19 @@ namespace PKHeX.Core
|
|||
public bool PokeDexComplete
|
||||
{
|
||||
get => Data[Offset + 0x30] == 1;
|
||||
set => Data[Offset + 0x30] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offset + 0x30] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public bool ArmorDexComplete
|
||||
{
|
||||
get => Data[Offset + 0x1B4] == 1;
|
||||
set => Data[Offset + 0x1B4] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offset + 0x1B4] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public bool CrownDexComplete
|
||||
{
|
||||
get => Data[Offset + 0x1B5] == 1;
|
||||
set => Data[Offset + 0x1B5] = (byte)(value ? 1 : 0);
|
||||
set => Data[Offset + 0x1B5] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public int Gender
|
||||
|
@ -307,7 +307,7 @@ namespace PKHeX.Core
|
|||
public bool IsShiny
|
||||
{
|
||||
get => Data[Offset + 0xC] != 0;
|
||||
set => Data[Offset + 0xC] = (byte) (value ? 1 : 0);
|
||||
set => Data[Offset + 0xC] = value ? 1 : 0;
|
||||
}
|
||||
|
||||
public uint EncryptionConstant
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace PKHeX.Core
|
|||
if (US)
|
||||
{
|
||||
StringConverter12.SetString1(line2, 0x10, false, 0x10, 0x50).CopyTo(Data, 0x11);
|
||||
StringConverter12.SetString1(line1, 0x10, false, 0x10, (ushort)(Data.Skip(0x11).Take(0x10).All(v => v == 0x50) ? 0x50 : 0x7F)).CopyTo(Data, 0);
|
||||
StringConverter12.SetString1(line1, 0x10, false, 0x10, Data.Skip(0x11).Take(0x10).All(v => v == 0x50) ? 0x50 : 0x7F).CopyTo(Data, 0);
|
||||
Data[0x10] = 0x4E;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace PKHeX.Core
|
|||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
for (int x = 0; x < 4; x++)
|
||||
SetMessage(y, x, (ushort)(x == 1 ? 0 : 0xFFFF));
|
||||
SetMessage(y, x, x == 1 ? 0 : 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace PKHeX.Core
|
|||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
for (int x = 0; x < 4; x++)
|
||||
SetMessage(y, x, (ushort)(x == 1 ? 0 : 0xFFFF));
|
||||
SetMessage(y, x, x == 1 ? 0 : 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue