Kernel_bin.Weapons_Data.cs 3.2 KB

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