Kernel_bin.Menu_abilities.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace FF8
  4. {
  5. public partial class Kernel_bin
  6. {
  7. /// <summary>
  8. /// Menu Abilities Data
  9. /// </summary>
  10. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Menu-abilities"/>
  11. public class Menu_abilities :Ability
  12. {
  13. public new const int count = 24;
  14. public new const int id = 17;
  15. public override string ToString() => Name;
  16. public byte Index { get; private set; }
  17. public byte Start { get; private set; }
  18. public byte End { get; private set; }
  19. public override void Read(BinaryReader br, int i)
  20. {
  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. Index = br.ReadByte();
  29. //0x0005 1 byte Index to m00X files in menu.fs
  30. //(first 3 sections are treated as special cases)
  31. Start = br.ReadByte();
  32. //0x0006 1 byte Start offset
  33. End = br.ReadByte();
  34. //0x0007 1 byte End offset
  35. }
  36. public static Dictionary<Abilities,Menu_abilities> Read(BinaryReader br)
  37. {
  38. Dictionary<Abilities, Menu_abilities> ret = new Dictionary<Abilities, Menu_abilities>(count);
  39. for (int i = 0; i < count; i++)
  40. {
  41. var tmp = new Menu_abilities();
  42. tmp.Read(br, i);
  43. ret[(Abilities)(i+(int)Abilities.Haggle)] = tmp;
  44. }
  45. return ret;
  46. }
  47. }
  48. }
  49. }