enchantments.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <?php
  2. /**
  3. * Artifacts view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @var Artifacts_Page $page The page model.
  9. * @var int $UID User id.
  10. */
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang='en'>
  14. <head>
  15. <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
  16. <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
  17. <title><?=$page->title?></title>
  18. <link rel='shortcut icon' href='<?=$page->favicon?>'/>
  19. <!-- CSS files -->
  20. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
  21. <?php
  22. if ($MODE == GAME_MODE_ID::RTA){
  23. ?>
  24. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui-rta.css'/>
  25. <?php
  26. }
  27. ?>
  28. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>enchantments.css'/>
  29. <!-- Meta tags -->
  30. <link rel='canonical' href='<?=$page->canonical?>'/>
  31. <link rel='author' href='<?=$page->author?>'/>
  32. <link rel='publisher' href='<?=$page->author?>'/>
  33. <meta name='description' content='<?=$page->description?>'/>
  34. <meta property='og:title' content='<?=$page->title?>'/>
  35. <meta property='og:url' content='<?=$page->canonical?>'/>
  36. <meta property='og:description' content='<?=$page->description?>'/>
  37. <meta property='og:image' content='<?=$page->icon?>'/>
  38. <meta property='og:site_name' content='<?=$page->name?>'/>
  39. <meta property='og:type' content='website'/>
  40. <meta property='og:locale' content='en'/>
  41. <meta name='twitter:card' content='summary'/>
  42. <meta name='twitter:title' content='<?=$page->title?>'/>
  43. <meta name='twitter:description' content='<?=$page->description?>'/>
  44. <meta name='twitter:image' content='<?=$page->icon?>'/>
  45. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  46. <meta name='robots' content='index follow'/>
  47. <script>
  48. /**
  49. * Hack to treat all type selects as one.
  50. *
  51. * @param clicked Numeric order of the select clicked.
  52. * @param event onMouseDown event.
  53. */
  54. function fixTypeSelect(clicked, event){
  55. if (!event.ctrlKey){
  56. // If controll was not being held, clean all other selects
  57. const selects = document.querySelectorAll('.select_type');
  58. Array.from(selects).forEach((element, index) => {
  59. if (element.id != "select_type_" + clicked){
  60. element.selectedIndex = -1;
  61. }
  62. });
  63. }
  64. }
  65. /**
  66. * Hack to treat all main stat selects as one.
  67. *
  68. * @param clicked Numeric order of the select clicked.
  69. * @param event onMouseDown event.
  70. */
  71. function fixMainSelect(clicked, event){
  72. if (!event.ctrlKey){
  73. // If controll was not being held, clean all other selects
  74. const selects = document.querySelectorAll('.select_main');
  75. Array.from(selects).forEach((element, index) => {
  76. if (element.id != "select_main_" + clicked){
  77. element.selectedIndex = -1;
  78. }
  79. });
  80. }
  81. }
  82. </script>
  83. </head>
  84. <body>
  85. <?php
  86. include __DIR__ . "/inc/header.php";
  87. ?>
  88. <aside class='filters'>
  89. <h2>
  90. Enchantments
  91. </h2>
  92. <p>
  93. Manage your enchantments
  94. </p>
  95. <form action='/<?=$UID?>/enchantments/' method='get' id='filter_artifacts' class='filter'>
  96. <table>
  97. <tr>
  98. <td class='label'>
  99. Type:
  100. </td>
  101. <td>
  102. <select multiple name='type[]' id='filter_type'>
  103. <?php
  104. $selected = "";
  105. if (in_array("GRI", $page->filters["TYPE"])){
  106. $selected = "selected='selected'";
  107. }
  108. ?>
  109. <option value='GRI' <?=$selected?>>Grindstone</option>
  110. <?php
  111. $selected = "";
  112. if (in_array("GEM", $page->filters["TYPE"])){
  113. $selected = "selected='selected'";
  114. }
  115. ?>
  116. <option value='GEM' <?=$selected?>>Gem</option>
  117. </select>
  118. </td>
  119. </tr>
  120. <tr>
  121. <td class='label'>
  122. Quality:
  123. </td>
  124. <td>
  125. <?php
  126. $selected = Array("", "", "", "", "");
  127. $selected[$page->filters["MIN_QUALITY"] - 1] = "selected";
  128. ?>
  129. <select name='min_quality' id='filter_quality_min'>
  130. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  131. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  132. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  133. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  134. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  135. </select>
  136. -
  137. <?php
  138. $selected = Array("", "", "", "", "");
  139. $selected[$page->filters["MAX_QUALITY"] - 1] = "selected";
  140. ?>
  141. <select name='max_quality' id='filter_quality_max'>
  142. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  143. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  144. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  145. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  146. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  147. </select>
  148. </td>
  149. </tr>
  150. <tr>
  151. <td class='label'>
  152. Rune:
  153. </td>
  154. <td class='rune'>
  155. <div>
  156. <select multiple name='rune[]' id='filter_rune'>
  157. <?php
  158. $selected = "";
  159. if (in_array(0, $page->filters["RUNE"])){
  160. $selected = "selected='selected'";
  161. }
  162. ?>
  163. <option value='0' <?=$selected?>>Inmemorial</option>
  164. <?php
  165. $reflect = new ReflectionClass("RUNE_SET_ID");
  166. $i = 1;
  167. $j = 1;
  168. foreach($reflect->getConstants() as $name => $id){
  169. $selected = "";
  170. if (in_array($id, $page->filters["TYPE"])){
  171. $selected = "selected='selected'";
  172. }
  173. $name_format = ucwords(strtolower($name));
  174. if (strlen($name_format) > 9){
  175. $name_format = substr($name_format, 0, 9) . ".";
  176. }
  177. ?>
  178. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  179. <?php
  180. if (($i + 1) % 6 == 0 && ($i + 1) < sizeof($reflect->getConstants())){
  181. ?>
  182. </select><select multiple name='type[]' class='select_type' id='select_type_<?=$j?>' onMouseDown='fixTypeSelect(<?=$j?>, event);'>
  183. <?php
  184. $j ++;
  185. }
  186. $i ++;
  187. }
  188. ?>
  189. </select>
  190. </div>
  191. </td>
  192. </tr>
  193. <tr>
  194. <td class='label'>
  195. Stat:
  196. </td>
  197. <td class='stats'>
  198. <div>
  199. <select multiple name='stat[]' id='filter_stat'>
  200. <?php
  201. $reflect = new ReflectionClass("RUNE_STAT_ID");
  202. $i = 0;
  203. $j = 1;
  204. foreach($reflect->getConstants() as $name => $id){
  205. $selected = "";
  206. if (in_array($id, $page->filters["SUB"])){
  207. $selected = "selected='selected'";
  208. }
  209. $name_format = ucwords(str_replace("_P", "%", $name));
  210. ?>
  211. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  212. <?php
  213. if (($i + 1) % 2 == 0){
  214. ?>
  215. </select><select multiple name='main_stat[]' class='select_sub' id='filter_sub_stat_<?=$j?>' onMouseDown='fixSubSelect(<?=$j?>, event);'>
  216. <?php
  217. $j ++;
  218. }
  219. $i ++;
  220. }
  221. ?>
  222. </select>
  223. </div>
  224. </td>
  225. </tr>
  226. </table>
  227. <div id='filter_apply'>
  228. <input type='submit' value='Apply'/>
  229. </div>
  230. </form>
  231. </aside> <!-- #filters -->
  232. <main>
  233. <section class='content' id='enchantments'>
  234. <h2>
  235. Enchantments
  236. </h2>
  237. <table>
  238. <?php
  239. $prev_group = "";
  240. $group = "";
  241. $group_title = "";
  242. $group_image = "";
  243. foreach ($page->grindstones as $grindstone){
  244. $group = $grindstone->rune->id . "-" . $grindstone->inmemorial;
  245. if ($prev_group != $group){
  246. if ($grindstone->inmemorial == 1){
  247. $group_title = "Inmemorial";
  248. $group_image = URL::IMG["ICON"] . "star.png";
  249. }
  250. else{
  251. $group_title = $grindstone->rune->name;
  252. $group_image = URL::IMG["RUNE"] . str_pad($grindstone->rune->id, 2, '0', STR_PAD_LEFT) . ".png";
  253. }
  254. if ($prev_group == ""){
  255. ?>
  256. <tr>
  257. <td class='header'>
  258. <?php
  259. }
  260. else{
  261. ?>
  262. </td>
  263. </tr>
  264. <tr>
  265. <td class='header'>
  266. <?php
  267. }
  268. $prev_group = $group;
  269. ?>
  270. <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
  271. <span>
  272. <?=$group_title?>
  273. </span>
  274. </td>
  275. </tr>
  276. <tr>
  277. <td>
  278. <?php
  279. }
  280. ?>
  281. <?=HTML::enchantment_panel($grindstone)?>
  282. <?php
  283. }
  284. ?>
  285. </td> <!-- Close last group -->
  286. </tr>
  287. </table>
  288. </section>
  289. </main>
  290. <?php
  291. include __DIR__ . "/inc/footer.php";
  292. ?>
  293. </body>
  294. </html>