From 030cbe72bdadea6226f2665cd5c2b2f04e272d9c Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sun, 22 May 2022 16:19:11 +0800 Subject: asd --- features/eventsGUI/index.js | 221 ++++++++++++++++++++++++++++++++++++++++++- features/soopyGui/GuiPage.js | 8 +- features/soopyGui/index.js | 92 +++++++++--------- socketConnection.js | 18 +++- 4 files changed, 286 insertions(+), 53 deletions(-) diff --git a/features/eventsGUI/index.js b/features/eventsGUI/index.js index c828f85..d13d792 100644 --- a/features/eventsGUI/index.js +++ b/features/eventsGUI/index.js @@ -1,7 +1,17 @@ /// /// +import Enum from "../../../guimanager/Enum"; +import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent"; import BoxWithLoading from "../../../guimanager/GuiElement/BoxWithLoading"; +import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; +import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement"; +import SoopyMarkdownElement from "../../../guimanager/GuiElement/SoopyMarkdownElement"; +import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"; +import TextBox from "../../../guimanager/GuiElement/TextBox"; import Feature from "../../featureClass/class"; +import socketConnection from "../../socketConnection"; +import { timeSince } from "../../utils/numberUtils"; +import { firstLetterCapital } from "../../utils/stringUtils"; import GuiPage from "../soopyGui/GuiPage"; class EventsGui extends Feature { @@ -12,10 +22,23 @@ class EventsGui extends Feature { onEnable() { this.initVariables() - // this.GuiPage = new EventsPage() //TODO: SOON(tm) + this.GuiPage = new EventsPage() // this.registerChat("&9&m-----------------------------------------------------&r&9${*}&r&9 ${*} &6Friends (Page ${pagenum} of ${maxpages})${friendslist}&r&9&m-----------------------------------------------------&r", (...args) => { this.GuiPage.friendListMessageEvent.call(this.GuiPage, ...args) }) - // this.registerStep(true, 5, () => { this.GuiPage.regenGuiElements.call(this.GuiPage) }) + this.registerStep(true, 5, () => { this.GuiPage.regenGuiElements.call(this.GuiPage) }) + this.registerStep(false, 60, () => { this.GuiPage.pollData.call(this.GuiPage) }) + } + + eventsDataUpdated(data) { + this.GuiPage.eventsDataUpdated(data) + } + + joinEventResult(data) { + this.GuiPage.joinEventResult(data) + } + + pollEventData(admin) { + this.GuiPage.pollEventData(admin) } initVariables() { @@ -32,17 +55,207 @@ class EventsPage extends GuiPage { constructor() { super(8) - this.name = "Guild Events" + this.name = "Events" this.pages = [this.newPage()] - this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + this.leaderboardElm = undefined + this.memberData = undefined + + this.lastScroll = 1 + + this.leaderboardChildren = [] + + this.code = undefined this.finaliseLoading() } + updateNotInEvent() { + this.pages[0].clearChildren() + + this.pages[0].addChild(new SoopyTextElement().setText("§0You are not currently in any events").setMaxTextScale(3).setLocation(0.2, 0.1, 0.6, 0.2)) + this.pages[0].addChild(new SoopyTextElement().setText("§0If you have a join code enter it here").setMaxTextScale(1).setLocation(0.3, 0.4, 0.4, 0.1)) + let joinBox = new TextBox().setPlaceholder("Code here").setLocation(0.3, 0.5, 0.4, 0.1) + this.pages[0].addChild(joinBox) + + this.pages[0].addChild(new ButtonWithArrow().setLocation(0.35, 0.6, 0.3, 0.1).setText("§0Join Event").addEvent(new SoopyMouseClickEvent().setHandler(() => { + + let code = joinBox.getText() + + this.pages[0].clearChildren() + this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + + socketConnection.pollEventCode(code) + + this.code = code + }))) + } + + updateInEvent(data) { + //MAIN PAGE + + this.pages[0].clearChildren() + + this.pages[0].addChild(new SoopyTextElement().setText("§0You are curently in an event managed by §6" + data.admin).setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.2)) + + if (!data.members[Player.getUUID().toString().replace(/-/g, "")]) { + this.pages[0].addChild(new ButtonWithArrow().setText("Join").setLocation(0.05, 0.2, 0.1, 0.05).addEvent(new SoopyMouseClickEvent().setHandler(() => { + this.pages[0].clearChildren() + this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + + socketConnection.pollEventCode(data.code) + + this.code = data.code + }))) + } + + let leaderboard = new SoopyGuiElement().setLocation(0.1, 0.3, 0.8, 0.7).setScrollable(true) + + this.pages[0].addChild(leaderboard) + + let playerPosition = -1 + + if (this.leaderboardElm) { + let scroll = this.leaderboardElm._scrollAmount + + leaderboard._scrollAmount = scroll + leaderboard.location.scroll.y.set(scroll, 0) + } + + this.leaderboardElm = leaderboard + + Object.values(data.members).sort((a, b) => b.progress - a.progress).forEach((m, i) => { + let isPlayer = m.uuid === Player.getUUID().toString().replace(/-/g, "") + + if (isPlayer) playerPosition = i + 1 + + let nameLine = new SoopyTextElement().setText(`${isPlayer ? "§d" : "§0"}#${i + 1} ${m.username}`).setLocation(0, i * 0.05, 0.5, 0.05).setLore(["Last updated " + timeSince(m.timestamp) + " ago"]) + nameLine.timestamp = m.timestamp + leaderboard.addChild(nameLine) + leaderboard.addChild(new SoopyTextElement().setText(`§0+${Math.floor(m.progress)}`).setLocation(0.5, i * 0.05, 0.5, 0.05)) + }) + + this.leaderboardChildren = [...leaderboard.children] + + this.lastScroll = 1 + + if (playerPosition >= 0) { + this.pages[0].addChild(new SoopyTextElement().setText("§0You are #" + playerPosition + " with +" + Math.floor(data.members[Player.getUUID().toString().replace(/-/g, "")].progress)).setMaxTextScale(2).setLocation(0.2, 0.2, 0.6, 0.1)) + } + + // SIDEBAR + + let sideBarElm = new SoopyGuiElement().setLocation(0, 0, 1, 1).setScrollable(true) + + sideBarElm.addChild(new SoopyTextElement().setText("§0Event Settings").setMaxTextScale(3).setLocation(0.1, 0, 0.8, 0.2)) + + sideBarElm.addChild(new SoopyMarkdownElement().setLocation(0.05, 0.2, 0.9, 1).setText("# Tracking: \n" + data.settings.tracking.map(a => firstLetterCapital(a.replace(/\w+?_/, "").replace(/_/g, " "))).join("\n"))) + + this.openSidebarPage(sideBarElm) + } + + regenGuiElements() { + if (!this.isOpen()) return + + if (this.leaderboardElm) { + let scroll = this.leaderboardElm.location.scroll.y.get() + if (this.lastScroll !== scroll) { + this.lastScroll = scroll + + this.leaderboardElm.children = [] + + let min = this.leaderboardElm.location.getYExact() - 100 + let max = min + 200 + this.leaderboardElm.location.getHeightExact() + let lastChildNotAdded = undefined + this.leaderboardChildren.forEach(c => { + c.setParent(this.leaderboardElm) + c.triggerEvent(Enum.EVENT.RESET_FRAME_CACHES) + + let y = c.location.getYExact() + + if (y > min && y < max) { + this.leaderboardElm.children.push(c) + } else { + lastChildNotAdded = c + } + }) + + if (lastChildNotAdded) { + this.leaderboardElm.children.push(lastChildNotAdded) + } + } + + + this.leaderboardChildren.forEach(c => { + if (c.timestamp) { + c.setLore(["Last updated " + timeSince(c.timestamp) + " ago"]) + } + }) + } + } + + eventsDataUpdated(data) { + if (!data.inEvent) { + this.updateNotInEvent() + return + } + + this.updateInEvent(data) + } + + pollEventData(admin) { + if (!admin) { + this.updateNotInEvent() + this.pages[0].addChild(new SoopyTextElement().setText("§cInvalid code").setMaxTextScale(3).setLocation(0.2, 0.7, 0.6, 0.2)) + return + } + this.pages[0].clearChildren() + this.pages[0].addChild(new SoopyTextElement().setText("§0Join §6" + admin + "§0's event?").setMaxTextScale(3).setLocation(0.2, 0.2, 0.6, 0.2)) + this.pages[0].addChild(new ButtonWithArrow().setText("§0Join").setLocation(0.4, 0.4, 0.4, 0.3).addEvent(new SoopyMouseClickEvent().setHandler(() => { + socketConnection.joinEvent(this.code) + this.pages[0].clearChildren() + this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + }))) + this.pages[0].addChild(new ButtonWithArrow().setText("§0Cancel").setLocation(0.2, 0.4, 0.2, 0.3).setDirectionRight(false).addEvent(new SoopyMouseClickEvent().setHandler(() => { + this.updateNotInEvent() + }))) + } + + joinEventResult(data) { + this.pages[0].clearChildren() + if (data.success) { + this.pages[0].addChild(new SoopyTextElement().setText("§0Joined event!").setMaxTextScale(3).setLocation(0.2, 0.2, 0.6, 0.2)) + this.pages[0].addChild(new ButtonWithArrow().setText("§0Ok").setLocation(0.3, 0.4, 0.4, 0.4).addEvent(new SoopyMouseClickEvent().setHandler(() => { + this.pages[0].clearChildren() + this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + + socketConnection.pollEventData() + }))) + } else { + this.pages[0].addChild(new SoopyTextElement().setText("§0Unable to join event!").setMaxTextScale(3).setLocation(0.2, 0.2, 0.6, 0.1)) + this.pages[0].addChild(new SoopyTextElement().setText("§0" + data.reason).setMaxTextScale(3).setLocation(0.2, 0.3, 0.6, 0.1)) + this.pages[0].addChild(new ButtonWithArrow().setText("§0Ok").setLocation(0.3, 0.4, 0.4, 0.4).addEvent(new SoopyMouseClickEvent().setHandler(() => { + this.pages[0].clearChildren() + this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + + socketConnection.pollEventData() + }))) + } + } + + pollData() { + if (!this.isOpen()) return + + socketConnection.pollEventData() + } + onOpen() { + this.pages[0].clearChildren() + this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) + this.leaderboardElm = undefined + socketConnection.pollEventData() } } diff --git a/features/soopyGui/GuiPage.js b/features/soopyGui/GuiPage.js index f5ac9a5..7a21d26 100644 --- a/features/soopyGui/GuiPage.js +++ b/features/soopyGui/GuiPage.js @@ -19,7 +19,13 @@ class GuiPage { } getSoopyGui() { - return global.soopyv2featuremanagerthing.features["soopyGui"].class + if (global.soopyv2featuremanagerthing.features["soopyGui"]) return global.soopyv2featuremanagerthing.features["soopyGui"].class; + } + + isOpen() { + if (!this.getSoopyGui()?.gui?.ctGui?.isOpen()) return false + + return this.getSoopyGui()?.currCategory === this } newPage() { diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js index 4c8f571..32ac1a7 100644 --- a/features/soopyGui/index.js +++ b/features/soopyGui/index.js @@ -29,7 +29,7 @@ class SoopyGui extends Feature { this.activeCategory = undefined } - onEnable(){ + onEnable() { this.gui = new SoopyGui2() // this.gui.isDebugEnabled = true @@ -39,23 +39,23 @@ class SoopyGui extends Feature { this.mainWindowElement = new SoopyBoxElement().setLocation(0.25, 0.2, 0.5, 0.6) - this.mainWindowElement.addEvent(new SoopyOpenGuiEvent().setHandler(()=>{this.goToPageNum(0, false)})) + this.mainWindowElement.addEvent(new SoopyOpenGuiEvent().setHandler(() => { this.goToPageNum(0, false) })) //############################################################################################### // Category Page //############################################################################################### this.categoryPage = new SoopyGuiElement().setLocation(0, 0, 1, 1) - + let title = new SoopyTextElement().setText("§0SoopyV2!").setMaxTextScale(3).setLocation(0.1, 0.05, 0.5, 0.1) this.categoryPage.addChild(title) let discordButton = new ButtonWithArrow().setText("§0Discord").setLocation(0.7, 0.05, 0.25, 0.1) - discordButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + discordButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { java.awt.Desktop.getDesktop().browse( new java.net.URI("https://discord.gg/dfSMq96RSN") - ); - })) + ); + })) this.categoryPage.addChild(discordButton) this.buttonListElm = new SoopyGuiElement().setLocation(0.1, 0.2, 0.8, 0.8).setScrollable(true) @@ -64,11 +64,11 @@ class SoopyGui extends Feature { //############################################################################################### // Back button for all second pages //############################################################################################### - + this.backButton = new TextWithArrow().setText("§0Back").setLocation(0.01, -0.2, 0.1, 0.1).setDirectionRight(false) - let backButtonEvent = new SoopyMouseClickEvent().setHandler(()=>{this.clickedBackButton()}) + let backButtonEvent = new SoopyMouseClickEvent().setHandler(() => { this.clickedBackButton() }) this.backButton.addEvent(backButtonEvent) - + this.mainWindowElement.addChild(this.categoryPage) this.sidebarPage = new SoopyBoxElement().setLocation(0.3, 0.2, 0.3, 0.6) @@ -76,43 +76,43 @@ class SoopyGui extends Feature { this.gui.element.addChild(this.sidebarPage) this.gui.element.addChild(this.mainWindowElement) - + this.mainWindowElement.addChild(this.backButton) this.updateButtons() } - openCommand(page){ + openCommand(page) { this.gui.open() - if(page){ - this.getPages().forEach(p=>{ - if(p.name.replace(/ /g, "_").toLowerCase() === page.toLowerCase()){ + if (page) { + this.getPages().forEach(p => { + if (p.name.replace(/ /g, "_").toLowerCase() === page.toLowerCase()) { this.clickedOpen(p, false) } }) } } - getPages(){ + getPages() { return categoryManager.arr } - updateButtons(){ - if(!this.buttonListElm) return; + updateButtons() { + if (!this.buttonListElm) return; this.buttonListElm.children = [] - this.getPages().forEach((p, i)=>{ - let settingsButton = new ButtonWithArrow().setText("§0" + p.name).setLocation(0, 0.225*i, 1, 0.2) - settingsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{this.clickedOpen(p)})) + this.getPages().forEach((p, i) => { + let settingsButton = new ButtonWithArrow().setText("§0" + p.name).setLocation(0, 0.225 * i, 1, 0.2) + settingsButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { this.clickedOpen(p) })) this.buttonListElm.addChild(settingsButton) }) } - clickedOpen(category, anim=true){ - if(!this.lastClickedOpen)this.lastClickedOpen = 0 - if(Date.now()-this.lastClickedOpen < 100) return //Stopping infinite loop where button getting reset causes click event to get fired again + clickedOpen(category, anim = true) { + if (!this.lastClickedOpen) this.lastClickedOpen = 0 + if (Date.now() - this.lastClickedOpen < 100) return //Stopping infinite loop where button getting reset causes click event to get fired again this.lastClickedOpen = Date.now() let theParent = this.mainWindowElement.innerObjectPaddingThing || this.mainWindowElement @@ -124,7 +124,7 @@ class SoopyGui extends Feature { this.activePages = category.pages this.currCategory = category - Object.values(this.activePages).forEach(p=>{ + Object.values(this.activePages).forEach(p => { this.mainWindowElement.addChild(p) }) @@ -133,7 +133,7 @@ class SoopyGui extends Feature { this.goToPageNum(1, anim) } - onDisable(){ + onDisable() { this.gui.delete() this.gui = undefined @@ -145,50 +145,50 @@ class SoopyGui extends Feature { this.lastClickedOpen = undefined } - clickedBackButton(){ - this.goToPageNum(this.currentPage-1) + clickedBackButton() { + this.goToPageNum(this.currentPage - 1) } - goToPage(page, animate=true){ + goToPage(page, animate = true) { let pageNum = page._soopyAddonsPageId - - if(pageNum == this.currentPage){ + + if (pageNum == this.currentPage) { return } this.currentPage = pageNum - this.getPages().forEach((p)=>{ - Object.values(p.pages).forEach((e, i)=>{ - e.location.location.x.set(i-pageNum+1, animate?500:0) + this.getPages().forEach((p) => { + Object.values(p.pages).forEach((e, i) => { + e.location.location.x.set(i - pageNum + 1, animate ? 500 : 0) }) }) - this.categoryPage.location.location.x.set(-pageNum, animate?500:0) + this.categoryPage.location.location.x.set(-pageNum, animate ? 500 : 0) - this.backButton.location.location.y.set((pageNum === 0 || !this.currCategory.showBackButton)?-0.2:0, animate?500:0) + this.backButton.location.location.y.set((pageNum === 0 || !this.currCategory.showBackButton) ? -0.2 : 0, animate ? 500 : 0) } - goToPageNum(pageNum, animate=true){ - if(pageNum<0) return; + goToPageNum(pageNum, animate = true) { + if (pageNum < 0) return; this.currentPage = pageNum - if(pageNum===0){ + if (pageNum === 0) { this.currCategory = undefined this.closeSidebarPage() this.updateButtons() } - this.getPages().forEach((p)=>{ - Object.values(p.pages).forEach((e, i)=>{ - e.location.location.x.set(i-pageNum+1, animate?500:0) + this.getPages().forEach((p) => { + Object.values(p.pages).forEach((e, i) => { + e.location.location.x.set(i - pageNum + 1, animate ? 500 : 0) }) }) - this.categoryPage.location.location.x.set(-pageNum, animate?500:0) + this.categoryPage.location.location.x.set(-pageNum, animate ? 500 : 0) - this.backButton.location.location.y.set((pageNum === 0 || !this.currCategory.showBackButton)?-0.2:0, animate?500:0) + this.backButton.location.location.y.set((pageNum === 0 || !this.currCategory.showBackButton) ? -0.2 : 0, animate ? 500 : 0) - if(this.currCategory) this.currCategory.onOpenPage(pageNum) + if (this.currCategory) this.currCategory.onOpenPage(pageNum) } - openSidebarPage(child){ + openSidebarPage(child) { this.sidebarPage.location.location.x.set(0.625, 500) this.mainWindowElement.location.location.x.set(0.075, 500) @@ -197,7 +197,7 @@ class SoopyGui extends Feature { this.sidebarPage.addChild(child) } - closeSidebarPage(){ + closeSidebarPage() { this.sidebarPage.location.location.x.set(0.3, 500) this.mainWindowElement.location.location.x.set(0.25, 500) diff --git a/socketConnection.js b/socketConnection.js index b032d39..7e6bb99 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -20,6 +20,8 @@ class SoopyV2Server extends WebsiteCommunicator { this.userCosmeticPermissions = undefined + this.eventData = undefined + this.cookieCount = 0 this.cookieData = undefined this.cookieDataUpdated = 0 @@ -74,11 +76,16 @@ class SoopyV2Server extends WebsiteCommunicator { this.cookieDataUpdated = Date.now() } if (data.type === "joinEventResult") { - console.log(JSON.stringify(data, undefined, 2)) + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.eventsGUI) global.soopyv2featuremanagerthing.features.eventsGUI.class.joinEventResult(data.response) } if (data.type === "eventData") { - console.log(JSON.stringify(data, undefined, 2)) + this.eventData = data + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.eventsGUI) global.soopyv2featuremanagerthing.features.eventsGUI.class.eventsDataUpdated(data) + } + if (data.type === "pollEvent") { + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.eventsGUI) global.soopyv2featuremanagerthing.features.eventsGUI.class.pollEventData(data.admin) } + } onConnect() { @@ -206,6 +213,13 @@ class SoopyV2Server extends WebsiteCommunicator { type: "eventData" }) } + + pollEventCode(code) { + this.sendData({ + type: "pollEvent", + code + }) + } } if (!global.soopyV2Server) { -- cgit From 53faec014e6c7bd2f38c177ad40a0c89f410c0c6 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sun, 22 May 2022 16:19:21 +0800 Subject: aasd --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 669b79d..5b7b284 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.81", - "versionId": 208, + "version": "2.1.82", + "versionId": 209, "requires": [ "soopyApis", "soopyAddonsData", -- cgit From 4d8f233a98cecbce7090396474bb762370d982da Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sun, 22 May 2022 16:20:51 +0800 Subject: asd --- features/bestiary/metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/bestiary/metadata.json b/features/bestiary/metadata.json index 3ff9383..44dad33 100644 --- a/features/bestiary/metadata.json +++ b/features/bestiary/metadata.json @@ -1,7 +1,7 @@ { "name": "Bestiary", "description": "Bestiary trackers", - "isHidden": false, + "isHidden": true, "isTogglable": true, "defaultEnabled": true, "sortA": 0 -- cgit From 740d3e1d2cf3bcc664438e864b926210896145ee Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Tue, 24 May 2022 15:59:26 +0800 Subject: + gemstone $/h tracker --- features/mining/index.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++- metadata.json | 4 ++-- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/features/mining/index.js b/features/mining/index.js index a05552d..1c1eb5f 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -7,7 +7,8 @@ import * as utils from "../../utils/utils" import HudTextElement from "../hud/HudTextElement"; import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; -import { numberWithCommas } from "../../utils/numberUtils"; +import { numberWithCommas, timeSince } from "../../utils/numberUtils"; +import { fetch } from "../../utils/networkUtils"; class Mining extends Feature { constructor() { @@ -42,6 +43,14 @@ class Mining extends Feature { this.hudElements.push(this.compactHudElement) this.compactProgressHudOnlyWhenMoreThan0 = new ToggleSetting("Only show compact progress when it is above 0", "So that you dont need to disable it when you start doing something else", true, "compact_progress_disable_0", this).requires(this.compactProgressHud) + this.gemstoneMoneyHud = new ToggleSetting("Show $/h made from gemstone mining", "This will add a HUD element with the gemstone $/h", true, "gemstone_money_hud", this) + this.gemstoneMoneyHudElement = new HudTextElement() + .setToggleSetting(this.gemstoneMoneyHud) + .setLocationSetting(new LocationSetting("HUD Location", "Allows you to edit the location of the gemstone $/h", "gemstone_money_location", this, [10, 60, 1, 1]) + .requires(this.gemstoneMoneyHud) + .editTempText("&6$/h&7> &f$12,345,678\n&6$ made&7> &f$123,456,789\n&6Time tracked&7> &f123m")) + this.hudElements.push(this.gemstoneMoneyHudElement) + this.seenBalDamages = [] this.balHP = 250 this.lastBalAlive = 0 @@ -76,6 +85,52 @@ class Mining extends Feature { this.registerChat("&r&c&oThe boss looks weak and tired and retreats into the lava...&r", () => { this.balHP = 0 }) + + let startingTime = -1 + let money = 0 + let gemstoneCosts = {} + let lastMined = 0 + this.registerChat("&r&d&lPRISTINE! &r&fYou found &r${*} &r&aFlawed ${type} Gemstone &r&8x${num}&r&f!&r", (type, num) => { + let id = "FLAWED_" + type.toUpperCase() + "_GEM" + let number = parseInt(num) + + lastMined = Date.now() + + if (!this.gemstoneMoneyHud.getValue()) return + + if (startingTime === 0) return + if (startingTime === -1) { + startingTime = 0 + fetch("https://api.hypixel.net/skyblock/bazaar").json(data => { + startingTime = Date.now() + + Object.keys(data.products).forEach(id => { + if (id.startsWith("FLAWED_")) { + gemstoneCosts[id] = Math.max(240, data.products[id].quick_status.sellPrice) + console.log(id + ": " + gemstoneCosts[id]) + } + }) + }) + return + } + + money += gemstoneCosts[id] * number + + console.log(money) + let moneyPerHour = Math.floor(money / ((Date.now() - startingTime) / (1000 * 60 * 60))) + let moneyMade = Math.floor(money) + let timeTracked = timeSince(startingTime) + + this.gemstoneMoneyHudElement.setText("&6$/h&7> &f$" + numberWithCommas(moneyPerHour) + "\n&6$ made&7> &f$" + numberWithCommas(moneyMade) + "\n&6Time tracked&7> &f" + timeTracked) + }) + this.registerStep(false, 30, () => { + if (lastMined && Date.now() - lastMined > 60000) { + money = 0 + startingTime = -1 + lastMined = 0 + this.gemstoneMoneyHudElement.setText("") + } + }) } itemTooltipEvent(lore, item, event) { diff --git a/metadata.json b/metadata.json index 5b7b284..1978a48 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.82", - "versionId": 209, + "version": "2.1.83", + "versionId": 210, "requires": [ "soopyApis", "soopyAddonsData", -- cgit From e822810c47267b4a8e8d6dc89084a8c3fb0d006a Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Tue, 24 May 2022 19:33:34 +0800 Subject: + CH current event indicator thingo --- features/mining/index.js | 28 ++++++++++++++++++++++++++-- metadata.json | 4 ++-- socketConnection.js | 14 +++++++++++++- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/features/mining/index.js b/features/mining/index.js index 1c1eb5f..d557aed 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -9,6 +9,7 @@ import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; import { numberWithCommas, timeSince } from "../../utils/numberUtils"; import { fetch } from "../../utils/networkUtils"; +import socketConnection from "../../socketConnection"; class Mining extends Feature { constructor() { @@ -51,6 +52,14 @@ class Mining extends Feature { .editTempText("&6$/h&7> &f$12,345,678\n&6$ made&7> &f$123,456,789\n&6Time tracked&7> &f123m")) this.hudElements.push(this.gemstoneMoneyHudElement) + this.nextChEvent = new ToggleSetting("Show the current and next crystal hollows event", "(syncs the data between all users in ch)", true, "chevent_hud", this) + this.nextChEventElement = new HudTextElement() + .setToggleSetting(this.nextChEvent) + .setLocationSetting(new LocationSetting("HUD Location", "Allows you to edit the location of the hud element", "chevent_hud_location", this, [10, 70, 1, 1]) + .requires(this.nextChEvent) + .editTempText("&6Event&7> &fGONE WITH THE WIND &7->&f 2X POWDER")) + this.hudElements.push(this.nextChEventElement) + this.seenBalDamages = [] this.balHP = 250 this.lastBalAlive = 0 @@ -116,7 +125,6 @@ class Mining extends Feature { money += gemstoneCosts[id] * number - console.log(money) let moneyPerHour = Math.floor(money / ((Date.now() - startingTime) / (1000 * 60 * 60))) let moneyMade = Math.floor(money) let timeTracked = timeSince(startingTime) @@ -128,8 +136,24 @@ class Mining extends Feature { money = 0 startingTime = -1 lastMined = 0 - this.gemstoneMoneyHudElement.setText("") + this.gemstoneMoneyHudElement.setText("&6Event&7> &f" + socketConnection.chEvent.join(" &7->&f ")) } + + this.nextChEventElement.setText() + }) + + // 2X POWDER ENDED! + // Passive Active Event + // 2X POWDER STARTED! + //&r&r&r &r&9&lGONE WITH THE WIND ENDED!&r + //§r§r§r §r§b§l2X POWDER ENDED!§r + //§r§r§r §r§b§l2X POWDER STARTED!§r + + this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} ENDED!&r", (spaces, color, event) => { + socketConnection.sendCHEventData(event.trim(), false) + }) + this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} STARTED!&r", (spaces, color, event) => { + socketConnection.sendCHEventData(event.trim(), true) }) } diff --git a/metadata.json b/metadata.json index 1978a48..efba9b7 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.83", - "versionId": 210, + "version": "2.1.84", + "versionId": 211, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/socketConnection.js b/socketConnection.js index 7e6bb99..e8aa796 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -26,6 +26,8 @@ class SoopyV2Server extends WebsiteCommunicator { this.cookieData = undefined this.cookieDataUpdated = 0 + this.chEvent = ["???", "???"] + register("step", () => { if (this.cookieDataUpdated && Date.now() - this.cookieDataUpdated > 60000) { this.cookieData = 0 @@ -85,7 +87,9 @@ class SoopyV2Server extends WebsiteCommunicator { if (data.type === "pollEvent") { if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.eventsGUI) global.soopyv2featuremanagerthing.features.eventsGUI.class.pollEventData(data.admin) } - + if (data.type === "chEvent") { + this.chEvent = data.event + } } onConnect() { @@ -220,6 +224,14 @@ class SoopyV2Server extends WebsiteCommunicator { code }) } + + sendCHEventData(event, started) { + this.sendData({ + type: "chEvent", + event, + started + }) + } } if (!global.soopyV2Server) { -- cgit From 062f87c1acca16a40c8944de27efaac9741b44e6 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Tue, 24 May 2022 19:37:17 +0800 Subject: oops i edited the wrong thing --- features/mining/index.js | 4 ++-- metadata.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/mining/index.js b/features/mining/index.js index d557aed..eb1c434 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -136,10 +136,10 @@ class Mining extends Feature { money = 0 startingTime = -1 lastMined = 0 - this.gemstoneMoneyHudElement.setText("&6Event&7> &f" + socketConnection.chEvent.join(" &7->&f ")) + this.gemstoneMoneyHudElement.setText("") } - this.nextChEventElement.setText() + this.nextChEventElement.setText("&6Event&7> &f" + socketConnection.chEvent.join(" &7->&f ")) }) // 2X POWDER ENDED! diff --git a/metadata.json b/metadata.json index efba9b7..9449f9f 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.84", - "versionId": 211, + "version": "2.1.85", + "versionId": 212, "requires": [ "soopyApis", "soopyAddonsData", -- cgit From 7d40a943f3148979f0572e17d2a4f6a7c49beeb7 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Tue, 24 May 2022 20:13:39 +0800 Subject: + fix showing dwarven mines events on crystal hollows events thingo (oops) --- features/mining/index.js | 22 ++++++++++++++++------ metadata.json | 4 ++-- socketConnection.js | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/features/mining/index.js b/features/mining/index.js index eb1c434..b8eb9c9 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -16,6 +16,11 @@ class Mining extends Feature { super() } + isInCH() { + if (!this.FeatureManager || !this.FeatureManager.features["dataLoader"]) return false + return this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows" + } + onEnable() { this.initVariables() @@ -142,17 +147,22 @@ class Mining extends Feature { this.nextChEventElement.setText("&6Event&7> &f" + socketConnection.chEvent.join(" &7->&f ")) }) - // 2X POWDER ENDED! - // Passive Active Event - // 2X POWDER STARTED! - //&r&r&r &r&9&lGONE WITH THE WIND ENDED!&r - //§r§r§r §r§b§l2X POWDER ENDED!§r - //§r§r§r §r§b§l2X POWDER STARTED!§r + let lastWorldChange = 0 + + this.registerEvent("worldLoad", () => { + lastWorldChange = Date.now() + }) this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} ENDED!&r", (spaces, color, event) => { + if (Date.now() - lastWorldChange < 5000) return + if (!this.isInCH()) return + socketConnection.sendCHEventData(event.trim(), false) }) this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} STARTED!&r", (spaces, color, event) => { + if (Date.now() - lastWorldChange < 5000) return + if (!this.isInCH()) return + socketConnection.sendCHEventData(event.trim(), true) }) } diff --git a/metadata.json b/metadata.json index 9449f9f..7fd48da 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.85", - "versionId": 212, + "version": "2.1.86", + "versionId": 213, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/socketConnection.js b/socketConnection.js index e8aa796..7cea440 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -227,7 +227,7 @@ class SoopyV2Server extends WebsiteCommunicator { sendCHEventData(event, started) { this.sendData({ - type: "chEvent", + type: "chEvent2", event, started }) -- cgit From d24e54df28d92afebcd6d890e579340df84a010b Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 26 May 2022 12:35:28 +0800 Subject: + fix gemstoneMoneyHud for some people + fix scan current pet from pets menu --- features/dungeonMap/index.js | 1 + features/hud/index.js | 2 +- features/mining/index.js | 7 ++++--- metadata.json | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js index bdaaf23..9c28fd9 100644 --- a/features/dungeonMap/index.js +++ b/features/dungeonMap/index.js @@ -95,6 +95,7 @@ class DungeonMap extends Feature { this.bloodOpened = false this.registerChat("&r&cThe &r&c&lBLOOD DOOR&r&c has been opened!&r", () => { this.bloodOpened = true + this.keys-- }) this.registerChat("&r${*}&r&f &r&ehas obtained &r&a&r&${*} Key&r&e!&r", () => { diff --git a/features/hud/index.js b/features/hud/index.js index c6254d4..f375d41 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -458,7 +458,7 @@ class Hud extends Feature { if (Date.now() - this.lastSwappedPet > 1000) { inv[i].getLore().forEach(line => { - if (line.includes("Click to despawn.")) { + if (line.includes("Click to despawn!")) { this.petElement.setText("&6Pet&7> &7" + inv[i].getName().split("(")[0]) this.petText = "&6Pet&7> &7" + inv[i].getName().split("(")[0] } diff --git a/features/mining/index.js b/features/mining/index.js index b8eb9c9..dec8728 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -76,7 +76,7 @@ class Mining extends Feature { this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class - this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue()) + this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue() || this.gemstoneMoneyHud.getValue()) this.registerEvent("tick", this.tick) this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.showContainedGemstoneSlots.getValue() || this.showUnlockedGemstoneSlots.getValue()) this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.guessBalHp.getValue()) @@ -104,7 +104,8 @@ class Mining extends Feature { let money = 0 let gemstoneCosts = {} let lastMined = 0 - this.registerChat("&r&d&lPRISTINE! &r&fYou found &r${*} &r&aFlawed ${type} Gemstone &r&8x${num}&r&f!&r", (type, num) => { + this.registerChat("&r&d&lPRISTINE! &r&fYou found &r${*} &r&aFlawed ${type} Gemstone &r&8x${num}&r&f!&r", (type, num, event) => { + let id = "FLAWED_" + type.toUpperCase() + "_GEM" let number = parseInt(num) @@ -136,7 +137,7 @@ class Mining extends Feature { this.gemstoneMoneyHudElement.setText("&6$/h&7> &f$" + numberWithCommas(moneyPerHour) + "\n&6$ made&7> &f$" + numberWithCommas(moneyMade) + "\n&6Time tracked&7> &f" + timeTracked) }) - this.registerStep(false, 30, () => { + this.registerStep(false, 10, () => { if (lastMined && Date.now() - lastMined > 60000) { money = 0 startingTime = -1 diff --git a/metadata.json b/metadata.json index 7fd48da..b4402c4 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.86", - "versionId": 213, + "version": "2.1.87", + "versionId": 214, "requires": [ "soopyApis", "soopyAddonsData", -- cgit From a0ae59e33748047377b5ae65df675759a10bff18 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 26 May 2022 19:56:02 +0800 Subject: + fix sending boss into to wrong players sometimes + fix next ch event display for some people + change gemstone $/h to show both hours + minuites instead of just minuites / just hours --- features/dataLoader/index.js | 6 +++--- features/mining/index.js | 6 +++--- socketConnection.js | 6 ++++-- utils/numberUtils.js | 42 +++++++++++++++++++++++++----------------- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index f0ede23..b933e31 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -151,11 +151,11 @@ class DataLoader extends Feature { this.area = this.stats["Area"] - if (this.lastServer !== this.FeatureManager.features["dataLoader"].class.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { - this.lastServer = this.FeatureManager.features["dataLoader"].class.stats.Server; + if (this.lastServer !== this.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { + this.lastServer = this.stats.Server; this.lastSentServer = Date.now() - socketConnection.setServer(this.FeatureManager.features["dataLoader"].class.stats.Server); + socketConnection.setServer(this.stats.Server, this.area, this.areaFine); } } diff --git a/features/mining/index.js b/features/mining/index.js index dec8728..9a9a881 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -76,7 +76,7 @@ class Mining extends Feature { this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class - this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue() || this.gemstoneMoneyHud.getValue()) + this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue() || this.gemstoneMoneyHud.getValue() || this.nextChEvent.getValue()) this.registerEvent("tick", this.tick) this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.showContainedGemstoneSlots.getValue() || this.showUnlockedGemstoneSlots.getValue()) this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.guessBalHp.getValue()) @@ -133,12 +133,12 @@ class Mining extends Feature { let moneyPerHour = Math.floor(money / ((Date.now() - startingTime) / (1000 * 60 * 60))) let moneyMade = Math.floor(money) - let timeTracked = timeSince(startingTime) + let timeTracked = timeSince2(startingTime) this.gemstoneMoneyHudElement.setText("&6$/h&7> &f$" + numberWithCommas(moneyPerHour) + "\n&6$ made&7> &f$" + numberWithCommas(moneyMade) + "\n&6Time tracked&7> &f" + timeTracked) }) this.registerStep(false, 10, () => { - if (lastMined && Date.now() - lastMined > 60000) { + if (lastMined && Date.now() - lastMined > 2 * 60000) { money = 0 startingTime = -1 lastMined = 0 diff --git a/socketConnection.js b/socketConnection.js index 7cea440..6479dee 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -189,10 +189,12 @@ class SoopyV2Server extends WebsiteCommunicator { }) } - setServer(server) { + setServer(server, area, areaFine) { this.sendData({ type: "server", - server: server + server, + area, + areaFine }) } diff --git a/utils/numberUtils.js b/utils/numberUtils.js index 96a6b74..82a6805 100644 --- a/utils/numberUtils.js +++ b/utils/numberUtils.js @@ -1,11 +1,11 @@ module.exports = { - numberWithCommas: function(x){ + numberWithCommas: function (x) { if (x === undefined) { return "" } var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); }, - addNotation: function(type, value) { + addNotation: function (type, value) { let returnVal = value; let notList = []; if (type === "shortScale") { @@ -47,14 +47,14 @@ module.exports = { return returnVal; }, - timeSince:function (date) { + timeSince: function (date) { if (typeof date !== 'object') { date = new Date(date); } - - var seconds = Math.floor((new Date()-date) / 1000); + + var seconds = Math.floor((new Date() - date) / 1000); var intervalType; - + var interval = Math.floor(seconds / 31536000); interval = Math.floor(seconds / 86400); if (interval >= 1) { @@ -73,21 +73,29 @@ module.exports = { } } } - + return interval + '' + intervalType; }, - timeNumber: function(time){ - let mins = Math.floor(time/1000/60) - let secs = Math.floor(time/1000)%60 - - if(mins === 0) return secs + "s" + timeSince2: function (date) { + let time = Date.now() - date + + if (time > 30 * 60000) { + return this.timeNumber2(time) + } + return this.timeNumber(time) + }, + timeNumber: function (time) { + let mins = Math.floor(time / 1000 / 60) + let secs = Math.floor(time / 1000) % 60 + + if (mins === 0) return secs + "s" return `${mins}m ${secs}s` }, - timeNumber2: function(time){ - let hours = Math.floor(time/1000/60/60) - let mins = Math.floor(time/1000/60)%60 - - if(hours === 0) return mins + "m" + timeNumber2: function (time) { + let hours = Math.floor(time / 1000 / 60 / 60) + let mins = Math.floor(time / 1000 / 60) % 60 + + if (hours === 0) return mins + "m" return `${hours}h ${mins}m` } } \ No newline at end of file -- cgit From 6dee22fcfe3e1c57045f7b8b07b197dbca121a83 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 26 May 2022 22:21:17 +0800 Subject: + enable links from soopymc.my.to to be shown in patcher image preview --- features/agentlaiThings/hiddenRequirement.js | 8 -- features/agentlaiThings/index.js | 195 --------------------------- features/agentlaiThings/metadata.json | 8 -- features/bestiary/index.js | 8 -- features/globalSettings/index.js | 25 +++- 5 files changed, 23 insertions(+), 221 deletions(-) delete mode 100644 features/agentlaiThings/hiddenRequirement.js delete mode 100644 features/agentlaiThings/index.js delete mode 100644 features/agentlaiThings/metadata.json diff --git a/features/agentlaiThings/hiddenRequirement.js b/features/agentlaiThings/hiddenRequirement.js deleted file mode 100644 index effd23b..0000000 --- a/features/agentlaiThings/hiddenRequirement.js +++ /dev/null @@ -1,8 +0,0 @@ -let allowedUUIDS = [ - "f2bcfe6aa54c4eb9b37156b4f1d20beb", - "dc8c39647b294e03ae9ed13ebd65dd29" -] - -module.exports = {hidden: function(featureManager){ - 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 deleted file mode 100644 index 1654be4..0000000 --- a/features/agentlaiThings/index.js +++ /dev/null @@ -1,195 +0,0 @@ -/// -/// -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(){ - return; - 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", false, "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 deleted file mode 100644 index e44e8fa..0000000 --- a/features/agentlaiThings/metadata.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "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/bestiary/index.js b/features/bestiary/index.js index 3888ffb..de7d679 100644 --- a/features/bestiary/index.js +++ b/features/bestiary/index.js @@ -13,22 +13,14 @@ class Waypoints extends Feature { } onEnable() { - this.initVariables() - this.bestiaryData = JSON.parse(FileLib.read("soopyAddonsData", "bestiaryData.json") || "{}") this.bestiaryChanged = false } - initVariables() { - - } - onDisable() { if (this.bestiaryChanged) { FileLib.write("soopyAddonsData", "bestiaryData.json", JSON.stringify(this.bestiaryData)) } - - this.initVariables() } } diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 39a2714..92132d8 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -73,9 +73,30 @@ class GlobalSettings extends Feature { this.registerEvent("tick", this.fixNEU) } - if (net.minecraftforge.fml.common.Loader.isModLoaded("SoopyV2")) { + // if (net.minecraftforge.fml.common.Loader.isModLoaded("SoopyV2")) { + //TODO: stuff here + // } - } + try { //This enables links from soopymc.my.to to be shown in patcher image preview + let hasHost = false + + for (let host of Java.type("gg.essential.util.TrustedHostsUtil").INSTANCE.getTrustedHosts()) { + if (host.getName() === "soopymc") { + hasHost = true + } + } + + if (!hasHost) { + let TrustedHost = Java.type("gg.essential.api.utils.TrustedHostsUtil").TrustedHost + let TreeSet = Java.type("java.util.TreeSet") + let hosts = new TreeSet() + hosts.add("soopymc.my.to") + + let host = new TrustedHost(124123, "soopymc", hosts) + + Java.type("gg.essential.util.TrustedHostsUtil").INSTANCE.addTrustedHost(host) + } + } catch (e) { } this.registerCommand("soopyweight", (user = Player.getName()) => { this.soopyWeight(user) -- cgit From 0bdf178b8f4b282c2c9eb4147eba1ae2ffb34b5f Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 26 May 2022 22:41:08 +0800 Subject: + fix vanquisher waypoints --- features/nether/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/features/nether/index.js b/features/nether/index.js index 67accbc..52d1041 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -89,8 +89,8 @@ class Nether extends Feature { }) } - vanqData(loc) { - this.spawnedVanqs.push([...loc, Date.now()]) + vanqData(loc, name) { + this.spawnedVanqs.push([loc, name, Date.now()]) } tick() { @@ -212,8 +212,8 @@ class Nether extends Feature { } if (this.vaniquisherWaypoints.getValue()) { - Object.keys(this.spawnedVanqs).forEach(key => { - drawCoolWaypoint(this.spawnedVanqs[key][0], this.spawnedVanqs[key][1], this.spawnedVanqs[key][2], 255, 0, 0, { name: key + "'s vanquisher (" + Math.floor((Date.now() - this.spawnedVanqs[key][2]) / 1000) + "s)" }) + this.spawnedVanqs.forEach(vanq => { + drawCoolWaypoint(vanq[0][0], vanq[0][1], vanq[0][2], 255, 0, 0, { name: vanq[1] + "'s vanquisher (" + Math.floor((Date.now() - vanq[2]) / 1000) + "s)" }) }) } @@ -232,7 +232,7 @@ class Nether extends Feature { step1S() { if (this.blocks) this.blocks = this.blocks.filter(state => Date.now() < state.time) if (this.dojoFireBalls) this.dojoFireBalls = this.dojoFireBalls.filter(e => !e[f.isDead]) - if (this.spawnedVanqs) this.spawnedVanqs = this.spawnedVanqs.filter(a => Date.now() - a[3] < 60000) + if (this.spawnedVanqs) this.spawnedVanqs = this.spawnedVanqs.filter(a => Date.now() - a[2] < 60000) } getBlockIdFromState(state) { -- cgit From 7c372e66ded6b80dbe58f8fc89d1ec14019bc5cb Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Thu, 26 May 2022 23:02:22 +0800 Subject: +update metadata --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index b4402c4..07f2745 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.87", - "versionId": 214, + "version": "2.1.88", + "versionId": 215, "requires": [ "soopyApis", "soopyAddonsData", -- cgit From 83036d85a38729adf8fad5bc9bf38a06c183adf0 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Fri, 27 May 2022 14:10:18 +0800 Subject: + bestiary hud elements (hopefully not scuffed) --- features/bestiary/index.js | 240 +++++++++++++++++++++++++++++++++++++++- features/bestiary/metadata.json | 2 +- features/dataLoader/index.js | 14 +++ features/dungeonMap/index.js | 2 +- features/hud/index.js | 14 --- metadata.json | 4 +- 6 files changed, 252 insertions(+), 24 deletions(-) diff --git a/features/bestiary/index.js b/features/bestiary/index.js index de7d679..00d5752 100644 --- a/features/bestiary/index.js +++ b/features/bestiary/index.js @@ -1,13 +1,25 @@ /// /// -import { m } from "../../../mappings/mappings"; import Feature from "../../featureClass/class"; -import { drawCoolWaypoint } from "../../utils/renderUtils"; +import { numberWithCommas } from "../../utils/numberUtils"; +import HudTextElement from "../hud/HudTextElement"; +import DropdownSetting from "../settings/settingThings/dropdownSetting"; +import LocationSetting from "../settings/settingThings/location"; import SettingBase from "../settings/settingThings/settingBase"; import ToggleSetting from "../settings/settingThings/toggle"; +let dontUseApi = new Set() +dontUseApi.add("arachne") +dontUseApi.add("barbarian_duke_x") +dontUseApi.add("bladesoul") +dontUseApi.add("mage_outlaw") +dontUseApi.add("ashfang") +dontUseApi.add("magma_cube_boss") +dontUseApi.add("headless_horseman") +dontUseApi.add("dragon") -class Waypoints extends Feature { + +class Bestiary extends Feature { constructor() { super() } @@ -15,15 +27,231 @@ class Waypoints extends Feature { onEnable() { this.bestiaryData = JSON.parse(FileLib.read("soopyAddonsData", "bestiaryData.json") || "{}") this.bestiaryChanged = false + + this.bestiaryApiTracking = {} + + this.registerStep(true, 5, this.scanInv) + this.registerStep(false, 5, this.saveData) + + + this.bestiaryStatTypes = { + "barbarian_duke_x": "Ba