home.php 27 KB

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