Skip to content

Commit

Permalink
updated gearcheck to 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ranidspace committed Jan 23, 2024
1 parent 612e561 commit 8282d3f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
36 changes: 18 additions & 18 deletions GearCheckData/gearchecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ function submit(){
div.id = "Missing";
document.getElementById("output").appendChild(div);

const ver = (await jfetch("https://raw.githubusercontent.com/Leanny/splat3/ee576ce418b55192b011e034ab53d7c2af3a0207/versions.json")).at(-1)

console.log(`The current splatoon version is `+ ver.substr(0,1)+ '.' +ver.substr(1,1)+ '.' +ver.substr(2,1))
//run the missing gear function
await missinggear(result, 'head', "Head")
await missinggear(result, 'clothing', "Clothes")
await missinggear(result, 'shoes', "Shoes")
await missinggear(result, 'head', "Head", ver)
await missinggear(result, 'clothing', "Clothes", ver)
await missinggear(result, 'shoes', "Shoes", ver)

document.getElementById(`output`).appendChild(document.createElement("hr"));

Expand All @@ -61,9 +63,9 @@ function submit(){
div.id = String(i);
document.getElementById(`output`).appendChild(div);

await starcount(result, "headGear", "GearInfoHead", i);
await starcount(result, "clothingGear", "GearInfoClothes", i);
await starcount(result, "shoesGear", "GearInfoShoes", i);
await starcount(result, "headGear", "GearInfoHead", i, ver);
await starcount(result, "clothingGear", "GearInfoClothes", i, ver);
await starcount(result, "shoesGear", "GearInfoShoes", i, ver);
if (i != 5){
document.getElementById(`output`).appendChild(document.createElement("hr"));
}
Expand All @@ -73,30 +75,28 @@ function submit(){
}

//this function shows the missing gear for
async function missinggear(gearlist, Gear, GearInfo) {
async function missinggear(gearlist, Gear, GearInfo, ver) {
const path = gearlist['gear']['data'][Gear+"Gears"]['nodes'];
const jsonlistunfiltered = await jfetch(`https://raw.githubusercontent.com/Leanny/splat3/main/data/mush/600/GearInfo${GearInfo}.json`);
const jsonlistunfiltered = await jfetch(`https://raw.githubusercontent.com/Leanny/splat3/main/data/mush/${ver}/GearInfo${GearInfo}.json`);
const translate = await jfetch(`https://raw.githubusercontent.com/Leanny/splat3/main/data/language/USen.json`);

let jsonlist = [];
//TODO: improve performace. apparently for loops are faster than filtering. idk, nothing seems to work
jsonlist = jsonlistunfiltered.filter(x =>
!((x.HowToGet === "Impossible" ||
x.__RowId === "Shs_SHT012" ||
x.__RowId === "Shs_SHI011"||
x.__RowId === "Clt_HAP001"||
x.__RowId === "Clt_TES030" ||
x.__RowId === "Clt_TNK003"
x.Season > ver.substring(0,1)||
x.__RowId === "Clt_HAP001"
)));

const difference = jsonlist.filter(entry1 => !path.some(entry2 => entry1.Id === entry2[Gear+"GearId"]));

for (i=0; i < difference.length; i++) {
let div = document.createElement("div");
div.className = "item";
if (difference[i].__RowId.substr(4,3) === "AMB") {
div.classList.add("amiiboitem")
console.log("added")
}
if (difference[i].HowToGet === "Uroko") {
div.classList.add("urokoitem")
}
div.id = String(Gear+String(i))
document.getElementById("Missing").appendChild(div);
Expand All @@ -113,9 +113,9 @@ async function missinggear(gearlist, Gear, GearInfo) {
}
}
//This function shows gear for a certain star count
async function starcount(gearlist, Gear, GearInfo, Stars) {
async function starcount(gearlist, Gear, GearInfo, Stars, ver) {
const path = gearlist.gear.data[Gear+"s"].nodes;
const jsonlist = await jfetch(`https://raw.githubusercontent.com/Leanny/splat3/main/data/mush/600/${GearInfo}.json`);
const jsonlist = await jfetch(`https://raw.githubusercontent.com/Leanny/splat3/main/data/mush/${ver}/${GearInfo}.json`);

for (let i = 0; i < path.length; i++){
if (path[i].rarity === Stars) {
Expand Down Expand Up @@ -150,7 +150,7 @@ async function jfetch(url) {

//all of this is for the darkmode toggle
function changetheme() {
const currentThemeSetting = document.querySelector("html").getAttribute("data-theme");
let currentThemeSetting = document.querySelector("html").getAttribute("data-theme");
const newTheme = currentThemeSetting === "dark" ? "light" : "dark";

localStorage.setItem("theme", newTheme);
Expand Down
8 changes: 5 additions & 3 deletions GearCheckData/gearstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ small {
}
input, button{
font-size: 16px;
margin: 10px 0;
}
hr {
color: var(--color-fg);
Expand Down Expand Up @@ -131,11 +132,12 @@ a:focus {color: var(--color-bg); background-color: var(--color-fg);}
}

/* Amiibo checkbox */
.amiibocheck {
margin: 20px 0;
.gearfilter {
margin: 10px 0;
}

.amiibocheck:checked ~ div > div > div.amiiboitem {
#amiibo:checked ~ div > div > div.amiiboitem,
#uroko:checked ~ div > div > div.urokoitem {
display: none;
}

Expand Down
8 changes: 5 additions & 3 deletions gearcheck.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script src="GearCheckData\gearchecker.js"></script>
</head>
<body onload=loadpage()>
<h1>Splatoon 3 Gear Completion Checker <small>V1.1.3</small></h1> <button
<h1>Splatoon 3 Gear Completion Checker <small>V1.2.0</small></h1> <button
onclick=changetheme()
type="button"
data-theme-toggle
Expand All @@ -29,11 +29,13 @@ <h1>Splatoon 3 Gear Completion Checker <small>V1.1.3</small></h1> <button

<p>Everything is processed locally on your computer and nothing is uploaded, <a href="https://github.com/ranidspace/ranidspace.github.io">read the source code for this whole website here</a></p>

<p>Upload the geardata file and press submit:</p><br />
<p>Upload the geardata file and press submit:</p>

<input type="file" id="geardata" name="file" accept=".json" class="inputbutton" /><br />
<input type="checkbox" class="amiibocheck">
<input type="checkbox" class="gearfilter" id="amiibo">
<label for="amiibo">Exclude Missing Amiibo Gear</label><br />
<input type="checkbox" class="gearfilter" id="uroko">
<label for="uroko">Exclude Missing Grizzco Shop Gear</label><br />
<button onclick=submit()>Start</button>
<div id='output'></div>
</body>
Expand Down

0 comments on commit 8282d3f

Please sign in to comment.