aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-02-04 16:10:29 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-02-04 16:10:29 +0800
commit7882632751f1132e67dcee92389e82317b8db123 (patch)
tree833899d85393b046304ffb2f5db50e52ddddd005 /features
parentf724d7e9f5ec6d5e2f004a240f5117a41a752dc8 (diff)
downloadSoopyV2-7882632751f1132e67dcee92389e82317b8db123.tar.gz
SoopyV2-7882632751f1132e67dcee92389e82317b8db123.tar.bz2
SoopyV2-7882632751f1132e67dcee92389e82317b8db123.zip
maby fix buttons like settings not showing up in /soopyv2 menu
Diffstat (limited to 'features')
-rw-r--r--features/dataLoader/index.js2
-rw-r--r--features/globalSettings/index.js4
-rw-r--r--features/hud/index.js3
-rw-r--r--features/soopyGui/GuiPage.js13
-rw-r--r--features/soopyGui/categoryManager.js37
-rw-r--r--features/soopyGui/index.js34
6 files changed, 53 insertions, 40 deletions
diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js
index 27ab173..b4fb31a 100644
--- a/features/dataLoader/index.js
+++ b/features/dataLoader/index.js
@@ -78,7 +78,7 @@ class DataLoader extends Feature {
this.stats["Area"] = undefined
this.stats["Dungeon"] = undefined
- if(World.getWorld() && TabList.getNames()){
+ if(World.isLoaded() && TabList.getNames()){
TabList.getNames().forEach(n=>{
n = ChatLib.removeFormatting(n)
if(n.includes(": ")){
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index a958628..f98bab6 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -55,7 +55,7 @@ class Hud extends Feature {
if(!this.firstLoadPageData.shown){
new Thread(()=>{
- while(!World || !this.FeatureManager.finishedLoading){
+ while(!World.isLoaded() || !this.FeatureManager.finishedLoading){
Thread.sleep(100)
}
Thread.sleep(500)
@@ -147,7 +147,7 @@ class Hud extends Feature {
}
showFirstLoadPage(){
- if(!this.ranFirstLoadThing && World && !this.firstLoadPageData.shown){
+ if(!this.ranFirstLoadThing && World.isLoaded() && !this.firstLoadPageData.shown){
ChatLib.chat(this.FeatureManager.messagePrefix + "Opening first load page, if you accidentally close it run /soopyv2 and click the button")
ChatLib.command("soopyv2 first_load_thing", true)
this.ranFirstLoadThing = true
diff --git a/features/hud/index.js b/features/hud/index.js
index d256d41..de37a64 100644
--- a/features/hud/index.js
+++ b/features/hud/index.js
@@ -110,7 +110,7 @@ class Hud extends Feature {
this.guidedSheepCooldownSetting = new ToggleSetting("Show Guided Sheep / Explosive Shot Cooldown", "This will render a small cooldown below your crosshair", true, "guided_sheep_cooldown_enabled", this)
- this.showSpotifyPlaying = new ToggleSetting("Show Current Playing Spotify Song", "(Only tested with spotify from windows store)", false, "spotify_now_playing", this)
+ this.showSpotifyPlaying = new ToggleSetting("Show Current Playing Spotify Song", "(WINDOWS + Spotify Desktop only)", false, "spotify_now_playing", this)
this.spotifyElement = new HudTextElement()
.setText("&6Spotify&7> ")
.setBaseEditWidth(Renderer.getStringWidth("Spotify> ")+150)
@@ -595,6 +595,7 @@ class Hud extends Feature {
apiLoad(data, dataType, isSoopyServer, isLatest){
if(dataType === "skyblock" && !isSoopyServer){
+ console.log(this.constructor.name)
this.statApiLoadThingo(data)
}
if(!isSoopyServer || !isLatest) return
diff --git a/features/soopyGui/GuiPage.js b/features/soopyGui/GuiPage.js
index 1ae10fe..812c831 100644
--- a/features/soopyGui/GuiPage.js
+++ b/features/soopyGui/GuiPage.js
@@ -1,4 +1,5 @@
import SoopyGuiElement from '../../../guimanager/GuiElement/SoopyGuiElement.js';
+import categoryManager from './categoryManager.js';
class GuiPage{
constructor(priority){
@@ -12,10 +13,6 @@ class GuiPage{
}
this.soopyGui = global.soopyv2featuremanagerthing.features["soopyGui"].class;
-
- if(this.finalisedLoading){
- this.finaliseLoading()
- }
}).start()
this.name = ""
@@ -26,11 +23,7 @@ class GuiPage{
}
finaliseLoading(){
- if(!this.soopyGui){
- this.finalisedLoading = true
- return
- }
- this.soopyGui.addCategory(this);
+ categoryManager.addCategory(this);
}
newPage(){
@@ -56,7 +49,7 @@ class GuiPage{
}
delete(){
- this.soopyGui.deleteCategory(this);
+ categoryManager.deleteCategory(this)
}
//Override me :D
diff --git a/features/soopyGui/categoryManager.js b/features/soopyGui/categoryManager.js
new file mode 100644
index 0000000..6709ff4
--- /dev/null
+++ b/features/soopyGui/categoryManager.js
@@ -0,0 +1,37 @@
+class CategoryManager {
+ constructor(){
+ this.categorys = {}
+
+ this.arr = []
+ }
+
+ addCategory(category){
+ // this.pages = this.pages.filter(a=>a.name!==category.name)
+
+ this.categorys[category.name] = (category)
+ this.update()
+ }
+
+ deleteCategory(category){
+ delete this.categorys[category.name]
+ this.update()
+ }
+
+ update(){
+
+ this.arr = Object.values(this.categorys).sort((a, b)=>{
+ return b.priority - a.priority
+ })
+ }
+}
+
+
+if(!global.soopyv2CategoryManager){
+ global.soopyv2CategoryManager = new CategoryManager()
+
+ register("gameUnload", ()=>{
+ global.soopyv2CategoryManager = undefined
+ })
+}
+
+export default global.soopyv2CategoryManager \ No newline at end of file
diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js
index 45e97a6..13a8813 100644
--- a/features/soopyGui/index.js
+++ b/features/soopyGui/index.js
@@ -9,6 +9,7 @@ import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow";
import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent";
import SoopyOpenGuiEvent from "../../../guimanager/EventListener/SoopyOpenGuiEvent";
import SoopyGui2 from "../../../guimanager/SoopyGui";
+import categoryManager from "./categoryManager";
class SoopyGui extends Feature {
@@ -17,7 +18,6 @@ class SoopyGui extends Feature {
this.gui = undefined
- this.pages = []
this.currentPage = 0
this.backButton = undefined
@@ -78,7 +78,7 @@ class SoopyGui extends Feature {
this.gui.open()
if(page){
- this.pages.forEach(p=>{
+ this.getPages().forEach(p=>{
if(p.name.replace(/ /g, "_").toLowerCase() === page.toLowerCase()){
this.clickedOpen(p, false)
}
@@ -86,20 +86,8 @@ class SoopyGui extends Feature {
}
}
- addCategory(category){
- // this.pages = this.pages.filter(a=>a.name!==category.name)
-
- this.pages.push(category)
- this.sortPages()
-
- this.updateButtons()
- }
-
- deleteCategory(category){
- this.pages = this.pages.filter(a=>a!==category)
- this.sortPages()
-
- this.updateButtons()
+ getPages(){
+ return categoryManager.arr
}
updateButtons(){
@@ -107,7 +95,7 @@ class SoopyGui extends Feature {
this.buttonListElm.children = []
- this.pages.forEach((p, i)=>{
+ 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)
@@ -137,18 +125,11 @@ class SoopyGui extends Feature {
category.onOpen()
}
- sortPages(){
- this.pages = this.pages.sort((a, b)=>{
- return b.priority - a.priority
- })
- }
-
onDisable(){
this.gui.delete()
this.gui = undefined
- this.pages = []
this.currentPage = 0
this.backButton = undefined
this.activePages = []
@@ -169,7 +150,7 @@ class SoopyGui extends Feature {
this.currentPage = pageNum
- this.pages.forEach((p)=>{
+ this.getPages().forEach((p)=>{
Object.values(p.pages).forEach((e, i)=>{
e.location.location.x.set(i-pageNum+1, animate?500:0)
})
@@ -185,9 +166,10 @@ class SoopyGui extends Feature {
if(pageNum===0){
this.currCategory = undefined
this.closeSidebarPage()
+ this.updateButtons()
}
- this.pages.forEach((p)=>{
+ this.getPages().forEach((p)=>{
Object.values(p.pages).forEach((e, i)=>{
e.location.location.x.set(i-pageNum+1, animate?500:0)
})