aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/dungeonSolvers/index.js45
-rw-r--r--features/globalSettings/index.js234
-rw-r--r--features/hud/HudTextElement.js56
-rw-r--r--features/soopyGui/GuiPage.js24
4 files changed, 197 insertions, 162 deletions
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index b4f1793..51a9ce4 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -9,9 +9,7 @@ import HudTextElement from "../hud/HudTextElement";
import LocationSetting from "../settings/settingThings/location";
import ToggleSetting from "../settings/settingThings/toggle";
-const EntityArrow = Java.type("net.minecraft.entity.projectile.EntityArrow");
const EntityBlaze = Java.type("net.minecraft.entity.monster.EntityBlaze");
-const AxisAlignedBB = Java.type("net.minecraft.util.AxisAlignedBB");
let translate;
try {
translate = net.minecraft.util.StringTranslate.func_74808_a();
@@ -180,6 +178,9 @@ class DungeonSolvers extends Feature {
});
})
+ this.firstDeath = false
+ this.firstDeathHadSpirit = false
+
this.registerChat("&b&bYou are currently connected to server &6${*}&r", (e) => {
if (this.checkingPing) {
this.lastPings[this.pingI % 3] = Date.now() - this.lastPingCheck;
@@ -210,7 +211,6 @@ class DungeonSolvers extends Feature {
// Information about the dungeon
let deaths = parseInt(this.FeatureManager.features["dataLoader"].class.stats.Deaths.replace("(", "").replace(")", ""));
- let firstDeathHadSpirit = false; //TODO: this
let seconds = 0;
if (this.FeatureManager.features["dataLoader"].class.stats.Time !== "Soon!") {
@@ -243,7 +243,7 @@ class DungeonSolvers extends Feature {
let maxSecrets = currentSecretsFound / currentSecretPercent || 50;
//Actual Score Calculation
- let skillScore = Math.floor(Math.max(20, (20 - (this.totalPuzzleCount - this.completedPuzzleCount) * 10 + (((80 * (clearedRooms + this.bloodOpenedBonus + this.goneInBonus)) / totalRooms) - deaths * 2 + firstDeathHadSpirit))));
+ let skillScore = Math.floor(Math.max(20, (20 - (this.totalPuzzleCount - this.completedPuzzleCount) * 10 + (((80 * (clearedRooms + this.bloodOpenedBonus + this.goneInBonus)) / totalRooms) - deaths * 2 + this.firstDeathHadSpirit))));
let exploreScore = (Math.floor((60 * (clearedRooms + this.bloodOpenedBonus + this.goneInBonus)) / totalRooms) + Math.floor(Math.min(40, (40 * currentSecretsFound) / secretPercentRequired / maxSecrets)));
let speedScore;
if (inDungeonSeconds < 480) {
@@ -263,7 +263,7 @@ class DungeonSolvers extends Feature {
//Calculating secrets for s/s+
- let hypotheticalSkillScore = Math.floor(Math.max(20, (20 - (this.failedPuzzleCount) * 10 + 80 - deaths * 2 + firstDeathHadSpirit)));
+ let hypotheticalSkillScore = Math.floor(Math.max(20, (20 - (this.failedPuzzleCount) * 10 + 80 - deaths * 2 + this.firstDeathHadSpirit)));
let hypotheticalSpeedScore = speedScore
//Calculating for S
@@ -297,12 +297,43 @@ class DungeonSolvers extends Feature {
hypotheticalScoreGottenSPlus += hypotheticalBonusScoreSplus
//Setting hud element
- let sPlusText = currentSecretsFound === 0 ? "??" : (skillScore + exploreScore + speedScore + bonus) >= 300 ? ": ✔" : splusPossible ? `(${hypotheticalScoreGottenSPlus}): ${currentSecretsFound}/${splusNeededSecrets} +${crypts}c/${splusCryptsNeeded}` : "✖"
- let sText = currentSecretsFound === 0 ? " ??" : (skillScore + exploreScore + speedScore + bonus) >= 270 ? " : ✔" : sPossible ? `(${hypotheticalScoreGottenS}): ${currentSecretsFound}/${sNeededSecrets} +${crypts}c/${sCryptsNeeded}` : "✖"
+ let sPlusText = currentSecretsFound === 0 ? "??" : (skillScore + exploreScore + speedScore + bonus) >= 300 ? "✔" : splusPossible ? `(${hypotheticalScoreGottenSPlus}): ${currentSecretsFound}/${splusNeededSecrets} +${crypts}c/${splusCryptsNeeded}` : "✖"
+ let sText = currentSecretsFound === 0 ? " ??" : (skillScore + exploreScore + speedScore + bonus) >= 270 ? " ✔" : sPossible ? ` (${hypotheticalScoreGottenS}): ${currentSecretsFound}/${sNeededSecrets} +${crypts}c/${sCryptsNeeded}` : "✖"
this.scoreElement.setText(`&dScore: ${skillScore + exploreScore + speedScore + bonus}\n&aS+ ${sPlusText}\n&aS ${sText}`);
}
+ scanFirstDeathForSpiritPet(username) {
+ if (this.firstDeath) return
+ this.firstDeath = true
+
+ username = username.split(" ")[0]
+
+ if (this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue()) {
+ fetch(`https://api.hypixel.net/player?key=${this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue()}&name=${username}`).json(data => {
+ if (!data.success) return
+ fetch(`https://api.hypixel.net/skyblock/profiles?key=${this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue()}&uuid=${data.player.uuid}`).json(data2 => {
+ if (!data2.success) return
+
+ let latestProfile = [0, undefined]
+
+ data2.profiles.forEach(p => {
+ if (p.members[data.player.uuid].last_save > latestProfile[0]) {
+ latestProfile = [p.members[data.player.uuid].last_save, p.members[data.player.uuid].pets.find(pet => pet.type === "SPIRIT" && pet.tier === "LEGENDARY")]
+ }
+ })
+
+ if (latestProfile[1]) {
+ this.firstDeathHadSpirit = true
+ ChatLib.chat(this.FeatureManager.messagePrefix + "First death has spirit pet!")
+ } else {
+ ChatLib.chat(this.FeatureManager.messagePrefix + "First death does not have spirit pet!")
+ }
+ })
+ })
+ }
+ }
+
entityJoinWorldEvent(event) {
if (this.bloodCampAssist.getValue()) this.todoE.push(event.entity);
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index 604f887..43b2b4f 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -20,27 +20,27 @@ const JavaString = Java.type("java.lang.String")
class Hud extends Feature {
constructor() {
super()
-
+
this.initVariables()
}
- initVariables(){
+ initVariables() {
this.apiKeySetting = undefined
this.GuiPage = undefined
}
- onEnable(){
+ onEnable() {
this.apiKeySetting = new TextSetting("Api Key", "Your hypixel api key", "", "api_key", this, "Run /api new to load", true)
this.verifyApiKey = new ButtonSetting("Verify api key", "Click this to make sure the api key is working", "verify_key", this, "Click!", this.verifyKey2, undefined)
this.newApiKey = new ButtonSetting("Run /api new", "This is here so u dont need to exit and re-enter", "api_new_command", this, "Click!", this.apiNewCommand, undefined)
- this.findApiKey = new ButtonSetting("Attempt to load api key from other mods", "This will scan other mods configs to attempt to find your key", "find_key", this, "Click!", ()=>{this.findKey()}, undefined)
+ this.findApiKey = new ButtonSetting("Attempt to load api key from other mods", "This will scan other mods configs to attempt to find your key", "find_key", this, "Click!", () => { this.findKey() }, undefined)
// this.notifyNewVersion = new ToggleSetting("Notify when there is a new update", "Will notify you when there is a new version of soopyv2 avalible for download", false, "notify_update", this)
this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this)
-
+
this.privacySettings = [this.reportErrorsSetting]
this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {}
@@ -53,38 +53,38 @@ class Hud extends Feature {
this.ranFirstLoadThing = false
- if(!this.firstLoadPageData.shown){
- new Thread(()=>{
- while(!World.isLoaded() || !this.FeatureManager.finishedLoading){
+ if (!this.firstLoadPageData.shown) {
+ new Thread(() => {
+ while (!World.isLoaded() || !this.FeatureManager.finishedLoading) {
Thread.sleep(100)
}
Thread.sleep(500)
this.showFirstLoadPage.call(this)
}).start()
}
-
- this.registerCommand("soopyweight", (user=Player.getName())=>{
+
+ this.registerCommand("soopyweight", (user = Player.getName()) => {
this.soopyWeight(user)
})
- this.registerCommand("sweight", (user=Player.getName())=>{
+ this.registerCommand("sweight", (user = Player.getName()) => {
this.soopyWeight(user)
})
}
- soopyWeight(user){
+ soopyWeight(user) {
ChatLib.chat(this.FeatureManager.messagePrefix + "Finding senither weight for " + user)
- fetch("http://soopymc.my.to/api/v2/player/"+user).json(userData=>{
- if(!userData.success){
+ fetch("http://soopymc.my.to/api/v2/player/" + user).json(userData => {
+ if (!userData.success) {
ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + userData.error.description)
return
}
- fetch("http://soopymc.my.to/api/v2/player_skyblock/"+userData.data.uuid).json(sbData=>{
-
- if(!sbData.success){
+ fetch("http://soopymc.my.to/api/v2/player_skyblock/" + userData.data.uuid).json(sbData => {
+
+ if (!sbData.success) {
ChatLib.chat(this.FeatureManager.messagePrefix + "&cError loading data: " + sbData.error.description)
return
}
@@ -93,50 +93,50 @@ class Hud extends Feature {
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()
+ .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()
+ .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){
+ .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 (current 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()
+ .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()
+ .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()
+ .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("-"))
@@ -144,8 +144,8 @@ class Hud extends Feature {
})
}
- showFirstLoadPage(){
- if(!this.ranFirstLoadThing && World.isLoaded() && !this.firstLoadPageData.shown){
+ showFirstLoadPage() {
+ if (!this.ranFirstLoadThing && World.isLoaded() && !this.firstLoadPageData.shown) {
ChatLib.chat(this.FeatureManager.messagePrefix + "Opening first load page, if you accidentally close it run /soopyv2 and click the button")
ChatLib.command("soopyv2 first_load_thing", true)
this.ranFirstLoadThing = true
@@ -154,183 +154,183 @@ class Hud extends Feature {
FileLib.write("soopyAddonsData", "soopyv2firstloaddata.json", JSON.stringify(this.firstLoadPageData))
}
}
- verifyKey(key){
+ verifyKey(key) {
// console.log(key)
- if(key){
- try{
+ if (key) {
+ try {
var url = "https://api.hypixel.net/key?key=" + key
let data = fetch(url).json()
// console.log(data)
- if(data.success){
+ if (data.success) {
return true
- }else{
+ } else {
return false
}
- }catch(e){
+ } catch (e) {
return false
}
- }else{
+ } else {
return false
}
}
- findKey(){
+ findKey() {
new Notification("Finding key...", [])
- new Thread(()=>{
+ new Thread(() => {
// NEU
- try{
+ try {
let testKey = JSON.parse(new JavaString(Files.readAllBytes(Paths.get("./config/notenoughupdates/configNew.json")))).apiKey.apiKey
- if(testKey){
- if(this.verifyKey(testKey)){
+ if (testKey) {
+ if (this.verifyKey(testKey)) {
this.apiKeySetting.setValue(testKey)
new Notification("§aSuccess!", ["Found api key in NotEnoughUpdates!"])
return;
- }else{
+ } else {
logger.logMessage("Found invalid key in NotEnoughUpdates", 3)
}
}
- }catch(_){}
+ } catch (_) { }
// SBE
- // try{
+ try {
let testKey = JSON.parse(new JavaString(Files.readAllBytes(Paths.get("./config/SkyblockExtras.cfg")))).values.apiKey
- if(testKey){
- if(this.verifyKey(testKey)){
+ if (testKey) {
+ if (this.verifyKey(testKey)) {
this.apiKeySetting.setValue(testKey)
new Notification("§aSuccess!", ["Found api key in SkyblockExtras!"])
return;
- }else{
+ } else {
logger.logMessage("Found invalid key in SkyblockExtras", 3)
}
}
- // }catch(_){}
+ } catch (_) { }
// SKYTILS
- try{
+ try {
let testKey2 = new JavaString(Files.readAllBytes(Paths.get("./config/skytils/config.toml")))
let testKey = undefined
- testKey2.split("\n").forEach(line=>{
- if(line.startsWith(" hypixel_api_key = \"")){
+ testKey2.split("\n").forEach(line => {
+ if (line.startsWith(" hypixel_api_key = \"")) {
testKey = line.split("\"")[1]
}
})
- if(testKey){
- if(this.verifyKey(testKey)){
+ if (testKey) {
+ if (this.verifyKey(testKey)) {
this.apiKeySetting.setValue(testKey)
new Notification("§aSuccess!", ["Found api key in Skytils!"])
return;
- }else{
+ } else {
logger.logMessage("Found invalid key in Skytils", 3)
}
}
- }catch(_){}
+ } catch (_) { }
// SOOPYADDONS DATA
- try{
+ try {
let testKey = FileLib.read("soopyAddonsData", "apikey.txt")
- if(testKey){
- if(this.verifyKey(testKey)){
+ if (testKey) {
+ if (this.verifyKey(testKey)) {
this.apiKeySetting.setValue(testKey)
new Notification("§aSuccess!", ["Found api key in old soopyaddons version!"])
return;
- }else{
+ } else {
logger.logMessage("Found invalid key in soopyaddonsData", 3)
}
}
- }catch(_){}
+ } catch (_) { }
// HypixelApiKeyManager
- try{
+ try {
let testKey = JSON.parse(FileLib.read("HypixelApiKeyManager", "localdata.json")).key
- if(testKey){
- if(this.verifyKey(testKey)){
+ if (testKey) {
+ if (this.verifyKey(testKey)) {
this.apiKeySetting.setValue(testKey)
new Notification("§aSuccess!", ["Found api key in HypixelApiKeyManager!"])
return;
- }else{
+ } else {
logger.logMessage("Found invalid key in HypixelApiKeyManager", 3)
}
}
- }catch(_){}
+ } catch (_) { }
+
-
new Notification("§cUnable to find api key", [])
}).start()
}
- apiNewCommand(){
+ apiNewCommand() {
ChatLib.command("api new")
}
- verifyKey2(key){
- if(key){
- try{
+ verifyKey2(key) {
+ if (key) {
+ try {
var url = "https://api.hypixel.net/key?key=" + key
let data = fetch(url).json()
- if(data.success){
+ if (data.success) {
return true
- }else{
+ } else {
return false
}
- }catch(e){
+ } catch (e) {
return false
}
}
- if(this.module.apiKeySetting.getValue() == ""){
+ if (this.module.apiKeySetting.getValue() == "") {
new Notification("§cError!", ["You need to set an api key first!"])
return
}
-
- new Thread(()=>{
- try{
+
+ new Thread(() => {
+ try {
var url = "https://api.hypixel.net/key?key=" + this.module.apiKeySetting.getValue()
let data = fetch(url).json()
- if(data.success){
+ if (data.success) {
new Notification("§aSuccess!", ["Your api key is valid!"])
return
- }else{
+ } else {
new Notification("§cError!", ["Your api key is invalid!"])
return
}
- }catch(e){
+ } catch (e) {
new Notification("§cError!", ["Your api key is invalid!"])
return
}
}).start()
}
- newKey(key, event){
+ newKey(key, event) {
ChatLib.chat(this.FeatureManager.messagePrefix + "Copied api key!")
this.apiKeySetting.setValue(key)
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
class FirstLoadingPage extends GuiPage {
- constructor(mainThing){
+ constructor(mainThing) {
super(-10)
this.showBackButton = false
-
+
this.name = "First load thing"
this.mainThing = mainThing
this.pageThings = []
- firstLoadPages.forEach((page, i)=>{
+ firstLoadPages.forEach((page, i) => {
let newPage = this.newPage()
newPage.addChild(page)
- page.setLoc(i!==0, i!== firstLoadPages.length-1)
+ page.setLoc(i !== 0, i !== firstLoadPages.length - 1)
page.guiPage = this
this.pageThings.push(newPage)
@@ -341,22 +341,22 @@ class FirstLoadingPage extends GuiPage {
this.finaliseLoading()
}
- nextPage(){
+ nextPage() {
this.pageNum++
this.goToPage(this.pageNum)
}
- prevPage(){
+ prevPage() {
this.pageNum--
this.goToPage(this.pageNum)
}
- onOpen(){
+ onOpen() {
this.pageNum = 0
- firstLoadPages.forEach((page, i)=>{
+ firstLoadPages.forEach((page, i) => {
page.load()
})
}
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index d2a2c91..8646e45 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -15,7 +15,8 @@ class HudTextElement {
this.tempDisableTime = 0
- this.renderTextCache = [[""], [""]]
+ this.renderTextCache = [""]
+ this.renderBlackTextCache = [""]
this.textChanged = false
}
@@ -36,7 +37,8 @@ class HudTextElement {
this.blackText = "&0" + ChatLib.removeFormatting(text)
}
- this.renderTextCache = [this.text.split("\n"), this.blackText.split("\n")]
+ this.renderTextCache = this.text.split("\n")
+ this.renderBlackTextCache = this.blackText.split("\n")
return this
}
setToggleSetting(setting) {
@@ -67,11 +69,11 @@ class HudTextElement {
getWidth(locationBox = false) {
if (locationBox && this.editBaseWidth) return this.editBaseWidth
- return Math.max(...(this.getText()[0].map(a => Renderer.getStringWidth(ChatLib.removeFormatting(a)))))
+ return Math.max(...(this.getText().map(a => Renderer.getStringWidth(ChatLib.removeFormatting(a)))))
}
getHeight(locationBox = false) {
if (locationBox && this.editBaseHeight) return this.editBaseHeight
- return 9 * this.getText()[0].length
+ return 9 * this.getText().length
}
getText() {
@@ -109,28 +111,30 @@ class HudTextElement {
}
renderRaw() {
- let text = this.getText()
-
- text.forEach((line, i) => {
- Renderer.scale(this.locationSetting.scale, this.locationSetting.scale)
- switch (this.locationSetting.shadowType) {
- case 0:
- Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- case 1:
- Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- case 2:
- let blackText = this.getBlackText()
- Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i)
- Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i)
-
- Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
- break;
- }
- })
+ try {
+ let text = this.getText()
+
+ text.forEach((line, i) => {
+ Renderer.scale(this.locationSetting.scale, this.locationSetting.scale)
+ switch (this.locationSetting.shadowType) {
+ case 0:
+ Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ case 1:
+ Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ case 2:
+ let blackText = this.getBlackText()
+ Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i)
+ Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i)
+
+ Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i)
+ break;
+ }
+ })
+ } catch (e) { }//incase of wrong opengl context
}
}
diff --git a/features/soopyGui/GuiPage.js b/features/soopyGui/GuiPage.js
index 35ce980..f5ac9a5 100644
--- a/features/soopyGui/GuiPage.js
+++ b/features/soopyGui/GuiPage.js
@@ -1,8 +1,8 @@
import SoopyGuiElement from '../../../guimanager/GuiElement/SoopyGuiElement.js';
import categoryManager from './categoryManager.js';
-class GuiPage{
- constructor(priority){
+class GuiPage {
+ constructor(priority) {
this.currentPageId = 0;
this.priority = priority
@@ -14,17 +14,17 @@ class GuiPage{
this.finalisedLoading = false
}
- finaliseLoading(){
+ finaliseLoading() {
categoryManager.addCategory(this);
}
- getSoopyGui(){
+ getSoopyGui() {
return global.soopyv2featuremanagerthing.features["soopyGui"].class
}
- newPage(){
+ newPage() {
this.currentPageId++
- let page = new SoopyGuiElement().setLocation(1*this.currentPageId,0,1,1)
+ let page = new SoopyGuiElement().setLocation(1 * this.currentPageId, 0, 1, 1)
page._soopyAddonsPageId = this.currentPageId
@@ -33,28 +33,28 @@ class GuiPage{
return page
}
- goToPage(page, anim){
+ goToPage(page, anim) {
this.getSoopyGui().goToPageNum(page, anim)
}
- openSidebarPage(child){
+ openSidebarPage(child) {
this.getSoopyGui().openSidebarPage(child)
}
- closeSidebarPage(){
+ closeSidebarPage() {
this.getSoopyGui().closeSidebarPage()
}
- delete(){
+ delete() {
categoryManager.deleteCategory(this)
}
//Override me :D
- onOpen(){
+ onOpen() {
}
//Override me :D
- onOpenPage(page){
+ onOpenPage(page) {
}
}