runs.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <?php
  2. global $AREA_TYPE;
  3. global $SCENARIO;
  4. global $UID;
  5. ?>
  6. <!DOCTYPE html>
  7. <html lang='en'>
  8. <head>
  9. <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
  10. <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
  11. <title><?=$page->title?></title>
  12. <link rel='shortcut icon' href='<?=$page->favicon?>'/>
  13. <!-- CSS files -->
  14. <link rel='stylesheet' type='text/css' href='<?=$path["css"]?>ui.css'/>
  15. <link rel='stylesheet' type='text/css' href='<?=$path["css"]?>runs.css'/>
  16. <link rel='stylesheet' type='text/css' href='<?=$path["css"]?>filters.css'/>
  17. <!-- Script files -->
  18. <script src="<?=$path["js"]?>ui.js"></script>
  19. <!-- Meta tags -->
  20. <link rel='canonical' href='<?=$page->canonical?>'/>
  21. <link rel='author' href='<?=$page->author?>'/>
  22. <link rel='publisher' href='<?=$page->author?>'/>
  23. <meta name='description' content='<?=$page->description?>'/>
  24. <meta property='og:title' content='<?=$page->title?>'/>
  25. <meta property='og:url' content='<?=$page->canonical?>'/>
  26. <meta property='og:description' content='<?=$page->description?>'/>
  27. <meta property='og:image' content='<?=$page->icon?>'/>
  28. <meta property='og:site_name' content='<?=$page->name?>'/>
  29. <meta property='og:type' content='website'/>
  30. <meta property='og:locale' content='en'/>
  31. <meta name='twitter:card' content='summary'/>
  32. <meta name='twitter:title' content='<?=$page->title?>'/>
  33. <meta name='twitter:description' content='<?=$page->description?>'/>
  34. <meta name='twitter:image' content='<?=$page->icon?>'/>
  35. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  36. <meta name='robots' content='index follow'/>
  37. <script>
  38. function saveForm(id, show){
  39. if (show === true){
  40. document.getElementById('save_team').style.display = 'block';
  41. document.getElementById('save_id').value = id;
  42. }
  43. else{
  44. document.getElementById('save_team').style.display = 'none';
  45. }
  46. }
  47. function saveTeam(){
  48. var id = document.getElementById('save_id').value;
  49. var name = document.getElementById('save_team_name').value;
  50. var description = document.getElementById('save_team_description').value;
  51. if (name == ''){
  52. alert('Name required')
  53. return;
  54. }
  55. var xhttp = new XMLHttpRequest();
  56. xhttp.onreadystatechange = function() {
  57. if (this.readyState == 4 && this.status == 200) {
  58. saveForm(null, false);
  59. }
  60. };
  61. xhttp.open("POST", "/action/save_run_team/", true);
  62. xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  63. xhttp.send('uid=<?=$UID?>&run=' + id + '&name=' + encodeURI(name) + '&description=' + encodeURI(description));
  64. }
  65. </script>
  66. </head>
  67. <body>
  68. <?php
  69. include __DIR__ . "/inc/header.php";
  70. ?>
  71. <section class='filters'>
  72. <h2>
  73. Run filters
  74. </h2>
  75. <?php
  76. $filters = $page->filters;
  77. //TODO
  78. include __DIR__ . "/inc/filter_runs.php";
  79. ?>
  80. </section> <!-- #filters -->
  81. <section class='content'>
  82. <h2>
  83. Runs
  84. </h2>
  85. <article>
  86. <table id='runs'>
  87. <tr>
  88. <th>
  89. Area
  90. </th>
  91. <th>
  92. Date
  93. </th>
  94. <th>
  95. Team
  96. </th>
  97. <th>
  98. Time
  99. </th>
  100. <th>
  101. Reward
  102. </th>
  103. </tr>
  104. <?php
  105. foreach ($page->runs as $run){
  106. $enable_save = true;
  107. ?>
  108. <tr>
  109. <td class='area'>
  110. <div class='area'>
  111. <img title='<?=$run->area->name?>' class='area' src='<?=$run->area->get_image($run->stage)?>'/>
  112. <?php
  113. if ($run->stage > 0){
  114. ?>
  115. <span class='stage'><?=$run->stage?></span>
  116. <?php
  117. }
  118. // TODO: Labyrinth difficulty
  119. if (in_array($run->area->id, $SCENARIO)){
  120. ?>
  121. <span class='difficulty'>
  122. <?php
  123. for ($i = 0; $i < $run->difficulty; $i ++){
  124. ?>
  125. <img class='difficulty' src='<?=$path["img"]["icon"]?>star.png'/>
  126. <?php
  127. }
  128. ?>
  129. </span>
  130. <?php
  131. }
  132. ?>
  133. </div>
  134. </td>
  135. <td class='date'>
  136. <?php
  137. $date = date_create($run->dtime);
  138. ?>
  139. <?=date_format($date, "Y/m/d H:i:s")?>
  140. </td>
  141. <td class='team'>
  142. <?php
  143. if ($run->helper == 1){
  144. $enable_save = false;
  145. ?>
  146. <div class='monster_panel helper'>
  147. <img class='monster' title='Friend/Menstor' src='<?=$path["img"]["currency"]?>socialpoint.png'/>
  148. </div>
  149. <?php
  150. }
  151. foreach ($run->party as $party){
  152. if ($party instanceof K_Unit){
  153. $enable_save = false;
  154. $disabled = "disabled";
  155. }
  156. else{
  157. $disabled = "";
  158. }
  159. if ($disabled == ""){
  160. ?>
  161. <a target='_blank' href='/<?=$UID?>>/monster/<?=$party->id?>'>
  162. <?php
  163. }
  164. ?>
  165. <div class='monster_panel <?=$disabled?>'>
  166. <?=html_unit_panel($party)?>
  167. </div>
  168. <?php
  169. if ($disabled == ""){
  170. ?>
  171. </a>
  172. <?php
  173. }
  174. }
  175. ?>
  176. </td>
  177. <td class='time'>
  178. <?php
  179. if ($run->win == 1){
  180. $s = floor($run->time / 1000);
  181. $m = floor($s / 60);
  182. $s = floor($s % 60);
  183. $ms = ($run-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
  184. $s = str_pad($s, 2, '0', STR_PAD_LEFT);
  185. $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
  186. ?>
  187. <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
  188. <?php
  189. }
  190. else{
  191. ?>
  192. <span class='defeated'>Defeated</span>
  193. <?php
  194. }
  195. ?>
  196. </td>
  197. <td class='reward'>
  198. <?php
  199. if ($run->energy > 0){
  200. ?>
  201. <div class='item'>
  202. <img class='item' title='Energy' src='<?=$path["img"]["currency"]?>energy.png'/>
  203. <span class='item'><?=$run->energy?></span>
  204. </div>
  205. <?php
  206. }
  207. if ($run->mana > 0){
  208. ?>
  209. <div class='item'>
  210. <img class='item' title='Mana' src='<?=$path["img"]["currency"]?>mana.png'/>
  211. <span class='item'><?=$run->mana?></span>
  212. </div>
  213. <?php
  214. }
  215. if ($run->crystal > 0){
  216. ?>
  217. <div class='item'>
  218. <img class='item' title='Crystal' src='<?=$path["img"]["currency"]?>crystal.png'/>
  219. <span class='item'><?=$run->crystal?></span>
  220. </div>
  221. <?php
  222. }
  223. foreach ($run->unit as $unit){
  224. ?>
  225. <div class='item'>
  226. <img class='item' title='<?=$unit->title?>' src='<?=$unit->get_image()?>'/>
  227. </div>
  228. <?php
  229. }
  230. foreach ($run->item as $item){
  231. ?>
  232. <div class='item'>
  233. <img class='item' title='<?=$item->name?>' src='<?=$item->get_image()?>'/>
  234. <span class='item'><?=$item->amount?></span>
  235. </div>
  236. <?php
  237. }
  238. foreach ($run->sd as $sd){
  239. ?>
  240. <div class='item'>
  241. <img class='item' title='<?=$sd->unit->title?>' src='<?=$sd->unit->get_image()?>'/>
  242. <img class='item' title=' ' src='<?=$path["img"]["misc"]?>mask-sd.png'/>
  243. </div>
  244. <?php
  245. }
  246. foreach ($run->unit_piece as $piece){
  247. ?>
  248. <div class='item'>
  249. <img class='item' title='<?=$piece->unit->title?>' src='<?=$piece->unit->get_image()?>'/>
  250. <img class='item' title=' ' src='<?=$path["img"]["misc"]?>mask-piece.png'/>
  251. <span class='item'><?=$piece->quantity?></span>
  252. </div>
  253. <?php
  254. }
  255. if ($run->shapeshifting > 0){
  256. ?>
  257. <div class='item'>
  258. <img class='item' title='Shapeshifting Stones' src='<?=$path["img"]["currency"]?>costumestone.png'/>
  259. <span class='item'><?=$run->shapeshifting?></span>
  260. </div>
  261. <?php
  262. }
  263. foreach ($run->rune as $rune){
  264. ?>
  265. <div class='item item_rune'>
  266. <img class='item' title='Rune' src='<?=$path["img"]["rune"]?>base.png'/>
  267. <?=html_rune_table($rune)?>
  268. </div>
  269. <?php
  270. }
  271. ?>
  272. </td>
  273. <td class='action'>
  274. <?php
  275. if ($enable_save){
  276. ?>
  277. <img alt='Save Team' class='save_team' onclick='saveForm(<?=$run->id?>, true);' src='<?=$path["img"]["icon"]?>save.png'/>
  278. <?php
  279. }
  280. ?>
  281. </td>
  282. </tr>
  283. <?php
  284. }
  285. ?>
  286. </table>
  287. </article>
  288. </section>
  289. <section id='save_team' class='content'>
  290. <h2>
  291. Save run
  292. </h2>
  293. <article>
  294. <input id='save_id' type='hidden' value=''/>
  295. <table>
  296. <tr>
  297. <td class='save_title'>
  298. Name
  299. </td>
  300. <td class='save_values'>
  301. <input type='text' id='save_team_name' name='name'/>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td class='save_title'>
  306. Description
  307. </td>
  308. <td class='save_values'>
  309. <textarea id='save_team_description' name='description'></textarea>
  310. </td>
  311. </tr>
  312. <tr>
  313. <td colspan='2'>
  314. <input type='button' value='Save' onClick='saveTeam();'/>
  315. <input type='button' value='Close' onClick='saveForm(null, false);'/>
  316. </td>
  317. </tr>
  318. </table>
  319. </article>
  320. </section>
  321. <?php
  322. include __DIR__ . "/inc/footer.php";
  323. ?>
  324. </body>
  325. </html>