monsters.php 14 KB

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