From fd3d053e34ccd6ba21a6a3075ac69118ecc41fc7 Mon Sep 17 00:00:00 2001
From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com>
Date: Sun, 7 Nov 2021 15:24:24 +0800
Subject: Fix diana event waypoints
---
features/mining/index.js | 3 +-
features/soopyGui/index.js | 3 +-
features/streamsGUI/index.js | 136 ++++++++++++++++++++++++++++++++++++++
features/streamsGUI/metadata.json | 8 +++
utils/utils.js | 6 +-
5 files changed, 150 insertions(+), 6 deletions(-)
create mode 100644 features/streamsGUI/index.js
create mode 100644 features/streamsGUI/metadata.json
diff --git a/features/mining/index.js b/features/mining/index.js
index 457ab84..c430e3a 100644
--- a/features/mining/index.js
+++ b/features/mining/index.js
@@ -1,9 +1,8 @@
///
///
import Feature from "../../featureClass/class";
-import { drawBoxAtBlockNotVisThruWalls } from "../../utils/renderUtils";
import * as stringUtils from "../../utils/stringUtils";
-import * as utils from "../../utils/utils";
+import * as utils from "../../utils/utils"
import HudTextElement from "../hud/HudTextElement";
import LocationSetting from "../settings/settingThings/location";
import ToggleSetting from "../settings/settingThings/toggle";
diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js
index 2a70b8f..aa4f691 100644
--- a/features/soopyGui/index.js
+++ b/features/soopyGui/index.js
@@ -61,13 +61,14 @@ class SoopyGui extends Feature {
this.backButton.addEvent(backButtonEvent)
this.mainWindowElement.addChild(this.categoryPage)
- this.mainWindowElement.addChild(this.backButton)
this.sidebarPage = new SoopyBoxElement().setLocation(0.3, 0.2, 0.3, 0.6)
// this.sidebarPage.visable = false
this.gui.element.addChild(this.sidebarPage)
this.gui.element.addChild(this.mainWindowElement)
+
+ this.mainWindowElement.addChild(this.backButton)
this.updateButtons()
}
diff --git a/features/streamsGUI/index.js b/features/streamsGUI/index.js
new file mode 100644
index 0000000..0277eb4
--- /dev/null
+++ b/features/streamsGUI/index.js
@@ -0,0 +1,136 @@
+///
+///
+import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement";
+import Feature from "../../featureClass/class";
+import GuiPage from "../soopyGui/GuiPage";
+// import SoopyBoxElement from "../../../guimanager/GuiElement/SoopyBoxElement";
+// import SoopyMarkdownElement from "../../../guimanager/GuiElement/SoopyMarkdownElement";
+// import SoopyImageElement from "../../../guimanager/GuiElement/SoopyImageElement";
+// import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement";
+// import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent";
+
+class StreamsGui extends Feature {
+ constructor() {
+ super()
+ }
+
+ onEnable(){
+ this.initVariables()
+
+ // this.GuiPage = new StreamPage()
+ }
+
+ initVariables(){
+ this.GuiPage = undefined
+ }
+
+ onDisable(){
+ this.initVariables()
+ }
+}
+
+/*
+class StreamPage extends GuiPage {
+ constructor(){
+ super(7)
+
+ this.name = "Skyblock Streams"
+
+ this.pages = [this.newPage()]
+
+
+ this.pages[0].addChild(new SoopyTextElement().setText("§0Skyblock Streams").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1))
+
+ this.streamsBox = new SoopyGuiElement().setLocation(0.1, 0.15, 0.8, 0.85)
+
+ this.streamsBox.setScrollable(true)
+
+ this.pages[0].addChild(this.streamsBox)
+
+ this.finaliseLoading()
+ }
+
+ updateStreams(){
+ let streams = JSON.parse(FileLib.getUrlContent("http://soopymc.my.to/api/skyblockstreams"))
+
+ this.streamsBox.clearChildren()
+
+ let y = 0
+
+ Object.keys(streams.twitch).forEach((channel, i)=>{
+ let stream = streams.twitch[channel]
+
+ if(i%2===0){
+ this.streamsBox.addChild(new StreamElement().setStream(stream, true).setLocation(0, y, 0.45, 0.55).setStreamPage(this))
+ }
+ if(i%2===1){
+ this.streamsBox.addChild(new StreamElement().setStream(stream, true).setLocation(0.55, y, 0.45, 0.55).setStreamPage(this))
+ y+= 0.6
+ }
+ })
+ }
+
+ openStreamSidebar(data){
+ let sidebar = new SoopyGuiElement().setLocation(0,0,1,1)
+
+ this.openSidebarPage(sidebar)
+
+
+ }
+
+ onOpen(){
+ new Thread(()=>{
+ this.updateStreams()
+ }).start()
+ }
+}
+
+class StreamElement extends SoopyBoxElement {
+ constructor(){
+ super()
+
+ this.streamData = undefined
+
+ this.channelElement = new SoopyTextElement().setLocation(0.1,0.025,0.8,0.1).setMaxTextScale(10)
+
+ this.channelImg = new SoopyImageElement().setLocation(0.1,0.125,0.8,0.2).loadHeightFromImage()
+
+ this.titleElement = new SoopyMarkdownElement().setLocation(0.1,0.45,0.8,0.1)
+
+ this.channelImg.onImageHeightChange(()=>{
+ this.titleElement.location.location.y.set(0.15+this.channelImg.location.size.y.get())
+ },this)
+
+ this.streamPage = undefined
+
+ this.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ this.streamPage.openStreamSidebar(this.streamData)
+ }))
+
+ this.addChild(this.channelElement)
+ this.addChild(this.titleElement)
+ this.addChild(this.channelImg)
+ }
+
+ setStream(stream, twitch){
+ this.streamData = stream
+
+ this.titleElement.setText(stream.title)
+
+ this.channelElement.setText((twitch ? "§0"+stream.user_name : "§0"+stream.channelTitle) + (twitch?"&7 - " + stream.viewer_count + " viewers":""))
+
+ this.channelImg.setImage(twitch ? `https://static-cdn.jtvnw.net/previews-ttv/live_user_${stream.user_login}-640x360.jpg` : stream.thumbnails.high.url)
+
+ return this
+ }
+
+ setStreamPage(page){
+ this.streamPage = page
+
+ return this
+ }
+}*/
+
+module.exports = {
+ class: new StreamsGui()
+}
\ No newline at end of file
diff --git a/features/streamsGUI/metadata.json b/features/streamsGUI/metadata.json
new file mode 100644
index 0000000..3123559
--- /dev/null
+++ b/features/streamsGUI/metadata.json
@@ -0,0 +1,8 @@
+{
+ "name": "Streams gui",
+ "description": "Gui for skyblock streams",
+ "isHidden": true,
+ "isTogglable": false,
+ "defaultEnabled": true,
+ "sortA": 0
+}
\ No newline at end of file
diff --git a/utils/utils.js b/utils/utils.js
index 8aa2ad0..6b28979 100644
--- a/utils/utils.js
+++ b/utils/utils.js
@@ -72,7 +72,7 @@ let utils = {
ret.push(ret.length)
}
- let allOrders = functions.permutation(ret)
+ let allOrders = utils.permutation(ret)
let lastOrder = []
let lastOrderLength = Infinity
@@ -84,7 +84,7 @@ let utils = {
})
let len = 0
positions.forEach((pos)=>{
- len += functions.calculateDistance(lastPoint,pos)
+ len += utils.calculateDistance(lastPoint,pos)
lastPoint = pos
})
@@ -116,4 +116,4 @@ let utils = {
}
}
-export default utils
\ No newline at end of file
+module.exports = utils
\ No newline at end of file
--
cgit