player.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <?php
  2. /**
  3. * Home view.
  4. *
  5. * Contains the view layout and some 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 Home_Page $page The page model.
  12. * @var Player_Page $page The page model.
  13. */
  14. ?>
  15. <!DOCTYPE html>
  16. <html lang='en'>
  17. <head>
  18. <?=$page->generate_head()?>
  19. </head>
  20. <body>
  21. <header>
  22. <?php
  23. include __DIR__ . "/inc/header.php";
  24. ?>
  25. </header>
  26. <aside>
  27. <h2>
  28. <?=get_context()->get_player()->get_name()?>'s profile
  29. </h2>
  30. <table id='profile'>
  31. <tr>
  32. <td class='label'>
  33. Lv.
  34. </td>
  35. <td class='value'>
  36. <?=get_context()->get_player()->get_level()?>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class='label'>
  41. Exp.
  42. </td>
  43. <td class='value'>
  44. <?=get_context()->get_player()->get_experience()?>
  45. </td>
  46. </tr>
  47. <tr>
  48. <td class='label'>
  49. Country
  50. </td>
  51. <td class='value'>
  52. <?=get_context()->get_player()->get_country()?>
  53. </td>
  54. </tr>
  55. <tr>
  56. <td class='label'>
  57. Since
  58. </td>
  59. <td class='value'>
  60. <?=get_context()->get_player()->get_joined('Y-m-d')?>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td class='label'>
  65. Days
  66. </td>
  67. <td class='value'>
  68. <?=round((time() - get_context()->get_player()->get_joined('U')) / (60 * 60 * 24))?>
  69. </td>
  70. </tr>
  71. </table>
  72. </aside>
  73. <main>
  74. <section class='content'>
  75. <h2>
  76. <span>
  77. Summoners War DataBase
  78. </span>
  79. </h2>
  80. <article id='profile'>
  81. <div class='panel' id='panel_left'>
  82. <div id='placements' class='profile_section'>
  83. <h4>
  84. Placements
  85. </h4>
  86. <table>
  87. <tr>
  88. <th>
  89. Rep.
  90. </th>
  91. <td>
  92. <?=HTML::unit_panel(get_context()->get_player()->get_rep(), $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . get_context()->get_player()->get_rep()->get_id())?>
  93. </td>
  94. </tr>
  95. <tr>
  96. <th>
  97. Arena
  98. </th>
  99. <td>
  100. <?php
  101. foreach (get_context()->get_player()->get_arena_defense() as $defense){
  102. ?>
  103. <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
  104. <?php
  105. }
  106. ?>
  107. </td>
  108. </tr>
  109. <tr>
  110. <th>
  111. G. War
  112. </th>
  113. <td>
  114. <div class='team'>
  115. <?php
  116. foreach (get_context()->get_player()->get_gw_defense()[0] as $defense){
  117. ?>
  118. <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
  119. <?php
  120. }
  121. ?>
  122. </div>
  123. <div class='team'>
  124. <?php
  125. foreach (get_context()->get_player()->get_gw_defense()[1] as $defense){
  126. ?>
  127. <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
  128. <?php
  129. }
  130. ?>
  131. </div>
  132. </td>
  133. </tr>
  134. <tr>
  135. <th colspan='2'>
  136. Siege defences
  137. </th>
  138. </tr>
  139. <tr>
  140. <td id='siege_def' colspan='2'>
  141. <?php
  142. foreach (get_context()->get_player()->get_siege_defense() as $formation){
  143. ?>
  144. <div class='team'>
  145. <?php
  146. foreach($formation as $defense){
  147. ?>
  148. <?=HTML::unit_panel($defense, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
  149. <?php
  150. }
  151. ?>
  152. </div>
  153. <?php
  154. }
  155. ?>
  156. </td>
  157. </tr>
  158. </table>
  159. </div>
  160. <div id='building' class='profile_section'>
  161. <h4>
  162. Buildings
  163. </h4>
  164. <?php
  165. // Buildings
  166. $half = sizeof(get_context()->get_player()->get_buildings()) / 2;
  167. $i = 0;
  168. foreach (get_context()->get_player()->get_buildings() as $building){
  169. if ($i == $half){
  170. ?>
  171. <br class='desktop'/>
  172. <?php
  173. }
  174. ?>
  175. <?=HTML::building_panel($building)?>
  176. <?php
  177. $i ++;
  178. }
  179. ?>
  180. <br/>
  181. <?php
  182. // Decorations
  183. $half = sizeof(get_context()->get_player()->get_decorations()) / 2;
  184. $i = 0;
  185. foreach (get_context()->get_player()->get_decorations() as $decoration){
  186. if ($i == $half){
  187. ?>
  188. <br class='desktop'/>
  189. <?php
  190. }
  191. ?>
  192. <?=HTML::building_panel($decoration)?>
  193. <?php
  194. $i ++;
  195. }
  196. ?>
  197. </div>
  198. <div class='inventory profile_section' id='inventory'>
  199. <h4>
  200. Inventory
  201. </h4>
  202. <ul>
  203. <li>
  204. <img title='Energy' src='<?=URL::IMG["CURRENCY"]?>energy.png'/>
  205. <?=get_context()->get_player()->get_currencies()["energy"]?> / <?=get_context()->get_player()->get_currencies()["energy_max"]?>
  206. </li>
  207. <li>
  208. <img title='Arena Invitations' src='<?=URL::IMG["CURRENCY"]?>arenaenergy.png'/>
  209. <?=get_context()->get_player()->get_currencies()["arena_energy"]?> / 10
  210. </li>
  211. <li>
  212. <img title='Dimensional Energy' src='<?=URL::IMG["CURRENCY"]?>dimensionenergy.png'/>
  213. <?=get_context()->get_player()->get_currencies()["dimension_energy"]?> / 100
  214. </li>
  215. <li>
  216. <img title='Dimensional Crystal' src='<?=URL::IMG["CURRENCY"]?>darkportalenergy.png'/>
  217. <?=get_context()->get_player()->get_currencies()["darkportal_energy"]?> / 10
  218. </li>
  219. <li>
  220. <img title='Mana' src='<?=URL::IMG["CURRENCY"]?>mana.png'/>
  221. <?=get_context()->get_player()->get_currencies()["mana"]?>
  222. </li>
  223. <li>
  224. <img title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
  225. <?=get_context()->get_player()->get_currencies()["crystal"]?>
  226. </li>
  227. <li>
  228. <img title='Social Points' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
  229. <?=get_context()->get_player()->get_currencies()["social_point"]?>
  230. </li>
  231. <li>
  232. <img title='Honor Points' src='<?=URL::IMG["CURRENCY"]?>honor.png'/>
  233. <?=get_context()->get_player()->get_currencies()["honor_point"]?>
  234. </li>
  235. <li>
  236. <img title='Guild Points' src='<?=URL::IMG["CURRENCY"]?>guildpoint.png'/>
  237. <?=get_context()->get_player()->get_currencies()["guild_point"]?>
  238. </li>
  239. <li>
  240. <img title='Honor Medals' src='<?=URL::IMG["CURRENCY"]?>badge.png'/>
  241. <?=get_context()->get_player()->get_currencies()["honor_medal"]?>
  242. </li>
  243. <li>
  244. <img src='<?=URL::IMG["CURRENCY"]?>mark.png'/>
  245. <?=get_context()->get_player()->get_currencies()["honor_mark"]?>
  246. </li>
  247. <li>
  248. <img title='Ancient Coins' src='<?=URL::IMG["CURRENCY"]?>ancientcoin.png'/>
  249. <?=get_context()->get_player()->get_currencies()["event_coin"]?>
  250. </li>
  251. <li>
  252. <img title='Ancient Crystal' src='<?=URL::IMG["CURRENCY"]?>ancientstone.png'/>
  253. <?=get_context()->get_player()->get_currencies()["ancient_stone"]?>
  254. </li>
  255. <li>
  256. <img title='Shapeshifting Stones' src='<?=URL::IMG["CURRENCY"]?>costumestone.png'/>
  257. <?=get_context()->get_player()->get_currencies()["costume_point"]?>
  258. </li>
  259. </ul>
  260. <?php
  261. // Scrolls
  262. $half = sizeof(get_context()->get_player()->get_scrolls()) / 2;
  263. $i = 0;
  264. foreach (get_context()->get_player()->get_scrolls() as $item){
  265. if ($half > 6 && $i == $half){
  266. ?>
  267. <br class='desktop'/>
  268. <?php
  269. }
  270. ?>
  271. <?=HTML::item_panel($item)?>
  272. <?php
  273. $i ++;
  274. }
  275. ?>
  276. <br/>
  277. <?php
  278. // Rune craft materials
  279. $prev = 0;
  280. foreach (get_context()->get_player()->get_rune_craft_materials() as $item){
  281. ?>
  282. <?=HTML::item_panel($item)?>
  283. <?php
  284. $prev = $item->get_id();
  285. }
  286. ?>
  287. <br/>
  288. <?php
  289. // Other craft materials
  290. $prev = 0;
  291. foreach (get_context()->get_player()->get_craft_materials() as $item){
  292. if ($prev != 0 && $prev < 5000 && $item->get_id() > 5000){
  293. ?>
  294. <br class='desktop'/>
  295. <?php
  296. }
  297. ?>
  298. <?=HTML::item_panel($item)?>
  299. <?php
  300. $prev = $item->get_id();
  301. }
  302. ?>
  303. <br/>
  304. <?php
  305. // Essences
  306. $prev = "";
  307. $i = 0;
  308. foreach (get_context()->get_player()->get_essences() as $item){
  309. //if ($prev != "" && $prev != preg_split('/\s+/', $item->name)[2]){
  310. if ($i > 0 && $i % 6 == 0){
  311. ?>
  312. <br class='desktop'/>
  313. <?php
  314. }
  315. ?>
  316. <?=HTML::item_panel($item)?>
  317. <?php
  318. $prev = preg_split('/\s+/', $item->get_name())[2];
  319. $i ++;
  320. }
  321. ?>
  322. </div>
  323. </div> <!-- #panel_left -->
  324. <div class='panel' id='panel_right'>
  325. <div class='profile_section' id='records'>
  326. <h4>
  327. Records
  328. </h4>
  329. <div class='record'>
  330. <table id='rank_records'>
  331. <tr>
  332. <td class='label'>
  333. Arena
  334. </td>
  335. <td class='value rank'>
  336. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_arena())?>
  337. </td>
  338. </tr>
  339. <tr>
  340. <td class='label'>
  341. World Arena
  342. </td>
  343. <td class='value rank'>
  344. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_world_arena())?>
  345. </td>
  346. </tr>
  347. <tr>
  348. <td class='label'>
  349. Special League
  350. </td>
  351. <td class='value rank'>
  352. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_special_league())?>
  353. </td>
  354. </tr>
  355. <tr>
  356. <td class='label'>
  357. Guild War
  358. </td>
  359. <td class='value rank'>
  360. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_gw() - 10)?>
  361. </td>
  362. </tr>
  363. <tr>
  364. <td class='label'>
  365. Siege Battle
  366. </td>
  367. <td class='value rank'>
  368. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_siege())?>
  369. </td>
  370. </tr>
  371. <tr>
  372. <td class='label'>
  373. World Boss
  374. </td>
  375. <td class='value wboss'>
  376. <!-- TODO Rank 12?? -->
  377. <?=WORLD_BOSS_RANK_ID::RANK[get_context()->get_player()->get_top_rank_wboss()]?>
  378. </td>
  379. </tr>
  380. <tr>
  381. <td class='label'>
  382. Trial of Ascension (Normal)
  383. </td>
  384. <td class='value toa'>
  385. <?=get_context()->get_player()->get_top_rank_toan()?>F
  386. </td>
  387. </tr>
  388. <tr>
  389. <td class='label'>
  390. Trial of Ascension (Hard)
  391. </td>
  392. <td class='value toa'>
  393. <?=get_context()->get_player()->get_top_rank_toah()?>F
  394. </td>
  395. </tr>
  396. <tr>
  397. <td class='label'>
  398. Trial of Ascension (Hell)
  399. </td>
  400. <td class='value toa'>
  401. <?=get_context()->get_player()->get_top_rank_toal()?>
  402. <img id='toal_star' src='<?=URL::IMG["ICON"]?>star.png'/>
  403. </td>
  404. </tr>
  405. </table>
  406. <table id='battle_records'>
  407. <?php
  408. foreach (get_context()->get_player()->get_records() as $record){
  409. ?>
  410. <tr>
  411. <td class='record_dungeon'>
  412. <img title='<?=$record->get_area()->get_name()?>' class='area' src='<?=$record->get_area()->get_image()?>'/>
  413. </td>
  414. <td class='record_info'>
  415. <span class='title'>
  416. <?php
  417. $title = "";
  418. switch ($record->get_area()->get_type()){
  419. case AREA_TYPE_ID::CAIROS_DUNGEON:
  420. case AREA_TYPE_ID::DIMENSIONAL_HOLE:
  421. $title = $record->get_area()->get_name() . " " . $record->get_stage() . "F";
  422. break;
  423. case AREA_TYPE_ID::RIFT_DUNGEON:
  424. $title = $record->get_area()->get_name();
  425. break;
  426. case AREA_TYPE_ID::RIFT_RAID:
  427. $title = $record->get_area()->get_name() . " " . $record->get_stage();
  428. break;
  429. }
  430. ?>
  431. <?=$title?>
  432. </span>
  433. <?php
  434. if ($record->get_area()->get_type() == AREA_TYPE_ID::RIFT_DUNGEON){
  435. ?>
  436. <span class='score'>
  437. <?=$record->get_score()?>
  438. </span>
  439. <span class='rank'>
  440. <?=$record->get_rank()?>
  441. </span>
  442. <?php
  443. }
  444. else{
  445. $s = floor($record->get_time() / 1000);
  446. $m = floor($s / 60);
  447. $s = floor($s % 60);
  448. $ms = ($record->get_time() - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
  449. $s = str_pad($s, 2, '0', STR_PAD_LEFT);
  450. $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
  451. ?>
  452. <span class='time'>
  453. <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
  454. </span>
  455. <?php
  456. }
  457. ?>
  458. </td>
  459. <?php
  460. $class_frontline = "";
  461. if ($record->get_area()->get_type() == AREA_TYPE_ID::RIFT_DUNGEON || $record->get_area()->get_type() == AREA_TYPE_ID::RIFT_RAID){
  462. $class_frontline = "frontlines";
  463. }
  464. ?>
  465. <td class='record_party <?=$class_frontline?>'>
  466. <?php
  467. $prev_front = false;
  468. $front = "undefined";
  469. foreach ($record->get_party() as $party){
  470. $front = in_array($party->get_id(), $record->get_frontline());
  471. if ($front != "undefined" && $prev_front != $front){
  472. ?>
  473. <hr class='frontline'/>
  474. <?php
  475. }
  476. if ($party instanceof Monster){
  477. $disabled = "disabled";
  478. $href = null;
  479. }
  480. else{
  481. $disabled = "";
  482. $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $party->get_id();
  483. }
  484. ?>
  485. <?=HTML::unit_panel($party, $simple=true, $href="/player/" . get_context()->get_player()->get_id() . "/units/" . $defense->get_id())?>
  486. <?php
  487. $prev_front = $front;
  488. }
  489. ?>
  490. </td>
  491. </tr>
  492. <?php
  493. }
  494. ?>
  495. </table>
  496. </div>
  497. </div>
  498. </div> <!-- #panel_right -->
  499. </article>
  500. </section>
  501. </main>
  502. <?php
  503. include __DIR__ . "/inc/footer.php";
  504. ?>
  505. </body>
  506. </html>