monsters.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <?php
  2. /**
  3. * Monsters view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @property_read Monsters_Page $page The page model.
  9. * @property_read int $UID Player 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. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>monsters.css'/>
  22. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
  23. <!-- Meta tags -->
  24. <link rel='canonical' href='<?=$page->canonical?>'/>
  25. <link rel='author' href='<?=$page->author?>'/>
  26. <link rel='publisher' href='<?=$page->author?>'/>
  27. <meta name='description' content='<?=$page->description?>'/>
  28. <meta property='og:title' content='<?=$page->title?>'/>
  29. <meta property='og:url' content='<?=$page->canonical?>'/>
  30. <meta property='og:description' content='<?=$page->description?>'/>
  31. <meta property='og:image' content='<?=$page->icon?>'/>
  32. <meta property='og:site_name' content='<?=$page->name?>'/>
  33. <meta property='og:type' content='website'/>
  34. <meta property='og:locale' content='en'/>
  35. <meta name='twitter:card' content='summary'/>
  36. <meta name='twitter:title' content='<?=$page->title?>'/>
  37. <meta name='twitter:description' content='<?=$page->description?>'/>
  38. <meta name='twitter:image' content='<?=$page->icon?>'/>
  39. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  40. <meta name='robots' content='index follow'/>
  41. <script>
  42. /**
  43. * Shows or hiddes the filters panel.
  44. */
  45. function toggleFilters(){
  46. var content = document.getElementById('filters_content');
  47. var slid = document.getElementById('filters_slid');
  48. if (content.style.maxHeight != '30em'){
  49. content.style.maxHeight = '30em';
  50. slid.style.transform = 'rotate(90deg)';
  51. }
  52. else{
  53. content.style.maxHeight = '0px';
  54. slid.style.transform = 'rotate(0deg)';
  55. }
  56. };
  57. </script>
  58. </head>
  59. <body>
  60. <?php
  61. include __DIR__ . "/inc/header.php";
  62. ?>
  63. <section class='filters'>
  64. <h2 id='filters_title' onClick='toggleFilters();'>
  65. <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
  66. Monster filters
  67. </h2>
  68. <article id='filters_content'>
  69. <?php
  70. $filters = $page->filters;
  71. $custom_filters = $page->custom_filters;
  72. include __DIR__ . "/inc/filter_monsters.php";
  73. ?>
  74. </article>
  75. </section> <!-- #filters -->
  76. <section class='list'>
  77. <h2>
  78. Monsters
  79. </h2>
  80. <article>
  81. <?php
  82. foreach ($page->monsters as $mon){
  83. ?>
  84. <div class='monster'>
  85. <a href='/<?=$UID?>/monsters/<?=$mon->id?>'>
  86. <div class='monster_panel'>
  87. <?=HTML::unit_panel($mon)?>
  88. </div>
  89. </a>
  90. <div class='monster_tooltip'>
  91. <h4>
  92. <?=$mon->title?>
  93. </h4>
  94. <?php
  95. $building_attack = floor(($mon->attack * $page->building_stats["atk"] / 100) + ($mon->attack * $page->building_stats["elm"][$mon->unit->element] / 100));
  96. $building_defense = floor($page->building_stats["def"] * $mon->defense / 100);
  97. $building_hp = floor($page->building_stats["hp"] * $mon->hp / 100);
  98. $building_speed = $page->building_stats["spd"];
  99. $building_crit_rate = 0;
  100. $building_crit_damage = $page->building_stats["crd"];
  101. $building_accuracy = 0;
  102. $building_resistance = 0;
  103. ?>
  104. <table class='stats'>
  105. <tr>
  106. <th>
  107. Stats
  108. </th>
  109. <th>
  110. Base
  111. </th>
  112. <th>
  113. Runes
  114. </th>
  115. <th>
  116. Buildings
  117. </th>
  118. <th>
  119. Total
  120. </th>
  121. </tr>
  122. <tr>
  123. <th>
  124. ATK
  125. </th>
  126. <td class='base'>
  127. <?=$mon->attack?>
  128. </td>
  129. <td class='extra'>
  130. +<?=$mon->rune_attack?>
  131. </td>
  132. <td class='extra'>
  133. +<?=$building_attack?>
  134. </td>
  135. <td class='total'>
  136. <?=$mon->attack + $mon->rune_attack + $building_attack?>
  137. </td>
  138. </tr>
  139. <tr>
  140. <th>
  141. DEF
  142. </th>
  143. <td class='base'>
  144. <?=$mon->defense?>
  145. </td>
  146. <td class='extra'>
  147. +<?=$mon->rune_defense?>
  148. </td>
  149. <td class='extra'>
  150. +<?=$building_defense?>
  151. </td>
  152. <td class='total'>
  153. <?=$mon->defense + $mon->rune_defense + $building_defense?>
  154. </td>
  155. </tr>
  156. <tr>
  157. <th>
  158. HP
  159. </th>
  160. <td class='base'>
  161. <?=$mon->hp?>
  162. </td>
  163. <td class='extra'>
  164. +<?=$mon->rune_hp?>
  165. </td>
  166. <td class='extra'>
  167. +<?=$building_hp?>
  168. </td>
  169. <td class='total'>
  170. <?=$mon->hp + $mon->rune_hp + $building_hp?>
  171. </td>
  172. </tr>
  173. <tr>
  174. <th>
  175. SPD
  176. </th>
  177. <td class='base'>
  178. <?=$mon->speed?>
  179. </td>
  180. <td class='extra'>
  181. +<?=$mon->rune_speed?>
  182. </td>
  183. <td class='extra'>
  184. +<?=$building_speed?>
  185. </td>
  186. <td class='total'>
  187. <?=$mon->speed + $mon->rune_speed + $building_speed?>
  188. </td>
  189. </tr>
  190. <tr>
  191. <th>
  192. CRR
  193. </th>
  194. <td class='base'>
  195. <?=$mon->crit_rate?>%
  196. </td>
  197. <td class='extra'>
  198. +<?=$mon->rune_crit_rate?>%
  199. </td>
  200. <td class='extra'>
  201. +<?=$building_crit_rate?>%
  202. </td>
  203. <td class='total'>
  204. <?=$mon->crit_rate + $mon->rune_crit_rate + $building_crit_rate?>%
  205. </td>
  206. </tr>
  207. <tr>
  208. <th>
  209. CRD
  210. </th>
  211. <td class='base'>
  212. <?=$mon->crit_damage?>%
  213. </td>
  214. <td class='extra'>
  215. +<?=$mon->rune_crit_damage?>%
  216. </td>
  217. <td class='extra'>
  218. +<?=$building_crit_damage?>%
  219. </td>
  220. <td class='total'>
  221. <?=$mon->crit_damage + $mon->rune_crit_damage + $building_crit_damage?>%
  222. </td>
  223. </tr>
  224. <tr>
  225. <th>
  226. ACC
  227. </th>
  228. <td class='base'>
  229. <?=$mon->accuracy?>%
  230. </td>
  231. <td class='extra'>
  232. +<?=$mon->rune_accuracy?>%
  233. </td>
  234. <td class='extra'>
  235. +<?=$building_accuracy?>%
  236. </td>
  237. <td class='total'>
  238. <?=$mon->accuracy + $mon->rune_accuracy + $building_accuracy?>%
  239. </td>
  240. </tr>
  241. <tr>
  242. <th>
  243. RES
  244. </th>
  245. <td class='base'>
  246. <?=$mon->resistance?>%
  247. </td>
  248. <td class='extra'>
  249. +<?=$mon->rune_resistance?>%
  250. </td>
  251. <td class='extra'>
  252. +<?=$building_resistance?>%
  253. </td>
  254. <td class='total'>
  255. <?=$mon->resistance + $mon->rune_resistance + $building_resistance?>%
  256. </td>
  257. </tr>
  258. </table>
  259. <div class='skills'>
  260. <?php
  261. $skill_num = 0;
  262. foreach ($mon->unit->skill as $skill){
  263. $cur_lvl = $mon->skill_levels[$skill_num];
  264. $max_lvl = $skill->max_level;
  265. if ($max_lvl == $cur_lvl){
  266. $maxed = "maxed";
  267. }
  268. else{
  269. $maxed = "";
  270. }
  271. ?>
  272. <div class='skill'>
  273. <img src='<?=$skill->get_image()?>'/>
  274. <span class='skill_level <?=$maxed?>'>
  275. <?=$cur_lvl?>/<?=$max_lvl?>
  276. </span>
  277. <span class='skill_name'>
  278. <?=$skill->name?>
  279. </span>
  280. </div>
  281. <?php
  282. $skill_num ++;
  283. }
  284. ?>
  285. </div>
  286. </div>
  287. </div>
  288. <?php
  289. }
  290. ?>
  291. </article>
  292. </section> <!-- #catalog -->
  293. <?php
  294. include __DIR__ . "/inc/footer.php";
  295. ?>
  296. </body>
  297. </html>