diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/eventsGUI/index.js | 29 | ||||
-rw-r--r-- | features/friendsGUI/index.js | 10 | ||||
-rw-r--r-- | features/globalSettings/index.js | 20 | ||||
-rw-r--r-- | features/networthGUI/index.js | 4 | ||||
-rw-r--r-- | features/settings/index.js | 10 | ||||
-rw-r--r-- | features/settings/settingThings/imageLocation.js | 204 | ||||
-rw-r--r-- | features/settings/settingThings/location.js | 2 | ||||
-rw-r--r-- | features/settings/settingThings/settingBase.js | 6 | ||||
-rw-r--r-- | features/settings/settingThings/toggle.js | 2 | ||||
-rw-r--r-- | features/soopyGui/index.js | 8 | ||||
-rw-r--r-- | features/streamsGUI/index.js | 6 | ||||
-rw-r--r-- | features/suggestionsGui/index.js | 2 |
12 files changed, 161 insertions, 142 deletions
diff --git a/features/eventsGUI/index.js b/features/eventsGUI/index.js index d13d792..af7a4f2 100644 --- a/features/eventsGUI/index.js +++ b/features/eventsGUI/index.js @@ -10,8 +10,8 @@ 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 { numberWithCommas, timeSince } from "../../utils/numberUtils"; +import { firstLetterCapital, firstLetterWordCapital } from "../../utils/stringUtils"; import GuiPage from "../soopyGui/GuiPage"; class EventsGui extends Feature { @@ -100,7 +100,7 @@ class EventsPage extends GuiPage { 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].addChild(new ButtonWithArrow().setText("§0Join").setLocation(0.2, 0.2, 0.6, 0.1).addEvent(new SoopyMouseClickEvent().setHandler(() => { this.pages[0].clearChildren() this.pages[0].addChild(new BoxWithLoading().setLocation(0.3, 0.3, 0.4, 0.4)) @@ -130,10 +130,27 @@ class EventsPage extends GuiPage { 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"]) + 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", "Currently: " + (m.online ? "§aOnline" : "§cOffline")]) nameLine.timestamp = m.timestamp + nameLine.online = m.online leaderboard.addChild(nameLine) - leaderboard.addChild(new SoopyTextElement().setText(`§0+${Math.floor(m.progress)}`).setLocation(0.5, i * 0.05, 0.5, 0.05)) + + let lore = [ + `TOTAL: §e${numberWithCommas(Math.floor(m.progress))}`, + ` ` + ] + Object.keys(m.current.weights).map(w => { + let progress = m.current.weights[w] - m.starting.weights[w] + + return [w, progress] + }).sort((a, b) => b[1] - a[1]).forEach((l, i) => { + if (i > 10) return + + lore.push(firstLetterWordCapital(l[0].replace(/_/g, " ").replace(/^.+? /, "")) + ": §e" + numberWithCommas(Math.floor(l[1]))) + }) + + + leaderboard.addChild(new SoopyTextElement().setText(`§0+${numberWithCommas(Math.floor(m.progress))}`).setLocation(0.5, i * 0.05, 0.5, 0.05).setLore(lore)) }) this.leaderboardChildren = [...leaderboard.children] @@ -189,7 +206,7 @@ class EventsPage extends GuiPage { this.leaderboardChildren.forEach(c => { if (c.timestamp) { - c.setLore(["Last updated " + timeSince(c.timestamp) + " ago"]) + c.setLore(["Last updated " + timeSince(c.timestamp) + " ago", "Currently: " + (c.online ? "§aOnline" : "§cOffline")]) } }) } diff --git a/features/friendsGUI/index.js b/features/friendsGUI/index.js index 8422081..bae266b 100644 --- a/features/friendsGUI/index.js +++ b/features/friendsGUI/index.js @@ -74,7 +74,7 @@ class SettingPage extends GuiPage { this.sidebarMainPage = new SoopyGuiElement().setLocation(0, 0, 1, 1) - this.heightPerFriend = 0.2 + this.heightPerFriend = 0.15 this.loadingElement = new BoxWithLoading().setLocation(0, 0, 1, 0.175) this.lastLoadedPage = 0 this.maxLoadedPage = 0 @@ -129,7 +129,7 @@ class SettingPage extends GuiPage { for (let i = 0; i < commands.length; i++) { let i2 = i - elements.push(new SoopyTextElement().setText("§0" + commands[i]).setLocation(0.2, 0.4 + i * 0.05, 0.6, 0.05)) + elements.push(new SoopyTextElement().setText("§0" + commands[i]).setLocation(0.2, 0.4 + i * 0.025, 0.6, 0.025)) this.runCommand(commands[i], () => { progressBar.setProgress((i2 + 1) / (commands.length), 1000) @@ -138,7 +138,7 @@ class SettingPage extends GuiPage { this.sidebarCustomPage.removeChild(e) elements.forEach((e, i) => { - e.location.location.y.set(0.4 + i * 0.05, 500) + e.location.location.y.set(0.4 + i * 0.025, 500) }) if (i2 === commands.length - 1) { @@ -195,7 +195,7 @@ class SettingPage extends GuiPage { } else { if (!this.allFriendsLoaded) { this.sidebarMainPage.addChild( - new ButtonWithArrow().setText("§0Load all friends").setLocation(0.1, 0.1, 0.8, 0.2) + new ButtonWithArrow().setText("§0Load all friends").setLocation(0.1, 0.1, 0.8, 0.15) .addEvent(new SoopyMouseClickEvent().setHandler(() => { this.loadAllFriends() @@ -203,7 +203,7 @@ class SettingPage extends GuiPage { }))) } else { this.sidebarMainPage.addChild( - new ButtonWithArrow().setText("§0Select all").setLocation(0.1, 0.1, 0.8, 0.2) + new ButtonWithArrow().setText("§0Select all").setLocation(0.1, 0.1, 0.8, 0.15) .addEvent(new SoopyMouseClickEvent().setHandler(() => { Object.keys(this.loadedFriends).forEach((ign, i) => { diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 69da074..f5913ff 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -201,9 +201,11 @@ class GlobalSettings extends Feature { } updateItemLores() { - if (!this.itemWorth.getValue()) return; + if (!this.itemWorth.getValue() && !this.showChampion.getValue() && !this.showHecatomb.getValue()) return; - [...Player.getInventory().getItems(), ...Player.getContainer().getItems()].forEach(i => { + let items = [...Player.getInventory().getItems(), ...Player.getContainer().getItems()] + + items.forEach(i => { let uuid = getSBUUID(i) if (!uuid) return @@ -217,15 +219,15 @@ class GlobalSettings extends Feature { if (a) { addLore(i, "§eWorth: ", "§6$" + numberWithCommas(Math.round(a))) - return - } - - if (this.requestingPrices.has(uuid)) return + } else { + if (!this.requestingPrices.has(uuid)) { + this.requestingPrices.add(uuid) - this.requestingPrices.add(uuid) + let json = i.getNBT().toObject() + socketConnection.requestItemPrice(json, uuid) + } + } - let json = i.getNBT().toObject() - socketConnection.requestItemPrice(json, uuid) } if (this.showChampion.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp")) { diff --git a/features/networthGUI/index.js b/features/networthGUI/index.js index 7ba2394..d4858b2 100644 --- a/features/networthGUI/index.js +++ b/features/networthGUI/index.js @@ -226,12 +226,12 @@ class NetworthPage extends GuiPage { this.leaderboardArea.clearChildren() data.data.data.forEach((user, i) => { this.leaderboardArea.addChild( - new SoopyTextElement().setText("§0#" + numberWithCommas(i + 1 + page * 100) + ": " + user.username).setMaxTextScale(1.5).setLocation(0.05, i * 0.1, 0.5, 0.1).setLore(["Click to show detailed stats"]).addEvent(new SoopyMouseClickEvent().setHandler(() => { + new SoopyTextElement().setText("§0#" + numberWithCommas(i + 1 + page * 100) + ": " + user.username).setMaxTextScale(1.5).setLocation(0.05, i * 0.05, 0.5, 0.05).setLore(["Click to show detailed stats"]).addEvent(new SoopyMouseClickEvent().setHandler(() => { this.updateData(user.uuid) })) ) this.leaderboardArea.addChild( - new SoopyTextElement().setText("§2$" + numberWithCommas(Math.round(user.networth)).replace(/,/g, "§7,§2")).setMaxTextScale(1.5).setLocation(0.6, i * 0.1, 0.35, 0.1) + new SoopyTextElement().setText("§2$" + numberWithCommas(Math.round(user.networth)).replace(/,/g, "§7,§2")).setMaxTextScale(1.5).setLocation(0.6, i * 0.05, 0.35, 0.05) ) }) }) diff --git a/features/settings/index.js b/features/settings/index.js index 6943537..92fbeec 100644 --- a/features/settings/index.js +++ b/features/settings/index.js @@ -132,7 +132,7 @@ class SettingPage extends GuiPage { let settingsCategoryTitle = new SoopyTextElement().setText("§0Settings").setMaxTextScale(3).setLocation(0.1, 0.05, 0.5, 0.1) this.pages[0].addChild(settingsCategoryTitle) - this.settingsCategorySearch = new TextBox().setPlaceholder("Search...").setLocation(0.6, 0.05, 0.3, 0.1) + this.settingsCategorySearch = new TextBox().setPlaceholder("Search...").setLocation(0.6, 0.05 + 0.0125, 0.3, 0.075) this.pages[0].addChild(this.settingsCategorySearch) this.settingsCategorySearch.text.addEvent(new SoopyContentChangeEvent().setHandler(() => { @@ -208,12 +208,12 @@ class SettingPage extends GuiPage { } if (isHidden) return - let category = new ButtonWithArrowAndDescription().setText("&0" + meta.name).setDesc("&0" + meta.description).setLocation(0, height, 1, 0.2) + let category = new ButtonWithArrowAndDescription().setText("&0" + meta.name).setDesc("&0" + meta.description).setLocation(0, height, 1, 0.15) category.addEvent(new SoopyMouseClickEvent().setHandler(() => { this.clickedOpenCategory(f) })) this.settingsCategoryArea.addChild(category) - height += 0.225 + height += 0.175 if (search.length > 0) { @@ -246,7 +246,7 @@ class SettingPage extends GuiPage { let height = 0 if (meta.isTogglable) { - let toggle = new BoxWithToggleAndDescription().setLocation(0, height, 1, 0.2).setText("&0Main toggle").setDesc("&0This is the main toggle for the whole category") + let toggle = new BoxWithToggleAndDescription().setLocation(0, height, 1, 0.15).setText("&0Main toggle").setDesc("&0This is the main toggle for the whole category") this.settingsArea.addChild(toggle) toggle.toggle.setValue(this.FeatureManager.isFeatureLoaded(category), 0) @@ -282,7 +282,7 @@ class SettingPage extends GuiPage { //only show if feature issnt loaded - let textBox = new SoopyBoxElement().setLocation(0, height, 1, 0.2) + let textBox = new SoopyBoxElement().setLocation(0, height, 1, 0.15) .addChild(new SoopyTextElement().setText("&0Feature not loaded").setLocation(0, 0, 1, 0.5)) .addChild(new SoopyTextElement().setText("&0Load feature to access settings").setLocation(0, 0.5, 1, 0.5)) this.settingsArea.addChild(textBox) diff --git a/features/settings/settingThings/imageLocation.js b/features/settings/settingThings/imageLocation.js index c8f37ed..c459c82 100644 --- a/features/settings/settingThings/imageLocation.js +++ b/features/settings/settingThings/imageLocation.js @@ -10,9 +10,9 @@ import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyC import locationSettingHolder from "../locationSettingHolder" class ImageLocationSetting extends ButtonSetting { - constructor(name, description, settingId, module, defaultLocation, image, imageWBase, imageHBase){ + constructor(name, description, settingId, module, defaultLocation, image, imageWBase, imageHBase) { super(name, description, settingId, module, "Edit Position", this.editPosition, defaultLocation) - + this.x = this.getValue()[0] this.y = this.getValue()[1] this.scale = this.getValue()[2] @@ -25,10 +25,10 @@ class ImageLocationSetting extends ButtonSetting { this.dragOffset = [0, 0] this.resisizing = false this.resizePoint = 0 - this.resizeInitialPos=[0, 0, 0, 0, 0, 0] + this.resizeInitialPos = [0, 0, 0, 0, 0, 0] this.soopyGui = new SoopyGui() - this.soopyGui._renderBackground = ()=>{} //remove background darkening + this.soopyGui._renderBackground = () => { } //remove background darkening this.elmSettings = new SoopyBoxElement().setLocation(0, 0, 0.25, 0.25) @@ -37,18 +37,18 @@ class ImageLocationSetting extends ButtonSetting { scaleText.centeredX = false this.elmSettings.addChild(scaleText) - this.scaleInput = new NumberTextBox().setText(this.scale.toFixed(2)).setLocation(Renderer.getStringWidth("Scale: ")+3, 0.025, -(Renderer.getStringWidth("Scale: ")+6), 0.15) + this.scaleInput = new NumberTextBox().setText(this.scale.toFixed(2)).setLocation(Renderer.getStringWidth("Scale: ") + 3, 0.025, -(Renderer.getStringWidth("Scale: ") + 6), 0.15) this.scaleInput.location.location.setRelative(false, true) this.scaleInput.location.size.setRelative(false, true) this.elmSettings.addChild(this.scaleInput) - this.scaleInput.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ - try{ + this.scaleInput.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { + try { newVal = parseFloat(newVal) - if(!isNaN(newVal)){ + if (!isNaN(newVal)) { this.scale = newVal this._updateValue() } - }catch(e){} + } catch (e) { } })) this.lastScaleRender = this.scale.toFixed(2) @@ -56,18 +56,18 @@ class ImageLocationSetting extends ButtonSetting { xText.location.location.setRelative(false, true) xText.centeredX = false this.elmSettings.addChild(xText) - this.xInput = new NumberTextBox().setText(this.x.toFixed(0)).setLocation(Renderer.getStringWidth("X: ")+3, 0.225, -(Renderer.getStringWidth("X: ")+6), 0.15) + this.xInput = new NumberTextBox().setText(this.x.toFixed(0)).setLocation(Renderer.getStringWidth("X: ") + 3, 0.225, -(Renderer.getStringWidth("X: ") + 6), 0.15) this.xInput.location.location.setRelative(false, true) this.xInput.location.size.setRelative(false, true) this.elmSettings.addChild(this.xInput) - this.xInput.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ - try{ + this.xInput.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { + try { newVal = parseFloat(newVal) - if(!isNaN(newVal)){ + if (!isNaN(newVal)) { this.x = newVal this._updateValue() } - }catch(e){} + } catch (e) { } })) this.lastXRender = this.x.toFixed(0) @@ -75,25 +75,25 @@ class ImageLocationSetting extends ButtonSetting { yText.location.location.setRelative(false, true) yText.centeredX = false this.elmSettings.addChild(yText) - this.yInput = new NumberTextBox().setText(this.y.toFixed(0)).setLocation(Renderer.getStringWidth("Y: ")+3, 0.425, -(Renderer.getStringWidth("Y: ")+6), 0.15) + this.yInput = new NumberTextBox().setText(this.y.toFixed(0)).setLocation(Renderer.getStringWidth("Y: ") + 3, 0.425, -(Renderer.getStringWidth("Y: ") + 6), 0.15) this.yInput.location.location.setRelative(false, true) this.yInput.location.size.setRelative(false, true) this.elmSettings.addChild(this.yInput) - this.yInput.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ - try{ + this.yInput.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { + try { newVal = parseFloat(newVal) - if(!isNaN(newVal)){ + if (!isNaN(newVal)) { this.y = newVal this._updateValue() } - }catch(e){} + } catch (e) { } })) this.lastYRender = this.y.toFixed(0) this.soopyGui.element.addChild(this.elmSettings) let button = new ButtonWithArrow().setText("&0Reset").setLocation(0.125, 0.625, 0.75, 0.15) - button.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + button.addEvent(new SoopyMouseClickEvent().setHandler(() => { this.x = defaultLocation[0] this.y = defaultLocation[1] this.scale = defaultLocation[2] @@ -102,7 +102,7 @@ class ImageLocationSetting extends ButtonSetting { this.elmSettings.addChild(button) let button2 = new ButtonWithArrow().setText("&0Back").setLocation(0.125, 0.825, 0.75, 0.15) - button2.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + button2.addEvent(new SoopyMouseClickEvent().setHandler(() => { this.soopyGui.close() this.guiObject.main.ctGui.open() })) @@ -110,74 +110,74 @@ class ImageLocationSetting extends ButtonSetting { this.editGui = this.soopyGui.ctGui - this.editGui.registerDraw((mouseX, mouseY, partialTicks)=>{ + this.editGui.registerDraw((mouseX, mouseY, partialTicks) => { this.renderGui(mouseX, mouseY) this.soopyGui._render(mouseX, mouseY, partialTicks) }) - this.editGui.registerClicked((mouseX, mouseY, button)=>{ + this.editGui.registerClicked((mouseX, mouseY, button) => { this.clicked(mouseX, mouseY) this.soopyGui._onClick(mouseX, mouseY, button) }) - this.editGui.registerMouseReleased((mouseX, mouseY)=>{ + this.editGui.registerMouseReleased((mouseX, mouseY) => { this.released(mouseX, mouseY) }) locationSettingHolder.addLocationSetting(this) } - requires(toggleSetting){ + requires(toggleSetting) { this.requiresO = toggleSetting - toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ - if(newVal){ - this.guiObject.location.size.y.set(0.2, 500) - }else{ + toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { + if (newVal) { + this.guiObject.location.size.y.set(0.15, 500) + } else { this.guiObject.location.size.y.set(0, 500) } })) let newVal = this.requiresO.getValue() - if(!newVal){ + if (!newVal) { this.guiObject.location.size.y.set(0, 0) } return this } - _updateValue(){ + _updateValue() { this.setValue([this.x, this.y, this.scale, this.shadowType]) } - editPosition(){ + editPosition() { this.guiObject.main.ctGui.close() this.soopyGui.open() } - clicked(mouseX, mouseY){ + clicked(mouseX, mouseY) { let width = this.getWidth() let height = this.getHeight() - let locations = [[this.x, this.y], [this.x+width*this.scale, this.y], [this.x, this.y+height*this.scale], [this.x+width*this.scale, this.y+height*this.scale]] + let locations = [[this.x, this.y], [this.x + width * this.scale, this.y], [this.x, this.y + height * this.scale], [this.x + width * this.scale, this.y + height * this.scale]] - locations.forEach((loc, i)=>{ - if(mouseX >= loc[0]-1*Math.max(1, this.scale) && mouseX <= loc[0]+1*Math.max(1, this.scale) - && mouseY >= loc[1]-1*Math.max(1, this.scale) && mouseY <= loc[1]+1*Math.max(1, this.scale)){ - this.resisizing= true + locations.forEach((loc, i) => { + if (mouseX >= loc[0] - 1 * Math.max(1, this.scale) && mouseX <= loc[0] + 1 * Math.max(1, this.scale) + && mouseY >= loc[1] - 1 * Math.max(1, this.scale) && mouseY <= loc[1] + 1 * Math.max(1, this.scale)) { + this.resisizing = true this.resizePoint = i - this.resizeInitialPos = [mouseX, mouseY, this.x, this.y, width*this.scale, height*this.scale] + this.resizeInitialPos = [mouseX, mouseY, this.x, this.y, width * this.scale, height * this.scale] } }) - if(this.resisizing) return; + if (this.resisizing) return; - if(mouseX > this.x && mouseX < this.x+width*this.scale - && mouseY>this.y && mouseY<this.y+height*this.scale){ + if (mouseX > this.x && mouseX < this.x + width * this.scale + && mouseY > this.y && mouseY < this.y + height * this.scale) { this.dragging = true; - this.dragOffset = [this.x-mouseX, this.y-mouseY] + this.dragOffset = [this.x - mouseX, this.y - mouseY] return true } return false } - released(mouseX, mouseY){ + released(mouseX, mouseY) { this.updateLocation(mouseX, mouseY) this.dragging = false this.resisizing = false @@ -185,135 +185,135 @@ class ImageLocationSetting extends ButtonSetting { this._updateValue() } - getWidth(){ + getWidth() { return this.imageWBase } - getHeight(){ + getHeight() { return this.imageHBase } - updateLocation(mouseX, mouseY, drawCollidingBox){ + updateLocation(mouseX, mouseY, drawCollidingBox) { let width = this.getWidth() let height = this.getHeight() - if(this.dragging){ - this.x = mouseX+this.dragOffset[0] - this.y = mouseY+this.dragOffset[1] + if (this.dragging) { + this.x = mouseX + this.dragOffset[0] + this.y = mouseY + this.dragOffset[1] let snapPoints = [] - locationSettingHolder.getData().forEach(loc=>{ - if(loc === this) return; + locationSettingHolder.getData().forEach(loc => { + if (loc === this) return; snapPoints.push([loc.x, loc.y]) - snapPoints.push([loc.x+loc.getWidth()*loc.scale, loc.y]) - snapPoints.push([loc.x+loc.getWidth()*loc.scale, loc.y+height*loc.scale]) - snapPoints.push([loc.x, loc.y+height*loc.scale]) + snapPoints.push([loc.x + loc.getWidth() * loc.scale, loc.y]) + snapPoints.push([loc.x + loc.getWidth() * loc.scale, loc.y + height * loc.scale]) + snapPoints.push([loc.x, loc.y + height * loc.scale]) }) - snapPoints.forEach(point=>{ + snapPoints.forEach(point => { //top left - if(Math.abs(this.x-point[0]) < 5 && Math.abs(this.y-point[1]) < 5){ + if (Math.abs(this.x - point[0]) < 5 && Math.abs(this.y - point[1]) < 5) { this.x = point[0] this.y = point[1] } //top right - if(Math.abs(this.x+width*this.scale-point[0]) < 5 && Math.abs(this.y-point[1]) < 5){ - this.x = point[0]-width*this.scale + if (Math.abs(this.x + width * this.scale - point[0]) < 5 && Math.abs(this.y - point[1]) < 5) { + this.x = point[0] - width * this.scale this.y = point[1] } //bottom left - if(Math.abs(this.x-point[0]) < 5 && Math.abs(this.y+height*this.scale-point[1]) < 5){ + if (Math.abs(this.x - point[0]) < 5 && Math.abs(this.y + height * this.scale - point[1]) < 5) { this.x = point[0] - this.y = point[1]-height*this.scale + this.y = point[1] - height * this.scale } //bottom right - if(Math.abs(this.x+width*this.scale-point[0]) < 5 && Math.abs(this.y+height*this.scale-point[1]) < 5){ - this.x = point[0]-width*this.scale - this.y = point[1]-height*this.scale + if (Math.abs(this.x + width * this.scale - point[0]) < 5 && Math.abs(this.y + height * this.scale - point[1]) < 5) { + this.x = point[0] - width * this.scale + this.y = point[1] - height * this.scale } }) } - if(this.resisizing){ - if(this.resizePoint === 3){ - this.scale=(mouseX-this.x)/width + if (this.resisizing) { + if (this.resizePoint === 3) { + this.scale = (mouseX - this.x) / width this.scale = Math.max(0.25, this.scale) } - if(this.resizePoint === 1){ - + if (this.resizePoint === 1) { + let [oMouseX, oMouseY, oX, oY, ow, oh] = this.resizeInitialPos - - this.scale=(mouseX-this.x)/width + + this.scale = (mouseX - this.x) / width this.scale = Math.max(0.25, this.scale) - this.y=oY+oh-height*this.scale + this.y = oY + oh - height * this.scale } - if(this.resizePoint===0){ + if (this.resizePoint === 0) { let [oMouseX, oMouseY, oX, oY, ow, oh] = this.resizeInitialPos - - this.scale=(oX+ow-mouseX)/width + + this.scale = (oX + ow - mouseX) / width this.scale = Math.max(0.25, this.scale) - this.x=oX+ow-width*this.scale - this.y=oY+oh-height*this.scale + this.x = oX + ow - width * this.scale + this.y = oY + oh - height * this.scale } - if(this.resizePoint === 2){ + if (this.resizePoint === 2) { let [oMouseX, oMouseY, oX, oY, ow, oh] = this.resizeInitialPos - - this.scale=(oX+ow-mouseX)/width + + this.scale = (oX + ow - mouseX) / width this.scale = Math.max(0.25, this.scale) - this.x=oX+ow-width*this.scale + this.x = oX + ow - width * this.scale } } } - renderGui(mouseX, mouseY){ + renderGui(mouseX, mouseY) { let width = this.getWidth() let height = this.getHeight() - this.image.draw(this.x, this.y, width*this.scale, height*this.scale) + this.image.draw(this.x, this.y, width * this.scale, height * this.scale) this.updateLocation(mouseX, mouseY, true) this.renderBox(true) - if(this.x+width*this.scale/2 > Renderer.screen.getWidth()/2){ - this.elmSettings.location.location.x.set(Math.min(Math.max(this.x/Renderer.screen.getWidth()-0.25-0.03, 0.02), 0.73)) - }else{ - this.elmSettings.location.location.x.set(Math.min(Math.max((this.x+width*this.scale)/Renderer.screen.getWidth()+0.03, 0.02), 0.73)) + if (this.x + width * this.scale / 2 > Renderer.screen.getWidth() / 2) { + this.elmSettings.location.location.x.set(Math.min(Math.max(this.x / Renderer.screen.getWidth() - 0.25 - 0.03, 0.02), 0.73)) + } else { + this.elmSettings.location.location.x.set(Math.min(Math.max((this.x + width * this.scale) / Renderer.screen.getWidth() + 0.03, 0.02), 0.73)) } - this.elmSettings.location.location.y.set(Math.min(Math.max((this.y+height*this.scale/2)/Renderer.screen.getHeight() - this.elmSettings.location.size.y.get()/2, 0.02), 0.73)) + this.elmSettings.location.location.y.set(Math.min(Math.max((this.y + height * this.scale / 2) / Renderer.screen.getHeight() - this.elmSettings.location.size.y.get() / 2, 0.02), 0.73)) + - - if(this.lastScaleRender !== this.scale.toFixed(2) && !this.scaleInput.text.selected){ + if (this.lastScaleRender !== this.scale.toFixed(2) && !this.scaleInput.text.selected) { this.lastScaleRender = this.scale.toFixed(2) this.scaleInput.setText(this.scale.toFixed(2)) } - if(this.lastXRender !== this.x.toFixed(0) && !this.xInput.text.selected){ + if (this.lastXRender !== this.x.toFixed(0) && !this.xInput.text.selected) { this.lastXRender = this.x.toFixed(0) this.xInput.setText(this.x.toFixed(0)) } - if(this.lastYRender !== this.y.toFixed(0) && !this.yInput.text.selected){ + if (this.lastYRender !== this.y.toFixed(0) && !this.yInput.text.selected) { this.lastYRender = this.y.toFixed(0) this.yInput.setText(this.y.toFixed(0)) } } - renderBox(drawHandles){ + renderBox(drawHandles) { let width = this.getWidth() let height = this.getHeight() - Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y, width*this.scale, 1) - Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y, 1, height*this.scale) - Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y+height*this.scale, width*this.scale, 1) - Renderer.drawRect(Renderer.color(255, 255, 255), this.x+width*this.scale, this.y, 1, height*this.scale) + Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y, width * this.scale, 1) + Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y, 1, height * this.scale) + Renderer.drawRect(Renderer.color(255, 255, 255), this.x, this.y + height * this.scale, width * this.scale, 1) + Renderer.drawRect(Renderer.color(255, 255, 255), this.x + width * this.scale, this.y, 1, height * this.scale) - if(drawHandles){ - Renderer.drawRect(Renderer.color(255, 255, 255), this.x-1*Math.max(1, this.scale)+width*this.scale, this.y-1*Math.max(1, this.scale), 2*Math.max(1, this.scale)+1, 2*Math.max(1, this.scale)+1) - Renderer.drawRect(Renderer.color(255, 255, 255), this.x-1*Math.max(1, this.scale), this.y-1*Math.max(1, this.scale)+height*this.scale, 2*Math.max(1, this.scale)+1, 2*Math.max(1, this.scale)+1) - Renderer.drawRect(Renderer.color(255, 255, 255), this.x-1*Math.max(1, this.scale)+width*this.scale, this.y-1*Math.max(1, this.scale)+height*this.scale, 2*Math.max(1, this.scale)+1, 2*Math.max(1, this.scale)+1) - Renderer.drawRect(Renderer.color(255, 255, 255), this.x-1*Math.max(1, this.scale), this.y-1*Math.max(1, this.scale), 2*Math.max(1, this.scale)+1, 2*Math.max(1, this.scale)+1) + if (drawHandles) { + Renderer.drawRect(Renderer.color(255, 255, 255), this.x - 1 * Math.max(1, this.scale) + width * this.scale, this.y - 1 * Math.max(1, this.scale), 2 * Math.max(1, this.scale) + 1, 2 * Math.max(1, this.scale) + 1) + Renderer.drawRect(Renderer.color(255, 255, 255), this.x - 1 * Math.max(1, this.scale), this.y - 1 * Math.max(1, this.scale) + height * this.scale, 2 * Math.max(1, this.scale) + 1, 2 * Math.max(1, this.scale) + 1) + Renderer.drawRect(Renderer.color(255, 255, 255), this.x - 1 * Math.max(1, this.scale) + width * this.scale, this.y - 1 * Math.max(1, this.scale) + height * this.scale, 2 * Math.max(1, this.scale) + 1, 2 * Math.max(1, this.scale) + 1) + Renderer.drawRect(Renderer.color(255, 255, 255), this.x - 1 * Math.max(1, this.scale), this.y - 1 * Math.max(1, this.scale), 2 * Math.max(1, this.scale) + 1, 2 * Math.max(1, this.scale) + 1) } } } diff --git a/features/settings/settingThings/location.js b/features/settings/settingThings/location.js index c9587eb..4e18446 100644 --- a/features/settings/settingThings/location.js +++ b/features/settings/settingThings/location.js @@ -133,7 +133,7 @@ class LocationSetting extends ButtonSetting { toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { if (newVal) { - this.guiObject.location.size.y.set(0.2, 500) + this.guiObject.location.size.y.set(0.15, 500) } else { this.guiObject.location.size.y.set(0, 500) } diff --git a/features/settings/settingThings/settingBase.js b/features/settings/settingThings/settingBase.js index 95f902e..5320f40 100644 --- a/features/settings/settingThings/settingBase.js +++ b/features/settings/settingThings/settingBase.js @@ -21,9 +21,9 @@ class SettingBase { this.val = defaultVal; - this.guiObject = new BoxWithTextAndDescription().setDesc("§0" + this.description.replace(/\n/g, "\n§0")).setText("§0" + this.name).setLocation(0, 0, 1, 0.175) + this.guiObject = new BoxWithTextAndDescription().setDesc("§0" + this.description.replace(/\n/g, "\n§0")).setText("§0" + this.name).setLocation(0, 0, 1, 0.15) - this.settingObject = new SoopyGuiElement().setLocation(0.8, 0, 0.2, 1) + this.settingObject = new SoopyGuiElement().setLocation(0.8, 0, 0.15, 1) this.guiObject.addChild(this.settingObject) @@ -130,7 +130,7 @@ class SettingBase { toggleSetting.toggleObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { if (newVal) { - this.guiObject.location.size.y.set(0.2, 500) + this.guiObject.location.size.y.set(0.15, 500) } else { this.guiObject.location.size.y.set(0, 500) } diff --git a/features/settings/settingThings/toggle.js b/features/settings/settingThings/toggle.js index 200ac87..24310d2 100644 --- a/features/settings/settingThings/toggle.js +++ b/features/settings/settingThings/toggle.js @@ -37,7 +37,7 @@ class ToggleSetting extends SettingBase { this.toggleObject.triggerEvent(Enum.EVENT.CONTENT_CHANGE, [this.temp_val, false, () => { }]) - this.guiObject.location.size.y.set(0.2, 500) + this.guiObject.location.size.y.set(0.15, 500) } else { this.temp_val = this.getValue() this.setValue(false) diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js index 9f1bb4b..0ad6b8c 100644 --- a/features/soopyGui/index.js +++ b/features/soopyGui/index.js @@ -39,7 +39,7 @@ class SoopyGui extends Feature { this.registerCommand("snoopyv2", this.openCommand) this.registerCommand("snoopy", this.openCommand) - this.mainWindowElement = new SoopyBoxElement().setLocation(0.25, 0.2, 0.5, 0.6) + this.mainWindowElement = new SoopyBoxElement().setLocation(0.25, 0.1, 0.5, 0.8) this.mainWindowElement.addEvent(new SoopyOpenGuiEvent().setHandler(() => { this.goToPageNum(0, false) })) @@ -52,7 +52,7 @@ class SoopyGui extends Feature { 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) + let discordButton = new ButtonWithArrow().setText("§0Discord").setLocation(0.7, 0.05 + 0.0125, 0.25, 0.075) discordButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { java.awt.Desktop.getDesktop().browse( new java.net.URI("https://discord.gg/dfSMq96RSN") @@ -73,7 +73,7 @@ class SoopyGui extends Feature { this.mainWindowElement.addChild(this.categoryPage) - this.sidebarPage = new SoopyBoxElement().setLocation(0.3, 0.2, 0.3, 0.6) + this.sidebarPage = new SoopyBoxElement().setLocation(0.3, 0.1, 0.3, 0.8) // this.sidebarPage.visable = false this.gui.element.addChild(this.sidebarPage) @@ -106,7 +106,7 @@ class SoopyGui extends Feature { this.buttonListElm.children = [] if (this.getPages()) this.getPages().forEach((p, i) => { - let settingsButton = new ButtonWithArrow().setText("§0" + p.name).setLocation(0, 0.225 * i, 1, 0.2) + let settingsButton = new ButtonWithArrow().setText("§0" + p.name).setLocation(0, 0.175 * i, 1, 0.15) settingsButton.addEvent(new SoopyMouseClickEvent().setHandler(() => { this.clickedOpen(p) })) this.buttonListElm.addChild(settingsButton) }) diff --git a/features/streamsGUI/index.js b/features/streamsGUI/index.js index 390f625..9b8e1d7 100644 --- a/features/streamsGUI/index.js +++ b/features/streamsGUI/index.js @@ -73,15 +73,15 @@ class StreamPage extends GuiPage { let stream = streams.twitch[channel] if (i % 2 === 0) { - let element = new StreamElement().setLocation(0, y, 0.45, 0.55).setStreamPage(this) + let element = new StreamElement().setLocation(0, y, 0.45, 0.4).setStreamPage(this) this.streamsBox.addChild(element) element.setStream(stream, true) } if (i % 2 === 1) { - let element = new StreamElement().setLocation(0.55, y, 0.45, 0.55).setStreamPage(this) + let element = new StreamElement().setLocation(0.55, y, 0.45, 0.4).setStreamPage(this) this.streamsBox.addChild(element) element.setStream(stream, true) - y += 0.6 + y += 0.45 } }) }) diff --git a/features/suggestionsGui/index.js b/features/suggestionsGui/index.js index 8ddaa24..919d76c 100644 --- a/features/suggestionsGui/index.js +++ b/features/suggestionsGui/index.js @@ -103,7 +103,7 @@ class SuggestionPage extends GuiPage { if (suggestion.uuid !== Player.getUUID().toString().replace(/-/g, "") && !allowed.has(Player.getUUID().toString().replace(/-/g, ""))) return } - let box = new SoopyBoxElement().setLocation(0, 0.225 * i, 1, 0.2).setLore(["Click for more information + vote buttons"]) + let box = new SoopyBoxElement().setLocation(0, 0.175 * i, 1, 0.15).setLore(["Click for more information + vote buttons"]) this.suggestionsArea.addChild(box) let title = new SoopyTextElement().setText("§0" + suggestion.title + " §7(" + this.tags.suggestionTags[suggestion.tag] + ")").setMaxTextScale(2).setLocation(0, 0, 0.8, 1) |