report_skillup.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <?php
  2. /**
  3. * Skillup report view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @author Iñigo Valentin <i@inigovalentin.com>
  8. * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
  9. * @package SWDB
  10. * @category View
  11. * @property Report_Skillup_Page $page The page model.
  12. * @var Report_Skillup_Page $page The page model.
  13. */
  14. ?>
  15. <!DOCTYPE html>
  16. <html lang='en'>
  17. <head>
  18. <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
  19. <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
  20. <title><?=$page->get_title()?></title>
  21. <link rel='shortcut icon' href='<?=$page->get_favicon()?>'/>
  22. <!-- CSS files -->
  23. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
  24. <?php
  25. if (get_context()->get_game_mode() == GAME_MODE_ID::RTA){
  26. ?>
  27. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui-rta.css'/>
  28. <?php
  29. }
  30. ?>
  31. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>report_skillup.css'/>
  32. <!-- Meta tags -->
  33. <link rel='canonical' href='<?=$page->get_canonical()?>'/>
  34. <link rel='author' href='<?=$page->get_author()?>'/>
  35. <link rel='publisher' href='<?=$page->get_author()?>'/>
  36. <meta name='description' content='<?=$page->get_description()?>'/>
  37. <meta property='og:title' content='<?=$page->get_title()?>'/>
  38. <meta property='og:url' content='<?=$page->get_canonical()?>'/>
  39. <meta property='og:description' content='<?=$page->get_description()?>'/>
  40. <meta property='og:image' content='<?=$page->get_icon()?>'/>
  41. <meta property='og:site_name' content='<?=$page->get_name()?>?>'/>
  42. <meta property='og:type' content='website'/>
  43. <meta property='og:locale' content='en'/>
  44. <meta name='twitter:card' content='summary'/>
  45. <meta name='twitter:title' content='<?=$page->get_title()?>'/>
  46. <meta name='twitter:description' content='<?=$page->get_description()?>'/>
  47. <meta name='twitter:image' content='<?=$page->get_icon()?>'/>
  48. <meta name='twitter:url' content='<?=$page->get_canonical()?>'/>
  49. <meta name='robots' content='index follow'/>
  50. </head>
  51. <body id='body_report_skillup'>
  52. <?php
  53. include __DIR__ . "/inc/header.php";
  54. ?>
  55. <aside class='content filters' id='filters'>
  56. <h2 id='filters_title'>
  57. Report filters
  58. </h2>
  59. <article id='filters_content'>
  60. <form action='/<?=get_context()->get_player()->get_id()?>/report/skillup/' method='get' id='filter_skillup' class='filter'>
  61. <table>
  62. <tr>
  63. <td class='filter' id='filter_stars'>
  64. Stars:
  65. </td>
  66. <td>
  67. <input type='number' name='min_stars' min='1' max='6' value='<?=$page->get_filter("MIN_STARS")?>'/>
  68. -
  69. <input type='number' name='max_stars' min='1' max='6' value='<?=$page->get_filter("MAX_STARS")?>'/>
  70. </td>
  71. </tr>
  72. <tr>
  73. <td class='filter' id='filter_stars'>
  74. Natural stars:
  75. </td>
  76. <td>
  77. <input type='number' name='min_natural_stars' min='1' max='5' value='<?=$page->get_filter("MIN_NATURAL_STARS")?>'/>
  78. -
  79. <input type='number' name='max_natural_stars' min='1' max='5' value='<?=$page->get_filter("MAX_NATURAL_STARS")?>'/>
  80. </td>
  81. </tr>
  82. <tr>
  83. <td class='filter'>
  84. Show units:
  85. </td>
  86. <td>
  87. <?php
  88. $selected = Array("", "", "", "", "");
  89. $selected[$page->get_filter("UNIT")] = "selected";
  90. ?>
  91. <select name='unit'>
  92. <option value='0' <?=$selected[0]?>>All</option>
  93. <option value='1' <?=$selected[1]?>>In teams</option>
  94. <option value='2' <?=$selected[2]?>>In teams (score > 0)</option>
  95. </select>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td rowspan='2' class='filter'>
  100. Ponderation:
  101. <div class='help_tooltip'>
  102. <p>
  103. Skill weight in the calculation based on it's position.
  104. </p>
  105. </div>
  106. </td>
  107. <td class='filter'>
  108. &nbsp;S1:<input type='number' step='0.1' min='0' max='4' name='pond_1' id='pond_1' value='<?=$page->get_filter("PONDERATION")[0]?>'/>
  109. &nbsp;S2:<input type='number' step='0.1' min='0' max='4' name='pond_2' id='pond_2' value='<?=$page->get_filter("PONDERATION")[1]?>'/>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td class='filter'>
  114. &nbsp;S3:<input type='number' step='0.1' min='0' max='4' name='pond_3' id='pond_3' value='<?=$page->get_filter("PONDERATION")[2]?>'/>
  115. &nbsp;S4:<input type='number' step='0.1' min='0' max='4' name='pond_4' id='pond_4' value='<?=$page->get_filter("PONDERATION")[3]?>'/>
  116. </td>
  117. </tr>
  118. <tr>
  119. <td class='filter' colspan='2'>
  120. <?php
  121. $checked = "";
  122. if ($page->get_filter("FAMILY")){
  123. $checked = "checked";
  124. }
  125. ?>
  126. <input type='checkbox' name='family' id='filter_family' <?=$checked?>/>
  127. <label for='filter_family'>Mons. with lower grade siblings.</label>
  128. <div class='help_tooltip'>
  129. <p>
  130. Include monsters that have family members with less stars than seleced in the stars filters.
  131. </p>
  132. </div>
  133. </td>
  134. </tr>
  135. <tr>
  136. <td class='filter' colspan='2'>
  137. <?php
  138. $checked = "";
  139. if ($page->get_filter("2A")){
  140. $checked = "checked";
  141. }
  142. ?>
  143. <input type='checkbox' name='2a' id='filter_2a'<?=$checked?>/>
  144. <label for='filter_2a'>Include second-awakened monsters.</label>
  145. </td>
  146. </tr>
  147. <tr>
  148. <td class='filter' colspan='2'>
  149. <?php
  150. $checked = "";
  151. if ($page->get_filter("HOMUNCULUS")){
  152. $checked = "checked";
  153. }
  154. ?>
  155. <input type='checkbox' name='homunculus' id='filter_homunculus' <?=$checked?>/>
  156. <label for='filter_homunculus'>Include Homunculus.</label>
  157. </td>
  158. </tr>
  159. <tr>
  160. <td class='filter' colspan='2'>
  161. <?php
  162. $checked = "";
  163. if ($page->get_filter("IN_STORAGE")){
  164. $checked = "checked";
  165. }
  166. ?>
  167. <input type='checkbox' name='in_storage' id='filter_in_storage' <?=$checked?>/>
  168. <label for='filter_in_storage'>Show monsters in storage.</label>
  169. </td>
  170. </tr>
  171. <tr>
  172. <td class='filter' colspan='2'>
  173. <?php
  174. $checked = "";
  175. if ($page->get_filter("WITHOUT_RUNES")){
  176. $checked = "checked";
  177. }
  178. ?>
  179. <input type='checkbox' name='without_runes' id='filter_without_runes' <?=$checked?>/>
  180. <label for='filter_without_runes'>Show monsters without runes.</label>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td class='filter' colspan='2'>
  185. <?php
  186. $checked = "";
  187. if ($page->get_filter("MAXED")){
  188. $checked = "checked";
  189. }
  190. ?>
  191. <input type='checkbox' name='maxed' id='filter_maxed' <?=$checked?>/>
  192. <label for='filter_maxed'>Show fully skilled-up monster</label>
  193. </td>
  194. </tr>
  195. </table>
  196. <input type='submit' value='Apply'/>
  197. </form>
  198. </article>
  199. </aside> <!-- #filters -->
  200. <main>
  201. <section class='content' id='results'>
  202. <h2>
  203. <span>
  204. Results
  205. </span>
  206. </h2>
  207. <table id='results'>
  208. <?php
  209. $index = 1;
  210. foreach ($page->get_units() as $unit){
  211. switch ($index % 10){
  212. case 1:
  213. $index_title = $index . "<span class='superindex'>st</span> - " . $unit->get_title();
  214. break;
  215. case 2:
  216. $index_title = $index . "<span class='superindex'>nd</span> - " . $unit->get_title();
  217. break;
  218. case 3:
  219. $index_title = $index . "<span class='superindex'>rd</span> - " . $unit->get_title();
  220. break;
  221. default:
  222. $index_title = $index . "<span class='superindex'>th</span> - " . $unit->get_title();
  223. break;
  224. }
  225. switch ($index % 100){
  226. case 11:
  227. case 12:
  228. case 13:
  229. $index_title = $index . "<span class='superindex'>th</span> - " . $unit->get_title();
  230. break;
  231. }
  232. ?>
  233. <tr>
  234. <td colspan='7' class='header'>
  235. <?=$index_title?>
  236. </td>
  237. </tr>
  238. <tr>
  239. <td rowspan='3' class='img'>
  240. <a href='/<?=get_context()->get_player()->get_id()?>/monsters/<?=$unit->get_id()?>/' target='_blank'>
  241. <div class='monster_panel'>
  242. <?=HTML::unit_panel($unit)?>
  243. </div>
  244. </a>
  245. </td>
  246. <?php
  247. $skill_num = 1;
  248. $absolute_level = 0;
  249. $absolute_max_level = 0;
  250. $ponderated_level = 0.0;
  251. $ponderated_max_level = 0.0;
  252. foreach ($unit->get_monster()->get_skills() as $skill){
  253. if ($skill->get_max_level() > 1){
  254. $absolute_max_level += $skill->get_max_level();
  255. }
  256. $cur_lvl = $unit->get_skill_levels()[$skill_num - 1];
  257. if ($skill->get_max_level() > 1){
  258. $absolute_level += $cur_lvl;
  259. $ponderated_level += $cur_lvl * $page->get_filter("PONDERATION")[$skill_num - 1];//$cur_lvl * (($skill_num + 1) / 2.0);
  260. $ponderated_max_level += $skill->get_max_level() * $page->get_filter("PONDERATION")[$skill_num - 1];//$skill->get_max_level() * (($skill_num + 1) / 2.0);
  261. }
  262. $max_lvl = $skill->get_max_level();
  263. if ($max_lvl == $cur_lvl){
  264. $maxed = "maxed";
  265. }
  266. else{
  267. $maxed = "";
  268. }
  269. ?>
  270. <td rowspan='3' class='skill'>
  271. <img title='<?=$skill->get_description()?>' src='<?=$skill->get_image()?>'/>
  272. <span class='skill_level <?=$maxed?>'>
  273. <?=$cur_lvl?>/<?=$max_lvl?>
  274. </span>
  275. <span class='skill_name'>
  276. <?=$skill->get_name()?>
  277. </span>
  278. </td>
  279. <?php
  280. $skill_num ++;
  281. }
  282. while ($skill_num < 5){
  283. ?>
  284. <td rowspan='3' class='skill empty'>
  285. </td>
  286. <?php
  287. $skill_num ++;
  288. }
  289. ?>
  290. <td class='label'>
  291. <span class='desktop'>
  292. Absolute skill-ups:
  293. </span>
  294. <span class='mobile'>
  295. Abs:
  296. </span>
  297. </td>
  298. <td class='value'>
  299. <?=number_format($absolute_level * 100 / $absolute_max_level, 2)?>%
  300. </td>
  301. </tr>
  302. <tr>
  303. <td class='label'>
  304. <span class='desktop'>
  305. Ponderated skill-ups:
  306. </span>
  307. <span class='mobile'>
  308. Pond:
  309. </span>
  310. </td>
  311. <td class='value'>
  312. <?=number_format($ponderated_level * 100 / $ponderated_max_level, 2)?>%
  313. </td>
  314. </tr>
  315. <tr>
  316. <td class='label'>
  317. <span class='desktop'>
  318. Remaining skill-ups:
  319. </span>
  320. <span class='mobile'>
  321. Left:
  322. </span>
  323. </td>
  324. <td class='value'>
  325. <?=$absolute_max_level - $absolute_level?>&nbsp;
  326. </td>
  327. </tr>
  328. <?php
  329. $index ++;
  330. }
  331. ?>
  332. </table>
  333. </section>
  334. </main>
  335. <?php
  336. include __DIR__ . "/inc/footer.php";
  337. ?>
  338. </body>
  339. </html>