Kernel_bin.Stat_percent_abilities.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace OpenVIII
  4. {
  5. public partial class Kernel_bin
  6. {
  7. /// <summary>
  8. /// Stat Percentage Increasing Abilities Data
  9. /// </summary>
  10. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Stat-percentage-increasing-abilities"/>
  11. public class Stat_percent_abilities : Equipable_Ability
  12. {
  13. public new const int count = 19;
  14. public new const int id = 13;
  15. public Stat Stat { get; private set; }
  16. public byte Value { 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_Character;
  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 needed to learn the ability
  28. Stat = (Stat)br.ReadByte();
  29. //0x0005 1 byte Stat to increase
  30. Value = br.ReadByte();
  31. //0x0006 1 byte Increase value
  32. Unknown0 = br.ReadByte();
  33. //0x0007 1 byte Unknown/ Unused
  34. }
  35. public static Dictionary<Abilities, Stat_percent_abilities> Read(BinaryReader br)
  36. {
  37. Dictionary<Abilities, Stat_percent_abilities> ret = new Dictionary<Abilities, Stat_percent_abilities>(count);
  38. for (int i = 0; i < count; i++)
  39. {
  40. Stat_percent_abilities tmp = new Stat_percent_abilities();
  41. tmp.Read(br, i);
  42. ret[(Abilities)(i+ (int)Abilities.HP_20)] = tmp;
  43. }
  44. return ret;
  45. }
  46. }
  47. }
  48. }