aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/events/index.js65
-rw-r--r--features/settings/index.js163
2 files changed, 105 insertions, 123 deletions
diff --git a/features/events/index.js b/features/events/index.js
index aff9766..e3decc5 100644
--- a/features/events/index.js
+++ b/features/events/index.js
@@ -7,6 +7,7 @@ import { drawBoxAtBlock, drawBoxAtBlockNotVisThruWalls, drawCoolWaypoint, drawLi
import { calculateDistanceQuick } from "../../utils/utils";
import SettingBase from "../settings/settingThings/settingBase";
import ToggleSetting from "../settings/settingThings/toggle";
+import { fetch } from "../../utils/networkUtils"
class Events extends Feature {
constructor() {
@@ -38,8 +39,6 @@ class Events extends Feature {
this.shinyBlocks = []
- this.particleColorAverages = [0, 0, 0, 0]
-
this.lastDing = 0
this.lastDingPitch = 0
this.firstPitch = 0
@@ -47,7 +46,6 @@ class Events extends Feature {
this.firstParticlePoint = undefined
this.particlePoint = undefined
this.guessPoint = undefined
- this.particleC = 0
this.distance = undefined
this.dingIndex = 0
this.dingSlope = []
@@ -55,6 +53,7 @@ class Events extends Feature {
this.slayerLocationDataH = {}
this.todoE = []
+
this.shinyBlockOverlayEnabled = new ToggleSetting("Shiny blocks highlight", "Will highlight shiny blocks in the end", false, "shiny_blocks_overlay", this)
this.registerEvent("worldLoad", this.worldLoad)
@@ -89,7 +88,7 @@ class Events extends Feature {
})
if (this.showingWaypoints) {
if (this.guessPoint && this.showBurrialGuess.getValue()) {
- drawCoolWaypoint(this.guessPoint[0] - 0.5, this.guessPoint[1] - 0.5, this.guessPoint[2] - 0.5, 255, 255, 0, { name: "§eGuess" })
+ drawCoolWaypoint(this.guessPoint[0], this.guessPoint[1], this.guessPoint[2], 255, 255, 0, { name: "§eGuess" })
}
this.burrialData.locations.forEach((loc, i) => {
@@ -188,11 +187,10 @@ class Events extends Feature {
this.firstPitch = 0
this.lastParticlePoint = undefined
this.lastParticlePoint2 = undefined
- this.lastParticlePoint3 = undefined
+ this.lastSoundPoint = undefined
this.firstParticlePoint = undefined
this.particlePoint = undefined
this.guessPoint = undefined
- this.particleC = 0
this.distance = undefined
this.dingIndex = 0
this.dingSlope = []
@@ -219,65 +217,58 @@ class Events extends Feature {
this.lastDingPitch = pitch
this.lastParticlePoint = undefined
this.lastParticlePoint2 = undefined
- this.lastParticlePoint3 = undefined
+ this.lastSoundPoint = undefined
this.firstParticlePoint = undefined
- this.particleC = 0
}
if (this.lastDingPitch === 0) {
this.lastDingPitch = pitch
this.lastParticlePoint = undefined
this.lastParticlePoint2 = undefined
- this.lastParticlePoint3 = undefined
+ this.lastSoundPoint = undefined
this.firstParticlePoint = undefined
- this.particleC = 0
return
}
- if (this.dingSlope.length > 15) return
-
this.dingIndex++
- if (this.dingIndex > 3) this.dingSlope.push(pitch - this.lastDingPitch)
+ if (this.dingIndex > 1) this.dingSlope.push(pitch - this.lastDingPitch)
+ if (this.dingSlope.length > 15) this.dingSlope.shift()
let slope = this.dingSlope.reduce((a, b) => a + b, 0) / this.dingSlope.length
- // console.log(slope)
- this.distance = Math.E / slope
+ // console.log(this.dingSlope.join(","))
+ this.lastSoundPoint = [pos.getX(), pos.getY(), pos.getZ()]
+ this.lastDingPitch = pitch
+
+ if (!this.lastParticlePoint2 || !this.particlePoint || !this.firstParticlePoint) return
+ this.distance = Math.E / slope - Math.hypot(this.firstParticlePoint[0] - pos.getX(), this.firstParticlePoint[1] - pos.getY(), this.firstParticlePoint[2] - pos.getZ())
// console.log(this.dingIndex + " " + this.dingSlope / this.dingIndex + " " + pitch + " " + (pitch - this.lastDingPitch))
- this.lastDingPitch = pitch
- if (!this.lastParticlePoint3 || !this.particlePoint || !this.firstParticlePoint) return
- let lineDist = Math.hypot(this.lastParticlePoint3[0] - this.particlePoint[0], this.lastParticlePoint3[1] - this.particlePoint[1], this.lastParticlePoint3[2] - this.particlePoint[2])
- let distance = this.distance - Math.hypot(this.firstParticlePoint[0] - this.particlePoint[0], this.firstParticlePoint[2] - this.particlePoint[2])
- let changes = [this.particlePoint[0] - this.lastParticlePoint3[0], this.particlePoint[1] - this.lastParticlePoint3[1], this.particlePoint[2] - this.lastParticlePoint3[2]]
+ let lineDist = Math.hypot(this.lastParticlePoint2[0] - this.particlePoint[0], this.lastParticlePoint2[1] - this.particlePoint[1], this.lastParticlePoint2[2] - this.particlePoint[2])
+ let distance = this.distance
+ let changes = [this.particlePoint[0] - this.lastParticlePoint2[0], this.particlePoint[1] - this.lastParticlePoint2[1], this.particlePoint[2] - this.lastParticlePoint2[2]]
changes = changes.map(a => a / lineDist)
- this.guessPoint = [this.particlePoint[0] + changes[0] * distance, this.particlePoint[1] + changes[1] * distance, this.particlePoint[2] + changes[2] * distance]
+ this.guessPoint = [this.lastSoundPoint[0] + changes[0] * distance, this.lastSoundPoint[1] + changes[1] * distance, this.lastSoundPoint[2] + changes[2] * distance]
}
spawnParticle(particle, type, event) {
- if (this.showingWaypoints && this.showBurrialGuess.getValue() && particle.toString().startsWith("SparkFX,")) {
+ if (this.showingWaypoints && this.showBurrialGuess.getValue() && particle.toString().startsWith("EntityDropParticleFX,")) {
let run = false
- if (Math.abs(particle.getX() - Player.getX()) < 3 && Math.abs(particle.getY() - Player.getY()) < 3 && Math.abs(particle.getZ() - Player.getZ()) < 3) {
- run = true
- }
- if (this.particlePoint && !run && Math.abs(particle.getX() - this.particlePoint[0]) < 2 && Math.abs(particle.getY() - this.particlePoint[1]) < 0.5 && Math.abs(particle.getZ() - this.particlePoint[2]) < 2) {
+ if (this.lastSoundPoint && !run && Math.abs(particle.getX() - this.lastSoundPoint[0]) < 2 && Math.abs(particle.getY() - this.lastSoundPoint[1]) < 0.5 && Math.abs(particle.getZ() - this.lastSoundPoint[2]) < 2) {
run = true
}
if (run) {
- this.particleC++
- if (this.particleC > 15) return
if (this.lastParticlePoint === undefined) {
this.firstParticlePoint = [particle.getX(), particle.getY(), particle.getZ()]
}
- this.lastParticlePoint3 = this.lastParticlePoint2
this.lastParticlePoint2 = this.lastParticlePoint
this.lastParticlePoint = this.particlePoint
this.particlePoint = [particle.getX(), particle.getY(), particle.getZ()]
- if (!this.lastParticlePoint3 || !this.particlePoint || !this.firstParticlePoint || !this.distance) return
+ if (!this.lastParticlePoint2 || !this.particlePoint || !this.firstParticlePoint || !this.distance || !this.lastSoundPoint) return
- let lineDist = Math.hypot(this.lastParticlePoint3[0] - this.particlePoint[0], this.lastParticlePoint3[1] - this.particlePoint[1], this.lastParticlePoint3[2] - this.particlePoint[2])
- let distance = this.distance - Math.hypot(this.firstParticlePoint[0] - this.particlePoint[0], this.firstParticlePoint[2] - this.particlePoint[2])
- let changes = [this.particlePoint[0] - this.lastParticlePoint3[0], this.particlePoint[1] - this.lastParticlePoint3[1], this.particlePoint[2] - this.lastParticlePoint3[2]]
+ let lineDist = Math.hypot(this.lastParticlePoint2[0] - this.particlePoint[0], this.lastParticlePoint2[1] - this.particlePoint[1], this.lastParticlePoint2[2] - this.particlePoint[2])
+ let distance = this.distance
+ let changes = [this.particlePoint[0] - this.lastParticlePoint2[0], this.particlePoint[1] - this.lastParticlePoint2[1], this.particlePoint[2] - this.lastParticlePoint2[2]]
changes = changes.map(a => a / lineDist)
- this.guessPoint = [this.particlePoint[0] + changes[0] * distance, this.particlePoint[1] + changes[1] * distance, this.particlePoint[2] + changes[2] * distance]
+ this.guessPoint = [this.lastSoundPoint[0] + changes[0] * distance, this.lastSoundPoint[1] + changes[1] * distance, this.lastSoundPoint[2] + changes[2] * distance]
}
}
if (this.shinyBlockOverlayEnabled.getValue() && this.FeatureManager.features["dataLoader"].class.areaFine === "The End") {
@@ -404,11 +395,6 @@ class Events extends Feature {
if (this.potentialParticleLocs[locstr].enchant >= 1 && this.potentialParticleLocs[locstr].step >= 2) {
if (found) {
found.type = this.potentialParticleLocs[locstr].isMob >= 1 ? 1 : (this.potentialParticleLocs[locstr].crit > this.potentialParticleLocs[locstr].enchant / 20 ? 0 : 2)
-
- if (this.potentialParticleLocs[locstr].step === 10) {
- this.potentialParticleLocs[locstr].step++
- socketConnection.burrialSpawned(locstr)
- }
return
}
this.burrialData.locations.push({
@@ -426,7 +412,6 @@ class Events extends Feature {
}
burrialClicked() {
- this.particleColorAverages = [0, 0, 0, 0]
if (this.inquisWaypointSpawned) {
socketConnection.sendInquisData({ loc: null });
this.inquisWaypointSpawned = false
diff --git a/features/settings/index.js b/features/settings/index.js
index 6888f8a..30f653f 100644
--- a/features/settings/index.js
+++ b/features/settings/index.js
@@ -20,15 +20,15 @@ class SettingsRenderer extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.SettingPage = new SettingPage()
this.EditLocationsPage = new EditLocationsPage()
this.SettingPage.FeatureManager = this.FeatureManager
- this.registerStep(true, 1, ()=>{
- if(!this.EditLocationsPage) return
-
- if(this.EditLocationsPage.needsExitPage){
+ this.registerStep(true, 1, () => {
+ if (!this.EditLocationsPage) return
+
+ if (this.EditLocationsPage.needsExitPage) {
this.EditLocationsPage.goToPage(0, 500)
this.EditLocationsPage.needsExitPage = false
}
@@ -36,66 +36,66 @@ class SettingsRenderer extends Feature {
}
- onDisable(){
+ onDisable() {
this.EditLocationsPage = undefined
this.SettingPage = undefined
}
}
class EditLocationsPage extends GuiPage {
-
- constructor(){
+
+ constructor() {
super(9)
-
+
this.name = "Edit GUI Locations"
this.needsExitPage = false
this.soopyGui = new SoopyGui()
- this.soopyGui._renderBackground = ()=>{} //remove background darkening
+ this.soopyGui._renderBackground = () => { } //remove background darkening
+
-
- this.soopyGui.ctGui.registerDraw((mouseX, mouseY, partialTicks)=>{
+ this.soopyGui.ctGui.registerDraw((mouseX, mouseY, partialTicks) => {
this.renderGui(mouseX, mouseY)
this.soopyGui._render(mouseX, mouseY, partialTicks)
})
- this.soopyGui.ctGui.registerClicked((mouseX, mouseY, button)=>{
+ this.soopyGui.ctGui.registerClicked((mouseX, mouseY, button) => {
this.clicked(mouseX, mouseY)
this.soopyGui._onClick(mouseX, mouseY, button)
})
- this.soopyGui.ctGui.registerMouseReleased((mouseX, mouseY)=>{
+ this.soopyGui.ctGui.registerMouseReleased((mouseX, mouseY) => {
this.released(mouseX, mouseY)
})
this.finaliseLoading()
}
-
- renderGui(mouseX, mouseY){
- for(let setting of locationSettingHolder.getData()){
- if(setting.parent){
- if(setting.parent.isEnabled()){
+
+ renderGui(mouseX, mouseY) {
+ for (let setting of locationSettingHolder.getData()) {
+ if (setting.parent) {
+ if (setting.parent.isEnabled()) {
setting.renderGui(mouseX, mouseY)
}
- }else{
+ } else {
setting.renderGui(mouseX, mouseY)
}
}
}
- clicked(mouseX, mouseY){
- for(let setting of locationSettingHolder.getData()){
- if(setting.clicked(mouseX, mouseY)) return //dont allow the user to drag 2 locations at once
+ clicked(mouseX, mouseY) {
+ for (let setting of locationSettingHolder.getData()) {
+ if (setting.clicked(mouseX, mouseY)) return //dont allow the user to drag 2 locations at once
}
}
- released(mouseX, mouseY){
- for(let setting of locationSettingHolder.getData()){
+ released(mouseX, mouseY) {
+ for (let setting of locationSettingHolder.getData()) {
setting.released(mouseX, mouseY)
}
}
- onOpen(){
+ onOpen() {
this.needsExitPage = true
this.soopyGui.open()
@@ -103,9 +103,9 @@ class EditLocationsPage extends GuiPage {
}
class SettingPage extends GuiPage {
- constructor(){
+ constructor() {
super(10)
-
+
this.name = "Settings"
this.pages = [this.newPage(), this.newPage()]
@@ -118,20 +118,20 @@ class SettingPage extends GuiPage {
this.SettingPage = undefined
- this.pages[0].addEvent(new SoopyRenderEvent().setHandler(()=>{this.updateLocs()}))
+ this.pages[0].addEvent(new SoopyRenderEvent().setHandler(() => { this.updateLocs() }))
//###############################################################################################
// Settings Category Page
//###############################################################################################
-
+
let settingsCategoryTitle = new SoopyTextElement().setText("§0Settings").setMaxTextScale(3).setLocation(0.1, 0.05, 0.5, 0.1)
this.pages[0].addChild(settingsCategoryTitle)
this.settingsCategorySearch = new TextBox().setPlaceholder("Search...").setLocation(0.6, 0.05, 0.3, 0.1)
this.pages[0].addChild(this.settingsCategorySearch)
- this.settingsCategorySearch.text.addEvent(new SoopyContentChangeEvent().setHandler(()=>{
+ this.settingsCategorySearch.text.addEvent(new SoopyContentChangeEvent().setHandler(() => {
this.updateSettingCategories()
}))
@@ -153,7 +153,7 @@ class SettingPage extends GuiPage {
this.finaliseLoading()
}
- onOpen(){
+ onOpen() {
this.updateSettingCategories()
this.settingsCategoryArea.location.scroll.x.set(0, 0)
this.settingsCategoryArea.location.scroll.y.set(0, 0)
@@ -163,13 +163,13 @@ class SettingPage extends GuiPage {
this.updateSettingCategories()
}
- onOpenPage(p){
- if(p===1) this.updateSettingCategories()
+ onOpenPage(p) {
+ if (p === 1) this.updateSettingCategories()
this.closeSidebarPage()
}
- updateSettingCategories(){
+ updateSettingCategories() {
let search = this.settingsCategorySearch.text.text
@@ -177,50 +177,50 @@ class SettingPage extends GuiPage {
let height = 0
- Object.keys(this.FeatureManager.featureMetas).sort((a, b)=>{return a.sortA-b.sortA}).forEach((f)=>{
+ Object.keys(this.FeatureManager.featureMetas).sort((a, b) => { return a.sortA - b.sortA }).forEach((f) => {
let meta = this.FeatureManager.featureMetas[f]
let showing = search.length === 0
- if(!showing){
+ if (!showing) {
showing = meta.name.toLowerCase().includes(search.toLowerCase()) || meta.description.toLowerCase().includes(search.toLowerCase())
}
- if(!showing){
- settingsCommunicator.getModuleSettings(f).forEach(setting=>{
+ if (!showing) {
+ settingsCommunicator.getModuleSettings(f).forEach(setting => {
- if(setting && (setting.name.toLowerCase().includes(search.toLowerCase()) || setting.description.toLowerCase().includes(search.toLowerCase()))){
+ if (setting && (setting.name.toLowerCase().includes(search.toLowerCase()) || setting.description.toLowerCase().includes(search.toLowerCase()))) {
showing = true
}
})
}
- if(!showing) return
+ if (!showing) return
let isHidden = meta.isHidden
- if(typeof isHidden === "string"){
+ if (typeof isHidden === "string") {
isHidden = require("../" + f + "/" + isHidden).hidden(this.FeatureManager)
}
- if(isHidden) return
+ if (isHidden) return
- let category = new ButtonWithArrowAndDescription().setText("&0" + meta.name).setDesc("&0" +meta.description).setLocation(0, height, 1, 0.2)
- category.addEvent(new SoopyMouseClickEvent().setHandler(()=>{this.clickedOpenCategory(f)}))
+ let category = new ButtonWithArrowAndDescription().setText("&0" + meta.name).setDesc("&0" + meta.description).setLocation(0, height, 1, 0.2)
+ category.addEvent(new SoopyMouseClickEvent().setHandler(() => { this.clickedOpenCategory(f) }))
this.settingsCategoryArea.addChild(category)
- height+=0.225
+ height += 0.225
-
- if(search.length > 0){
- settingsCommunicator.getModuleSettings(f).forEach(setting=>{
- if(setting && (setting.name.toLowerCase().includes(search.toLowerCase()) || setting.description.toLowerCase().includes(search.toLowerCase()))){
+ if (search.length > 0) {
+ settingsCommunicator.getModuleSettings(f).forEach(setting => {
+
+ if (setting && (setting.name.toLowerCase().includes(search.toLowerCase()) || setting.description.toLowerCase().includes(search.toLowerCase()))) {
setting.getGuiObject().location.location.y.set(height, 0)
this.settingsCategoryArea.addChild(setting.getGuiObject())
-
- height += 0.025+setting.getGuiObject().location.size.y.get()
+
+ height += 0.025 + setting.getGuiObject().location.size.y.get()
setting.update()
}
@@ -232,7 +232,7 @@ class SettingPage extends GuiPage {
// this.FeatureManager.features = {}; enabled features
}
- updateSettings(category){
+ updateSettings(category) {
let meta = this.FeatureManager.featureMetas[category]
this.settingsArea.children = []
@@ -241,82 +241,79 @@ class SettingPage extends GuiPage {
let height = 0
- if(meta.isTogglable){
+ if (meta.isTogglable) {
let toggle = new BoxWithToggleAndDescription().setLocation(0, height, 1, 0.2).setText("&0Main toggle").setDesc("&0This is the main toggle for the whole category")
this.settingsArea.addChild(toggle)
toggle.toggle.setValue(this.FeatureManager.isFeatureLoaded(category), 0)
- toggle.toggle.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{
+ toggle.toggle.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => {
//dont allow editing if currenately loading/unloading it
- if(this.modifyingFeature){
+ if (this.modifyingFeature) {
resetFun()
return
}
//toggle the feature
this.modifyingFeature = true
- new Thread(()=>{
- this.FeatureManager.featureSettingsData[category].enabled = newVal
- this.FeatureManager.featureSettingsDataLastUpdated = true
+ this.FeatureManager.featureSettingsData[category].enabled = newVal
+ this.FeatureManager.featureSettingsDataLastUpdated = true
- if(!newVal && this.FeatureManager.isFeatureLoaded(category)){
- this.FeatureManager.unloadFeature(category)
- }
- if(newVal && !this.FeatureManager.isFeatureLoaded(category)){
- this.FeatureManager.loadFeature(category)
- }
+ if (!newVal && this.FeatureManager.isFeatureLoaded(category)) {
+ this.FeatureManager.unloadFeature(category)
+ }
+ if (newVal && !this.FeatureManager.isFeatureLoaded(category)) {
+ this.FeatureManager.loadFeature(category)
+ }
- Thread.sleep(100)
- this.modifyingFeature = false
-
- this.updateSettings(category)
- }).start()
+ this.modifyingFeature = false
+
+ this.updateSettings(category)
}))
- height += toggle.location.size.y.get()+0.045
+ height += toggle.location.size.y.get() + 0.045
}
- if(!this.FeatureManager.isFeatureLoaded(category)){
+ if (!this.FeatureManager.isFeatureLoaded(category)) {
//only show if feature issnt loaded
let textBox = new SoopyBoxElement().setLocation(0, height, 1, 0.2)
- .addChild(new SoopyTextElement().setText("&0Feature not loaded").setLocation(0, 0, 1, 0.5))
- .addChild(new SoopyTextElement().setText("&0Load feature to access settings").setLocation(0, 0.5, 1, 0.5))
+ .addChild(new SoopyTextElement().setText("&0Feature not loaded").setLocation(0, 0, 1, 0.5))
+ .addChild(new SoopyTextElement().setText("&0Load feature to access settings").setLocation(0, 0.5, 1, 0.5))
this.settingsArea.addChild(textBox)
return;
}
- settingsCommunicator.getModuleSettings(category).forEach(setting=>{
+ settingsCommunicator.getModuleSettings(category).forEach(setting => {
setting.getGuiObject().location.location.y.set(height, 0)
this.settingsArea.addChild(setting.getGuiObject())
- height += 0.045+setting.getGuiObject().location.size.y.get()
-
+ height += 0.045 + setting.getGuiObject().location.size.y.get()
+
setting.update()
})
}
- updateLocs(){
+ updateLocs() {
let totalHeight = 0
- this.settingsArea.children.forEach(e=>{
+ this.settingsArea.children.forEach(e => {
e.location.location.y.set(totalHeight, 0)
- totalHeight += e.location.size.y.get()+Math.min(0.045,e.location.size.y.get())
+ totalHeight += e.location.size.y.get() + Math.min(0.045, e.location.size.y.get())
})
totalHeight = 0
- this.settingsCategoryArea.children.forEach(e=>{
+ this.settingsCategoryArea.children.forEach(e => {
e.location.location.y.set(totalHeight, 0)
- totalHeight += e.location.size.y.get()+Math.min(0.025,e.location.size.y.get())
+ totalHeight += e.location.size.y.get() + Math.min(0.025, e.location.size.y.get())
})
}
- clickedOpenCategory(category){
+ clickedOpenCategory(category) {
this.updateSettings(category)
this.goToPage(2)