report_rune_enchantment.php 24 KB

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