diff options
| author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-10-31 09:49:42 +0800 |
|---|---|---|
| committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-10-31 09:49:42 +0800 |
| commit | 48653ec89538f1650106a5e77463412cad4684c2 (patch) | |
| tree | 09687cd579462e04d539fd4615369fa6dae13902 /features | |
| download | SoopyV2-48653ec89538f1650106a5e77463412cad4684c2.tar.gz SoopyV2-48653ec89538f1650106a5e77463412cad4684c2.tar.bz2 SoopyV2-48653ec89538f1650106a5e77463412cad4684c2.zip | |
first commit
Diffstat (limited to 'features')
47 files changed, 4362 insertions, 0 deletions
diff --git a/features/agentlaiThings/hiddenRequirement.js b/features/agentlaiThings/hiddenRequirement.js new file mode 100644 index 0000000..3c0408d --- /dev/null +++ b/features/agentlaiThings/hiddenRequirement.js @@ -0,0 +1,8 @@ +let allowedUUIDS = [ + "f2bcfe6aa54c4eb9b37156b4f1d20beb", + "dc8c39647b294e03ae9ed13ebd65dd29" +] + +export default ()=>{ + return !allowedUUIDS.includes(Player.getUUID().toString().replace(/-/g, "")) +}
\ No newline at end of file diff --git a/features/agentlaiThings/index.js b/features/agentlaiThings/index.js new file mode 100644 index 0000000..aa3fdc3 --- /dev/null +++ b/features/agentlaiThings/index.js @@ -0,0 +1,194 @@ +/// <reference types="../../../CTAutocomplete" /> +/// <reference lib="es2015" /> +import { SoopyGui, SoopyRenderEvent } from "../../../guimanager"; +import SoopyBoxElement from "../../../guimanager/GuiElement/SoopyBoxElement"; +import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement"; +import renderLibs from "../../../guimanager/renderLibs"; +import Feature from "../../featureClass/class"; +import ToggleSetting from "../settings/settingThings/toggle"; + +class AgentThings extends Feature { + constructor() { + super() + } + + onEnable(){ + this.initVariables() + + this.nearPlayerData = [] + while(this.nearPlayerData.length < 100){this.nearPlayerData.push({})} + + this.recordNearestPlayers = new ToggleSetting("Record nearby players", "You can then view this data with /nearplayers", true, "record_near_players", this) + + this.registerStep(false, 1, this.step) + + this.nearPlayersGui = new SoopyGui().setOpenCommand("nearplayers") + + this.nearPlayersGuiBox = new SoopyBoxElement().setLocation(0.25, 0.25, 0.5, 0.5) + this.nearPlayersGui.element.addChild(this.nearPlayersGuiBox) + + this.nearPlayersRenderElement = new SoopyGuiElement() + this.nearPlayersGuiBox.addChild(this.nearPlayersRenderElement) + + + let selected = undefined + let selectedDist = undefined + let lastXY = 0 + this.nearPlayersRenderElement.addEvent(new SoopyRenderEvent().setHandler((mouseX, mouseY)=>{ + let moved = lastXY !== mouseX+mouseY + lastXY = mouseX+mouseY + + let x = this.nearPlayersRenderElement.location.getXExact() + let y = this.nearPlayersRenderElement.location.getYExact() + let width = this.nearPlayersRenderElement.location.getWidthExact() + let height = this.nearPlayersRenderElement.location.getHeightExact() + + x+=width*0.125 + y+=height*0.125 + width*=0.75 + height*=0.75 + + Renderer.drawLine(Renderer.color(0, 0, 0), x, y+height, x+width, y+height, 2)//bottom axis line + Renderer.drawLine(Renderer.color(0, 0, 0), x, y, x, y+height, 2)//left axis line + + renderLibs.drawStringCentered("&0100s ago", x, y+height+6, Renderer.screen.getWidth()/1000) + renderLibs.drawStringCentered("&050s ago", x+width/2, y+height+6, Renderer.screen.getWidth()/1000) + renderLibs.drawStringCentered("&0Now", x+width, y+height+6, Renderer.screen.getWidth()/1000) //bottom axis markers + + + renderLibs.drawStringCenteredVertically("&025m away", x+3-Renderer.getStringWidth("&025m away")*Renderer.screen.getWidth()/1000, y, Renderer.screen.getWidth()/1000) + renderLibs.drawStringCenteredVertically("&020m away", x+3-Renderer.getStringWidth("&020m away")*Renderer.screen.getWidth()/1000, y+height/5*1, Renderer.screen.getWidth()/1000) + renderLibs.drawStringCenteredVertically("&010m away", x+3-Renderer.getStringWidth("&010m away")*Renderer.screen.getWidth()/1000, y+height/5*3, Renderer.screen.getWidth()/1000) + renderLibs.drawStringCenteredVertically("&00m away", x+3-Renderer.getStringWidth("&00m away")*Renderer.screen.getWidth()/1000, y+height-6, Renderer.screen.getWidth()/1000) + + if(moved){ + selected = undefined + selectedDist = undefined + } + let lastUuids = [] + this.nearPlayerData.forEach((data, i)=>{ + let newLastUuids = [] + Object.keys(data).forEach(uuid=>{ + newLastUuids.push(uuid) + lastUuids = lastUuids.filter(a=>a!==uuid) + + let dist = data[uuid].distance + let oldDist = this.nearPlayerData[i-1]?.[uuid]?.distance || 25 + + let thisX = x+(i)/100*width + let thisY = y+height-(dist/25)*height + + if(moved && (thisX-mouseX)**2 + (thisY-mouseY)**2 < 3){ + selected = uuid + selectedDist = dist + } + + if(i !== 0){ + Renderer.drawLine(Renderer.color(0, 0, 0), x+(i-1)/100*width, y+height-(oldDist/25)*height, thisX, thisY, 1) + } + + Renderer.drawRect(Renderer.color(0, 0, 0), thisX-1, thisY-1, 3, 3) + }) + + lastUuids.forEach(uuid=>{ + let dist = 25 + let oldDist = this.nearPlayerData[i-1]?.[uuid]?.distance || 25 + + let thisX = x+(i)/100*width + let thisY = y+height-(dist/25)*height + + if(i !== 0){ + Renderer.drawLine(Renderer.color(0, 0, 0), x+(i-1)/100*width, y+height-(oldDist/25)*height, thisX, thisY, 1) + } + }) + + lastUuids = newLastUuids + }) + + if(selected){ + width = this.nearPlayersRenderElement.location.getWidthExact() + height = this.nearPlayersRenderElement.location.getHeightExact() + + width*=0.75 + height*=0.75 + + renderLibs.scizzorFast(0,0,Renderer.screen.getWidth(), Renderer.screen.getHeight()) + let selectedIgn = undefined + let lastRenderedSelected = false + this.nearPlayerData.forEach((data, i)=>{ + if(data[selected]){ + lastRenderedSelected = true + + selectedIgn = data[selected].name + + let dist = data[selected].distance + let oldDist = this.nearPlayerData[i-1]?.[selected]?.distance || 25 + + let thisX = x+(i)/100*width + let thisY = y+height-(dist/25)*height + + if(i !== 0){ + Renderer.drawLine(Renderer.color(255, 0, 0), x+(i-1)/100*width, y+height-(oldDist/25)*height, thisX, thisY, 3) + } + }else{ + if(lastRenderedSelected){ + lastRenderedSelected = false + + let dist = 25 + let oldDist = this.nearPlayerData[i-1]?.[selected]?.distance || 25 + + let thisX = x+(i)/100*width + let thisY = y+height-(dist/25)*height + + if(i !== 0){ + Renderer.drawLine(Renderer.color(255, 0, 0), x+(i-1)/100*width, y+height-(oldDist/25)*height, thisX, thisY, 3) + } + } + } + }) + + let width = Math.max(Renderer.getStringWidth(selectedIgn)*2, Renderer.getStringWidth("Distance: " + selectedDist.toFixed(1)))+8 + let height = 32 + renderLibs.drawBox([255, 255, 255], mouseX+10, mouseY-height/2, width,height, 3) + renderLibs.drawString("&0" + selectedIgn, mouseX+14, mouseY-height/2+3, 2) + renderLibs.drawString("&0Distance: &7" + selectedDist.toFixed(1) , mouseX+14, mouseY-height/2+21, 1) + } + + })) + } + + step(){ + if(!this.recordNearestPlayers.getValue()) return + + let thisSecondPlayerData = {} + World.getAllPlayers().forEach(p=>{ + let distSq = (p.getX()-Player.getX())**2+(p.getY()-Player.getY())**2+(p.getZ()-Player.getZ())**2 + + if(distSq < 25*25 && distSq !== 0){ + thisSecondPlayerData[p.getUUID().toString()] = {name: p.getName(), distance: Math.sqrt(distSq)} + } + }) + + this.nearPlayerData.push(thisSecondPlayerData) + + if(this.nearPlayerData.length > 100) this.nearPlayerData.shift() + } + + initVariables(){ + this.recordNearestPlayers = undefined + this.nearPlayerData = undefined + this.nearPlayersGui = undefined + this.nearPlayersGuiBox = undefined + this.nearPlayersRenderElement = undefined + } + + onDisable(){ + this.nearPlayersGui.delete() + + this.initVariables() + } +} + +module.exports = { + class: new AgentThings() +}
\ No newline at end of file diff --git a/features/agentlaiThings/metadata.json b/features/agentlaiThings/metadata.json new file mode 100644 index 0000000..e44e8fa --- /dev/null +++ b/features/agentlaiThings/metadata.json @@ -0,0 +1,8 @@ +{ + "name": "Agentlai Settings", + "description": "Settings only avalible to agentlai", + "isHidden": "hiddenRequirement.js", + "isTogglable": true, + "defaultEnabled": false, + "sortA": 0 +}
\ No newline at end of file diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js new file mode 100644 index 0000000..8600499 --- /dev/null +++ b/features/betterGuis/index.js @@ -0,0 +1,197 @@ +/// <reference types="../../../CTAutocomplete" /> +/// <reference lib="es2015" /> +import Feature from "../../featureClass/class"; +import { drawBoxAtBlockNotVisThruWalls } from "../../utils/renderUtils"; +import ToggleSetting from "../settings/settingThings/toggle"; + +class BetterGuis extends Feature { + constructor() { + super() + } + + onEnable(){ + this.initVariables() + + this.replaceSbMenuClicks = new ToggleSetting("Improve Clicks on SBMENU", "This will change clicks to middle clicks, AND use commands where possible (eg /pets)", true, "sbmenu_clicks", this) + this.reliableSbMenuClicks = {getValue: ()=>false}//removed because hypixel fixed may add back later //new ToggleSetting("Make SBMENU clicks reliable", "This will delay clicks on sbmenu to time them so they dont get canceled", true, "sbmenu_time", this) + + this.lastWindowId = 0 + this.shouldHold = 10 + this.clickSlot = -1 + this.clickSlotTime = 0 + + this.middleClickGuis = [ + "Your SkyBlock Profile", + "Your Skills", + "Farming Skill", + "Mining Skill", + "Heart of the Mountain", + "Combat Skill", + "Foraging Skill", + "Fishing Skill", + "Enchanting Skill", + "Alchemy Skill", + "Carpentry Skill", + "Runecrafting Skill", + "Social Skill", + "Taming Skill", + "Dungeoneering", + "Your Essence", + "Healer Class Perks", + "Mage Class Perks", + "Beserk Class Perks", + "Archer Class Perks", + "Tank Class Perks", + "Recipe Book", + "Trades", + "Quest Log", + "Quest Log (Completed)", + "Fairt Souls Guide", + "Dungeon Journals", + "Calendar and Events", + "Booster Cookie", + "Island Management", + "Toggle Potion Effects", + "Bank", + "Bank Account Upgrades", + "Co-op Bank Account", + "Bank Deposit", + "Bank Withdrawal", + "Personal Bank Account", + "Bazaar Orders", + "Co-op Bazaar Orders" + ] + this.middleClickStartsWith = [ + "Bestiary", + "Private Island", + "Hub", + "Spiders Den", + "Blazing Fortress", + "The End", + "Deep Caverns", + "The Park", + "Spooky Festival", + "Catacombs", + "The Catacombs", + "Settings", + "Bazaar", + "Farming", + "Mining", + "Woods & Fishes", + "Oddities" + ] + this.middleClickEndsWith = [ + "Recipe", + "Recipes", + "Pets", + "Collection", + "Active Effects" + ] + + this.registerEvent("guiMouseClick", this.guiClicked) + this.registerStep(true, 10, this.step) + } + + guiClicked(mouseX, mouseY, button, gui, event){ + if(gui.class.toString()==="class net.minecraft.client.gui.inventory.GuiChest" && button===0 && this.replaceSbMenuClicks.getValue()){ + + let hoveredSlot = gui.getSlotUnderMouse() + if(!hoveredSlot) return + + let hoveredSlotId = hoveredSlot.field_75222_d + // console.log(hoveredSlotId) + if(this.guiSlotClicked(ChatLib.removeFormatting(Player.getOpenedInventory().getName()), hoveredSlotId)){ + cancel(event) + } + } + } + + step(){ + if(this.replaceSbMenuClicks.getValue()){ + if(Player.getOpenedInventory().getName()==="SkyBlock Menu"){ + if(this.lastWindowId === 0){ + this.lastWindowId = Player.getOpenedInventory().getWindowId() + return; + } + if(Player.getOpenedInventory().getWindowId()!==this.lastWindowId){ + this.lastWindowId = Player.getOpenedInventory().getWindowId() + this.shouldHold+= 10 + if(Date.now()-this.clickSlotTime >1000){ + this.clickSlot = -1 + } + if(this.clickSlot && this.clickSlot != -1){ + Player.getOpenedInventory().click(this.clickSlot, false, "MIDDLE") + this.clickSlot = -1 + } + }else{ + this.shouldHold-- + } + }else{ + this.lastWindowId =0 + } + } + } + + guiSlotClicked(inventoryName, slotId){ + switch(inventoryName){ + case "SkyBlock Menu": + switch(slotId){ + case 30: + ChatLib.command("pets") + break + case 25: + ChatLib.command("storage") + break + default: + if(this.shouldHold>0 && this.reliableSbMenuClicks.getValue()){ + this.clickSlot = slotId + this.clickSlotTime = Date.now() + }else{ + Player.getOpenedInventory().click(slotId, false, "MIDDLE") + } + break; + } + return true + break + default: + if(this.middleClickGuis.includes(inventoryName)){ + Player.getOpenedInventory().click(slotId, false, "MIDDLE") + return true + } + for(let thing of this.middleClickStartsWith){ + if(inventoryName.startsWith(thing)){ + Player.getOpenedInventory().click(slotId, false, "MIDDLE") + return true + } + } + for(let thing of this.middleClickEndsWith){ + if(inventoryName.endsWith(thing)){ + Player.getOpenedInventory().click(slotId, false, "MIDDLE") + return true + } + } + return false + break + } + } + + initVariables(){ + this.replaceSbMenuClicks = undefined + this.lastWindowId = undefined + this.shouldHold = undefined + this.clickSlot = undefined + this.clickSlotTime = undefined + this.reliableSbMenuClicks = undefined + this.middleClickGuis = undefined + this.middleClickStartsWith = undefined + this.middleClickEndsWith = undefined + } + + onDisable(){ + this.initVariables() + } +} + +module.exports = { + class: new BetterGuis() +}
\ No newline at end of file diff --git a/features/betterGuis/metadata.json b/features/betterGuis/metadata.json new file mode 100644 index 0000000..6aeed27 --- /dev/null +++ b/features/betterGuis/metadata.json @@ -0,0 +1,8 @@ +{ + "name": "Better guis", + "description": "Edits to a bunch of guis to make them nicer to use", + "isHidden": false, + "isTogglable": true, + "defaultEnabled": true, + "sortA": 1 +}
\ No newline at end of file diff --git a/features/changeLogGUI/index.js b/features/changeLogGUI/index.js new file mode 100644 index 0000000..f6595b0 --- /dev/null +++ b/features/changeLogGUI/index.js @@ -0,0 +1,210 @@ +/// <reference types="../../../CTAutocomplete" /> +/// <reference lib="es2015" /> +import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement"; +import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"; +import Feature from "../../featureClass/class"; +import GuiPage from "../soopyGui/GuiPage"; +import SoopyMarkdownElement from '../../../guimanager/GuiElement/SoopyMarkdownElement.js'; +import metadata from "../../metadata"; +import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; +import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent"; +import ProgressBar from "../../../guimanager/GuiElement/ProgressBar" +import SoopyRenderEvent from "../../../guimanager/EventListener/SoopyRenderEvent" +const File = Java.type("java.io.File") +const URL = Java.type("java.net.URL"); +const PrintStream = Java.type("java.io.PrintStream"); +const Byte = Java.type("java.lang.Byte"); + +class ChangeLogGui extends Feature { + constructor() { + super() + } + + onEnable(){ + this.initVariables() + + this.ChangelogPage = new ChangelogPage() + } + + initVariables(){ + this.ChangelogPage = undefined + } + + onDisable(){ + this.initVariables() + } +} + + +class ChangelogPage extends GuiPage { + constructor(){ + super(9) + + this.name = "Changelog" + + this.pages = [this.newPage()] + + this.changelogData = [] + this.downloadableVersion = 0 + + let changelogTitle = new SoopyTextElement().setText("§0Changelog").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) + this.pages[0].addChild(changelogTitle) + + this.changelogArea = new SoopyGuiElement().setLocation(0.1, 0.2, 0.8, 0.8).setScrollable(true) + this.pages[0].addChild(this.changelogArea) + + //Update confirmation page + this.updatingSidebar =new SoopyGuiElement().setLocation(0,0,1,1) + this.updatingSidebarConfirmPage = new SoopyGuiElement().setLocation(0,0,1,1) + this.updatingSidebar.addChild(this.updatingSidebarConfirmPage) + + this.updateTitle = new SoopyTextElement().setText("§0Update to SoopyAddons ").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) + this.updatingSidebarConfirmPage.addChild(this.updateTitle) + + this.warningMessage = new SoopyMarkdownElement().setLocation(0.1, 0.2, 0.8, 0.8) + this.warningMessage.setText(`# NOTE +Updating SoopyAddons through this method is downloading the code from _§cmy server_ +This means that there is _§cno_ third party that is double checking the code to ensure there is no virus in it. +This is fine if you trust me to not put a virus in it, but if you dont you should instead wait for the update to be checked and verified by the chattriggers people.`) + this.updatingSidebarConfirmPage.addChild(this.warningMessage) + + this.updateButton = new ButtonWithArrow().setText("§0Update").setLocation(0.3, 0.3+this.warningMessage.getHeight(), 0.4, 0.2) + this.updatingSidebarConfirmPage.addChild(this.updateButton) + + this.updatingSidebarConfirmPage.setScrollable(true) + + this.updateButton.addEvent(new SoopyRenderEvent().setHandler(()=>{ + this.updateButton.location.location.y.set(0.3+this.warningMessage.getHeight(),0) + })) + this.updateButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + this.downloadUpdate() + })) + + this.updatingSidebarLoadingPage = new SoopyGuiElement().setLocation(1,0,1,1) + this.updatingSidebar.addChild(this.updatingSidebarLoadingPage) + + let updatingTitle = new SoopyTextElement().setText("§0Updating...").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) + this.updatingSidebarLoadingPage.addChild(updatingTitle) + + this.progressBar = new ProgressBar().setLocation(0.1, 0.2, 0.8, 0.1) + this.updatingSidebarLoadingPage.addChild(this.progressBar) + + this.currVersionId = metadata.versionId + + this.finaliseLoading() + } + + onOpen(){ + new Thread(()=>{ + let data = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/soopyv2/changelog.json")) + + this.changelogData = data.changelog.reverse() + + this.downloadableVersion = data.downloadableVersion + + this.updateText() + }).start() + } + + showConfirmUpdatePage(){ + let version = "" + this.changelogData.forEach(data=>{ + + if(this.downloadableVersion === data.versionId && this.downloadableVersion > this.currVersionId){ + //add button to download this version + version = data.version + } + }) + this.updateTitle.setText("§0Update to SoopyAddons " + version) + + this.updateButton.location.location.y.set(0.3+this.warningMessage.getHeight(),0) + + this.openSidebarPage(this.updatingSidebar) + } + + downloadUpdate(){ + new Thread(()=>{ + this.updatingSidebarConfirmPage.location.location.x.set(-1,500) + this.updatingSidebarLoadingPage.location.location.x.set(0,500) + + new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload").mkdir() + + this.progressBar.setProgress(0.1) + + this.urlToFile("http://soopymc.my.to/api/soopyv2/downloadLatest.zip", "./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons.zip", 10000, 20000) + + this.progressBar.setProgress(0.5) + + FileLib.unzip("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons.zip", "./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/") + + this.progressBar.setProgress(0.75) + + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyV2")) + + this.progressBar.setProgress(0.9) + + new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload/SoopyAddons/SoopyV2").renameTo(new File("./config/ChatTriggers/modules/SoopyV2")) + + FileLib.deleteDirectory(new File("./config/ChatTriggers/modules/SoopyAddonsTempDownload")) + + this.progressBar.setProgress(1) + + Client.currentGui.close() + + ChatLib.command("ct load", true) + }).start() + } + + urlToFile(url, destination, connecttimeout, readtimeout) { + const d = new File(destination); + d.getParentFile().mkdirs(); + const connection = new URL(url).openConnection(); + connection.setDoOutput(true); + connection.setConnectTimeout(connecttimeout); + connection.setReadTimeout(readtimeout); + const IS = connection.getInputStream(); + const FilePS = new PrintStream(destination); + let buf = new Packages.java.lang.reflect.Array.newInstance(Byte.TYPE, 65536); + let len; + while ((len = IS.read(buf)) > 0) { + FilePS.write(buf, 0, len); + } + IS.close(); + FilePS.close(); + } + + updateText(){ + this.changelogArea.children = [] + + let height = 0 + + this.changelogData.forEach(data=>{ + + if(this.downloadableVersion === data.versionId && this. |
