item_db2_re_compat.sql 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. #
  2. # View structure for view `item_db2_re_compat`
  3. #
  4. DROP VIEW IF EXISTS `item_db2_re_compat`;
  5. CREATE VIEW `item_db2_re_compat` AS (
  6. SELECT
  7. `id`,
  8. `name_aegis` AS `name_english`,
  9. `name_english` AS `name_japanese`,
  10. case
  11. when `type` = 'Healing' then
  12. 0
  13. when `type` = 'Usable' then
  14. 2
  15. when `type` = 'Etc' then
  16. 3
  17. when `type` = 'Armor' then
  18. 4
  19. when `type` = 'Weapon' then
  20. 5
  21. when `type` = 'Card' then
  22. 6
  23. when `type` = 'Petegg' then
  24. 7
  25. when `type` = 'Petarmor' then
  26. 8
  27. when `type` = 'Ammo' then
  28. 10
  29. when `type` = 'Delayconsume' then
  30. 11
  31. when `type` = 'Shadowgear' then
  32. 12
  33. when `type` = 'Cash' then
  34. 18
  35. else
  36. 3 -- etc
  37. end as `type`,
  38. `price_buy`,
  39. `price_sell`,
  40. `weight`,
  41. case
  42. when `attack` > 0 and `magic_attack` > 0 then
  43. CONCAT( `attack`, ':', `magic_attack` )
  44. when `attack` > 0 then
  45. `attack`
  46. when `magic_attack` > 0 then
  47. CONCAT( '0:', `magic_attack` )
  48. else
  49. null
  50. end as `atk:matk`,
  51. `defense` as `defence`,
  52. `range`,
  53. `slots`,
  54. case
  55. when `job_all` > 0 then
  56. 4294967295
  57. else
  58. IF(
  59. IF( `job_acolyte` > 0, 16, 0 ) +
  60. IF( `job_alchemist` > 0, 262144, 0 ) +
  61. IF( `job_archer` > 0, 8, 0 ) +
  62. IF( `job_assassin` > 0, 4096, 0 ) +
  63. IF( `job_barddancer` > 0, 524288, 0 ) +
  64. IF( `job_blacksmith` > 0, 1024, 0 ) +
  65. IF( `job_crusader` > 0, 16384, 0 ) +
  66. IF( `job_gunslinger` > 0, 16777216, 0 ) +
  67. IF( `job_hunter` > 0, 2048, 0 ) +
  68. IF( `job_kagerouoboro` > 0, 536870912, 0 ) +
  69. IF( `job_knight` > 0, 128, 0 ) +
  70. IF( `job_mage` > 0, 4, 0 ) +
  71. IF( `job_merchant` > 0, 32, 0 ) +
  72. IF( `job_monk` > 0, 32768, 0 ) +
  73. IF( `job_ninja` > 0, 33554432, 0 ) +
  74. IF( `job_novice` > 0 OR `job_supernovice` > 0, 1, 0 ) +
  75. IF( `job_priest` > 0, 256, 0 ) +
  76. IF( `job_rebellion` > 0, 1073741824, 0 ) +
  77. IF( `job_rogue` > 0, 131072, 0 ) +
  78. IF( `job_sage` > 0, 65536, 0 ) +
  79. IF( `job_soullinker` > 0, 8388608, 0 ) +
  80. IF( `job_stargladiator` > 0, 4194304, 0 ) +
  81. IF( `job_summoner` > 0, 2147483648, 0 ) +
  82. IF( `job_swordman` > 0, 2, 0 ) +
  83. IF( `job_taekwon` > 0, 2097152, 0 ) +
  84. IF( `job_thief` > 0, 64, 0 ) +
  85. IF( `job_wizard` > 0, 512, 0 ) > 0
  86. ,
  87. IF( `job_acolyte` > 0, 16, 0 ) +
  88. IF( `job_alchemist` > 0, 262144, 0 ) +
  89. IF( `job_archer` > 0, 8, 0 ) +
  90. IF( `job_assassin` > 0, 4096, 0 ) +
  91. IF( `job_barddancer` > 0, 524288, 0 ) +
  92. IF( `job_blacksmith` > 0, 1024, 0 ) +
  93. IF( `job_crusader` > 0, 16384, 0 ) +
  94. IF( `job_gunslinger` > 0, 16777216, 0 ) +
  95. IF( `job_hunter` > 0, 2048, 0 ) +
  96. IF( `job_kagerouoboro` > 0, 536870912, 0 ) +
  97. IF( `job_knight` > 0, 128, 0 ) +
  98. IF( `job_mage` > 0, 4, 0 ) +
  99. IF( `job_merchant` > 0, 32, 0 ) +
  100. IF( `job_monk` > 0, 32768, 0 ) +
  101. IF( `job_ninja` > 0, 33554432, 0 ) +
  102. IF( `job_novice` > 0 OR `job_supernovice` > 0, 1, 0 ) +
  103. IF( `job_priest` > 0, 256, 0 ) +
  104. IF( `job_rebellion` > 0, 1073741824, 0 ) +
  105. IF( `job_rogue` > 0, 131072, 0 ) +
  106. IF( `job_sage` > 0, 65536, 0 ) +
  107. IF( `job_soullinker` > 0, 8388608, 0 ) +
  108. IF( `job_stargladiator` > 0, 4194304, 0 ) +
  109. IF( `job_summoner` > 0, 2147483648, 0 ) +
  110. IF( `job_swordman` > 0, 2, 0 ) +
  111. IF( `job_taekwon` > 0, 2097152, 0 ) +
  112. IF( `job_thief` > 0, 64, 0 ) +
  113. IF( `job_wizard` > 0, 512, 0 )
  114. ,
  115. null
  116. )
  117. end as `equip_jobs`,
  118. case
  119. when `class_all` > 0 then
  120. 63
  121. else
  122. IF(
  123. IF( `class_normal` > 0, 1, 0 ) +
  124. IF( `class_upper` > 0, 2, 0 ) +
  125. IF( `class_baby` > 0, 4, 0 ) +
  126. IF( `class_third` > 0, 8, 0 ) +
  127. IF( `class_third_upper` > 0, 16, 0 ) +
  128. IF( `class_third_baby` > 0, 32, 0 ) > 0
  129. ,
  130. IF( `class_normal` > 0, 1, 0 ) +
  131. IF( `class_upper` > 0, 2, 0 ) +
  132. IF( `class_baby` > 0, 4, 0 ) +
  133. IF( `class_third` > 0, 8, 0 ) +
  134. IF( `class_third_upper` > 0, 16, 0 ) +
  135. IF( `class_third_baby` > 0, 32, 0 )
  136. ,
  137. null
  138. )
  139. end as `equip_upper`,
  140. case
  141. when `gender` = 'Female' then
  142. 0
  143. when `gender` = 'Male' then
  144. 1
  145. when `gender` = 'Both' then
  146. 2
  147. else
  148. null
  149. end as `equip_genders`,
  150. IF(
  151. IF( `location_head_top` > 0, 256, 0 ) +
  152. IF( `location_head_mid` > 0, 512, 0 ) +
  153. IF( `location_head_low` > 0, 1, 0 ) +
  154. IF( `location_armor` > 0, 16, 0 ) +
  155. IF( `location_right_hand` > 0, 2, 0 ) +
  156. IF( `location_left_hand` > 0, 32, 0 ) +
  157. IF( `location_garment` > 0, 4, 0 ) +
  158. IF( `location_shoes` > 0, 64, 0 ) +
  159. IF( `location_right_accessory` > 0, 8, 0 ) +
  160. IF( `location_left_accessory` > 0, 128, 0 ) +
  161. IF( `location_costume_head_top` > 0, 1024, 0 ) +
  162. IF( `location_costume_head_mid` > 0, 2048, 0 ) +
  163. IF( `location_costume_head_low` > 0, 4096, 0 ) +
  164. IF( `location_costume_garment` > 0, 8192, 0 ) +
  165. IF( `location_ammo` > 0, 32768, 0 ) +
  166. IF( `location_shadow_armor` > 0, 65536, 0 ) +
  167. IF( `location_shadow_weapon` > 0, 131072, 0 ) +
  168. IF( `location_shadow_shield` > 0, 262144, 0 ) +
  169. IF( `location_shadow_shoes` > 0, 524288, 0 ) +
  170. IF( `location_shadow_right_accessory` > 0, 1048576, 0 ) +
  171. IF( `location_shadow_left_accessory` > 0, 2097152, 0 ) > 0
  172. ,
  173. IF( `location_head_top` > 0, 256, 0 ) +
  174. IF( `location_head_mid` > 0, 512, 0 ) +
  175. IF( `location_head_low` > 0, 1, 0 ) +
  176. IF( `location_armor` > 0, 16, 0 ) +
  177. IF( `location_right_hand` > 0, 2, 0 ) +
  178. IF( `location_left_hand` > 0, 32, 0 ) +
  179. IF( `location_garment` > 0, 4, 0 ) +
  180. IF( `location_shoes` > 0, 64, 0 ) +
  181. IF( `location_right_accessory` > 0, 8, 0 ) +
  182. IF( `location_left_accessory` > 0, 128, 0 ) +
  183. IF( `location_costume_head_top` > 0, 1024, 0 ) +
  184. IF( `location_costume_head_mid` > 0, 2048, 0 ) +
  185. IF( `location_costume_head_low` > 0, 4096, 0 ) +
  186. IF( `location_costume_garment` > 0, 8192, 0 ) +
  187. IF( `location_ammo` > 0, 32768, 0 ) +
  188. IF( `location_shadow_armor` > 0, 65536, 0 ) +
  189. IF( `location_shadow_weapon` > 0, 131072, 0 ) +
  190. IF( `location_shadow_shield` > 0, 262144, 0 ) +
  191. IF( `location_shadow_shoes` > 0, 524288, 0 ) +
  192. IF( `location_shadow_right_accessory` > 0, 1048576, 0 ) +
  193. IF( `location_shadow_left_accessory` > 0, 2097152, 0 )
  194. ,
  195. null
  196. )
  197. as `equip_locations`,
  198. `weapon_level`,
  199. case
  200. when `equip_level_min` > 0 and `equip_level_max` > 0 then
  201. CONCAT( `equip_level_min`, ':', `equip_level_max` )
  202. when `equip_level_min` > 0 then
  203. `equip_level_min`
  204. when `equip_level_min` > 0 then
  205. `equip_level_min`
  206. else
  207. null
  208. end as `equip_level`,
  209. `refineable`,
  210. case
  211. when `view` > 0 then
  212. `view`
  213. else
  214. null
  215. end as `view`,
  216. `script`,
  217. `equip_script`,
  218. `unequip_script`
  219. FROM `item_db2_re`
  220. );