Skip to content

Commit

Permalink
TSTATS: brings code and style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mascaldotfr committed Jan 28, 2024
1 parent 7010f16 commit 737fe5a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
15 changes: 9 additions & 6 deletions css/tstats.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion js/menu.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 20 additions & 8 deletions js/tstats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 5 additions & 3 deletions tstats.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ <h1 id="title">Trainer statistics</h1>
<select id="ts-power">
<option value="Accurate swings">Accurate swings</option>
</select>
<h3 id="ts-powername">Accurate swings</h3>
<div id="ts-powergraph-graph"></div>
<div id="ts-powergraph-x" class="italic center">Skill level (frequency)</div>
<div id="ts-powergraph">
<h3 id="ts-powername">Accurate swings</h3>
<div id="ts-powergraph-graph"></div>
<div id="ts-powergraph-x" class="italic center">Skill level (frequency)</div>
</div>
</div>
<div class="card" id="ts-center">
<h2 id="ts-center-title">Percentual use</h2>
Expand Down

0 comments on commit 737fe5a

Please sign in to comment.