runs.php 14 KB

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