aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--features/events/index.js5
-rw-r--r--features/networthGUI/index.js153
-rw-r--r--features/statHistoryGui/index.js20
3 files changed, 101 insertions, 77 deletions
diff --git a/features/events/index.js b/features/events/index.js
index c98eb32..632be08 100644
--- a/features/events/index.js
+++ b/features/events/index.js
@@ -8,6 +8,7 @@ import { calculateDistanceQuick } from "../../utils/utils";
import SettingBase from "../settings/settingThings/settingBase";
import ToggleSetting from "../settings/settingThings/toggle";
import { fetch } from "../../utils/networkUtils"
+import ButtonSetting from "../settings/settingThings/button";
class Events extends Feature {
constructor() {
@@ -33,7 +34,9 @@ class Events extends Feature {
this.loadFromParticles = new ToggleSetting("Load burrials from particles", "Will load particles from burrows in the world", true, "burrial_from_partles", this)
this.showBurrialGuess = new ToggleSetting("Estimate burrial location from ability", "Will show a line + box where it thinks the burrial is", true, "burrial_guess", this)
- new SettingBase("NOTE: You must have music disabled for burrial guessess to work", "/togglemusic", false, "burrial_guess_into", this).requires(this.showBurrialGuess)
+ new ButtonSetting("NOTE: You must have music disabled", "for burrial guessess to work (/togglemusic)", "togglemusis_button", this, "click", () => {
+ ChatLib.command("togglemusic")
+ }, false).requires(this.showBurrialGuess)
this.otherInquisWaypoints = new ToggleSetting("Show other users inquis locations", "May be usefull for loot share", true, "inquis_location_other", this)
this.otherInquisPing = new ToggleSetting("Show cool title when someone's inquis spawned", "May be usefull for loot share", true, "inquis_ping_other", this)
diff --git a/features/networthGUI/index.js b/features/networthGUI/index.js
index 4e4b527..af358a4 100644
--- a/features/networthGUI/index.js
+++ b/features/networthGUI/index.js
@@ -15,33 +15,35 @@ import SoopyMarkdownElement from "../../../guimanager/GuiElement/SoopyMarkdownEl
import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent";
import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow";
import { fetch } from "../../utils/networkUtils";
+import Dropdown from "../../../guimanager/GuiElement/Dropdown";
+import SoopyContentChangeEvent from "../../../guimanager/EventListener/SoopyContentChangeEvent";
class NetworthGui extends Feature {
constructor() {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.GuiPage = new NetworthPage()
}
- initVariables(){
+ initVariables() {
this.GuiPage = undefined
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
class NetworthPage extends GuiPage {
- constructor(){
+ constructor() {
super(7)
-
+
this.name = "Networth"
this.pages = [this.newPage()]
@@ -51,17 +53,17 @@ class NetworthPage extends GuiPage {
let button = new ButtonWithArrow().setText("§0Open in browser").setLocation(0.7, 0.05, 0.2, 0.1)
this.pages[0].addChild(button)
- button.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ button.addEvent(new SoopyMouseClickEvent().setHandler(() => {
java.awt.Desktop.getDesktop().browse(
new java.net.URI("https://soopymc.my.to/networth")
- );
+ );
}))
this.nameInput = new TextBox().setPlaceholder("Click to search").setLocation(0.1, 0.225, 0.8, 0.1)
this.pages[0].addChild(this.nameInput)
- this.nameInput.addEvent(new SoopyKeyPressEvent().setHandler((key, keyId)=>{
- if(this.nameInput.text.selected && keyId === 28){
+ this.nameInput.addEvent(new SoopyKeyPressEvent().setHandler((key, keyId) => {
+ if (this.nameInput.text.selected && keyId === 28) {
this.playerLoad = this.nameInput.text.text
this.nameInput.setText("")
this.updateData(this.playerLoad)
@@ -77,13 +79,13 @@ class NetworthPage extends GuiPage {
this.playerLoad = undefined
- this.sidebarElement = new SoopyGuiElement().setLocation(0,0,1,1)
+ this.sidebarElement = new SoopyGuiElement().setLocation(0, 0, 1, 1)
this.sidebarUsernameSearch = new TextBox().setLocation(0.15, 0.05, 0.7, 0.1).setPlaceholder("Click to search")
this.sidebarElement.addChild(this.sidebarUsernameSearch)
-
- this.sidebarUsernameSearch.addEvent(new SoopyKeyPressEvent().setHandler((key, keyId)=>{
- if(this.sidebarUsernameSearch.text.selected && keyId === 28){
+
+ this.sidebarUsernameSearch.addEvent(new SoopyKeyPressEvent().setHandler((key, keyId) => {
+ if (this.sidebarUsernameSearch.text.selected && keyId === 28) {
let search = this.sidebarUsernameSearch.text.text
this.sidebarUsernameSearch.setText("")
this.sidebarSearch(search)
@@ -94,13 +96,13 @@ class NetworthPage extends GuiPage {
this.lbNextButton = new ButtonWithArrow().setLocation(0.85, 0.05, 0.1, 0.1).setText("§0Next")
this.sidebarElement.addChild(this.lbBackButton)
this.sidebarElement.addChild(this.lbNextButton)
- this.lbBackButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
- if(this.currentLbPage > 0)this.goToLeaderboardPage(this.currentLbPage-1)
+ this.lbBackButton.addEvent(new SoopyMouseClickEvent().setHandler(() => {
+ if (this.currentLbPage > 0) this.goToLeaderboardPage(this.currentLbPage - 1)
}))
- this.lbNextButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
- this.goToLeaderboardPage(this.currentLbPage+1)
+ this.lbNextButton.addEvent(new SoopyMouseClickEvent().setHandler(() => {
+ this.goToLeaderboardPage(this.currentLbPage + 1)
}))
-
+
this.leaderboardArea = new SoopyGuiElement().setLocation(0.05, 0.15, 0.9, 0.85).setScrollable(true)
this.sidebarElement.addChild(this.leaderboardArea)
@@ -109,79 +111,88 @@ class NetworthPage extends GuiPage {
this.finaliseLoading()
}
- updateData(player){
+ updateData(player, profIn) {
this.playerLoad = player
this.statArea._scrollAmount = 0
- this.statArea.location.scroll.y.set(0,100)
+ this.statArea.location.scroll.y.set(0, 100)
this.statArea.clearChildren()
this.statArea.addChild(this.loadingElm)
- fetch("http://soopymc.my.to/api/v2/player/" + player).json(playerData=>{
+ fetch("http://soopymc.my.to/api/v2/player/" + player).json(playerData => {
- if(player !== this.playerLoad) return
+ if (player !== this.playerLoad) return
- if(!playerData.success){
+ if (!playerData.success) {
this.statArea.clearChildren()
this.statArea.addChild(this.errorElm)
this.errorElm.setText("§0" + playerData.error.name)
this.errorElm.setDesc("§0" + playerData.error.description)
return
}
-
- fetch("http://soopymc.my.to/api/v2/player_skyblock/" + playerData.data.uuid).json(skyblockData=>{
- if(player !== this.playerLoad) return
-
+ fetch("http://soopymc.my.to/api/v2/player_skyblock/" + playerData.data.uuid).json(skyblockData => {
+
+ if (player !== this.playerLoad) return
+
this.statArea.clearChildren()
-
- if(!skyblockData.success){
+
+ if (!skyblockData.success) {
this.statArea.addChild(this.errorElm)
this.errorElm.setText("§0" + skyblockData.error.name)
this.errorElm.setDesc("§0" + skyblockData.error.description)
return
}
-
- let highestProf = undefined
- Object.keys(skyblockData.data.profiles).forEach(prof=>{
- if(highestProf === undefined || skyblockData.data.profiles[prof].members[playerData.data.uuid].soopyNetworth.networth > skyblockData.data.profiles[highestProf].members[playerData.data.uuid].soopyNetworth.networth) highestProf = prof
- })
-
- let nwData = skyblockData.data.profiles[highestProf].members[playerData.data.uuid].soopyNetworth
+
+ let selectedProf = profIn || skyblockData.data.stats.bestProfileId
+
+ let nwData = skyblockData.data.profiles[selectedProf].members[playerData.data.uuid].soopyNetworth
let nameElm = new SoopyTextElement().setText(playerData.data.stats.nameWithPrefix.replace(/§f/g, "§7")).setMaxTextScale(2).setLocation(0.1, 0.05, 0.8, 0.1)
this.statArea.addChild(nameElm)
- this.statArea.addChild(new SoopyTextElement().setText("§0Networth (" + skyblockData.data.profiles[highestProf].stats.cute_name + "): §2$" + numberWithCommas(Math.round(nwData.networth)).replace(/,/g, "§7,§2")).setMaxTextScale(1.5).setLocation(0.1, 0.15, 0.8, 0.1))
+
+ let profOptions = {}
+ Object.keys(skyblockData.data.profiles).forEach(p => {
+ profOptions[p] = skyblockData.data.profiles[p].stats.cute_name
+ })
+
+ let profileSelect = new Dropdown().setOptions(profOptions).setSelectedOption(selectedProf).setLocation(0.1, 0.15, 0.3, 0.1).addEvent(new SoopyContentChangeEvent().setHandler(newval => {
+ this.updateData(player, newval)
+ }))
+ this.statArea.addChild(profileSelect)
+ this.statArea.addChild(new SoopyTextElement().setText("§0Networth: §2$" + numberWithCommas(Math.round(nwData.networth)).replace(/,/g, "§7,§2")).setMaxTextScale(1.5).setLocation(0.45, 0.15, 0.4, 0.1))
this.statArea.addChild(new SoopyTextElement().setText("§0Purse: §2$" + numberWithCommas(Math.round(nwData.purse)).replace(/,/g, "§7,§2") + "§0 | Bank: §2$" + numberWithCommas(Math.round(nwData.bank)).replace(/,/g, "§7,§2") + "§0 | Sack: §2$" + numberWithCommas(Math.round(nwData.sack)).replace(/,/g, "§7,§2")).setMaxTextScale(1.5).setLocation(0.1, 0.25, 0.8, 0.1))
-
- Object.keys(nwData.categories).sort((a, b)=>nwData.categories[b].total-nwData.categories[a].total).forEach((name, i)=>{
+
+ Object.keys(nwData.categories).sort((a, b) => nwData.categories[b].total - nwData.categories[a].total).forEach((name, i) => {
let renderName = firstLetterWordCapital(name.replace(/_/g, " "))
-
+
let data = nwData.categories[name]
-
- let box = new SoopyBoxElement().setLocation(i%2===0?0:0.525, 0.45 + Math.floor(i/2)*0.35, 0.475, 0.25)
-
- box.addChild(new SoopyMarkdownElement().setLocation(0,0,1,1).setText(data.items.filter(i=>i.name).splice(0,5).map(a=>{
- let name = (a.name.startsWith("§f") || a.name.startsWith("§7[Lvl "))?a.name.replace("§f","§7"):a.name
+
+ let box = new SoopyBoxElement().setLocation(i % 2 === 0 ? 0 : 0.525, 0.45 + Math.floor(i / 2) * 0.35, 0.475, 0.25)
+
+ box.addChild(new SoopyMarkdownElement().setLocation(0, 0, 1, 1).setText(data.items.filter(i => i.name).splice(0, 5).map(a => {
+ let name = (a.name.startsWith("§f") || a.name.startsWith("§7[Lvl ")) ? a.name.replace("§f", "§7") : a.name
return "§0" + name + "§0: §2$" + numberWithCommas(Math.round(a.p)).replace(/,/g, "§7,§2")
}).join("\n")))
-
- let boxName = new SoopyTextElement().setLocation(i%2===0?0:0.525, 0.4+Math.floor(i/2)*0.35, 0.475, 0.05).setText("§0" + renderName + "§0: §2$" + numberWithCommas(Math.round(data.total)).replace(/,/g, "§7,§2"))
-
+
+ let boxName = new SoopyTextElement().setLocation(i % 2 === 0 ? 0 : 0.525, 0.4 + Math.floor(i / 2) * 0.35, 0.475, 0.05).setText("§0" + renderName + "§0: §2$" + numberWithCommas(Math.round(data.total)).replace(/,/g, "§7,§2"))
+
this.statArea.addChild(box)
this.statArea.addChild(boxName)
})
-
- fetch("http://soopymc.my.to/api/v2/leaderboard/networth/user/" + playerData.data.uuid).json(leaderboardData=>{
- if(player !== this.playerLoad) return
-
- if(leaderboardData.success)nameElm.setText("§0#" + numberWithCommas(leaderboardData.data.data.position+1) + " " + playerData.data.stats.nameWithPrefix.replace(/§f/g, "§7"))
- })
+
+ if (selectedProf === skyblockData.data.stats.bestProfileId) {
+ fetch("http://soopymc.my.to/api/v2/leaderboard/networth/user/" + playerData.data.uuid).json(leaderboardData => {
+ if (player !== this.playerLoad) return
+
+ if (leaderboardData.success) nameElm.setText("§0#" + numberWithCommas(leaderboardData.data.data.position + 1) + " " + playerData.data.stats.nameWithPrefix.replace(/§f/g, "§7"))
+ })
+ }
})
})
}
- onOpen(){
+ onOpen() {
this.playerLoad = Player.getName()
this.updateData(Player.getName())
@@ -190,37 +201,37 @@ class NetworthPage extends GuiPage {
this.openSidebarPage(this.sidebarElement)
}
- sidebarSearch(user){
- fetch("http://soopymc.my.to/api/v2/leaderboard/networth/user/" + user).json(data=>{
- if(!data.success){
+ sidebarSearch(user) {
+ fetch("http://soopymc.my.to/api/v2/leaderboard/networth/user/" + user).json(data => {
+ if (!data.success) {
return
}
-
+
let position = data.data.data.position
-
- this.goToLeaderboardPage(Math.floor(position/100), false)
-
- this.leaderboardArea._scrollAmount = -((position%100)*0.1-0.45)*this.leaderboardArea.location.getHeightExact()
- this.leaderboardArea.location.scroll.y.set(-((position%100)*0.1-0.45)*this.leaderboardArea.location.getHeightExact(),100)
+
+ this.goToLeaderboardPage(Math.floor(position / 100), false)
+
+ this.leaderboardArea._scrollAmount = -((position % 100) * 0.1 - 0.45) * this.leaderboardArea.location.getHeightExact()
+ this.leaderboardArea.location.scroll.y.set(-((position % 100) * 0.1 - 0.45) * this.leaderboardArea.location.getHeightExact(), 100)
})
}
- goToLeaderboardPage(page, scroll=true){
+ goToLeaderboardPage(page, scroll = true) {
this.currentLbPage = page
- if(scroll)this.leaderboardArea._scrollAmount = 0
- if(scroll)this.leaderboardArea.location.scroll.y.set(0,100)
+ if (scroll) this.leaderboardArea._scrollAmount = 0
+ if (scroll) this.leaderboardArea.location.scroll.y.set(0, 100)
- fetch("http://soopymc.my.to/api/v2/leaderboard/networth/" + page).json(data=>{
+ fetch("http://soopymc.my.to/api/v2/leaderboard/networth/" + page).json(data => {
this.leaderboardArea.clearChildren()
- data.data.data.forEach((user, i)=>{
+ 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.1, 0.5, 0.1).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.1, 0.35, 0.1)
)
})
})
diff --git a/features/statHistoryGui/index.js b/features/statHistoryGui/index.js
index 5fe8356..4c02b2c 100644
--- a/features/statHistoryGui/index.js
+++ b/features/statHistoryGui/index.js
@@ -15,6 +15,8 @@ import { fetch } from "../../utils/networkUtils";
import SoopyImageElement from "../../../guimanager/GuiElement/SoopyImageElement";
import renderLibs from "../../../guimanager/renderLibs";
import SoopyBoxElement from "../../../guimanager/GuiElement/SoopyBoxElement";
+import Dropdown from "../../../guimanager/GuiElement/Dropdown";
+import SoopyContentChangeEvent from "../../../guimanager/EventListener/SoopyContentChangeEvent";
class StatHistoryGUI extends Feature {
constructor() {
@@ -79,7 +81,7 @@ class StatGraphPage extends GuiPage {
this.finaliseLoading()
}
- updateData(player) {
+ updateData(player, profIn) {
this.closeSidebarPage()
this.playerLoad = player
@@ -102,15 +104,13 @@ class StatGraphPage extends GuiPage {
return
}
this.statArea.clearChildren()
- let nameElm = new SoopyTextElement().setText(playerData.data.stats.nameWithPrefix.replace(/§f/g, "§7")).setMaxTextScale(2).setLocation(0.1, 0.05, 0.8, 0.1)
+ let nameElm = new SoopyTextElement().setText(playerData.data.stats.nameWithPrefix.replace(/§f/g, "§7")).setMaxTextScale(2).setLocation(0.1, 0.05, 0.5, 0.1)
this.statArea.addChild(nameElm)
this.statArea.addChild(this.loadingElm)
fetch("http://soopymc.my.to/api/v2/player_skyblock/" + playerData.data.uuid).json(skyblockData => {
-
if (player !== this.playerLoad) return
-
if (!skyblockData.success) {
this.statArea.clearChildren()
this.statArea.addChild(this.errorElm)
@@ -119,8 +119,18 @@ class StatGraphPage extends GuiPage {
return
}
+ let selectedProf = profIn || skyblockData.data.stats.bestProfileId
+ let profOptions = {}
+ Object.keys(skyblockData.data.profiles).forEach(p => {
+ profOptions[p] = skyblockData.data.profiles[p].stats.cute_name
+ })
+
+ let profileSelect = new Dropdown().setOptions(profOptions).setSelectedOption(selectedProf).setLocation(0.6, 0.05, 0.3, 0.1).addEvent(new SoopyContentChangeEvent().setHandler(newval => {
+ this.updateData(player, newval)
+ }))
+ this.statArea.addChild(profileSelect)
- fetch("http://soopymc.my.to/statgraphgenerations/" + playerData.data.uuid + "/" + skyblockData.data.stats.bestProfileId).json(graphData => {
+ fetch("http://soopymc.my.to/statgraphgenerations/" + playerData.data.uuid + "/" + selectedProf).json(graphData => {
if (player !== this.playerLoad) return
new Thread(() => {