aboutsummaryrefslogtreecommitdiff
path: root/features/statHistoryGui
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-06-18 12:10:46 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-06-18 12:10:46 +0800
commit4f36ccbe179654be353c8837802d94254182ddd5 (patch)
treeaf1f73c656038ef8d7ace6fabd511787abf4daf2 /features/statHistoryGui
parent89be4749d38875ce2dad1ad9db57ec6488c2c1d1 (diff)
downloadSoopyV2-4f36ccbe179654be353c8837802d94254182ddd5.tar.gz
SoopyV2-4f36ccbe179654be353c8837802d94254182ddd5.tar.bz2
SoopyV2-4f36ccbe179654be353c8837802d94254182ddd5.zip
+profile selection to networth and statgraphs pages
Diffstat (limited to 'features/statHistoryGui')
-rw-r--r--features/statHistoryGui/index.js20
1 files changed, 15 insertions, 5 deletions
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(() => {