report_rune_enchantment.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <?php
  2. /**
  3. * Rune Enchantment report view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @var Report_Rune_Enchantment_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?>report_rune_enchantment.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 grindstone stat selects as one.
  50. *
  51. * @param clicked Numeric order of the select clicked.
  52. * @param event onMouseDown event.
  53. */
  54. function fixGrindStatSelect(clicked, event){
  55. if (!event.ctrlKey){
  56. console.log("NO CTRL: " + clicked);
  57. // If controll was not being held, clean all other selects
  58. if (clicked == 0){
  59. document.getElementById("filter_grind_stat_1").selectedIndex = -1;
  60. }
  61. else if (clicked == 1){
  62. document.getElementById("filter_grind_stat_0").selectedIndex = -1;
  63. }
  64. }
  65. }
  66. /**
  67. * Hack to treat all enchant stat from selects as one.
  68. *
  69. * @param clicked Numeric order of the select clicked.
  70. * @param event onMouseDown event.
  71. */
  72. function fixEnchantStatFromSelect(clicked, event){
  73. if (!event.ctrlKey){
  74. // If controll was not being held, clean all other selects
  75. if (clicked == 0){
  76. document.getElementById("filter_gem_stat_from_1").selectedIndex = -1;
  77. }
  78. else if (clicked == 1){
  79. document.getElementById("filter_gem_stat_from_0").selectedIndex = -1;
  80. }
  81. }
  82. }
  83. /**
  84. * Hack to treat all enchant stat to selects as one.
  85. *
  86. * @param clicked Numeric order of the select clicked.
  87. * @param event onMouseDown event.
  88. */
  89. function fixEnchantStatToSelect(clicked, event){
  90. if (!event.ctrlKey){
  91. // If controll was not being held, clean all other selects
  92. if (clicked == 0){
  93. document.getElementById("filter_gem_stat_to_1").selectedIndex = -1;
  94. }
  95. else if (clicked == 1){
  96. document.getElementById("filter_gem_stat_to_0").selectedIndex = -1;
  97. }
  98. }
  99. }
  100. </script>
  101. </head>
  102. <body>
  103. <?php
  104. include __DIR__ . "/inc/header.php";
  105. ?>
  106. <aside>
  107. <h2>
  108. Report filters
  109. </h2>
  110. <form action='/<?=$UID?>/report/rune_enchantment/' method='get' id='filter_runeenchantment' class='filter'>
  111. <table>
  112. <tr>
  113. <td colspan='2' class='header'>
  114. Monster
  115. </td>
  116. </tr>
  117. <tr>
  118. <td class='label'>
  119. Name:
  120. <div class='help_tooltip'>
  121. <p>
  122. Units whose name contains this (case insensitive).
  123. </p>
  124. </div>
  125. </td>
  126. <td>
  127. <input type='text' name='monster_name' id='filter_name' value='<?=$page->filters["MONSTER_NAME"]?>'/>
  128. </td>
  129. </tr>
  130. <tr>
  131. <td class='label'>
  132. Stars:
  133. </td>
  134. <td>
  135. <input type='number' name='monster_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["MONSTER_MIN_STARS"]?>'/>
  136. -
  137. <input type='number' name='monster_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["MONSTER_MAX_STARS"]?>'/>
  138. </td>
  139. </tr>
  140. <tr>
  141. <td class='label'>
  142. Show units:
  143. </td>
  144. <td>
  145. <?php
  146. $selected = Array("", "", "", "", "");
  147. $selected[$page->filters["TEAM"]] = "selected";
  148. ?>
  149. <select name='unit'>
  150. <option value='0' <?=$selected[0]?>>All</option>
  151. <option value='1' <?=$selected[1]?>>In teams</option>
  152. <option value='2' <?=$selected[2]?>>In teams (score > 0)</option>
  153. </select>
  154. </td>
  155. </tr>
  156. <tr>
  157. <td class='label' colspan='2'>
  158. <?php
  159. $checked = "";
  160. if ($page->filters["MONSTER_IN_STORAGE"]){
  161. $checked = "checked";
  162. }
  163. ?>
  164. <input type='checkbox' name='monster_in_storage' id='filter_monster_in_storage' <?=$checked?>/>
  165. <label for='filter_monster_in_storage'>Show monsters in storage</label>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td colspan='2' class='header'>
  170. Runes
  171. </td>
  172. </tr>
  173. <tr>
  174. <td class='label'>
  175. Stars:
  176. </td>
  177. <td>
  178. <input type='number' name='rune_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["RUNE_MIN_STARS"]?>'/>
  179. -
  180. <input type='number' name='rune_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["RUNE_MAX_STARS"]?>'/>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td class='label'>
  185. Level:
  186. </td>
  187. <td>
  188. <input type='number' name='rune_min_level' id='filter_level_min' min='0' max='15' value='<?=$page->filters["RUNE_MIN_LEVEL"]?>'/>
  189. -
  190. <input type='number' name='rune_max_level' id='filter_level_max' min='0' max='15' value='<?=$page->filters["RUNE_MAX_LEVEL"]?>'/>
  191. </td>
  192. </tr>
  193. <tr>
  194. <td class='label'>
  195. Quality:
  196. </td>
  197. <td>
  198. <?php
  199. $selected = Array("", "", "", "", "");
  200. $selected[$page->filters["RUNE_MIN_QUALITY"] - 1] = "selected";
  201. ?>
  202. <select name='rune_min_quality' id='filter_quality_min'>
  203. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  204. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  205. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  206. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  207. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  208. </select>
  209. -
  210. <?php
  211. $selected = Array("", "", "", "", "");
  212. $selected[$page->filters["RUNE_MAX_QUALITY"] - 1] = "selected";
  213. ?>
  214. <select name='rune_max_quality' id='filter_quality_max'>
  215. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  216. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  217. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  218. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  219. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  220. </select>
  221. </td>
  222. </tr>
  223. <tr>
  224. <td class='label'>
  225. O. quality:
  226. </td>
  227. <td>
  228. <?php
  229. $selected = Array("", "", "", "", "");
  230. $selected[$page->filters["RUNE_MIN_ORIGINAL_QUALITY"] - 1] = "selected";
  231. ?>
  232. <select name='rune_min_original_quality' id='filter_original_quality_min'>
  233. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  234. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  235. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  236. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  237. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  238. </select>
  239. -
  240. <?php
  241. $selected = Array("", "", "", "", "");
  242. $selected[$page->filters["RUNE_MAX_ORIGINAL_QUALITY"] - 1] = "selected";
  243. ?>
  244. <select name='rune_max_original_quality' id='filter_original_quality_max'>
  245. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  246. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  247. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  248. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  249. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  250. </select>
  251. </td>
  252. </tr>
  253. <tr>
  254. <td class='label'>
  255. Efficiency:
  256. </td>
  257. <td>
  258. <input type='number' name='rune_min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$page->filters["RUNE_MIN_EFFICIENCY"]?>'/>%
  259. -
  260. <input type='number' name='rune_max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$page->filters["RUNE_MAX_EFFICIENCY"]?>'/>%
  261. </td>
  262. </tr>
  263. <tr>
  264. <td class='label'>
  265. Max. eff.:
  266. </td>
  267. <td>
  268. <input type='number' name='rune_min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$page->filters["RUNE_MIN_MAX_EFFICIENCY"]?>'/>%
  269. -
  270. <input type='number' name='rune_max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$page->filters["RUNE_MAX_MAX_EFFICIENCY"]?>'/>%
  271. </td>
  272. </tr>
  273. <tr>
  274. <td class='slot label'>
  275. Slot:
  276. </td>
  277. <td class='slot'>
  278. <select multiple name='rune_slot[]' id='filter_slot'>
  279. <?php
  280. for ($i = 1; $i <= 6; $i ++){
  281. if (in_array($i, $page->filters["RUNE_SLOT"])){
  282. $selected = "selected='selected'";
  283. }
  284. else{
  285. $selected = "";
  286. }
  287. ?>
  288. <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
  289. <?php
  290. }
  291. ?>
  292. </select>
  293. </td>
  294. </tr>
  295. <tr>
  296. <td colspan='2' class='header'>
  297. <?php
  298. $checked = "";
  299. if ($page->filters["GRIND"]){
  300. $checked = "checked";
  301. }
  302. ?>
  303. <input type='checkbox' name='grind' id='filter_grind' <?=$checked?>/>
  304. <label for='filter_grind'>Grindstones</label>
  305. </td>
  306. </tr>
  307. <tr>
  308. <td class='label'>
  309. Min. quality:
  310. </td>
  311. <td>
  312. <?php
  313. $selected = Array("", "", "", "", "");
  314. $selected[$page->filters["GRIND_MIN_QUALITY"] - 1] = "selected";
  315. ?>
  316. <select name='grind_min_quality'>
  317. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  318. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  319. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  320. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  321. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  322. </select>
  323. </td>
  324. </tr>
  325. <tr>
  326. <td class='stats label'>
  327. Stats:
  328. </td>
  329. <td class='stats'>
  330. <div>
  331. <select multiple name='grind_stat[]' id='filter_grind_stat_0' onMouseDown='fixGrindStatSelect(0, event);'>
  332. <?php
  333. $reflect = new ReflectionClass("RUNE_STAT_ID");
  334. $count = 1;
  335. $i = 0;
  336. foreach($reflect->getConstants() as $name => $id){
  337. $selected = "";
  338. if (in_array($id, $page->filters["GRIND_STAT"])){
  339. $selected = "selected='selected'";
  340. }
  341. $name_format = ucwords(str_replace("_P", "%", $name));
  342. ?>
  343. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  344. <?php
  345. if (($i + 1) % 2 == 0){
  346. ?>
  347. </select><select multiple name='grind_stat[]' id='filter_grind_stat_<?=$count?>' onMouseDown='fixGrindStatSelect(<?=$count?>, event);'>
  348. <?php
  349. $count ++;
  350. }
  351. $i ++;
  352. }
  353. ?>
  354. </select>
  355. </div>
  356. </td>
  357. </tr>
  358. <tr>
  359. <td colspan='2' class='header'>
  360. <?php
  361. $checked = "";
  362. if ($page->filters["GEM"]){
  363. $checked = "checked";
  364. }
  365. ?>
  366. <input type='checkbox' name='gem' id='filter_gem' <?=$checked?>/>
  367. <label for='filter_gem'>Gems</label>
  368. </td>
  369. </tr>
  370. <tr>
  371. <td class='label'>
  372. Min. quality:
  373. </td>
  374. <td>
  375. <?php
  376. $selected = Array("", "", "", "", "");
  377. $selected[$page->filters["GEM_MIN_QUALITY"] - 1] = "selected";
  378. ?>
  379. <select name='gem_min_quality'>
  380. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  381. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  382. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  383. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  384. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  385. </select>
  386. </td>
  387. </tr>
  388. <tr>
  389. <td class='stats label'>
  390. Replace...
  391. </td>
  392. <td class='stats'>
  393. <div>
  394. <select multiple name='gem_stat_from[]' id='filter_gem_stat_from_0' onMouseDown='fixEnchantStatFromSelect(0, event);'>
  395. <?php
  396. $reflect = new ReflectionClass("RUNE_STAT_ID");
  397. $count = 1;
  398. $i = 0;
  399. foreach($reflect->getConstants() as $name => $id){
  400. $selected = "";
  401. if (in_array($id, $page->filters["GEM_STAT_FROM"])){
  402. $selected = "selected='selected'";
  403. }
  404. $name_format = ucwords(str_replace("_P", "%", $name));
  405. ?>
  406. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  407. <?php
  408. if (($i + 1) % 2 == 0){
  409. ?>
  410. </select><select multiple name='gem_stat_from[]' id='filter_gem_stat_from_<?=$count?>' onMouseDown='fixEnchantStatFromSelect(<?=$count?>, event);'>
  411. <?php
  412. $count ++;
  413. }
  414. $i ++;
  415. }
  416. ?>
  417. </select>
  418. </div>
  419. </td>
  420. </tr>
  421. <tr>
  422. <td class='stats label'>
  423. ...with:
  424. </td>
  425. <td class='stats'>
  426. <div>
  427. <select multiple name='gem_stat_from[]' id='filter_gem_stat_to_0' onMouseDown='fixEnchantStatToSelect(0, event);'>
  428. <?php
  429. $reflect = new ReflectionClass("RUNE_STAT_ID");
  430. $count = 1;
  431. $i = 0;
  432. foreach($reflect->getConstants() as $name => $id){
  433. $selected = "";
  434. if (in_array($id, $page->filters["GEM_STAT_TO"])){
  435. $selected = "selected='selected'";
  436. }
  437. $name_format = ucwords(str_replace("_P", "%", $name));
  438. ?>
  439. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  440. <?php
  441. if (($i + 1) % 2 == 0){
  442. ?>
  443. </select><select multiple name='gem_stat_to[]' id='filter_gem_stat_to_<?=$count?>' onMouseDown='fixEnchantStatToSelect(<?=$count?>, event);'>
  444. <?php
  445. $count ++;
  446. }
  447. $i ++;
  448. }
  449. ?>
  450. </select>
  451. </div>
  452. </td>
  453. </tr>
  454. </table>
  455. <input type='submit' value='Apply'/>
  456. </form>
  457. </aside>
  458. <main>
  459. <section id='results' class='content'>
  460. <h2>
  461. <span>
  462. Available enchantments
  463. </span>
  464. </h2>
  465. <table id='results'>
  466. <?php
  467. foreach ($page->upgrades as $upgrade){
  468. ?>
  469. <tr>
  470. <td class='header' colspan='2'>
  471. <a href='/<?=$UID?>/monsters/<?=$upgrade["unit"]->id?>/' target='_blank'>
  472. <div class='monster_panel'>
  473. <?=HTML::unit_panel($upgrade["unit"])?>
  474. </div>
  475. </a>
  476. <h4>
  477. <?=$upgrade["unit"]->title?>
  478. </h4>
  479. </td>
  480. </tr>
  481. <?php
  482. foreach ($upgrade["upgrade"] as $rupgrade){
  483. ?>
  484. <tr>
  485. <td class='rune'>
  486. <?=HTML::rune_table($rupgrade["rune"])?>
  487. </td>
  488. <td class='upgrades'>
  489. <?php
  490. foreach ($rupgrade["enchantment"] as $enchantment){
  491. ?>
  492. <?=HTML::enchantment_panel($enchantment)?>
  493. <?php
  494. }
  495. ?>
  496. </td>
  497. </tr>
  498. <?php
  499. }
  500. }
  501. ?>
  502. </table>
  503. </section>
  504. </main>
  505. <?php
  506. include __DIR__ . "/inc/footer.php";
  507. ?>
  508. </body>
  509. </html>