From 737fe5a547a65a7615467f5fe50266b5abfa9f1b Mon Sep 17 00:00:00 2001 From: mascal <116852972+mascaldotfr@users.noreply.github.com> Date: Sun, 28 Jan 2024 20:27:43 +0100 Subject: [PATCH] TSTATS: brings code and style fixes --- css/tstats.css | 15 +++++++++------ js/menu.js | 2 +- js/tstats.js | 28 ++++++++++++++++++++-------- tstats.html | 8 +++++--- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/css/tstats.css b/css/tstats.css index 9b02419..4c2dfed 100644 --- a/css/tstats.css +++ b/css/tstats.css @@ -4,7 +4,9 @@ } #ts-side { display: grid; - grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 6fr; + grid-template-rows: auto 1fr; + gap: var(--default_margin_padding); + height: max-content; } #ts-center { display: grid; @@ -18,15 +20,16 @@ text-align: center; background: var(--menu_background); margin-bottom: 0; - padding-top: var(--default_margin_padding); - margin-top: calc(4 * var(--default_margin_padding)); } #ts-center h2 { text-align: center; } -#ts-powergraph-graph svg { +#ts-powergraph { + margin-top: var(--default_margin_padding); +} +#ts-powergraph-graph svg, #ts-powergraph { background: var(--menu_background); - min-height: 400px; + min-height: 300px; } #ts-powergraph-graph .ct-bar { stroke-width: 25px; @@ -38,7 +41,7 @@ margin-bottom: calc(var(--default_margin_padding) * 3); } #ts-maingraph svg { - min-height: 800px; + min-height: 1200px; } .ct-label, .ct-axis { color: var(--foreground); diff --git a/js/menu.js b/js/menu.js index 2741dee..d341494 100644 --- a/js/menu.js +++ b/js/menu.js @@ -53,7 +53,7 @@ let __menu_footer = `
CoRT is a free and open source website, feel free to check out its source code, and report bugs. - Version: 20240128.142739 + Version: 20240128.192743
`; diff --git a/js/tstats.js b/js/tstats.js index 692ef4a..d8c7cbb 100644 --- a/js/tstats.js +++ b/js/tstats.js @@ -61,14 +61,25 @@ async function make_stats() { let clas = setup.shift(); let level = setup.shift(); - // skip empty setups, non lvl 60 - let checksum = 0; - for (let i = 1; i < setup.length / 2; i += 2) - checksum += setup[i].split("").reduce((a,b) => a + b, 0); - if (checksum == 0 || level < 60) + // skip empty setups, non lvl 60, and incomplete ones + if (level < 60) continue; - if (level > 60) - level = 60; // Soul monger crystal case + else + level = 60; // lvl 61 is raptor gem + let checksum = 0; // total power points used + for (let i = 1; i < setup.length; i += 2) { + let values = setup[i].split(""); + let sum = values.reduce((a,b) => parseInt(a) + parseInt(b), 0); + checksum += sum; + } + // see trainer.js + let powerpoints = 32; + if ((class_type_masks[clas] & 0xF0) != 32) + powerpoints = 80; + let ppoints = trainerdatasets[version]["points"]["power"][powerpoints][level - 1]; + if (checksum != ppoints) + continue; + console.log(checksum); let base_skills = class_type_masks[clas] & 0xF0; let class_skills = class_type_masks[clas]; @@ -134,7 +145,8 @@ function draw_maingraph() { }; let options = { horizontalBars: true, - axisY: { offset: 200 } + axisY: { offset: 200 }, + axisX: { onlyInteger: true } }; new Chartist.BarChart("#ts-maingraph", dataset, options); } diff --git a/tstats.html b/tstats.html index d959503..bf3d527 100644 --- a/tstats.html +++ b/tstats.html @@ -38,9 +38,11 @@