diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/events/index.js | 7 | ||||
-rw-r--r-- | features/globalSettings/firstLoadPages.js | 70 | ||||
-rw-r--r-- | features/globalSettings/index.js | 6 | ||||
-rw-r--r-- | features/hud/index.js | 52 | ||||
-rw-r--r-- | features/stat_next_to_name/index.js | 33 |
5 files changed, 127 insertions, 41 deletions
diff --git a/features/events/index.js b/features/events/index.js index 62e8ec7..bf955c5 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -56,7 +56,6 @@ class Events extends Feature { this.loadFromParticles = new ToggleSetting("Load burrials from particles", "Will load particles from burrows in the world", true, "burrial_from_partles", this) this.showBurrialGuess = new ToggleSetting("Estimate burrial location from ability", "Will show a line + box where it thinks the burrial is", true, "burrial_guess", this) - new SettingBase("There is also a hotkey to warp near", "see minecraft controls menu", true, "warp_info_hotkey", this) new ButtonSetting("NOTE: You must have music disabled", "for burrial guessess to work (/togglemusic)", "togglemusis_button", this, "toggle", () => { ChatLib.command("togglemusic") }, false).requires(this.showBurrialGuess) @@ -82,12 +81,14 @@ class Events extends Feature { this.dingIndex = 0 this.dingSlope = [] - this.warpBindDefault = new TextSetting("Default keybind", "Eg KEY_F", "CHAR_NONE", "inquis_keybind_default", this, "", false) + new SettingBase("There is also a hotkey to warp near", "see minecraft controls menu", true, "warp_info_hotkey", this) + this.warpBindDefault = new TextSetting("Default warp keybind", "Eg KEY_F", "CHAR_NONE", "inquis_keybind_default", this, "", false) try { this.warpBind = getKeyBindFromKey(Keyboard[this.warpBindDefault.getValue()], "Warp to nearest location to burrial guess"); } catch (e) { ChatLib.chat(this.FeatureManager.messagePrefix + this.warpBindDefault.getValue() + " is an invalid keyboard key, see https://legacy.lwjgl.org/javadoc/org/lwjgl/input/Keyboard.html") + this.warpBind = getKeyBindFromKey("CHAR_NONE", "Warp to nearest location to burrial guess"); } this.slayerLocationDataH = {} @@ -257,7 +258,7 @@ class Events extends Feature { this.todoE.forEach(e => { e = new Entity(e) - if (e.getName().toLowerCase().includes("inquis") && Math.abs(e.getY() - Player.getY()) < 10 && Math.abs(e.getX() - Player.getX()) < 10 && Math.abs(e.getZ() - Player.getZ()) < 10) { + if (e.getName().toLowerCase().includes("inquis") && !e.getName().includes("'") && Math.abs(e.getY() - Player.getY()) < 10 && Math.abs(e.getX() - Player.getX()) < 10 && Math.abs(e.getZ() - Player.getZ()) < 10) { let loc = [e.getX(), e.getY() - 1, e.getZ()] let self = false this.burrialData.locations.forEach(a => { diff --git a/features/globalSettings/firstLoadPages.js b/features/globalSettings/firstLoadPages.js index 50b9eee..19562a0 100644 --- a/features/globalSettings/firstLoadPages.js +++ b/features/globalSettings/firstLoadPages.js @@ -6,21 +6,21 @@ import Notification from "../../../guimanager/Notification"; import FeatureManager from "../../featureClass/featureManager"; import FirstLoadPage from "./firstLoadPage"; -class WelcomePage extends FirstLoadPage{ - constructor(){ +class WelcomePage extends FirstLoadPage { + constructor() { super() - this.addChild(new SoopyTextElement().setText("§0Welcome to SoopyAddons V2!").setLocation(0.1, 0.05,0.8,0.1).setMaxTextScale(10)); + this.addChild(new SoopyTextElement().setText("§0Welcome to SoopyAddons V2!").setLocation(0.1, 0.05, 0.8, 0.1).setMaxTextScale(10)); - this.addChild(new SoopyTextElement().setText("§7First lets get privacy settings out of the way.").setLocation(0.1, 0.15,0.8,0.075).setMaxTextScale(10)); + // this.addChild(new SoopyTextElement().setText("§7First lets get privacy settings out of the way.").setLocation(0.1, 0.15,0.8,0.075).setMaxTextScale(10)); - this.settingsArea = new SoopyGuiElement().setLocation(0.1, 0.25,0.8,0.75); + this.settingsArea = new SoopyGuiElement().setLocation(0.1, 0.25, 0.8, 0.75); this.settingsArea.setScrollable(true) this.addChild(this.settingsArea); } - load(){ + load() { let y = 0 this.guiPage.mainThing.privacySettings.forEach(setting => { @@ -30,25 +30,25 @@ class WelcomePage extends FirstLoadPage{ this.settingsArea.addChild(setting); - y += 0.045+setting.location.size.y.get() + y += 0.045 + setting.location.size.y.get() }) } } -class ApiKeyPage extends FirstLoadPage{ - constructor(){ +class ApiKeyPage extends FirstLoadPage { + constructor() { super() - this.addChild(new SoopyTextElement().setText("§0Next lets setup your api key!").setLocation(0.1, 0.05,0.8,0.1).setMaxTextScale(10)); + this.addChild(new SoopyTextElement().setText("§0Next lets setup your api key!").setLocation(0.1, 0.05, 0.8, 0.1).setMaxTextScale(10)); - this.addChild(new SoopyTextElement().setText("§7You can skip this but some features may not work").setLocation(0.1, 0.15,0.8,0.075).setMaxTextScale(10)); + this.addChild(new SoopyTextElement().setText("§7You can skip this but some features may not work").setLocation(0.1, 0.15, 0.8, 0.075).setMaxTextScale(10)); - this.settingsArea = new SoopyGuiElement().setLocation(0.1, 0.25,0.8,0.75); + this.settingsArea = new SoopyGuiElement().setLocation(0.1, 0.25, 0.8, 0.75); this.settingsArea.setScrollable(true) this.addChild(this.settingsArea); } - load(){ + load() { let y = 0 let settings = [this.guiPage.mainThing.apiKeySetting, this.guiPage.mainThing.verifyApiKey, this.guiPage.mainThing.findApiKey, this.guiPage.mainThing.newApiKey] @@ -59,30 +59,30 @@ class ApiKeyPage extends FirstLoadPage{ this.settingsArea.addChild(setting); - y += 0.045+setting.location.size.y.get() + y += 0.045 + setting.location.size.y.get() }) } } -class HowToOpenMenuPage extends FirstLoadPage{ - constructor(){ +class HowToOpenMenuPage extends FirstLoadPage { + constructor() { super() - this.addChild(new SoopyTextElement().setText("§0Your all set!").setLocation(0.1, 0.1,0.8,0.3).setMaxTextScale(10)); + this.addChild(new SoopyTextElement().setText("§0Your all set!").setLocation(0.1, 0.1, 0.8, 0.3).setMaxTextScale(10)); - this.addChild(new SoopyTextElement().setText("§7To change any settings, or to access this menu again run §2/soopy§7.").setLocation(0.1, 0.3,0.8,0.1).setMaxTextScale(10)); + this.addChild(new SoopyTextElement().setText("§7To change any settings, or to access this menu again run §2/soopy§7.").setLocation(0.1, 0.3, 0.8, 0.1).setMaxTextScale(10)); - let openSettingsButton = new ButtonWithArrow().setText("§0Open settings").setLocation(0.1, 0.5,0.3,0.2).setDirectionRight(false) + let openSettingsButton = new ButtonWithArrow().setText("§0Open settings").setLocation(0.1, 0.5, 0.3, 0.2).setDirectionRight(false) - openSettingsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + openSettingsButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { ChatLib.command("soopyv2", true) })) this.addChild(openSettingsButton); - let closeButton = new ButtonWithArrow().setText("§0Close").setLocation(0.6, 0.5,0.3,0.2) + let closeButton = new ButtonWithArrow().setText("§0Close").setLocation(0.6, 0.5, 0.3, 0.2) - closeButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + closeButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { Client.currentGui.close() })) @@ -91,34 +91,34 @@ class HowToOpenMenuPage extends FirstLoadPage{ } } -class DisableFeatures extends FirstLoadPage{ - constructor(){ +class DisableFeatures extends FirstLoadPage { + constructor() { super() - this.addChild(new SoopyTextElement().setText("§0Lastly do you want to disable all features?").setLocation(0.1, 0.1,0.8,0.3).setMaxTextScale(10)); + this.addChild(new SoopyTextElement().setText("§0Lastly do you want to disable all features?").setLocation(0.1, 0.1, 0.8, 0.3).setMaxTextScale(10)); - this.addChild(new SoopyTextElement().setText("§7(So you can only enable the ones you want)").setLocation(0.1, 0.3,0.8,0.1).setMaxTextScale(10)); + this.addChild(new SoopyTextElement().setText("§7(So you can only enable the ones you want)").setLocation(0.1, 0.3, 0.8, 0.1).setMaxTextScale(10)); - let openSettingsButton = new ButtonWithArrow().setText("§0Disable all features").setLocation(0.35, 0.5,0.3,0.2) + let openSettingsButton = new ButtonWithArrow().setText("§0Disable all features").setLocation(0.35, 0.5, 0.3, 0.2) - openSettingsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ - - new Thread(()=>{ + openSettingsButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { + + new Thread(() => { new Notification("Disabling features...", []) - Object.keys(FeatureManager.featureMetas).forEach((f)=>{ + Object.keys(FeatureManager.featureMetas).forEach((f) => { let meta = FeatureManager.featureMetas[f] let isHidden = meta.isHidden - if(typeof isHidden === "string"){ + if (typeof isHidden === "string") { return } - if(isHidden) return - if(!meta.isTogglable) return + if (isHidden) return + if (!meta.isTogglable) return FeatureManager.featureSettingsData[f].enabled = false FeatureManager.featureSettingsDataLastUpdated = true - if(FeatureManager.isFeatureLoaded(f)){ + if (FeatureManager.isFeatureLoaded(f)) { FeatureManager.unloadFeature(f) } }) diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 8ce9f7e..c215ae8 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -44,18 +44,18 @@ class GlobalSettings extends Feature { this.darkTheme = new ToggleSetting("Dark theme", "This might be scuffed because guis are still made in light theme", false, "dark_theme", this) // this.linkPreview = new ToggleSetting("Link preview", "Shows a preview of where a link will take you", true, "link_preview", 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.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this) this.hideFallingBlocks = new ToggleSetting("Hide falling blocks", "NOTE: this may cause more lag because of render entity event", false, "hide_falling_sand", this) this.twitchCommands = new ToggleSetting("Ingame twitch bot commands", "Allows u to use twitch bot commands ingame (eg -sa)", true, "twitch_commands_ingame", this) - this.privacySettings = [this.reportErrorsSetting] + this.privacySettings = [] this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {} this.GuiPage = new FirstLoadingPage(this) - soopyV2Server.reportErrorsSetting = this.reportErrorsSetting + // soopyV2Server.reportErrorsSetting = this.reportErrorsSetting this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey) const EntityFallingBlock = Java.type("net.minecraft.entity.item.EntityFallingBlock"); diff --git a/features/hud/index.js b/features/hud/index.js index 661509a..bb8d613 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -15,6 +15,9 @@ import { addNotation, numberWithCommas } from "../../utils/numberUtils.js"; const ProcessBuilder = Java.type("java.lang.ProcessBuilder") const Scanner = Java.type("java.util.Scanner") +let OldServerPinger = Java.type("net.minecraft.client.network.OldServerPinger") +let serverPinger = new OldServerPinger() + class Hud extends Feature { constructor() { super() @@ -147,6 +150,15 @@ class Hud extends Feature { this.showLobbyDayOnlyUnder30 = new ToggleSetting("Show Current Lobby Day ONLY WHEN under day 30", "", true, "lobby_day_30", this) this.hudElements.push(this.lobbyDayElement) + this.showPing = new ToggleSetting("Show Current Ping", "(Updates every 30s)", true, "show_ping", this) + this.pingElement = new HudTextElement() + .setText("&6Ping&7> &fLoading...") + .setToggleSetting(this.showPing) + .setLocationSetting(new LocationSetting("Ping Location", "Allows you to edit the location of the ping text", "show_ping_location", this, [10, 100, 1, 1]) + .requires(this.showPing) + .editTempText("&6Ping&7> &c312ms")) + this.hudElements.push(this.pingElement) + let hudStatTypes = { "cata": "Catacombs level + Exp", "totaldeaths": "Total deaths" @@ -258,6 +270,45 @@ class Hud extends Feature { this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue()) this.registerEvent("worldLoad", this.worldLoad) + this.registerStep(false, 30, () => { + if (this.showPing.getValue() && Client.getMinecraft().func_147104_D()) { + let pingNum = Client.getMinecraft().func_147104_D().field_78844_e + + let pingT = "&a" + pingNum + "ms" + if (pingNum > 150) { + pingT = "&e" + pingNum + "ms" + } + if (pingNum > 250) { + pingT = "&c" + pingNum + "ms" + } + + if (pingNum === -1) { + pingT = "Loading..." + } + this.pingElement.setText("&6Ping&7> " + pingT) + + serverPinger[m.ping](Client.getMinecraft().func_147104_D()); + } + }) + this.registerStep(false, 5, () => { + if (this.showPing.getValue() && Client.getMinecraft().func_147104_D()) { + let pingNum = Client.getMinecraft().func_147104_D().field_78844_e + + let pingT = "&a" + pingNum + "ms" + if (pingNum > 150) { + pingT = "&e" + pingNum + "ms" + } + if (pingNum > 250) { + pingT = "&c" + pingNum + "ms" + } + + if (pingNum === -1) { + return; + } + this.pingElement.setText("&6Ping&7> " + pingT) + } + }) + this.petLevels = {} this.petText = "&6Pet&7> &fLoading..." this.petElement.setText(this.petText) @@ -572,6 +623,7 @@ class Hud extends Feature { step_5second() { this.updateHudThingos() + if (!this.soulflowEnabledSetting.getValue()) return if (!Player.getPlayer()) return if (!Player.getInventory()) return diff --git a/features/stat_next_to_name/index.js b/features/stat_next_to_name/index.js index e534aba..46a7c8b 100644 --- a/features/stat_next_to_name/index.js +++ b/features/stat_next_to_name/index.js @@ -5,6 +5,8 @@ import soopyV2Server from "../../socketConnection"; import SettingBase from "../settings/settingThings/settingBase"; import * as numberUtils from "../../utils/numberUtils"; import DropdownSetting from "../settings/settingThings/dropdownSetting"; +import { fetch } from "../../utils/networkUtils" +import ToggleSetting from "../settings/settingThings/toggle"; class StatNextToName extends Feature { constructor() { @@ -39,15 +41,46 @@ class StatNextToName extends Feature { this.loadingStats = [] this.lastWorldLoad = undefined + this.apiKeyThing = new ToggleSetting("Use ur api key for data loading", "Max of 12 requests/min", true, "api_key_stat_load", this) soopyV2Server.onPlayerStatsLoaded = (stats) => { this.playerStatsLoaded.call(this, stats) } + soopyV2Server.apithingo = (uuid, packetId) => { + let key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() + if (!key) return + + fetch(`https://api.hypixel.net/skyblock/profiles?key=${key}&uuid=${uuid}`).text(t => { + soopyV2Server.respondQueue(packetId, t) + }) + } + this.registerStep(false, 5, this.loadPlayerStatsTick) this.registerEvent("worldLoad", this.worldLoad) this.registerEvent("playerJoined", this.playerJoined) this.worldLoad() + + + // respondQueue(id, data) { + // this.sendData({ + // type: "api", + // id, + // data + // }) + // } + + this.registerStep(false, 5, () => { + if (keyValid && this.apiKeyThing.getValue()) soopyV2Server.joinApiQ() + }) + + let keyValid = false + let key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() + fetch("https://api.hypixel.net/key?key=" + key).json(d => { + if (d.success) { + keyValid = true + } + }) } loadPlayerStatsTick() { |