Kernel_bin.Junctionable_GFs_Data.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. namespace FF8
  6. {
  7. public partial class Kernel_bin
  8. {
  9. /// <summary>
  10. /// requirement to unlock abilities
  11. /// </summary>
  12. /// <see cref="https://github.com/alexfilth/doomtrain/blob/master/Doomtrain/MainForm.Designer.cs"/>
  13. public enum Unlocker:byte
  14. {
  15. None,
  16. GFLevel1,
  17. GFLevel2,
  18. GFLevel3,
  19. GFLevel4,
  20. GFLevel5,
  21. GFLevel6,
  22. GFLevel7,
  23. GFLevel8,
  24. GFLevel9,
  25. GFLevel10,
  26. GFLevel11,
  27. GFLevel12,
  28. GFLevel13,
  29. GFLevel14,
  30. GFLevel15,
  31. GFLevel16,
  32. GFLevel17,
  33. GFLevel18,
  34. GFLevel19,
  35. GFLevel20,
  36. GFLevel21,
  37. GFLevel22,
  38. GFLevel23,
  39. GFLevel24,
  40. GFLevel25,
  41. GFLevel26,
  42. GFLevel27,
  43. GFLevel28,
  44. GFLevel29,
  45. GFLevel30,
  46. GFLevel31,
  47. GFLevel32,
  48. GFLevel33,
  49. GFLevel34,
  50. GFLevel35,
  51. GFLevel36,
  52. GFLevel37,
  53. GFLevel38,
  54. GFLevel39,
  55. GFLevel40,
  56. GFLevel41,
  57. GFLevel42,
  58. GFLevel43,
  59. GFLevel44,
  60. GFLevel45,
  61. GFLevel46,
  62. GFLevel47,
  63. GFLevel48,
  64. GFLevel49,
  65. GFLevel50,
  66. GFLevel51,
  67. GFLevel52,
  68. GFLevel53,
  69. GFLevel54,
  70. GFLevel55,
  71. GFLevel56,
  72. GFLevel57,
  73. GFLevel58,
  74. GFLevel59,
  75. GFLevel60,
  76. GFLevel61,
  77. GFLevel62,
  78. GFLevel63,
  79. GFLevel64,
  80. GFLevel65,
  81. GFLevel66,
  82. GFLevel67,
  83. GFLevel68,
  84. GFLevel69,
  85. GFLevel70,
  86. GFLevel71,
  87. GFLevel72,
  88. GFLevel73,
  89. GFLevel74,
  90. GFLevel75,
  91. GFLevel76,
  92. GFLevel77,
  93. GFLevel78,
  94. GFLevel79,
  95. GFLevel80,
  96. GFLevel81,
  97. GFLevel82,
  98. GFLevel83,
  99. GFLevel84,
  100. GFLevel85,
  101. GFLevel86,
  102. GFLevel87,
  103. GFLevel88,
  104. GFLevel89,
  105. GFLevel90,
  106. GFLevel91,
  107. GFLevel92,
  108. GFLevel93,
  109. GFLevel94,
  110. GFLevel95,
  111. GFLevel96,
  112. GFLevel97,
  113. GFLevel98,
  114. GFLevel99,
  115. GFLevel100,
  116. Ability1,
  117. Ability2,
  118. Ability3,
  119. Ability4,
  120. Ability5,
  121. Ability6,
  122. Ability7,
  123. Ability8,
  124. Ability9,
  125. Ability10,
  126. Ability11,
  127. Ability12,
  128. Ability13,
  129. Ability14,
  130. Ability15,
  131. Ability16,
  132. Ability17,
  133. Ability18,
  134. Ability19,
  135. Ability20,
  136. Ability21,
  137. }
  138. /// <summary>
  139. /// Junctionable GFs Data
  140. /// </summary>
  141. /// <see cref="https://github.com/alexfilth/doomtrain/wiki/Junctionable-GFs"/>
  142. public class Junctionable_GFs_Data
  143. {
  144. public const int id = 2;
  145. public const int count = 16;
  146. public FF8String Name { get; private set; }
  147. public FF8String Description { get; private set; }
  148. public override string ToString() => Name;
  149. //0x0000 2 bytes Offset to GF attack name
  150. //0x0002 2 bytes Offset to GF attack description
  151. public Magic_ID MagicID; //0x0004 2 bytes[[Magic ID
  152. public Attack_Type Attack_type; //0x0006 1 byte Attack type
  153. public byte GF_power; //0x0007 1 byte GF power(used in damage formula)
  154. public byte[] Unknown0; //0x0008 2 bytes Unknown
  155. public Attack_Flags Attack_flags; //0x000A 1 byte Attack Flags
  156. public byte[] Unknown1; //0x000B 2 bytes Unknown
  157. public Element Element; //0x000D 1 byte[[Element
  158. public Statuses0 Statuses0; //0x000E 2 bytes[[Statuses 0
  159. public Statuses1 Statuses1; //0x0010 4 bytes[[Statuses 1
  160. public byte GFHP_modifier; //0x0014 1 byte GF HP Modifier(used in GF HP formula)
  161. public byte[] Unknown2_1; //0x0015 3 bytes Unknown
  162. public ushort EXPperLevel; //0x18 1 byte *10;
  163. public byte[] Unknown2_2; //0x0019 2 bytes Unknown
  164. public byte Status_attack; //0x001B 1 byte Status attack enabler
  165. public Dictionary<Abilities, Unlocker> Ability;
  166. //0x001C 1 byte[[Ability 1 Unlocker
  167. //0x001D 1 byte Unknown
  168. //0x001E 1 byte[[Ability 1
  169. //0x001F 1 byte Unknown
  170. //0x0020 1 byte[[Ability 2 Unlocker
  171. //0x0021 1 byte Unknown
  172. //0x0022 1 byte[[Ability 2
  173. //0x0023 1 byte Unknown
  174. //0x0024 1 byte[[Ability 3 Unlocker
  175. //0x0025 1 byte Unknown
  176. //0x0026 1 byte[[Ability 3
  177. //0x0027 1 byte Unknown
  178. //0x0028 1 byte[[Ability 4 Unlocker
  179. //0x0029 1 byte Unknown
  180. //0x002A 1 byte[[Ability 4
  181. //0x002B 1 byte Unknown
  182. //0x002C 1 byte[[Ability 5 Unlocker
  183. //0x002D 1 byte Unknown
  184. //0x002E 1 byte[[Ability 5
  185. //0x002F 1 byte Unknown
  186. //0x0030 1 byte[[Ability 6 Unlocker
  187. //0x0031 1 byte Unknown
  188. //0x0032 1 byte[[Ability 6
  189. //0x0033 1 byte Unknown
  190. //0x0034 1 byte[[Ability 7 Unlocker
  191. //0x0035 1 byte Unknown
  192. //0x0036 1 byte[[Ability 7
  193. //0x0037 1 byte Unknown
  194. //0x0038 1 byte[[Ability 8 Unlocker
  195. //0x0039 1 byte Unknown
  196. //0x003A 1 byte[[Ability 8
  197. //0x003B 1 byte Unknown
  198. //0x003C 1 byte[[Ability 9 Unlocker
  199. //0x003D 1 byte Unknown
  200. //0x003E 1 byte[[Ability 9
  201. //0x003F 1 byte Unknown
  202. //0x0040 1 byte[[Ability 10 Unlocker
  203. //0x0041 1 byte Unknown
  204. //0x0042 1 byte[[Ability 10
  205. //0x0043 1 byte Unknown
  206. //0x0044 1 byte[[Ability 11 Unlocker
  207. //0x0045 1 byte Unknown
  208. //0x0046 1 byte[[Ability 11
  209. //0x0047 1 byte Unknown
  210. //0x0048 1 byte[[Ability 12 Unlocker
  211. //0x0049 1 byte Unknown
  212. //0x004A 1 byte[[Ability 12
  213. //0x004B 1 byte Unknown
  214. //0x004C 1 byte[[Ability 13 Unlocker
  215. //0x004D 1 byte Unknown
  216. //0x004E 1 byte[[Ability 13
  217. //0x004F 1 byte Unknown
  218. //0x0050 1 byte[[Ability 14 Unlocker
  219. //0x0051 1 byte Unknown
  220. //0x0052 1 byte[[Ability 14
  221. //0x0053 1 byte Unknown
  222. //0x0054 1 byte[[Ability 15 Unlocker
  223. //0x0055 1 byte Unknown
  224. //0x0056 1 byte[[Ability 15
  225. //0x0057 1 byte Unknown
  226. //0x0058 1 byte[[Ability 16 Unlocker
  227. //0x0059 1 byte Unknown
  228. //0x005A 1 byte[[Ability 16
  229. //0x005B 1 byte Unknown
  230. //0x005C 1 byte[[Ability 17 Unlocker
  231. //0x005D 1 byte Unknown
  232. //0x005E 1 byte[[Ability 17
  233. //0x005F 1 byte Unknown
  234. //0x0060 1 byte[[Ability 18 Unlocker
  235. //0x0061 1 byte Unknown
  236. //0x0062 1 byte[[Ability 18
  237. //0x0063 1 byte Unknown
  238. //0x0064 1 byte[[Ability 19 Unlocker
  239. //0x0065 1 byte Unknown
  240. //0x0066 1 byte[[Ability 19
  241. //0x0067 1 byte Unknown
  242. //0x0068 1 byte[[Ability 20 Unlocker
  243. //0x0069 1 byte Unknown
  244. //0x006A 1 byte[[Ability 20
  245. //0x006B 1 byte Unknown
  246. //0x006C 1 byte[[Ability 21 Unlocker
  247. //0x006D 1 byte Unknown
  248. //0x006E 1 byte[[Ability 21
  249. //0x006F 1 byte Unknown
  250. public Dictionary <GFs,decimal> GF_Compatibility;
  251. //0x0070 1 byte Quezacolt compatibility
  252. //0x0071 1 byte Shiva compatibility
  253. //0x0072 1 byte Ifrit compatibility
  254. //0x0073 1 byte Siren compatibility
  255. //0x0074 1 byte Brothers compatibility
  256. //0x0075 1 byte Diablos compatibility
  257. //0x0076 1 byte Carbuncle compatibility
  258. //0x0077 1 byte Leviathan compatibility
  259. //0x0078 1 byte Pandemona compatibility
  260. //0x0079 1 byte Cerberus compatibility
  261. //0x007A 1 byte Alexander compatibility
  262. //0x007B 1 byte Doomtrain compatibility
  263. //0x007C 1 byte Bahamut compatibility
  264. //0x007D 1 byte Cactuar compatibility
  265. //0x007E 1 byte Tonberry compatibility
  266. //0x007F 1 byte Eden compatibility
  267. public byte[] Unknown3; //0x0080 2 bytes Unknown
  268. public byte PowerMod; //0x0082 1 byte Power Mod(used in damage formula)
  269. public byte LevelMod; //0x0083 1 byte Level Mod(used in damage formula)
  270. public void Read(BinaryReader br, int i)
  271. {
  272. Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2);
  273. Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1);
  274. br.BaseStream.Seek(4, SeekOrigin.Current);
  275. MagicID = (Magic_ID)br.ReadUInt16(); //0x0004 2 bytes[[Magic ID
  276. Attack_type = (Attack_Type)br.ReadByte(); //0x0006 1 byte Attack type
  277. GF_power = br.ReadByte(); //0x0007 1 byte GF power(used in damage formula)
  278. Unknown0 = br.ReadBytes(2); //0x0008 2 bytes Unknown
  279. Attack_flags = (Attack_Flags)( br.ReadByte()); //0x000A 1 byte Attack Flags
  280. Unknown1 = br.ReadBytes(2); //0x000B 2 bytes Unknown
  281. Element = (Element)br.ReadByte(); //0x000D 1 byte[[Element
  282. Statuses0 = (Statuses0)br.ReadUInt16(); //0x000E 2 bytes[[Statuses 0
  283. Statuses1 = (Statuses1)br.ReadUInt32(); //0x0010 4 bytes[[Statuses 1
  284. GFHP_modifier = br.ReadByte(); //0x0014 1 byte GF HP Modifier(used in GF HP formula)
  285. Unknown2_1 = br.ReadBytes(3); //0x0015 3 bytes Unknown
  286. EXPperLevel = (ushort)((br.ReadByte())*10); //0x0018
  287. Unknown2_2 = br.ReadBytes(2); //0x0019 2 bytes Unknown
  288. Status_attack = br.ReadByte(); //0x001B 1 byte Status attack enabler
  289. Ability = new Dictionary< Abilities, Unlocker>(21);
  290. for (i = 0; i < 21; i++)
  291. {
  292. Unlocker val = (Unlocker) br.ReadByte();
  293. br.BaseStream.Seek(1, SeekOrigin.Current);
  294. Abilities key = (Abilities)br.ReadUInt16();
  295. Ability.Add(key, val);
  296. }
  297. GF_Compatibility = new Dictionary<GFs, decimal>(16);
  298. for(i=0; i < 16; i++)
  299. GF_Compatibility.Add((GFs)i,(100 - Convert.ToDecimal(br.ReadByte())) / 5); //doomtrain shows this is a decimal number. i got formula from code.
  300. Unknown3 = br.ReadBytes(2); //0x0080 2 bytes Unknown
  301. PowerMod = br.ReadByte(); //0x0082 1 byte Power Mod(used in damage formula)
  302. LevelMod = br.ReadByte(); //0x0083 1 byte Level Mod(used in damage formula)
  303. }
  304. public static Dictionary<GFs, Junctionable_GFs_Data> Read(BinaryReader br)
  305. {
  306. var ret = new Dictionary<GFs, Junctionable_GFs_Data>(count);
  307. for (int i = 0; i < count; i++)
  308. {
  309. var tmp = new Junctionable_GFs_Data();
  310. tmp.Read(br, i);
  311. ret[(GFs)i] = tmp;
  312. }
  313. return ret;
  314. }
  315. }
  316. }
  317. }