home.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  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 && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
  138. ?>
  139. <div class='skill'>
  140. <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->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 && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
  162. ?>
  163. <div class='skill'>
  164. <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->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. if ($first && isset($defense->unit->leader_skill) && ($defense->unit->leader_skill->area == $EFFECT_AREA["GENERAL"] || $defense->unit->leader_skill->area == $EFFECT_AREA["ARENA"])){
  182. ?>
  183. <div class='skill'>
  184. <img class='skill_img' title='<?=$defense->unit->leader_skill->create_description()?>' src='<?=$defense->unit->leader_skill->get_image()?>'/>
  185. </div>
  186. <?php
  187. }
  188. $first = false;
  189. }
  190. ?>
  191. </div>
  192. </div>
  193. <div id='building' class='profile_section'>
  194. <h4>
  195. Buildings
  196. </h4>
  197. <?php
  198. // Buildings
  199. $half = sizeof(get_context()->get_player()->get_buildings()) / 2;
  200. $i = 0;
  201. foreach (get_context()->get_player()->get_buildings() as $building){
  202. if ($i == $half){
  203. ?>
  204. <br class='desktop'/>
  205. <?php
  206. }
  207. ?>
  208. <?=HTML::building_panel($building)?>
  209. <?php
  210. $i ++;
  211. }
  212. ?>
  213. <br/>
  214. <?php
  215. // Decorations
  216. $ $half = sizeof(get_context()->get_player()->get_decorations()) / 2;
  217. $i = 0;
  218. foreach (get_context()->get_player()->get_decorations() as $decoration){
  219. if ($i == $half){
  220. ?>
  221. <br class='desktop'/>
  222. <?php
  223. }
  224. ?>
  225. <?=HTML::building_panel($decoration)?>
  226. <?php
  227. $i ++;
  228. }
  229. ?>
  230. </div>
  231. <div class='inventory profile_section' id='inventory'>
  232. <h4>
  233. Inventory
  234. </h4>
  235. <ul>
  236. <li>
  237. <img title='Energy' src='<?=URL::IMG["CURRENCY"]?>energy.png'/>
  238. <?=get_context()->get_player()->get_currencies()["energy"]?> / <?=get_context()->get_player()->get_currencies()["energy_max"]?>
  239. </li>
  240. <li>
  241. <img title='Arena Invitations' src='<?=URL::IMG["CURRENCY"]?>arenaenergy.png'/>
  242. <?=get_context()->get_player()->get_currencies()["arena_energy"]?> / 10
  243. </li>
  244. <li>
  245. <img title='Dimensional Energy' src='<?=URL::IMG["CURRENCY"]?>dimensionenergy.png'/>
  246. <?=get_context()->get_player()->get_currencies()["dimension_energy"]?> / 10
  247. </li>
  248. <li>
  249. <img title='Dimensional Crystal' src='<?=URL::IMG["CURRENCY"]?>darkportalenergy.png'/>
  250. <?=get_context()->get_player()->get_currencies()["darkportal_energy"]?> / 10
  251. </li>
  252. <li>
  253. <img title='Mana' src='<?=URL::IMG["CURRENCY"]?>mana.png'/>
  254. <?=get_context()->get_player()->get_currencies()["mana"]?>
  255. </li>
  256. <li>
  257. <img title='Crystal' src='<?=URL::IMG["CURRENCY"]?>crystal.png'/>
  258. <?=get_context()->get_player()->get_currencies()["crystal"]?>
  259. </li>
  260. <li>
  261. <img title='Social Points' src='<?=URL::IMG["CURRENCY"]?>socialpoint.png'/>
  262. <?=get_context()->get_player()->get_currencies()["social_point"]?>
  263. </li>
  264. <li>
  265. <img title='Honor Points' src='<?=URL::IMG["CURRENCY"]?>honor.png'/>
  266. <?=get_context()->get_player()->get_currencies()["honor_point"]?>
  267. </li>
  268. <li>
  269. <img title='Guild Points' src='<?=URL::IMG["CURRENCY"]?>guildpoint.png'/>
  270. <?=get_context()->get_player()->get_currencies()["guild_point"]?>
  271. </li>
  272. <li>
  273. <img title='Honor Medals' src='<?=URL::IMG["CURRENCY"]?>badge.png'/>
  274. <?=get_context()->get_player()->get_currencies()["honor_medal"]?>
  275. </li>
  276. <li>
  277. <img src='<?=URL::IMG["CURRENCY"]?>mark.png'/>
  278. <?=get_context()->get_player()->get_currencies()["honor_mark"]?>
  279. </li>
  280. <li>
  281. <img title='Ancient Coins' src='<?=URL::IMG["CURRENCY"]?>ancientcoin.png'/>
  282. <?=get_context()->get_player()->get_currencies()["event_coin"]?>
  283. </li>
  284. <li>
  285. <img title='Ancient Crystal' src='<?=URL::IMG["CURRENCY"]?>ancientstone.png'/>
  286. <?=get_context()->get_player()->get_currencies()["ancient_stone"]?>
  287. </li>
  288. <li>
  289. <img title='Shapeshifting Stones' src='<?=URL::IMG["CURRENCY"]?>costumestone.png'/>
  290. <?=get_context()->get_player()->get_currencies()["costume_point"]?>
  291. </li>
  292. </ul>
  293. <?php
  294. // Scrolls
  295. $half = sizeof(get_context()->get_player()->get_scrolls()) / 2;
  296. $i = 0;
  297. foreach (get_context()->get_player()->get_scrolls() as $item){
  298. if ($half > 6 && $i == $half){
  299. ?>
  300. <br class='desktop'/>
  301. <?php
  302. }
  303. ?>
  304. <?=HTML::item_panel($item)?>
  305. <?php
  306. $i ++;
  307. }
  308. ?>
  309. <br/>
  310. <?php
  311. // Rune craft materials
  312. $prev = 0;
  313. foreach (get_context()->get_player()->get_rune_craft_materials() as $item){
  314. ?>
  315. <?=HTML::item_panel($item)?>
  316. <?php
  317. $prev = $item->id;
  318. }
  319. ?>
  320. <br/>
  321. <?php
  322. // Other craft materials
  323. $prev = 0;
  324. foreach (get_context()->get_player()->get_craft_materials() as $item){
  325. if ($prev != 0 && $prev < 5000 && $item->id > 5000){
  326. ?>
  327. <br class='desktop'/>
  328. <?php
  329. }
  330. ?>
  331. <?=HTML::item_panel($item)?>
  332. <?php
  333. $prev = $item->id;
  334. }
  335. ?>
  336. <br/>
  337. <?php
  338. // Essences
  339. $prev = "";
  340. $i = 0;
  341. foreach (get_context()->get_player()->get_essences() as $item){
  342. //if ($prev != "" && $prev != preg_split('/\s+/', $item->name)[2]){
  343. if ($i > 0 && $i % 6 == 0){
  344. ?>
  345. <br class='desktop'/>
  346. <?php
  347. }
  348. ?>
  349. <?=HTML::item_panel($item)?>
  350. <?php
  351. $prev = preg_split('/\s+/', $item->name)[2];
  352. $i ++;
  353. }
  354. ?>
  355. </div>
  356. </div> <!-- #panel_left -->
  357. <div class='panel' id='panel_right'>
  358. <div class='profile_section' id='records'>
  359. <h4>
  360. Records
  361. </h4>
  362. <div class='record'>
  363. <table id='rank_records'>
  364. <tr>
  365. <td class='label'>
  366. Arena
  367. </td>
  368. <td class='value rank'>
  369. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_arena())?>
  370. </td>
  371. </tr>
  372. <tr>
  373. <td class='label'>
  374. World Arena
  375. </td>
  376. <td class='value rank'>
  377. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_world_arena())?>
  378. </td>
  379. </tr>
  380. <tr>
  381. <td class='label'>
  382. Special League
  383. </td>
  384. <td class='value rank'>
  385. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_special_league())?>
  386. </td>
  387. </tr>
  388. <tr>
  389. <td class='label'>
  390. Guild War
  391. </td>
  392. <td class='value rank'>
  393. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_gw() - 10)?>
  394. </td>
  395. </tr>
  396. <tr>
  397. <td class='label'>
  398. Siege Battle
  399. </td>
  400. <td class='value rank'>
  401. <?=HTML::arena_rank_icon(get_context()->get_player()->get_top_rank_siege())?>
  402. </td>
  403. </tr>
  404. <tr>
  405. <td class='label'>
  406. World Boss
  407. </td>
  408. <td class='value wboss'>
  409. <!-- TODO Rank 12?? -->
  410. <?=WORLD_BOSS_RANK_ID::RANK[get_context()->get_player()->get_top_rank_wboss()]?>
  411. </td>
  412. </tr>
  413. <tr>
  414. <td class='label'>
  415. Trial of Ascension (N)
  416. </td>
  417. <td class='value toa'>
  418. <?=get_context()->get_player()->get_top_rank_toan()?>F
  419. </td>
  420. </tr>
  421. <tr>
  422. <td class='label'>
  423. Trial of Ascension (N)
  424. </td>
  425. <td class='value toa'>
  426. <?=get_context()->get_player()->get_top_rank_toah()?>F
  427. </td>
  428. </tr>
  429. </table>
  430. <table id='battle_records'>
  431. <?php
  432. foreach (get_context()->get_player()->get_records() as $record){
  433. ?>
  434. <tr>
  435. <td class='record_dungeon'>
  436. <img title='<?=$record->area->name?>' class='area' src='<?=$record->area->get_image()?>'/>
  437. </td>
  438. <td class='record_info'>
  439. <span class='title'>
  440. <?php
  441. $title = "";
  442. switch ($record->area->type){
  443. case AREA_TYPE_ID::CAIROS_DUNGEON:
  444. $title = $record->area->name . " " . $record->stage . "F";
  445. break;
  446. case AREA_TYPE_ID::RIFT_DUNGEON:
  447. $title = $record->area->name;
  448. break;
  449. case AREA_TYPE_ID::RIFT_RAID:
  450. $title = $record->area->name;
  451. }
  452. ?>
  453. <?=$title?>
  454. </span>
  455. <?php
  456. if ($record->area->type == AREA_TYPE_ID::RIFT_DUNGEON){
  457. ?>
  458. <span class='score'>
  459. <?=$record->score?>
  460. </span>
  461. <span class='rank'>
  462. <?=$record->rank?>
  463. </span>
  464. <?php
  465. }
  466. else{
  467. $s = floor($record->time / 1000);
  468. $m = floor($s / 60);
  469. $s = floor($s % 60);
  470. $ms = ($record-> time - (1000 * 60 * $m) - (1000 * 60 * $s) / 100);
  471. $s = str_pad($s, 2, '0', STR_PAD_LEFT);
  472. $ms = str_pad($ms, 2, '0', STR_PAD_LEFT);
  473. ?>
  474. <span class='time'>
  475. <?=$m?>:<?=$s?><span class='ms'>.<?=$ms?></span>
  476. </span>
  477. <?php
  478. }
  479. ?>
  480. </td>
  481. <?php
  482. $class_frontline = "";
  483. if ($record->area->type == AREA_TYPE_ID::RIFT_DUNGEON || $record->area->type == AREA_TYPE_ID::RIFT_RAID){
  484. $class_frontline = "frontlines";
  485. }
  486. ?>
  487. <td class='record_party <?=$class_frontline?>'>
  488. <?php
  489. $prev_front = false;
  490. $front = "undefined";
  491. foreach ($record->party as $party){
  492. $front = in_array($party->id, $record->frontline);
  493. if ($front != "undefined" && $prev_front != $front){
  494. ?>
  495. <hr class='frontline'/>
  496. <?php
  497. }
  498. if ($party instanceof Monster){
  499. $disabled = "disabled";
  500. }
  501. else{
  502. $disabled = "";
  503. }
  504. if ($disabled == ""){
  505. ?>
  506. <a target='_blank' href='/<?=get_context()->get_player()->get_id()?>/monster/<?=$party->id?>'>
  507. <?php
  508. }
  509. ?>
  510. <div class='monster_panel <?=$disabled?>'>
  511. <?=HTML::unit_panel($party)?>
  512. <?php
  513. if ($party->id == $record->leader){
  514. ?>
  515. <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
  516. <?php
  517. }
  518. ?>
  519. </div>
  520. <?php
  521. if ($disabled == ""){
  522. ?>
  523. </a>
  524. <?php
  525. }
  526. $prev_front = $front;
  527. }
  528. ?>
  529. </td>
  530. </tr>
  531. <?php
  532. }
  533. ?>
  534. </table>
  535. </div>
  536. </div>
  537. </div> <!-- #panel_right -->
  538. </article>
  539. </section>
  540. </main>
  541. <?php
  542. include __DIR__ . "/inc/footer.php";
  543. ?>
  544. </body>
  545. </html>