Kernel_bin.Party_abilities.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. namespace FF8
  5. {
  6. public partial class Kernel_bin
  7. {
  8. /// <summary>
  9. /// Party Abilities Data
  10. /// </summary>
  11. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Party-abilities"/>
  12. public class Party_abilities : Equipable_Ability
  13. {
  14. public new const int count = 5;
  15. public new const int id = 15;
  16. public BitArray Flags { get; private set; }
  17. public byte[] Unknown0 { get; private set; }
  18. public override void Read(BinaryReader br, int i)
  19. {
  20. Icon = Icons.ID.Ability_Party;
  21. Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2);
  22. //0x0000 2 bytes Offset to name
  23. Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1);
  24. //0x0002 2 bytes Offset to description
  25. br.BaseStream.Seek(4, SeekOrigin.Current);
  26. AP = br.ReadByte();
  27. //0x0004 1 byte AP Required to learn ability
  28. Flags = new BitArray(br.ReadBytes(1));
  29. //0x0005 1 byte Flags
  30. Unknown0 = br.ReadBytes(2);
  31. //0x0006 2 byte Unknown/ Unused
  32. }
  33. public static Dictionary<Abilities,Party_abilities> Read(BinaryReader br)
  34. {
  35. Dictionary<Abilities, Party_abilities> ret = new Dictionary<Abilities, Party_abilities>(count);
  36. for (int i = 0; i < count; i++)
  37. {
  38. var tmp = new Party_abilities();
  39. tmp.Read(br, i);
  40. ret[(Abilities)(i+(int)Abilities.Alert)] = tmp;
  41. }
  42. return ret;
  43. }
  44. }
  45. }
  46. }