aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/events/index.js2
-rw-r--r--features/settings/helpDataLoader.js46
-rw-r--r--features/settings/index.js4
-rw-r--r--features/settings/settingThings/settingBase.js29
-rw-r--r--features/soopyGui/index.js2
5 files changed, 82 insertions, 1 deletions
diff --git a/features/events/index.js b/features/events/index.js
index 7ce40c8..664b675 100644
--- a/features/events/index.js
+++ b/features/events/index.js
@@ -227,6 +227,8 @@ class Events extends Feature {
let locsAccessed = []
let newLocs = []
+ if(!profileData.griffin) return
+
profileData.griffin.burrows.forEach((burrow)=>{
let pushed = false
this.burrialData.locations.forEach((loc, i)=>{
diff --git a/features/settings/helpDataLoader.js b/features/settings/helpDataLoader.js
new file mode 100644
index 0000000..aadbd93
--- /dev/null
+++ b/features/settings/helpDataLoader.js
@@ -0,0 +1,46 @@
+import { fetch } from "../../utils/networkUtils";
+
+class HelpDataLoader {
+ constructor() {
+ this.availableHelpData = {}
+ this.dataCach = {}
+
+ fetch("http://soopymc.my.to/api/soopyv2/settingshelpoptions.json").json(data=>{
+ Object.keys(data).forEach(category=>{
+ this.availableHelpData[category] = new Set(data[category])
+ });
+ })
+ }
+
+ hasData(category, id){
+ return this.availableHelpData[category] && this.availableHelpData[category].has(id)
+ }
+
+ getData(category, id, callback){
+ if(!this.hasData(category, id)){
+ callback("")
+ return
+ }
+
+ if(this.dataCach[category] && this.dataCach[category][id]){
+ callback(this.dataCach[category][id])
+ return
+ }
+
+ fetch("http://soopymc.my.to/api/soopyv2/settingshelp/" + category + "/" + id).text(data=>{
+ if(!this.dataCach[category]){
+ this.dataCach[category] = {}
+ }
+
+ this.dataCach[category][id] = data
+
+ callback(data)
+ })
+ }
+}
+
+if(!global.helpDataLoader){
+ global.helpDataLoader = new HelpDataLoader();
+}
+
+export default global.helpDataLoader; \ No newline at end of file
diff --git a/features/settings/index.js b/features/settings/index.js
index 9426337..3ff2a48 100644
--- a/features/settings/index.js
+++ b/features/settings/index.js
@@ -204,6 +204,8 @@ class SettingPage extends GuiPage {
this.settingsCategoryArea.addChild(setting.getGuiObject())
height += 0.025+setting.getGuiObject().location.size.y.get()
+
+ setting.update()
}
})
}
@@ -274,6 +276,8 @@ class SettingPage extends GuiPage {
this.settingsArea.addChild(setting.getGuiObject())
height += 0.045+setting.getGuiObject().location.size.y.get()
+
+ setting.update()
})
}
diff --git a/features/settings/settingThings/settingBase.js b/features/settings/settingThings/settingBase.js
index 55dacc3..8093179 100644
--- a/features/settings/settingThings/settingBase.js
+++ b/features/settings/settingThings/settingBase.js
@@ -1,8 +1,12 @@
import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent";
+import SoopyMouseClickEvent from "../../../../guimanager/EventListener/SoopyMouseClickEvent";
+import BoxWithText from "../../../../guimanager/GuiElement/BoxWithText";
import BoxWithTextAndDescription from "../../../../guimanager/GuiElement/BoxWithTextAndDescription"
import SoopyGuiElement from "../../../../guimanager/GuiElement/SoopyGuiElement";
import renderLibs from "../../../../guimanager/renderLibs";
+import helpDataLoader from "../helpDataLoader";
import settingsCommunicator from "../settingsCommunicator";
+import SoopyMarkdownElement from "../../../../guimanager/GuiElement/SoopyMarkdownElement";
class SettingBase {
constructor(name, description, defaultVal, settingId, module){
@@ -21,6 +25,17 @@ class SettingBase {
this.guiObject.addChild(this.settingObject)
+ this.helpButton = new BoxWithText().setText("ยง0?").setLocation(3, 3, 0.05, 0.5)
+ this.helpButton.location.location.setRelative(false, false)
+
+ this.helpButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ module.FeatureManager.features.soopyGui.class.openSidebarPage(new SoopyGuiElement().setLocation(0.05,0.05,0.9,0.9).setScrollable(true).addChild(new SoopyMarkdownElement().setLocation(0,0,1,1).setText("Loading...")))
+
+ this.getHelp(helpText=>{
+ module.FeatureManager.features.soopyGui.class.openSidebarPage(new SoopyGuiElement().setLocation(0.05,0.05,0.9,0.9).setScrollable(true).addChild(new SoopyMarkdownElement().setLocation(0,0,1,1).setText(helpText)))
+ })
+ }))
+
settingsCommunicator.addSetting(this.moduleId, settingId, this)
if(!module.FeatureManager.featureSettingsData[this.moduleId]){
@@ -46,6 +61,20 @@ class SettingBase {
this.initTime = Date.now()
}
+ update(){
+ if(this.hasHelp()){
+ this.guiObject.addChild(this.helpButton)
+ }
+ }
+
+ hasHelp(){
+ return helpDataLoader.hasData(this.moduleId, this.settingId)
+ }
+
+ getHelp(callback){
+ helpDataLoader.getData(this.moduleId, this.settingId, callback)
+ }
+
getValue(){
return this.val;
}
diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js
index 0f223e1..6cb271c 100644
--- a/features/soopyGui/index.js
+++ b/features/soopyGui/index.js
@@ -186,7 +186,7 @@ class SoopyGui extends Feature {
this.backButton.location.location.y.set((pageNum === 0 || !this.currCategory.showBackButton)?-0.2:0, animate?500:0)
- this.currCategory.onOpenPage(pageNum)
+ if(this.currCategory) this.currCategory.onOpenPage(pageNum)
}
openSidebarPage(child){
this.sidebarPage.location.location.x.set(0.625, 500)