stats.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <?php
  2. /**
  3. * Runs view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @property_read Stats_Page $page The page model.
  9. * @property_read int $UID Player ID.
  10. */
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang='en'>
  14. <head>
  15. <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
  16. <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
  17. <title><?=$page->title?></title>
  18. <link rel='shortcut icon' href='<?=$page->favicon?>'/>
  19. <!-- CSS files -->
  20. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
  21. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>stats.css'/>
  22. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
  23. <!-- Meta tags -->
  24. <link rel='canonical' href='<?=$page->canonical?>'/>
  25. <link rel='author' href='<?=$page->author?>'/>
  26. <link rel='publisher' href='<?=$page->author?>'/>
  27. <meta name='description' content='<?=$page->description?>'/>
  28. <meta property='og:title' content='<?=$page->title?>'/>
  29. <meta property='og:url' content='<?=$page->canonical?>'/>
  30. <meta property='og:description' content='<?=$page->description?>'/>
  31. <meta property='og:image' content='<?=$page->icon?>'/>
  32. <meta property='og:site_name' content='<?=$page->name?>'/>
  33. <meta property='og:type' content='website'/>
  34. <meta property='og:locale' content='en'/>
  35. <meta name='twitter:card' content='summary'/>
  36. <meta name='twitter:title' content='<?=$page->title?>'/>
  37. <meta name='twitter:description' content='<?=$page->description?>'/>
  38. <meta name='twitter:image' content='<?=$page->icon?>'/>
  39. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  40. <meta name='robots' content='index follow'/>
  41. <script>
  42. /**
  43. * Shows or hiddes the filters panel.
  44. */
  45. function toggleFilters(){
  46. var content = document.getElementById('filters_content');
  47. var slid = document.getElementById('filters_slid');
  48. if (content.style.maxHeight != '30em'){
  49. content.style.maxHeight = '30em';
  50. slid.style.transform = 'rotate(90deg)';
  51. }
  52. else{
  53. content.style.maxHeight = '0px';
  54. slid.style.transform = 'rotate(0deg)';
  55. }
  56. };
  57. function selectAreaType(){
  58. var areaType = document.getElementById('filter_area_type').options[document.getElementById('filter_area_type').selectedIndex].value;
  59. // Clear all selectors
  60. document.getElementById('filter_stage').style.display = 'none';
  61. document.getElementById('filter_difficulty').style.display = 'none';
  62. var areas = document.getElementsByClassName('filter_area');
  63. for (var i = 0; i < areas.length; i++) {
  64. areas[i].style.display = 'none';
  65. areas[i].removeAttribute('name');
  66. }
  67. // Show selected selector.
  68. switch (areaType){
  69. case '<?=AREA_TYPE_ID::SCENARIO?>':
  70. document.getElementById('filter_area_scenario').style.display = 'inline-block';
  71. document.getElementById('filter_area_scenario').setAttribute('name', 'area');
  72. populateStage(7);
  73. document.getElementById('filter_stage').style.display = 'inline-block';
  74. populateDifficulty();
  75. document.getElementById('filter_difficulty').style.display = 'inline-block';
  76. break;
  77. case '<?=AREA_TYPE_ID::CAIROS_DUNGEON?>':
  78. document.getElementById('filter_area_cairos').style.display = 'inline-block';
  79. document.getElementById('filter_area_cairos').setAttribute('name', 'area');
  80. populateStage(10);
  81. document.getElementById('filter_stage').style.display = 'inline-block';
  82. break;
  83. case '<?=AREA_TYPE_ID::RIFT_DUNGEON?>':
  84. document.getElementById('filter_area_rift_dungeon').style.display = 'inline-block';
  85. document.getElementById('filter_area_rift_dungeon').setAttribute('name', 'area');
  86. break;
  87. // TODO: Other areas
  88. // Rift Raid: Don't filter by area.
  89. // Arena: Don't filter by area.
  90. // Guild War: Don't filter by area.
  91. // Guild Siege: Don't filter by area.
  92. // Rift Raid: Don't filter by area.
  93. // Tartarus: Don't filter by area.
  94. // TOA: Don't filter by area.
  95. // Rift Raid: Don't filter by area.
  96. // WB: Don't filter by area.
  97. // Dimensional Rift: Don't filter by area.
  98. // TODO: Filter Dimensional Hole dungeon
  99. }
  100. }
  101. /**
  102. * Shows the stage selector in the filters.
  103. *
  104. * @param total The number of stages to show.
  105. */
  106. function populateStage(total){
  107. var sel = document.getElementById('filter_stage');
  108. while (sel.firstChild) {
  109. sel.removeChild(sel.firstChild);
  110. }
  111. var opt;
  112. var att;
  113. // Empty
  114. opt = document.createElement('option');
  115. tex = document.createTextNode('');
  116. opt.appendChild(tex);
  117. sel.appendChild(opt);
  118. for (var i = 1; i <= total; i ++){
  119. opt = document.createElement('option');
  120. tex = document.createTextNode('Stage ' + i);
  121. att = document.createAttribute('value');
  122. att.value = i;
  123. opt.setAttributeNode(att);
  124. opt.appendChild(tex);
  125. sel.appendChild(opt);
  126. }
  127. }
  128. /**
  129. * Shows the difficulty selector in the filter panel.
  130. *
  131. * @param labyrinth Indicates if the area type is the Tartarus
  132. * labyrinth. If so, it includes 'Easy'.
  133. * @param toa Indicates if the area type is the Tower of
  134. * Ascension. If so, it excludes 'Hell'.
  135. */
  136. function populateDifficulty(labyrinth = false, toa = false){
  137. var sel = document.getElementById('filter_difficulty');
  138. while (sel.firstChild) {
  139. sel.removeChild(sel.firstChild);
  140. }
  141. var opt;
  142. var att;
  143. var tex;
  144. // Empty
  145. opt = document.createElement('option');
  146. tex = document.createTextNode('');
  147. opt.appendChild(tex);
  148. sel.appendChild(opt);
  149. // Easy (Labyrinth only)
  150. if (labyrinth){
  151. opt = document.createElement('option');
  152. tex = document.createTextNode('Easy difficulty');
  153. att = document.createAttribute('value');
  154. att.value = '<?=DIFFICULTY_ID::EASY?>';
  155. opt.setAttributeNode(att);
  156. opt.appendChild(tex);
  157. sel.appendChild(opt);
  158. }
  159. // Normal
  160. opt = document.createElement('option');
  161. tex = document.createTextNode('Normal difficulty');
  162. att = document.createAttribute('value');
  163. att.value = '<?=DIFFICULTY_ID::NORMAL?>';
  164. opt.setAttributeNode(att);
  165. opt.appendChild(tex);
  166. sel.appendChild(opt);
  167. // Hard
  168. opt = document.createElement('option');
  169. tex = document.createTextNode('Hard difficulty');
  170. att = document.createAttribute('value');
  171. att.value = '<?=DIFFICULTY_ID::HARD?>';
  172. opt.setAttributeNode(att);
  173. opt.appendChild(tex);
  174. sel.appendChild(opt);
  175. // Hell
  176. if (!toa){
  177. opt = document.createElement('option');
  178. tex = document.createTextNode('Hell difficulty');
  179. att = document.createAttribute('value');
  180. att.value = '<?=DIFFICULTY_ID::HELL?>';
  181. opt.setAttributeNode(att);
  182. opt.appendChild(tex);
  183. sel.appendChild(opt);
  184. }
  185. }
  186. /**
  187. * Sets the values for the stage and difficulty at page load.
  188. */
  189. function initialValues(){
  190. <?php
  191. if ($page->filters["STAGE"] != null && $page->filters["STAGE"] > 0){
  192. ?>
  193. document.getElementById('filter_stage').selectedIndex = <?=$page->filters["STAGE"]?>;
  194. <?php
  195. }
  196. if ($page->filters["DIFFICULTY"] != null && $page->filters["DIFFICULTY"] > 0){
  197. ?>
  198. document.getElementById('filter_difficulty').selectedIndex = <?=$page->filters["DIFFICULTY"]?>;
  199. <?php
  200. }
  201. ?>
  202. }
  203. /**
  204. * Calls all required functions to draw all diagrams.
  205. */
  206. function populateDiagrams(){
  207. <?php
  208. if ($page->show_data){
  209. ?>
  210. diagramWin();
  211. diagramDropType();
  212. diagramDropRuneSlot();
  213. diagramDropRuneStars();
  214. diagramDropRuneQuality();
  215. <?php
  216. }
  217. ?>
  218. }
  219. /**
  220. * Generates the win rate diagram.
  221. */
  222. function diagramWin(){
  223. var canvas = document.getElementById("diagram_win");
  224. var ctx = canvas.getContext("2d");
  225. ctx.lineWidth = 2;
  226. var lastend = 0;
  227. var data = [<?=$page->win_lose[0]?>, <?=$page->win_lose[1]?>];
  228. var total = 0;
  229. var color = [
  230. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_1')).color,
  231. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_2')).color
  232. ];
  233. for(var e = 0; e < data.length; e++){
  234. total += data[e];
  235. }
  236. for (var i = 0; i < data.length; i++) {
  237. ctx.beginPath();
  238. ctx.moveTo(canvas.width / 2, canvas.height / 2);
  239. ctx.arc(canvas.width / 2, canvas.height / 2, canvas.height / 2, lastend, lastend + (Math.PI * 2 * (data[i] / total)), false);
  240. ctx.lineTo(canvas.width / 2, canvas.height / 2);
  241. ctx.fillStyle = '#000000';
  242. ctx.stroke();
  243. ctx.fillStyle = color[i];
  244. ctx.fill();
  245. lastend += Math.PI * 2 * (data[i] / total);
  246. }
  247. }
  248. /**
  249. * Generates the drop rate diagram.
  250. */
  251. function diagramDropType(){
  252. // TODO: Diferenciate scenario, dungeon and hall.
  253. var canvas = document.getElementById("diagram_drop_type");
  254. var ctx = canvas.getContext("2d");
  255. ctx.lineWidth = 2;
  256. var lastend = 0;
  257. var data = [
  258. <?=$page->drop_type["rune"]?>,
  259. <?=$page->drop_type["rune_craft"]?>,
  260. <?=$page->drop_type["item"]?>,
  261. <?=$page->drop_type["sd"]?>,
  262. <?=$page->drop_type["shapeshifting"]?>,
  263. <?=$page->drop_type["unit"]?>,
  264. ];
  265. var total = 0;
  266. var color = [
  267. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_1')).color,
  268. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_2')).color,
  269. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_3')).color,
  270. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_4')).color,
  271. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_5')).color,
  272. getComputedStyle(document.querySelector('div.diagram table.legend tr.color_6')).color,
  273. ];
  274. for(var e = 0; e < data.length; e++){
  275. total += data[e];
  276. }
  277. for (var i = 0; i < data.length; i++) {
  278. ctx.beginPath();
  279. ctx.moveTo(canvas.width/2, canvas.height/2);
  280. ctx.arc(canvas.width/2, canvas.height/2, canvas.height/2, lastend, lastend + (Math.PI * 2 * (data[i] / total)), false);
  281. ctx.lineTo(canvas.width/2, canvas.height/2);
  282. ctx.fillStyle = '#000000';
  283. ctx.stroke();
  284. ctx.fillStyle = color[i];
  285. ctx.fill();
  286. lastend += Math.PI * 2 * (data[i] / total);
  287. }
  288. }
  289. /**
  290. * Generates the rune slot rate diagram.
  291. */
  292. function diagramDropRuneSlot(){
  293. var canvas = document.getElementById("diagram_rune_slot");
  294. var data = [
  295. <?=$page->drop_rune_slot["1"]?>,
  296. <?=$page->drop_rune_slot["2"]?>,
  297. <?=$page->drop_rune_slot["3"]?>,
  298. <?=$page->drop_rune_slot["4"]?>,
  299. <?=$page->drop_rune_slot["5"]?>,
  300. <?=$page->drop_rune_slot["6"]?>
  301. ];
  302. var total = 6;
  303. // Polarchart base
  304. var ctx_base = canvas.getContext("2d");
  305. ctx_base.lineWidth = 1;
  306. ctx_base.font = '32px serif'
  307. ctx_base.textBaseline = 'middle'
  308. ctx_base.textAlign = 'middle'
  309. var lastend = Math.PI + Math.PI / total;
  310. var radius = Math.round((canvas.width / 2) * ((i + 1) / total));
  311. for (var i = 0; i < total; i++) {
  312. ctx_base.moveTo(canvas.width / 2, canvas.height / 2);
  313. ctx_base.arc(canvas.width / 2, canvas.height / 2, canvas.height / 2, lastend, lastend + (Math.PI * 2 / total), false);
  314. ctx_base.lineTo(canvas.width / 2, canvas.height / 2);
  315. ctx_base.strokeStyle = '#333333';
  316. ctx_base.stroke();
  317. lastend += (Math.PI * 2 / total);
  318. }
  319. ctx_base.fillStyle = '#33333366';
  320. ctx_base.fill();
  321. // Numbers
  322. ctx_base.fillStyle = '#ffffff';
  323. lastend = Math.PI + Math.PI / total;
  324. for (var i = 0; i < total; i ++){
  325. lastend += (Math.PI * 2 / total);
  326. tx = canvas.width / 2 + canvas.width / 2.3 * Math.cos(lastend);
  327. ty = canvas.width / 2 + canvas.width / 2.3 * Math.sin(lastend);
  328. ctx_base.fillText(i + 1, tx - 8, ty);
  329. }
  330. // Polarchart content
  331. var ctx_data = canvas.getContext("2d");
  332. max = Math.max.apply(null, data) * 1.1;
  333. var initX = 0;
  334. var initY = 0;
  335. let region = new Path2D();
  336. for (var i = 0; i < total; i++) {
  337. var r = Math.round((canvas.width / 2) * data[i] / max);
  338. var x = Math.round(r * Math.sin(Math.PI * 2 / total));
  339. var y = Math.round(r * Math.cos(Math.PI * 2 / total));
  340. // Rotate the point
  341. angle = (i + 4) * Math.PI * 2 / total;
  342. rx = x * Math.cos(angle) - y * Math.sin(angle)
  343. ry = y * Math.cos(angle) + x * Math.sin(angle)
  344. rx += canvas.width / 2;
  345. ry += canvas.width / 2;
  346. if (i == 0){
  347. region.moveTo(rx, ry);
  348. initX = rx;
  349. initY = ry;
  350. }
  351. else{
  352. region.lineTo(rx, ry);
  353. }
  354. }
  355. region.lineTo(initX, initY);
  356. ctx_data.lineWidth = 2;
  357. ctx_data.strokeStyle = '#ff0000';
  358. ctx_data.stroke(region)
  359. ctx_data.fillStyle = '#ff000055';
  360. ctx_data.fill(region)
  361. }
  362. /**
  363. * Generates the rune star rate diagram.
  364. */
  365. function diagramDropRuneStars(){
  366. var canvas = document.getElementById("diagram_rune_stars");
  367. var data = [
  368. <?=$page->drop_rune_stars["6"]?>,
  369. <?=$page->drop_rune_stars["5"]?>,
  370. <?=$page->drop_rune_stars["4"]?>,
  371. <?=$page->drop_rune_stars["3"]?>,
  372. <?=$page->drop_rune_stars["2"]?>,
  373. <?=$page->drop_rune_stars["1"]?>
  374. ];
  375. var total = 6;
  376. // Polarchart base
  377. var ctx_base = canvas.getContext("2d");
  378. ctx_base.lineWidth = 1;
  379. ctx_base.font = '32px serif'
  380. ctx_base.textBaseline = 'middle'
  381. ctx_base.textAlign = 'middle'
  382. var lastend = Math.PI + Math.PI / total;
  383. for (var i = 0; i < total; i++) {
  384. radius = Math.round((canvas.width / 2) * ((i + 1) / total));
  385. ctx_base.moveTo(canvas.width / 2, canvas.height / 2);
  386. ctx_base.arc(canvas.width / 2, canvas.height / 2, canvas.height / 2, lastend, lastend + (Math.PI * 2 / total), false);
  387. ctx_base.lineTo(canvas.width / 2, canvas.height / 2);
  388. ctx_base.strokeStyle = '#333333';
  389. ctx_base.stroke();
  390. lastend += (Math.PI * 2 / total);
  391. }
  392. ctx_base.fillStyle = '#33333366';
  393. ctx_base.fill();
  394. // Numbers
  395. ctx_base.fillStyle = '#ffffff';
  396. lastend = Math.PI + Math.PI / total;
  397. for (var i = 0; i < total; i ++){
  398. lastend += (Math.PI * 2 / total);
  399. tx = canvas.width / 2 + canvas.width / 2.3 * Math.cos(lastend);
  400. ty = canvas.width / 2 + canvas.width / 2.3 * Math.sin(lastend);
  401. ctx_base.fillText(6 - i, tx - 8, ty);
  402. }
  403. // Polarchart content
  404. var ctx_data = canvas.getContext("2d");
  405. max = Math.max.apply(null, data) * 1.1;
  406. var initX = 0;
  407. var initY = 0;
  408. let region = new Path2D();
  409. for (var i = 0; i < total; i++) {
  410. var r = Math.round((canvas.width / 2) * data[i] / max);
  411. var x = Math.round(r * Math.sin(Math.PI * 2 / total));
  412. var y = Math.round(r * Math.cos(Math.PI * 2 / total));
  413. // Rotate the point
  414. angle = (i + 4) * Math.PI * 2 / total;
  415. rx = x * Math.cos(angle) - y * Math.sin(angle)
  416. ry = y * Math.cos(angle) + x * Math.sin(angle)
  417. rx += canvas.width / 2;
  418. ry += canvas.width / 2;
  419. if (i == 0){
  420. region.moveTo(rx, ry);
  421. initX = rx;
  422. initY = ry;
  423. }
  424. else{
  425. region.lineTo(rx, ry);
  426. }
  427. }
  428. region.lineTo(initX, initY);
  429. ctx_data.lineWidth = 2;
  430. ctx_data.strokeStyle = '#ff0000';
  431. ctx_data.stroke(region)
  432. ctx_data.fillStyle = '#ff000055';
  433. ctx_data.fill(region)
  434. }
  435. /**
  436. * Generates the rune quality rate diagram.
  437. */
  438. function diagramDropRuneQuality(){
  439. var canvas = document.getElementById("diagram_rune_quality");
  440. var data = [
  441. <?=$page->drop_rune_quality[strval(QUALITY_ID::LEGEND)]?>,
  442. <?=$page->drop_rune_quality[strval(QUALITY_ID::HERO)]?>,
  443. <?=$page->drop_rune_quality[strval(QUALITY_ID::RARE)]?>,
  444. <?=$page->drop_rune_quality[strval(QUALITY_ID::MAGIC)]?>,
  445. <?=$page->drop_rune_quality[strval(QUALITY_ID::NORMAL)]?>
  446. ];
  447. var total = 5;
  448. // Polarchart base
  449. var ctx_base = canvas.getContext("2d");
  450. ctx_base.lineWidth = 1;
  451. //var lastend = Math.PI * 2 / (0.5 * total / Math.PI);
  452. var lastend = ((270 - (180 / (total))) * Math.PI / 180);
  453. var color = [
  454. '#f5790066', // LEGEND
  455. '#ad7fa866', // HERO
  456. '#15c6e166', // RARE
  457. '#55ff5566', // MAGIC
  458. '#cccccc66' // NORMAL
  459. ];
  460. for (var i = 0; i < total; i++) {
  461. ctx_base.beginPath();
  462. radius = Math.round((canvas.width / 2) * ((i + 1) / total));
  463. ctx_base.moveTo(canvas.width / 2, canvas.height / 2);
  464. ctx_base.arc(canvas.width / 2, canvas.height / 2, canvas.height / 2, lastend, lastend + (Math.PI * 2 / total), false);
  465. ctx_base.lineTo(canvas.width / 2, canvas.height / 2);
  466. ctx_base.fillStyle = color[i];
  467. ctx_base.fill();
  468. ctx_base.strokeStyle = '#333333';
  469. ctx_base.stroke();
  470. lastend += (Math.PI * 2 / total);
  471. }
  472. //ctx_base.fillStyle = '#33333366';
  473. //ctx_base.fill()
  474. // Polarchart content
  475. var ctx_data = canvas.getContext("2d");
  476. max = Math.max.apply(null, data) * 1.1;
  477. var initX = 0;
  478. var initY = 0;
  479. let region = new Path2D();
  480. for (var i = 0; i < total; i++) {
  481. var r = Math.round((canvas.width / 2) * data[i] / max);
  482. var x = Math.round(r * Math.sin(Math.PI * 2 / total));
  483. var y = Math.round(r * Math.cos(Math.PI * 2 / total));
  484. // Rotate the point
  485. // TOTALLY experimental, not reliable for a different number of sectors.
  486. angle = (i * Math.PI * 2 / total) + 2 * Math.PI / (2 * (total - 1)) + 270 * (4.6/6) * Math.PI / 180;
  487. rx = x * Math.cos(angle) - y * Math.sin(angle)
  488. ry = y * Math.cos(angle) + x * Math.sin(angle)
  489. rx += canvas.width / 2;
  490. ry += canvas.width / 2;
  491. if (i == 0){
  492. region.moveTo(rx, ry);
  493. initX = rx;
  494. initY = ry;
  495. }
  496. else{
  497. region.lineTo(rx, ry);
  498. }
  499. }
  500. region.lineTo(initX, initY);
  501. ctx_data.lineWidth = 2;
  502. ctx_data.strokeStyle = '#ff0000';
  503. ctx_data.stroke(region)
  504. ctx_data.fillStyle = '#ff000055';
  505. ctx_data.fill(region)
  506. }
  507. // TODO: Script to show/hide area selector
  508. </script>
  509. </head>
  510. <body onload='populateDiagrams();selectAreaType();initialValues();'>
  511. <?php
  512. include __DIR__ . "/inc/header.php";
  513. ?>
  514. <section class='filters'>
  515. <h2 id='filters_title' onClick='toggleFilters();'>
  516. <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
  517. Stat filters
  518. </h2>
  519. <article id='filters_content'>
  520. <?php
  521. $filters = $page->filters;
  522. include __DIR__ . "/inc/filter_stats.php";
  523. ?>
  524. </article>
  525. </section> <!-- #filters -->
  526. <?php
  527. if ($page->show_data){
  528. ?>
  529. <section class='content'>
  530. <h2>
  531. Stats
  532. </h2>
  533. <article>
  534. <div id='win' class='diagram'>
  535. <h3>
  536. Victory rate
  537. </h3>
  538. <canvas id='diagram_win' width='200' height='200'></canvas>
  539. <?php
  540. $total = $page->win_lose[0] + $page->win_lose[1];
  541. // Fix divisions by 0 (dont use in total count):
  542. if ($total == 0){
  543. $total ++;
  544. }
  545. ?>
  546. <table class='legend'>
  547. <tr class='color_1'>
  548. <td>
  549. Victories:
  550. </td>
  551. <td>
  552. <?=$page->win_lose[0]?>
  553. </td>
  554. <td>
  555. (<?=number_format(($page->win_lose[0] * 100) / $total, 2, ".", ",")?>%)
  556. </td>
  557. </tr>
  558. <tr class='color_2'>
  559. <td>
  560. Defeats:
  561. </td>
  562. <td>
  563. <?=$page->win_lose[1]?>
  564. </td>
  565. <td>
  566. (<?=number_format(($page->win_lose[1] * 100) / $total, 2, ".", ",")?>%)
  567. </td>
  568. </tr>
  569. <tr class='color_0'>
  570. <td>
  571. Total:
  572. </td>
  573. <td colspan='2'>
  574. <?=($page->win_lose[0] + $page->win_lose[1])?>
  575. </td>
  576. </tr>
  577. </table>
  578. </div>
  579. <div id='drop_type' class='diagram'>
  580. <h3>
  581. Drop rate
  582. </h3>
  583. <canvas id='diagram_drop_type' width='200' height='200'></canvas>
  584. <table class='legend'>
  585. <?php
  586. // Do some calculations
  587. $rune = $page->drop_type["rune"];
  588. $rucr = $page->drop_type["rune_craft"];
  589. $item = $page->drop_type["item"];
  590. $sedu = $page->drop_type["sd"];
  591. $shap = $page->drop_type["shapeshifting"];
  592. $unit = $page->drop_type["unit"];
  593. $total = $rune + $rucr + $item + $sedu + $shap + $unit;
  594. // Fix divisions by 0:
  595. if ($total == 0){
  596. $total ++;
  597. }
  598. ?>
  599. <tr class='color_1'>
  600. <td>
  601. Rune:
  602. </td>
  603. <td>
  604. <?=$rune?>
  605. </td>
  606. <td>
  607. (<?=number_format(($rune * 100) / $total, 2, ".", ",")?>%)
  608. </td>
  609. </tr>
  610. <tr class='color_2'>
  611. <td>
  612. Rune craft item:
  613. </td>
  614. <td>
  615. <?=$rucr?>
  616. </td>
  617. <td>
  618. (<?=number_format(($rucr * 100) / $total, 2, ".", ",")?>%)
  619. </td>
  620. </tr>
  621. <tr class='color_3'>
  622. <td>
  623. Item:
  624. </td>
  625. <td>
  626. <?=$item?>
  627. </td>
  628. <td>
  629. (<?=number_format(($item * 100) / $total, 2, ".", ",")?>%)
  630. </td>
  631. </tr>
  632. <tr class='color_4'>
  633. <td>
  634. Secret Dungeon:
  635. </td>
  636. <td>
  637. <?=$sedu?>
  638. </td>
  639. <td>
  640. (<?=number_format(($sedu * 100) / $total, 2, ".", ",")?>%)
  641. </td>
  642. </tr>
  643. <tr class='color_5'>
  644. <td>
  645. Transmog Stone:
  646. </td>
  647. <td>
  648. <?=$shap?>
  649. </td>
  650. <td>
  651. (<?=number_format(($shap * 100) / $total, 2, ".", ",")?>%)
  652. </td>
  653. </tr>
  654. <tr class='color_6'>
  655. <td>
  656. Unit:
  657. </td>
  658. <td>
  659. <?=$unit?>
  660. </td>
  661. <td>
  662. (<?=number_format(($unit * 100) / $total, 2, ".", ",")?>%)
  663. </td>
  664. </tr>
  665. </table>
  666. </div>
  667. <div id='drop_rune_slot' class='diagram'>
  668. <h3>
  669. Rune drops by slot
  670. </h3>
  671. <canvas id='diagram_rune_slot' width='200' height='200'></canvas>
  672. <table class='legend'>
  673. <?php
  674. $total = array_sum($page->drop_rune_slot);
  675. // Fix divisions by 0:
  676. if ($total == 0){
  677. $total ++;
  678. }
  679. for ($i = 1; $i <= 6; $i ++){
  680. $val = $page->drop_rune_slot[strval($i)]
  681. ?>
  682. <tr class='color_0'>
  683. <td>
  684. Slot <?=$i?>:
  685. </td>
  686. <td>
  687. <?=$val?>
  688. </td>
  689. <td>
  690. (<?=number_format(($val * 100) / $total, 2, ".", ",")?>%)
  691. </td>
  692. </tr>
  693. <?php
  694. }
  695. ?>
  696. </table>
  697. </div>
  698. <div id='drop_rune_stars' class='diagram'>
  699. <h3>
  700. Rune drops by stars
  701. </h3>
  702. <canvas id='diagram_rune_stars' width='200' height='200'></canvas>
  703. <table class='legend'>
  704. <?php
  705. $total = array_sum($page->drop_rune_stars);
  706. // Fix divisions by 0:
  707. if ($total == 0){
  708. $total ++;
  709. }
  710. for ($i = 6; $i >= 1; $i --){
  711. $val = $page->drop_rune_stars[strval($i)]
  712. ?>
  713. <tr class='color_0'>
  714. <td>
  715. <?php
  716. for ($j = 1; $j <= $i; $j ++){
  717. ?>
  718. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  719. <?php
  720. }
  721. ?>
  722. </td>
  723. <td>
  724. <?=$val?>
  725. </td>
  726. <td>
  727. (<?=number_format(($val * 100) / $total, 2, ".", ",")?>%)
  728. </td>
  729. </tr>
  730. <?php
  731. }
  732. ?>
  733. </table>
  734. </div>
  735. <div id='drop_rune_quality' class='diagram'>
  736. <h3>
  737. Rune drops by quality
  738. </h3>
  739. <canvas id='diagram_rune_quality' width='200' height='200'></canvas>
  740. <table class='legend'>
  741. <?php
  742. $total = array_sum($page->drop_rune_quality);
  743. // Fix divisions by 0:
  744. if ($total == 0){
  745. $total ++;
  746. }
  747. ?>
  748. <tr class='color_legend'>
  749. <td>
  750. Legend:
  751. </td>
  752. <td>
  753. <?=$page->drop_rune_quality[QUALITY_ID::LEGEND]?>
  754. </td>
  755. <td>
  756. (<?=number_format(($page->drop_rune_quality[QUALITY_ID::LEGEND] * 100) / $total, 2, ".", ",")?>%)
  757. </td>
  758. </tr>
  759. <tr class='color_hero'>
  760. <td>
  761. Hero:
  762. </td>
  763. <td>
  764. <?=$page->drop_rune_quality[QUALITY_ID::HERO]?>
  765. </td>
  766. <td>
  767. (<?=number_format(($page->drop_rune_quality[QUALITY_ID::HERO] * 100) / $total, 2, ".", ",")?>%)
  768. </td>
  769. </tr>
  770. <tr class='color_rare'>
  771. <td>
  772. Rare:
  773. </td>
  774. <td>
  775. <?=$page->drop_rune_quality[QUALITY_ID::RARE]?>
  776. </td>
  777. <td>
  778. (<?=number_format(($page->drop_rune_quality[QUALITY_ID::RARE] * 100) / $total, 2, ".", ",")?>%)
  779. </td>
  780. </tr>
  781. <tr class='color_magic'>
  782. <td>
  783. Magic:
  784. </td>
  785. <td>
  786. <?=$page->drop_rune_quality[QUALITY_ID::MAGIC]?>
  787. </td>
  788. <td>
  789. (<?=number_format(($page->drop_rune_quality[QUALITY_ID::MAGIC] * 100) / $total, 2, ".", ",")?>%)
  790. </td>
  791. </tr>
  792. <tr class='color_normal'>
  793. <td>
  794. Normal:
  795. </td>
  796. <td>
  797. <?=$page->drop_rune_quality[QUALITY_ID::NORMAL]?>
  798. </td>
  799. <td>
  800. (<?=number_format(($page->drop_rune_quality[QUALITY_ID::NORMAL] * 100) / $total, 2, ".", ",")?>%)
  801. </td>
  802. </tr>
  803. </table>
  804. </div>
  805. </article>
  806. </section>
  807. <?php
  808. }
  809. include __DIR__ . "/inc/footer.php";
  810. ?>
  811. </body>
  812. </html>