item_db2_compat.sql 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #
  2. # View structure for view `item_db2_compat`
  3. #
  4. DROP VIEW IF EXISTS `item_db2_compat`;
  5. CREATE VIEW `item_db2_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. `attack`,
  42. `defense` as `defence`,
  43. `range`,
  44. `slots`,
  45. case
  46. when `job_all` > 0 then
  47. 4294967295
  48. else
  49. IF(
  50. IF( `job_acolyte` > 0, 16, 0 ) +
  51. IF( `job_alchemist` > 0, 262144, 0 ) +
  52. IF( `job_archer` > 0, 8, 0 ) +
  53. IF( `job_assassin` > 0, 4096, 0 ) +
  54. IF( `job_barddancer` > 0, 524288, 0 ) +
  55. IF( `job_blacksmith` > 0, 1024, 0 ) +
  56. IF( `job_crusader` > 0, 16384, 0 ) +
  57. IF( `job_gunslinger` > 0, 16777216, 0 ) +
  58. IF( `job_hunter` > 0, 2048, 0 ) +
  59. IF( `job_knight` > 0, 128, 0 ) +
  60. IF( `job_mage` > 0, 4, 0 ) +
  61. IF( `job_merchant` > 0, 32, 0 ) +
  62. IF( `job_monk` > 0, 32768, 0 ) +
  63. IF( `job_ninja` > 0, 33554432, 0 ) +
  64. IF( `job_novice` > 0 OR `job_supernovice` > 0, 1, 0 ) +
  65. IF( `job_priest` > 0, 256, 0 ) +
  66. IF( `job_rogue` > 0, 131072, 0 ) +
  67. IF( `job_sage` > 0, 65536, 0 ) +
  68. IF( `job_soullinker` > 0, 8388608, 0 ) +
  69. IF( `job_stargladiator` > 0, 4194304, 0 ) +
  70. IF( `job_swordman` > 0, 2, 0 ) +
  71. IF( `job_taekwon` > 0, 2097152, 0 ) +
  72. IF( `job_thief` > 0, 64, 0 ) +
  73. IF( `job_wizard` > 0, 512, 0 ) > 0
  74. ,
  75. IF( `job_acolyte` > 0, 16, 0 ) +
  76. IF( `job_alchemist` > 0, 262144, 0 ) +
  77. IF( `job_archer` > 0, 8, 0 ) +
  78. IF( `job_assassin` > 0, 4096, 0 ) +
  79. IF( `job_barddancer` > 0, 524288, 0 ) +
  80. IF( `job_blacksmith` > 0, 1024, 0 ) +
  81. IF( `job_crusader` > 0, 16384, 0 ) +
  82. IF( `job_gunslinger` > 0, 16777216, 0 ) +
  83. IF( `job_hunter` > 0, 2048, 0 ) +
  84. IF( `job_knight` > 0, 128, 0 ) +
  85. IF( `job_mage` > 0, 4, 0 ) +
  86. IF( `job_merchant` > 0, 32, 0 ) +
  87. IF( `job_monk` > 0, 32768, 0 ) +
  88. IF( `job_ninja` > 0, 33554432, 0 ) +
  89. IF( `job_novice` > 0 OR `job_supernovice` > 0, 1, 0 ) +
  90. IF( `job_priest` > 0, 256, 0 ) +
  91. IF( `job_rogue` > 0, 131072, 0 ) +
  92. IF( `job_sage` > 0, 65536, 0 ) +
  93. IF( `job_soullinker` > 0, 8388608, 0 ) +
  94. IF( `job_stargladiator` > 0, 4194304, 0 ) +
  95. IF( `job_swordman` > 0, 2, 0 ) +
  96. IF( `job_taekwon` > 0, 2097152, 0 ) +
  97. IF( `job_thief` > 0, 64, 0 ) +
  98. IF( `job_wizard` > 0, 512, 0 )
  99. ,
  100. null
  101. )
  102. end as `equip_jobs`,
  103. case
  104. when `class_all` > 0 then
  105. 7
  106. else
  107. IF(
  108. IF( `class_normal` > 0, 1, 0 ) +
  109. IF( `class_upper` > 0, 2, 0 ) +
  110. IF( `class_baby` > 0, 4, 0 ) > 0
  111. ,
  112. IF( `class_normal` > 0, 1, 0 ) +
  113. IF( `class_upper` > 0, 2, 0 ) +
  114. IF( `class_baby` > 0, 4, 0 )
  115. ,
  116. null
  117. )
  118. end as `equip_upper`,
  119. case
  120. when `gender` = 'Female' then
  121. 0
  122. when `gender` = 'Male' then
  123. 1
  124. when `gender` = 'Both' then
  125. 2
  126. else
  127. null
  128. end as `equip_genders`,
  129. IF(
  130. IF( `location_head_top` > 0, 256, 0 ) +
  131. IF( `location_head_mid` > 0, 512, 0 ) +
  132. IF( `location_head_low` > 0, 1, 0 ) +
  133. IF( `location_armor` > 0, 16, 0 ) +
  134. IF( `location_right_hand` > 0, 2, 0 ) +
  135. IF( `location_left_hand` > 0, 32, 0 ) +
  136. IF( `location_garment` > 0, 4, 0 ) +
  137. IF( `location_shoes` > 0, 64, 0 ) +
  138. IF( `location_right_accessory` > 0, 8, 0 ) +
  139. IF( `location_left_accessory` > 0, 128, 0 ) +
  140. IF( `location_costume_head_top` > 0, 1024, 0 ) +
  141. IF( `location_costume_head_mid` > 0, 2048, 0 ) +
  142. IF( `location_costume_head_low` > 0, 4096, 0 ) +
  143. IF( `location_costume_garment` > 0, 8192, 0 ) +
  144. IF( `location_ammo` > 0, 32768, 0 ) +
  145. IF( `location_shadow_armor` > 0, 65536, 0 ) +
  146. IF( `location_shadow_weapon` > 0, 131072, 0 ) +
  147. IF( `location_shadow_shield` > 0, 262144, 0 ) +
  148. IF( `location_shadow_shoes` > 0, 524288, 0 ) +
  149. IF( `location_shadow_right_accessory` > 0, 1048576, 0 ) +
  150. IF( `location_shadow_left_accessory` > 0, 2097152, 0 ) > 0
  151. ,
  152. IF( `location_head_top` > 0, 256, 0 ) +
  153. IF( `location_head_mid` > 0, 512, 0 ) +
  154. IF( `location_head_low` > 0, 1, 0 ) +
  155. IF( `location_armor` > 0, 16, 0 ) +
  156. IF( `location_right_hand` > 0, 2, 0 ) +
  157. IF( `location_left_hand` > 0, 32, 0 ) +
  158. IF( `location_garment` > 0, 4, 0 ) +
  159. IF( `location_shoes` > 0, 64, 0 ) +
  160. IF( `location_right_accessory` > 0, 8, 0 ) +
  161. IF( `location_left_accessory` > 0, 128, 0 ) +
  162. IF( `location_costume_head_top` > 0, 1024, 0 ) +
  163. IF( `location_costume_head_mid` > 0, 2048, 0 ) +
  164. IF( `location_costume_head_low` > 0, 4096, 0 ) +
  165. IF( `location_costume_garment` > 0, 8192, 0 ) +
  166. IF( `location_ammo` > 0, 32768, 0 ) +
  167. IF( `location_shadow_armor` > 0, 65536, 0 ) +
  168. IF( `location_shadow_weapon` > 0, 131072, 0 ) +
  169. IF( `location_shadow_shield` > 0, 262144, 0 ) +
  170. IF( `location_shadow_shoes` > 0, 524288, 0 ) +
  171. IF( `location_shadow_right_accessory` > 0, 1048576, 0 ) +
  172. IF( `location_shadow_left_accessory` > 0, 2097152, 0 )
  173. ,
  174. null
  175. )
  176. as `equip_locations`,
  177. `weapon_level`,
  178. case
  179. when `equip_level_min` > 0 and `equip_level_max` > 0 then
  180. CONCAT( `equip_level_min`, ':', `equip_level_max` )
  181. when `equip_level_min` > 0 then
  182. `equip_level_min`
  183. when `equip_level_min` > 0 then
  184. `equip_level_min`
  185. else
  186. null
  187. end as `equip_level`,
  188. `refineable`,
  189. case
  190. when `view` > 0 then
  191. `view`
  192. else
  193. null
  194. end as `view`,
  195. `script`,
  196. `equip_script`,
  197. `unequip_script`
  198. FROM `item_db2`
  199. );