Kernel_bin.Weapons_Data.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.IO;
  2. namespace FF8
  3. {
  4. public partial class Kernel_bin
  5. {
  6. /// <summary>
  7. /// Weapon Data
  8. /// </summary>
  9. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Weapons"/>
  10. public class Weapons_Data
  11. {
  12. public const int count = 33;
  13. public const int id = 4;
  14. public FF8String Name { get; private set; }
  15. public override string ToString() => Name;
  16. //0x0000 2 bytes Offset to weapon name
  17. public Renzokeken_Level Renzokuken; //0x0002 1 byte Renzokuken finishers
  18. public byte Unknown0; //0x0003 1 byte Unknown
  19. public Characters Character;//0x0004 1 byte Character ID
  20. public Attack_Type Attack_type;//0x0005 1 bytes Attack Type
  21. public byte Attack_power;//0x0006 1 byte Attack Power
  22. public byte HIT;//0x0007 1 byte Attack Parameter
  23. public byte STR;//0x0008 1 byte STR Bonus
  24. public byte Tier;//0x0009 1 byte Weapon Tier
  25. public byte CRIT;//0x000A 1 byte Crit Bonus
  26. public bool Melee;//0x000B 1 byte Melee Weapon?
  27. public void Read(BinaryReader br, int string_id = 0)
  28. {
  29. Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, string_id);
  30. br.BaseStream.Seek(2, SeekOrigin.Current);
  31. Renzokuken = (Renzokeken_Level)br.ReadByte(); //0x0002 1 byte Renzokuken finishers
  32. Unknown0 = br.ReadByte(); //0x0003 1 byte Unknown
  33. Character = (Characters)br.ReadByte();//0x0004 1 byte Character ID
  34. Attack_type = (Attack_Type)br.ReadByte();//0x0005 1 bytes Attack Type
  35. Attack_power = br.ReadByte();//0x0006 1 byte Attack Power
  36. HIT = br.ReadByte();//0x0007 1 byte Attack Parameter
  37. STR = br.ReadByte();//0x0008 1 byte STR Bonus
  38. Tier = br.ReadByte();//0x0009 1 byte Weapon Tier
  39. CRIT = br.ReadByte();//0x000A 1 byte Crit Bonus
  40. Melee = br.ReadByte() == 0 ? false : true;//0x000B 1 byte Melee Weapon?
  41. }
  42. public static Weapons_Data[] Read(BinaryReader br)
  43. {
  44. Weapons_Data[] ret = new Weapons_Data[count];
  45. for (int i = 0; i < count; i++)
  46. {
  47. Weapons_Data tmp = new Weapons_Data();
  48. tmp.Read(br, i);
  49. ret[i] = tmp;
  50. }
  51. return ret;
  52. }
  53. }
  54. }
  55. }