public PersonalInfoSWSH(byte[] data) : base(data) { TMHM = new bool[200]; for (var i = 0; i < CountTR; i++) { TMHM[i] = FlagUtil.GetFlag(Data, 0x28 + (i >> 3), i); TMHM[i + CountTM] = FlagUtil.GetFlag(Data, 0x3C + (i >> 3), i); } // 0x38-0x3B type tutors, but only 8 bits are valid flags. var typeTutors = new bool[8]; for (int i = 0; i < typeTutors.Length; i++) { typeTutors[i] = FlagUtil.GetFlag(Data, 0x38, i); } TypeTutors = typeTutors; // 0xA8-0xAF are armor type tutors, one bit for each type var armorTutors = new bool[18]; for (int i = 0; i < armorTutors.Length; i++) { armorTutors[i] = FlagUtil.GetFlag(Data, 0xA8 + (i >> 3), i); } SpecialTutors = new[] { armorTutors, }; }
public override byte[] Write() { for (var i = 0; i < 100; i++) { FlagUtil.SetFlag(Data, 0x28 + (i >> 3), i, TMHM[i]); FlagUtil.SetFlag(Data, 0x3C + (i >> 3), i, TMHM[i + 100]); } for (int i = 0; i < TypeTutors.Length; i++) { FlagUtil.SetFlag(Data, 0x38, i, TypeTutors[i]); } return(Data); }
public override byte[] Write() { for (var i = 0; i < CountTR; i++) { FlagUtil.SetFlag(Data, 0x28 + (i >> 3), i, TMHM[i]); FlagUtil.SetFlag(Data, 0x3C + (i >> 3), i, TMHM[i + CountTM]); } for (int i = 0; i < TypeTutors.Length; i++) { FlagUtil.SetFlag(Data, 0x38, i, TypeTutors[i]); } for (int i = 0; i < SpecialTutors[0].Length; i++) { FlagUtil.SetFlag(Data, 0xA8 + (i >> 3), i, SpecialTutors[0][i]); } return(Data); }
public PersonalInfoSWSH(byte[] data) : base(data) { TMHM = new bool[200]; for (var i = 0; i < 100; i++) { TMHM[i] = FlagUtil.GetFlag(Data, 0x28 + (i >> 3), i); TMHM[i + 100] = FlagUtil.GetFlag(Data, 0x3C + (i >> 3), i); } // 0x38-0x3B type tutors, but only 8 bits are valid flags. var typeTutors = new bool[8]; for (int i = 0; i < typeTutors.Length; i++) { typeTutors[i] = FlagUtil.GetFlag(Data, 0x38, i); } TypeTutors = typeTutors; }
/// <summary> /// Sets the <see cref="bool"/> status of the Flag at the specified offset and index. /// </summary> /// <param name="offset">Offset to read from</param> /// <param name="bitIndex">Bit index to read</param> /// <param name="value">Flag status to set</param> /// <remarks>Flag is Set (true) or not Set (false)</remarks> public virtual void SetFlag(int offset, int bitIndex, bool value) => FlagUtil.SetFlag(Data, offset, bitIndex, value);
/// <summary> /// Gets the <see cref="bool"/> status of the Flag at the specified offset and index. /// </summary> /// <param name="offset">Offset to read from</param> /// <param name="bitIndex">Bit index to read</param> /// <returns>Flag is Set (true) or not Set (false)</returns> public virtual bool GetFlag(int offset, int bitIndex) => FlagUtil.GetFlag(Data, offset, bitIndex);
/// <inheritdoc /> public override void SetFlag(int offset, int bitIndex, bool value) => FlagUtil.SetFlag(General, offset, bitIndex, value);
/// <inheritdoc /> public override bool GetFlag(int offset, int bitIndex) => FlagUtil.GetFlag(General, offset, bitIndex);
private static void SetFlag(byte[] data, int offset, int bitIndex, bool value = true) => FlagUtil.SetFlag(data, offset + (bitIndex >> 3), bitIndex, value);
private static bool GetFlag(byte[] data, int offset, int bitIndex) => FlagUtil.GetFlag(data, offset + (bitIndex >> 3), bitIndex);
public void SetFlag(int index, bool value = true) { var offset = Offset + FlagStart + (index >> 3); FlagUtil.SetFlag(Data, offset, index, value); }
public bool GetFlag(int index) { var offset = Offset + FlagStart + (index >> 3); return(FlagUtil.GetFlag(Data, offset, index)); }