From 41a43e73fecbda2f32aa14e5410d2636862560ed Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 11 Nov 2021 20:29:18 -0800 Subject: [PATCH 01/19] Create calculate.js --- calculate.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 calculate.js diff --git a/calculate.js b/calculate.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/calculate.js @@ -0,0 +1 @@ + From 52c2304b77bf41e459456176e3d5056731c96669 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 11 Nov 2021 20:31:23 -0800 Subject: [PATCH 02/19] Update index.html --- index.html | 229 +---------------------------------------------------- 1 file changed, 1 insertion(+), 228 deletions(-) diff --git a/index.html b/index.html index 23b9770..db628d8 100644 --- a/index.html +++ b/index.html @@ -91,234 +91,7 @@ - +

Bad Skyblock Data Viewer

From 10bbd22927529618213e0e2e2b9525dddab0f453 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 11 Nov 2021 20:31:29 -0800 Subject: [PATCH 03/19] Update calculate.js --- calculate.js | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) diff --git a/calculate.js b/calculate.js index 8b13789..0090ae1 100644 --- a/calculate.js +++ b/calculate.js @@ -1 +1,226 @@ + function getURL() { + if (window.location.search) { + document.getElementById("mainpage").style.display = "none"; + var searches = window.location.search; + var poskey = searches.search("&key="); + if (searches.slice(poskey) != "&key=") { + getUser(searches.slice(5,poskey), searches.slice(poskey+5,)); + } else { + getUser(searches.slice(5,poskey), "8688c07f-e1c2-4f47-ae37-01013664ce6f"); + } + } else { + document.getElementById("statspage").style.display = "none"; + } + } + + async function getUser(username, key) { + let uuidURL = 'https://api.ashcon.app/mojang/v2/user/' + username; + const uuidData = await fetch(uuidURL); + if (uuidData.ok == false) { + console.log("Invalid Minecraft Username."); + return 0; + } + const uuidjson = await uuidData.json(); + let uuid = uuidjson.uuid; + uuid = uuid.replace(/-/g, ''); + + + let keyURL = new URL('https://api.hypixel.net/key'); + keyURL.searchParams.set('key', key); + const keydata = await fetch(keyURL); + if (keydata.status == 403) { + console.log("Invalid API key."); + return 0; + } else if (keydata.status == 429) { + console.log("API key throttle."); + return 0; + } + + let profileURL = new URL('https://api.hypixel.net/skyblock/profiles') + profileURL.searchParams.set('key', key); + profileURL.searchParams.set('uuid', uuid); + const profiledata = await fetch(profileURL); + if (profiledata.status == 400) { + console.log("Missing one or more fields."); + return 0; + } else if (profiledata.status == 403) { + console.log("Invalid API key."); + return 0; + } else if (profiledata.status == 422) { + console.log("Malformed UUID."); + return 0; + } else if (profiledata.status == 429) { + console.log("API key throttle"); + return 0; + } + const profilejson = await profiledata.json(); + if (profilejson.profiles == null) { + return 0; + } + + + let profileamount = profilejson.profiles.length; + let mostrecent = 0; + let recentprofilenum = 0; + let recentprofilename = ""; + for (let i = 0; i < profileamount; i++) { + if (profilejson.profiles[i].members[uuid].last_save > mostrecent) { + mostrecent = profilejson.profiles[i].members[uuid].last_save; + recentprofilenum = i; + recentprofilename = profilejson.profiles[i].cute_name; + } + } + getStats(username, key, uuid, uuidjson, recentprofilenum, profilejson); + } + + function getLevel(skill, profilejson, skillsjson, profilenum, uuid) { + let x = 0 + let SKILL = skill.toUpperCase(); + let experience_skill = "experience_skill_" + skill; + while (x < skillsjson.collections[SKILL].levels.length) { + if (profilejson.profiles[profilenum].members[uuid][experience_skill] < skillsjson.collections[SKILL].levels[x].totalExpRequired) { + break; + } else { + x += 1; + } + } + return x; + } + + function convertNbtToJson(t) { + let data; + try { + const n=Uint8Array.from(atob(t),t=>t.charCodeAt(0)),a=new Zlib.Gunzip(n).decompress(); + nbt.parse(a,function(t,n){if(t)throw t;data=n}) + } catch(t) { + console.log("Invalid input: couldn't parse nbt data"); + } + return data; + } + + async function getStats(username, key, uuid, uuidjson, profilenum, profilejson) { + let skyblockskill = await fetch("https://api.hypixel.net/resources/skyblock/skills"); + let skillsjson = await skyblockskill.json(); + var levels = {"skills":{}, "dungeons":{}}; + var skills = ['farming', 'mining', 'combat', 'foraging', 'fishing', 'enchanting', 'alchemy', 'taming']; + + console.log(profilejson); + + for (let i = 0; i < skills.length; i++) { + levels["skills"][skills[i]] = {}; + let level = getLevel(skills[i], profilejson, skillsjson, profilenum, uuid); + levels["skills"][skills[i]]["level"] = level; + levels["skills"][skills[i]]["xp"] = profilejson.profiles[profilenum].members[uuid]['experience_skill_'+skills[i]] - skillsjson.collections[skills[i].toUpperCase()].levels[level-1].totalExpRequired; + } + console.log(levels); + let nbtinventory = profilejson.profiles[profilenum].members[uuid].inv_contents.data; + let json_inventory = convertNbtToJson(nbtinventory); + console.log(json_inventory); + for (let i=0; i<36; i++) { + if (i < 9) { + let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; + document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseover", command); + document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); + document.getElementsByClassName("inventoryslot")[27+i].innerHTML = draw_slot(json_inventory[i]); + } else { + let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; + document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseover", command); + document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); + document.getElementsByClassName("inventoryslot")[i-9].innerHTML = draw_slot(json_inventory[i]); + } + } + } + + function write_slot(slot) { + if (slot.tag) { + let display = ""; + let line = ""; + let stylecodes = { + "§0": "color: #000000", + "§1": "color: #0000aa", + "§2": "color: #00aa00", + "§3": "color: #00aaaa", + "§4": "color: #aa0000", + "§5": "color: #aa00aa", + "§6": "color: #ffaa00", + "§7": "color: #aaaaaa", + "§8": "color: #555555", + "§9": "color: #5555ff", + "§a": "color: #55ff55", + "§b": "color: #55ffff", + "§c": "color: #ff5555", + "§d": "color: #ff55ff", + "§e": "color: #ffff55", + "§f": "color: #ffffff", + "§l": "font-weight:bold" + } + display = display + format_line(slot.tag.display.Name, stylecodes); + display = display + format_line("", stylecodes); + for (let i = 0; i < slot.tag.display.Lore.length; i++) { + display = display + format_line(slot.tag.display.Lore[i], stylecodes); + } + document.getElementById("itemview").innerHTML = display; + } + } + + function format_line(line, stylecodes) { + let display_line = ""; + let where = line.search("§"); + let style; + let styles = {}; + let close = false; + let lineadd = false; + let y; + while (where != -1) { + y = 1; + styles = {}; + while (stylecodes[line.slice(where+(2*(y-1)), where+(2*y))] != undefined) { + if (!(line.slice(where+(2*(y-1)), where+(2*y)) in styles)) { + let newstyle = line.slice(where+(2*(y-1)), where+(2*y)) + styles[newstyle] = 1; + } + y = y + 1; + } + + if (close == true) { + display_line = display_line + line.slice(0, where) + ""; + } else { + close = true; + } + + let styles_string = ""; + for (const property in styles) { + styles_string = styles_string + stylecodes[`${property}`] + "; "; + } + if (styles_string != "") { + display_line = display_line + "" + } else { + display_line = display_line + "" + } + + line = line.slice(where + (2*(y-1))); + where = line.search("§"); + lineadd = true; + } + if (lineadd == true) { + display_line = display_line + line + ""; + } + display_line = display_line + "\n"; + return display_line; + } + + document.documentElement.addEventListener("mousemove", e => { + document.documentElement.style.setProperty('--mouse-x', e.clientX + "px"); + document.documentElement.style.setProperty('--mouse-y', e.clientY + "px"); + }); + + function draw_slot(slot) { + if (slot.id) { + let text = "
"; + return text; + } else { + return ""; + } + } From f6dd92d6d9f60c0882f8221d7b319074867056b1 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 11 Nov 2021 20:37:20 -0800 Subject: [PATCH 04/19] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index db628d8..0062db1 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ body { font-family: Arial; - background: #8fafaf; + background: #5555ff; margin: 0; } From d3f60f19efde402105947b1ad6e49953deb40c8d Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 11 Nov 2021 20:38:19 -0800 Subject: [PATCH 05/19] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 0062db1..6475e66 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ body { font-family: Arial; - background: #5555ff; + background: #ffaa00; margin: 0; } From be51a669ce108ae55a61d5feb8360465e02b0165 Mon Sep 17 00:00:00 2001 From: Pierre Gouriou Date: Thu, 11 Nov 2021 20:52:02 -0800 Subject: [PATCH 06/19] Reindent calculate.js --- calculate.js | 358 +++++++++++++++++++++++++-------------------------- 1 file changed, 179 insertions(+), 179 deletions(-) diff --git a/calculate.js b/calculate.js index 0090ae1..59b9f6c 100644 --- a/calculate.js +++ b/calculate.js @@ -1,142 +1,142 @@ - function getURL() { - if (window.location.search) { - document.getElementById("mainpage").style.display = "none"; - var searches = window.location.search; - var poskey = searches.search("&key="); - if (searches.slice(poskey) != "&key=") { +function getURL() { + if (window.location.search) { + document.getElementById("mainpage").style.display = "none"; + var searches = window.location.search; + var poskey = searches.search("&key="); + if (searches.slice(poskey) != "&key=") { getUser(searches.slice(5,poskey), searches.slice(poskey+5,)); - } else { - getUser(searches.slice(5,poskey), "8688c07f-e1c2-4f47-ae37-01013664ce6f"); - } } else { - document.getElementById("statspage").style.display = "none"; - } - } - - async function getUser(username, key) { - let uuidURL = 'https://api.ashcon.app/mojang/v2/user/' + username; - const uuidData = await fetch(uuidURL); - if (uuidData.ok == false) { - console.log("Invalid Minecraft Username."); - return 0; - } - const uuidjson = await uuidData.json(); - let uuid = uuidjson.uuid; - uuid = uuid.replace(/-/g, ''); - - - let keyURL = new URL('https://api.hypixel.net/key'); - keyURL.searchParams.set('key', key); - const keydata = await fetch(keyURL); - if (keydata.status == 403) { - console.log("Invalid API key."); - return 0; - } else if (keydata.status == 429) { - console.log("API key throttle."); - return 0; + getUser(searches.slice(5,poskey), "8688c07f-e1c2-4f47-ae37-01013664ce6f"); } + } else { + document.getElementById("statspage").style.display = "none"; + } +} - - let profileURL = new URL('https://api.hypixel.net/skyblock/profiles') - profileURL.searchParams.set('key', key); - profileURL.searchParams.set('uuid', uuid); - const profiledata = await fetch(profileURL); - if (profiledata.status == 400) { - console.log("Missing one or more fields."); - return 0; - } else if (profiledata.status == 403) { - console.log("Invalid API key."); - return 0; - } else if (profiledata.status == 422) { - console.log("Malformed UUID."); - return 0; - } else if (profiledata.status == 429) { - console.log("API key throttle"); - return 0; - } - const profilejson = await profiledata.json(); - if (profilejson.profiles == null) { - return 0; - } - - - let profileamount = profilejson.profiles.length; - let mostrecent = 0; - let recentprofilenum = 0; - let recentprofilename = ""; - for (let i = 0; i < profileamount; i++) { - if (profilejson.profiles[i].members[uuid].last_save > mostrecent) { +async function getUser(username, key) { + let uuidURL = 'https://api.ashcon.app/mojang/v2/user/' + username; + const uuidData = await fetch(uuidURL); + if (uuidData.ok == false) { + console.log("Invalid Minecraft Username."); + return 0; + } + const uuidjson = await uuidData.json(); + let uuid = uuidjson.uuid; + uuid = uuid.replace(/-/g, ''); + + + let keyURL = new URL('https://api.hypixel.net/key'); + keyURL.searchParams.set('key', key); + const keydata = await fetch(keyURL); + if (keydata.status == 403) { + console.log("Invalid API key."); + return 0; + } else if (keydata.status == 429) { + console.log("API key throttle."); + return 0; + } + + + let profileURL = new URL('https://api.hypixel.net/skyblock/profiles') + profileURL.searchParams.set('key', key); + profileURL.searchParams.set('uuid', uuid); + const profiledata = await fetch(profileURL); + if (profiledata.status == 400) { + console.log("Missing one or more fields."); + return 0; + } else if (profiledata.status == 403) { + console.log("Invalid API key."); + return 0; + } else if (profiledata.status == 422) { + console.log("Malformed UUID."); + return 0; + } else if (profiledata.status == 429) { + console.log("API key throttle"); + return 0; + } + const profilejson = await profiledata.json(); + if (profilejson.profiles == null) { + return 0; + } + + + let profileamount = profilejson.profiles.length; + let mostrecent = 0; + let recentprofilenum = 0; + let recentprofilename = ""; + for (let i = 0; i < profileamount; i++) { + if (profilejson.profiles[i].members[uuid].last_save > mostrecent) { mostrecent = profilejson.profiles[i].members[uuid].last_save; recentprofilenum = i; recentprofilename = profilejson.profiles[i].cute_name; - } } - getStats(username, key, uuid, uuidjson, recentprofilenum, profilejson); - } - - function getLevel(skill, profilejson, skillsjson, profilenum, uuid) { - let x = 0 - let SKILL = skill.toUpperCase(); - let experience_skill = "experience_skill_" + skill; - while (x < skillsjson.collections[SKILL].levels.length) { - if (profilejson.profiles[profilenum].members[uuid][experience_skill] < skillsjson.collections[SKILL].levels[x].totalExpRequired) { + } + getStats(username, key, uuid, uuidjson, recentprofilenum, profilejson); +} + +function getLevel(skill, profilejson, skillsjson, profilenum, uuid) { + let x = 0 + let SKILL = skill.toUpperCase(); + let experience_skill = "experience_skill_" + skill; + while (x < skillsjson.collections[SKILL].levels.length) { + if (profilejson.profiles[profilenum].members[uuid][experience_skill] < skillsjson.collections[SKILL].levels[x].totalExpRequired) { break; - } else { + } else { x += 1; - } - } - return x; - } - - function convertNbtToJson(t) { - let data; - try { - const n=Uint8Array.from(atob(t),t=>t.charCodeAt(0)),a=new Zlib.Gunzip(n).decompress(); - nbt.parse(a,function(t,n){if(t)throw t;data=n}) - } catch(t) { - console.log("Invalid input: couldn't parse nbt data"); - } - return data; - } - - async function getStats(username, key, uuid, uuidjson, profilenum, profilejson) { - let skyblockskill = await fetch("https://api.hypixel.net/resources/skyblock/skills"); - let skillsjson = await skyblockskill.json(); - var levels = {"skills":{}, "dungeons":{}}; - var skills = ['farming', 'mining', 'combat', 'foraging', 'fishing', 'enchanting', 'alchemy', 'taming']; - - console.log(profilejson); - - for (let i = 0; i < skills.length; i++) { - levels["skills"][skills[i]] = {}; - let level = getLevel(skills[i], profilejson, skillsjson, profilenum, uuid); - levels["skills"][skills[i]]["level"] = level; - levels["skills"][skills[i]]["xp"] = profilejson.profiles[profilenum].members[uuid]['experience_skill_'+skills[i]] - skillsjson.collections[skills[i].toUpperCase()].levels[level-1].totalExpRequired; } - console.log(levels); - let nbtinventory = profilejson.profiles[profilenum].members[uuid].inv_contents.data; - let json_inventory = convertNbtToJson(nbtinventory); - console.log(json_inventory); - for (let i=0; i<36; i++) { - if (i < 9) { + } + return x; +} + +function convertNbtToJson(t) { + let data; + try { + const n=Uint8Array.from(atob(t),t=>t.charCodeAt(0)),a=new Zlib.Gunzip(n).decompress(); + nbt.parse(a,function(t,n){if(t)throw t;data=n}) + } catch(t) { + console.log("Invalid input: couldn't parse nbt data"); + } + return data; +} + +async function getStats(username, key, uuid, uuidjson, profilenum, profilejson) { + let skyblockskill = await fetch("https://api.hypixel.net/resources/skyblock/skills"); + let skillsjson = await skyblockskill.json(); + var levels = {"skills":{}, "dungeons":{}}; + var skills = ['farming', 'mining', 'combat', 'foraging', 'fishing', 'enchanting', 'alchemy', 'taming']; + + console.log(profilejson); + + for (let i = 0; i < skills.length; i++) { + levels["skills"][skills[i]] = {}; + let level = getLevel(skills[i], profilejson, skillsjson, profilenum, uuid); + levels["skills"][skills[i]]["level"] = level; + levels["skills"][skills[i]]["xp"] = profilejson.profiles[profilenum].members[uuid]['experience_skill_'+skills[i]] - skillsjson.collections[skills[i].toUpperCase()].levels[level-1].totalExpRequired; + } + console.log(levels); + let nbtinventory = profilejson.profiles[profilenum].members[uuid].inv_contents.data; + let json_inventory = convertNbtToJson(nbtinventory); + console.log(json_inventory); + for (let i=0; i<36; i++) { + if (i < 9) { let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseover", command); document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); document.getElementsByClassName("inventoryslot")[27+i].innerHTML = draw_slot(json_inventory[i]); - } else { + } else { let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseover", command); document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); document.getElementsByClassName("inventoryslot")[i-9].innerHTML = draw_slot(json_inventory[i]); - } - } - } - - function write_slot(slot) { - if (slot.tag) { - let display = ""; - let line = ""; - let stylecodes = { + } + } +} + +function write_slot(slot) { + if (slot.tag) { + let display = ""; + let line = ""; + let stylecodes = { "§0": "color: #000000", "§1": "color: #0000aa", "§2": "color: #00aa00", @@ -154,73 +154,73 @@ "§e": "color: #ffff55", "§f": "color: #ffffff", "§l": "font-weight:bold" - } - display = display + format_line(slot.tag.display.Name, stylecodes); - display = display + format_line("", stylecodes); - for (let i = 0; i < slot.tag.display.Lore.length; i++) { + } + display = display + format_line(slot.tag.display.Name, stylecodes); + display = display + format_line("", stylecodes); + for (let i = 0; i < slot.tag.display.Lore.length; i++) { display = display + format_line(slot.tag.display.Lore[i], stylecodes); - } - document.getElementById("itemview").innerHTML = display; } - } - - function format_line(line, stylecodes) { - let display_line = ""; - let where = line.search("§"); - let style; - let styles = {}; - let close = false; - let lineadd = false; - let y; - while (where != -1) { - y = 1; - styles = {}; - while (stylecodes[line.slice(where+(2*(y-1)), where+(2*y))] != undefined) { + document.getElementById("itemview").innerHTML = display; + } +} + +function format_line(line, stylecodes) { + let display_line = ""; + let where = line.search("§"); + let style; + let styles = {}; + let close = false; + let lineadd = false; + let y; + while (where != -1) { + y = 1; + styles = {}; + while (stylecodes[line.slice(where+(2*(y-1)), where+(2*y))] != undefined) { if (!(line.slice(where+(2*(y-1)), where+(2*y)) in styles)) { - let newstyle = line.slice(where+(2*(y-1)), where+(2*y)) - styles[newstyle] = 1; + let newstyle = line.slice(where+(2*(y-1)), where+(2*y)) + styles[newstyle] = 1; } y = y + 1; - } - - if (close == true) { + } + + if (close == true) { display_line = display_line + line.slice(0, where) + ""; - } else { + } else { close = true; - } - - let styles_string = ""; - for (const property in styles) { + } + + let styles_string = ""; + for (const property in styles) { styles_string = styles_string + stylecodes[`${property}`] + "; "; - } - if (styles_string != "") { + } + if (styles_string != "") { display_line = display_line + "" - } else { - display_line = display_line + "" - } - - line = line.slice(where + (2*(y-1))); - where = line.search("§"); - lineadd = true; - } - if (lineadd == true) { - display_line = display_line + line + ""; - } - display_line = display_line + "\n"; - return display_line; - } - - document.documentElement.addEventListener("mousemove", e => { - document.documentElement.style.setProperty('--mouse-x', e.clientX + "px"); - document.documentElement.style.setProperty('--mouse-y', e.clientY + "px"); - }); - - function draw_slot(slot) { - if (slot.id) { - let text = "
"; - return text; } else { - return ""; + display_line = display_line + "" } - } + + line = line.slice(where + (2*(y-1))); + where = line.search("§"); + lineadd = true; + } + if (lineadd == true) { + display_line = display_line + line + ""; + } + display_line = display_line + "
\n"; + return display_line; +} + +document.documentElement.addEventListener("mousemove", e => { + document.documentElement.style.setProperty('--mouse-x', e.clientX + "px"); + document.documentElement.style.setProperty('--mouse-y', e.clientY + "px"); +}); + +function draw_slot(slot) { + if (slot.id) { + let text = "
"; + return text; + } else { + return ""; + } +} From 79f8b10838d1a2162f65a39b7db738e0d8e9160c Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 08:55:34 -0800 Subject: [PATCH 07/19] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 6475e66..db628d8 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ body { font-family: Arial; - background: #ffaa00; + background: #8fafaf; margin: 0; } From 035cb77b429aaf96d034cb92c728efa03628dbc2 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 09:05:35 -0800 Subject: [PATCH 08/19] Update calculate.js --- calculate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/calculate.js b/calculate.js index 59b9f6c..ba442d7 100644 --- a/calculate.js +++ b/calculate.js @@ -9,7 +9,8 @@ function getURL() { getUser(searches.slice(5,poskey), "8688c07f-e1c2-4f47-ae37-01013664ce6f"); } } else { - document.getElementById("statspage").style.display = "none"; + document.getElementById("main").innerHTML = + "

Show Skyblock Stats for:

Your API key:


"; } } From 8dc27cb8424bfe716626b54dfd3cd2519902a118 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 09:06:51 -0800 Subject: [PATCH 09/19] Update calculate.js --- calculate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculate.js b/calculate.js index ba442d7..0aaae5a 100644 --- a/calculate.js +++ b/calculate.js @@ -10,7 +10,7 @@ function getURL() { } } else { document.getElementById("main").innerHTML = - "

Show Skyblock Stats for:

Your API key:


"; + "

Show Skyblock Stats for:

Your API key:


"; } } From c1690ec78c3827ebe8a02382bac98a6d4ab7773b Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 09:07:08 -0800 Subject: [PATCH 10/19] Update index.html --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index db628d8..7c3ba93 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@ .mainpage { margin: 20px; - }https://github.com/The-Shaman/HypixelAPI/blob/test-stuff/index.html + } .statspage { margin: 20px; @@ -97,6 +97,8 @@

Bad Skyblock Data Viewer

+
+

Show Skyblock Stats for:

From afa5e814e1233838e284f4a2e7a8b5bbdd208546 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 09:07:35 -0800 Subject: [PATCH 11/19] Update calculate.js --- calculate.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/calculate.js b/calculate.js index 0aaae5a..0fe482d 100644 --- a/calculate.js +++ b/calculate.js @@ -9,8 +9,7 @@ function getURL() { getUser(searches.slice(5,poskey), "8688c07f-e1c2-4f47-ae37-01013664ce6f"); } } else { - document.getElementById("main").innerHTML = - "

Show Skyblock Stats for:

Your API key:


"; + document.getElementById("main").innerHTML = "

Show Skyblock Stats for:

Your API key:


"; } } From f40c44ec022948bf2d3490a6d06d6ee9309ac7be Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 09:08:50 -0800 Subject: [PATCH 12/19] Update index.html --- index.html | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/index.html b/index.html index 7c3ba93..87c18d6 100644 --- a/index.html +++ b/index.html @@ -97,18 +97,7 @@

Bad Skyblock Data Viewer

-
- -
-
-

Show Skyblock Stats for:

- -

Your API key:

- -
- -
-
+
From 4948bcc200c935c77a4c647eb6f459298c271ed8 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 19:22:33 -0800 Subject: [PATCH 13/19] Update calculate.js --- calculate.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/calculate.js b/calculate.js index 0fe482d..1da7ba7 100644 --- a/calculate.js +++ b/calculate.js @@ -3,23 +3,20 @@ function getURL() { document.getElementById("mainpage").style.display = "none"; var searches = window.location.search; var poskey = searches.search("&key="); - if (searches.slice(poskey) != "&key=") { - getUser(searches.slice(5,poskey), searches.slice(poskey+5,)); - } else { - getUser(searches.slice(5,poskey), "8688c07f-e1c2-4f47-ae37-01013664ce6f"); - } + getUser(searches.slice(5,poskey), searches.slice(poskey+5,)); } else { - document.getElementById("main").innerHTML = "

Show Skyblock Stats for:

Your API key:


"; + document.getElementById("main").innerHTML = "

Show Skyblock Stats for:

Your API key:


"; } } async function getUser(username, key) { let uuidURL = 'https://api.ashcon.app/mojang/v2/user/' + username; const uuidData = await fetch(uuidURL); + if (uuidData.ok == false) { - console.log("Invalid Minecraft Username."); - return 0; - } + console.log("Invalid Minecraft Username."); + return 0; + } const uuidjson = await uuidData.json(); let uuid = uuidjson.uuid; uuid = uuid.replace(/-/g, ''); From bb996311a2a6584ce68fa8e5e92e2b1085f88388 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 19:26:27 -0800 Subject: [PATCH 14/19] Update calculate.js --- calculate.js | 1 - 1 file changed, 1 deletion(-) diff --git a/calculate.js b/calculate.js index 1da7ba7..bce90f3 100644 --- a/calculate.js +++ b/calculate.js @@ -1,6 +1,5 @@ function getURL() { if (window.location.search) { - document.getElementById("mainpage").style.display = "none"; var searches = window.location.search; var poskey = searches.search("&key="); getUser(searches.slice(5,poskey), searches.slice(poskey+5,)); From 492a6563c46ae51b2e29ef451db0c0f73013bbcf Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Fri, 12 Nov 2021 19:27:39 -0800 Subject: [PATCH 15/19] Update calculate.js --- calculate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calculate.js b/calculate.js index bce90f3..bea76b3 100644 --- a/calculate.js +++ b/calculate.js @@ -4,7 +4,7 @@ function getURL() { var poskey = searches.search("&key="); getUser(searches.slice(5,poskey), searches.slice(poskey+5,)); } else { - document.getElementById("main").innerHTML = "

Show Skyblock Stats for:

Your API key:


"; + document.getElementById("main").innerHTML = "

Show Skyblock Stats for:

Your API key:


"; } } From 0eccea00d0aad76f51decaa455112ced8dc9f505 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Sat, 13 Nov 2021 20:49:32 -0800 Subject: [PATCH 16/19] Update calculate.js --- calculate.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/calculate.js b/calculate.js index bea76b3..718d443 100644 --- a/calculate.js +++ b/calculate.js @@ -4,7 +4,7 @@ function getURL() { var poskey = searches.search("&key="); getUser(searches.slice(5,poskey), searches.slice(poskey+5,)); } else { - document.getElementById("main").innerHTML = "

Show Skyblock Stats for:

Your API key:


"; + create_form(); } } @@ -220,3 +220,7 @@ function draw_slot(slot) { return ""; } } + +function create_form() { + document.getElementById("main").innerHTML = "

Show Skyblock Stats for:

Your API key:


"; +} From 6e3081b4a7815ff53911c9aa4f8dad8421849b95 Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 6 Jan 2022 00:03:08 -0800 Subject: [PATCH 17/19] Update calculate.js --- calculate.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/calculate.js b/calculate.js index 718d443..e281487 100644 --- a/calculate.js +++ b/calculate.js @@ -113,6 +113,7 @@ async function getStats(username, key, uuid, uuidjson, profilenum, profilejson) let nbtinventory = profilejson.profiles[profilenum].members[uuid].inv_contents.data; let json_inventory = convertNbtToJson(nbtinventory); console.log(json_inventory); + document.getElementById('main').innerHTML = '
'; for (let i=0; i<36; i++) { if (i < 9) { let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; @@ -124,7 +125,11 @@ async function getStats(username, key, uuid, uuidjson, profilenum, profilejson) document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseover", command); document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); document.getElementsByClassName("inventoryslot")[i-9].innerHTML = draw_slot(json_inventory[i]); - } + } + document.getElementById('inventoryview').innerHTML = document.getElementById('inventoryview').innerHTML + '
'; + if (i == 26) { + document.getElementById('inventoryview').innerHTML = document.getElementById('inventoryview').innerHTML + '
'; + } } } From c17d3d246d4f23583da0bef4b2dc9e0baffd8cbd Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 6 Jan 2022 00:03:10 -0800 Subject: [PATCH 18/19] Update index.html --- index.html | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/index.html b/index.html index 87c18d6..af24172 100644 --- a/index.html +++ b/index.html @@ -99,47 +99,5 @@

Bad Skyblock Data Viewer

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 75c0c39d19a3eb89a55d6252b8555f95cee8e6fa Mon Sep 17 00:00:00 2001 From: TheTrueShaman <68354378+The-Shaman@users.noreply.github.com> Date: Thu, 6 Jan 2022 00:08:27 -0800 Subject: [PATCH 19/19] Update calculate.js --- calculate.js | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/calculate.js b/calculate.js index e281487..87ee6c7 100644 --- a/calculate.js +++ b/calculate.js @@ -103,34 +103,36 @@ async function getStats(username, key, uuid, uuidjson, profilenum, profilejson) console.log(profilejson); - for (let i = 0; i < skills.length; i++) { - levels["skills"][skills[i]] = {}; - let level = getLevel(skills[i], profilejson, skillsjson, profilenum, uuid); - levels["skills"][skills[i]]["level"] = level; - levels["skills"][skills[i]]["xp"] = profilejson.profiles[profilenum].members[uuid]['experience_skill_'+skills[i]] - skillsjson.collections[skills[i].toUpperCase()].levels[level-1].totalExpRequired; - } - console.log(levels); - let nbtinventory = profilejson.profiles[profilenum].members[uuid].inv_contents.data; - let json_inventory = convertNbtToJson(nbtinventory); - console.log(json_inventory); + for (let i = 0; i < skills.length; i++) { + levels["skills"][skills[i]] = {}; + let level = getLevel(skills[i], profilejson, skillsjson, profilenum, uuid); + levels["skills"][skills[i]]["level"] = level; + levels["skills"][skills[i]]["xp"] = profilejson.profiles[profilenum].members[uuid]['experience_skill_'+skills[i]] - skillsjson.collections[skills[i].toUpperCase()].levels[level-1].totalExpRequired; + } + console.log(levels); + let nbtinventory = profilejson.profiles[profilenum].members[uuid].inv_contents.data; + let json_inventory = convertNbtToJson(nbtinventory); + console.log(json_inventory); document.getElementById('main').innerHTML = '
'; - for (let i=0; i<36; i++) { - if (i < 9) { - let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; - document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseover", command); - document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); - document.getElementsByClassName("inventoryslot")[27+i].innerHTML = draw_slot(json_inventory[i]); - } else { - let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; - document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseover", command); - document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); - document.getElementsByClassName("inventoryslot")[i-9].innerHTML = draw_slot(json_inventory[i]); - } + for (let i=0; i<36; i++) { document.getElementById('inventoryview').innerHTML = document.getElementById('inventoryview').innerHTML + '
'; if (i == 26) { document.getElementById('inventoryview').innerHTML = document.getElementById('inventoryview').innerHTML + '
'; } - } + } + for (let i=0; i<36; i++) { + if (i < 9) { + let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; + document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseover", command); + document.getElementsByClassName("inventoryslot")[27+i].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); + document.getElementsByClassName("inventoryslot")[27+i].innerHTML = draw_slot(json_inventory[i]); + } else { + let command = "write_slot(" + JSON.stringify(json_inventory[i]) + ")"; + document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseover", command); + document.getElementsByClassName("inventoryslot")[i-9].setAttribute("onmouseout", "document.getElementById('itemview').innerHTML = '';"); + document.getElementsByClassName("inventoryslot")[i-9].innerHTML = draw_slot(json_inventory[i]); + } + } } function write_slot(slot) {