diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-01-12 13:21:55 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-01-12 13:21:55 +0800 |
commit | cf83a37b5e6e6ea049dc6aa2fc4a7de8396c429d (patch) | |
tree | ba1267a4a278f001596c52e45a7aca4cab09a17c /features | |
parent | eb7e80e3311e20192f2bb75342224109dc324133 (diff) | |
download | SoopyV2-cf83a37b5e6e6ea049dc6aa2fc4a7de8396c429d.tar.gz SoopyV2-cf83a37b5e6e6ea049dc6aa2fc4a7de8396c429d.tar.bz2 SoopyV2-cf83a37b5e6e6ea049dc6aa2fc4a7de8396c429d.zip |
add /soopyweight
Diffstat (limited to 'features')
-rw-r--r-- | features/globalSettings/index.js | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index a4c0e53..4580809 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -10,6 +10,8 @@ import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"; import Notification from "../../../guimanager/Notification"; import logger from "../../logger"; import soopyV2Server from "../../socketConnection"; +import { numberWithCommas } from "../../utils/numberUtils"; +import { firstLetterCapital } from "../../utils/stringUtils"; const Files = Java.type("java.nio.file.Files") const Paths = Java.type("java.nio.file.Paths") const JavaString = Java.type("java.lang.String") @@ -60,6 +62,88 @@ class Hud extends Feature { this.showFirstLoadPage.call(this) }).start() } + + + this.registerCommand("soopyweight", (user=Player.getName())=>{ + new Thread(()=>{ + this.soopyWeight(user) + }).start() + }) + this.registerCommand("sweight", (user=Player.getName())=>{ + new Thread(()=>{ + this.soopyWeight(user) + }).start() + }) + } + + soopyWeight(user){ + + ChatLib.chat(this.FeatureManager.messagePrefix + " Finding senither weight for " + user) + + let userData = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/v2/player/"+user)) + + if(!userData.success){ + ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + userData.error.description) + return + } + + let sbData = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/v2/player_skyblock/"+userData.data.uuid)) + + if(!sbData.success){ + ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + sbData.error.description) + return + } + + ChatLib.chat("&c" + ChatLib.getChatBreak("-")) + ChatLib.chat(userData.data.stats.nameWithPrefix + "'s senither weight (best profile):") + ChatLib.chat("&aTotal: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.total))) + new Message(new TextComponent("&aSkills: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill.total))) + .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill).map(skill=>{ + if(skill === "total"){ + return null + } + return "&a"+firstLetterCapital(skill)+": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill[skill].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill[skill].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.skill[skill].overflow)) + ")" + }).filter(a=>a).join("\n"))).chat() + new Message(new TextComponent("&aSlayer: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer.total))) + .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer).map(slayer=>{ + if(slayer === "total"){ + return null + } + return "&a"+firstLetterCapital(slayer)+": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer[slayer].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer[slayer].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.slayer[slayer].overflow)) + ")" + }).filter(a=>a).join("\n"))).chat() + new Message(new TextComponent("&aDungeon: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons.total))) + .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons).map(dungeons=>{ + if(dungeons === "total"){ + return null + } + return "&a"+firstLetterCapital(dungeons)+": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons[dungeons].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons[dungeons].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.bestProfileId].members[userData.data.uuid].weight.dungeons[dungeons].overflow)) + ")" + }).filter(a=>a).join("\n"))).chat() + if(sbData.data.stats.bestProfileId !== sbData.data.stats.currentProfileId){ + ChatLib.chat(userData.data.stats.nameWithPrefix + "'s senither weight (best profile):") + ChatLib.chat("&aTotal: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.total))) + new Message(new TextComponent("&aSkills: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill.total))) + .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill).map(skill=>{ + if(skill === "total"){ + return null + } + return "&a"+firstLetterCapital(skill)+": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill[skill].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill[skill].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.skill[skill].overflow)) + ")" + }).filter(a=>a).join("\n"))).chat() + new Message(new TextComponent("&aSlayer: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer.total))) + .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer).map(slayer=>{ + if(slayer === "total"){ + return null + } + return "&a"+firstLetterCapital(slayer)+": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer[slayer].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer[slayer].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.slayer[slayer].overflow)) + ")" + }).filter(a=>a).join("\n"))).chat() + new Message(new TextComponent("&aDungeon: &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons.total))) + .setHover("show_text", Object.keys(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons).map(dungeons=>{ + if(dungeons === "total"){ + return null + } + return "&a"+firstLetterCapital(dungeons)+": &b" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons[dungeons].total)) + " &7(" + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons[dungeons].weight)) + " | " + numberWithCommas(Math.round(sbData.data.profiles[sbData.data.stats.currentProfileId].members[userData.data.uuid].weight.dungeons[dungeons].overflow)) + ")" + }).filter(a=>a).join("\n"))).chat() + } + ChatLib.chat("&c" + ChatLib.getChatBreak("-")) } showFirstLoadPage(){ |