Kernel_bin.Renzokuken_Finishers_Data.cs 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. namespace OpenVIII
  6. {
  7. public partial class Kernel_bin
  8. {
  9. /// <summary>
  10. /// Renzokuken Finishers Data
  11. /// </summary>
  12. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Renzokuken-finishers"/>
  13. public class Renzokuken_Finishers_Data
  14. {
  15. public const int id = 5;
  16. public const int count = 4;
  17. public FF8String Name { get; private set; }
  18. public FF8String Description { get; private set; }
  19. public override string ToString() => Name;
  20. public Magic_ID MagicID { get; private set; } //0x0004 2 bytes Magic ID
  21. public Attack_Type Attack_Type { get; private set; } //0x0006 1 byte Attack Type
  22. public byte Unknown0 { get; private set; } //0x0007 1 byte Unknown
  23. public byte Attack_Power { get; private set; } //0x0008 1 byte Attack power
  24. public byte Unknown1 { get; private set; } //0x0009 1 byte Unknown
  25. public Target Target { get; private set; } //0x000A 1 byte Target info
  26. public Attack_Flags Attack_Flags { get; private set; } //0x000B 1 byte Attack Flags
  27. public byte Hit_Count { get; private set; } //0x000C 1 byte Hit count
  28. public Element Element { get; private set; } //0x000D 1 byte Element Attack
  29. public byte Element_Percent { get; private set; } //0x000E 1 byte Element Attack %
  30. public byte Status_Attack { get; private set; } //0x000F 1 byte Status Attack Enabler
  31. public byte[] Unknown2 { get; private set; } //0x0010 2 bytes Unknown
  32. public Persistent_Statuses Statuses0 { get; private set; } //0x0012 2 bytes status_0; //statuses 0-7
  33. public Battle_Only_Statuses Statuses1 { get; private set; } //0x0014 4 bytes status_1; //statuses 8-39
  34. public void Read(BinaryReader br, int i)
  35. {
  36. Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2);
  37. Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1);
  38. br.BaseStream.Seek(4, SeekOrigin.Current);
  39. MagicID = (Magic_ID)br.ReadUInt16(); //0x0004 2 bytes Magic ID
  40. Attack_Type = (Attack_Type)br.ReadByte(); //0x0006 1 byte Attack Type
  41. Unknown0 = br.ReadByte(); //0x0007 1 byte Unknown
  42. Attack_Power = br.ReadByte(); //0x0008 1 byte Attack power
  43. Unknown1 = br.ReadByte(); //0x0009 1 byte Unknown
  44. Target = (Target)br.ReadByte(); //0x000A 1 byte Target info
  45. Attack_Flags = (Attack_Flags)br.ReadByte(); //0x000B 1 byte Attack Flags
  46. Hit_Count = br.ReadByte(); //0x000C 1 byte Hit count
  47. Element = (Element)br.ReadByte(); //0x000D 1 byte Element Attack
  48. Element_Percent = br.ReadByte(); //0x000E 1 byte Element Attack %
  49. Status_Attack = br.ReadByte(); //0x000F 1 byte Status Attack Enabler
  50. Unknown2 = br.ReadBytes(2); //0x0010 2 bytes Unknown
  51. Statuses0 = (Persistent_Statuses)br.ReadUInt16(); //0x0012 2 bytes status_0; //statuses 0-7
  52. Statuses1 = (Battle_Only_Statuses)br.ReadUInt32(); //0x0014 4 bytes status_1; //statuses 8-39
  53. }
  54. public static Dictionary<Renzokeken_Finisher, Renzokuken_Finishers_Data> Read(BinaryReader br)
  55. {
  56. List<Kernel_bin.Renzokeken_Finisher> flags = Enum.GetValues(typeof(Kernel_bin.Renzokeken_Finisher))
  57. .Cast<Kernel_bin.Renzokeken_Finisher>()
  58. .ToList();
  59. var ret = new Dictionary<Renzokeken_Finisher, Renzokuken_Finishers_Data>(count);
  60. for (int i = 0; i < count; i++)
  61. {
  62. Renzokuken_Finishers_Data tmp = new Renzokuken_Finishers_Data();
  63. tmp.Read(br, i);
  64. ret[flags[i]] = tmp;
  65. }
  66. return ret;
  67. }
  68. }
  69. }
  70. }