aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
Diffstat (limited to 'features')
-rw-r--r--features/events/index.js873
-rw-r--r--features/streamsGUI/index.js87
-rw-r--r--features/waypoints/index.js6
3 files changed, 499 insertions, 467 deletions
diff --git a/features/events/index.js b/features/events/index.js
index 61ba36e..5190808 100644
--- a/features/events/index.js
+++ b/features/events/index.js
@@ -1,5 +1,6 @@
/// <reference types="../../../CTAutocomplete" />
/// <reference lib="es2015" />
+import { m } from "../../../mappings/mappings";
import Feature from "../../featureClass/class";
import socketConnection from "../../socketConnection";
import { drawBoxAtBlock, drawBoxAtBlockNotVisThruWalls, drawCoolWaypoint, drawLine } from "../../utils/renderUtils";
@@ -8,427 +9,459 @@ import SettingBase from "../settings/settingThings/settingBase";
import ToggleSetting from "../settings/settingThings/toggle";
class Events extends Feature {
- constructor() {
- super()
- }
-
- onEnable() {
- this.initVariables()
-
- this.burrialData = {
- points: [],
- locations: [],
- historicalLocations: []
- }
- this.lastWorldChange = 0
- this.lastRequest = 0
- this.potentialParticleLocs = {}
- this.showingWaypoints = false
- this.lastPath = []
- this.updatingPath = false
- this.lastPathCords = undefined
-
-
- this.loadFromParticles = new ToggleSetting("Load burrials from particles", "Will load particles from burrows in the world", true, "burrial_from_partles", this)
- this.showBurrialGuess = new ToggleSetting("Estimate burrial location from ability", "Will show a line + box where it thinks the burrial is", true, "burrial_guess", this)
- new SettingBase("NOTE: You must have music disabled for burrial guessess to work", "/togglemusic", false, "burrial_guess_into", this).requires(this.showBurrialGuess)
-
- this.otherInquisWaypoints = new ToggleSetting("Show other users inquis locations", "May be usefull for loot share", true, "inquis_location_other", this)
-
- this.shinyBlocks = []
-
- this.lastDing = 0
- this.lastDingPitch = 0
- this.firstPitch = 0
- this.lastParticlePoint = undefined
- this.particlePoint = undefined
- this.guessPoint1 = undefined
- this.guessPoint = undefined
- this.guessPoint2 = undefined
- this.dingIndex = 0
-
- 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)
- this.registerEvent("spawnParticle", this.spawnParticle).registeredWhen(() => this.showingWaypoints)
- this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.showingWaypoints || this.shinyBlockOverlayEnabled.getValue())
- this.registerStep(true, 2, this.step)
- this.registerStep(false, 5, this.step_5s)
-
- this.registerEvent("soundPlay", this.playSound).registeredWhen(() => this.showingWaypoints)
- this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.showingWaypoints);
-
- this.registerChat("&r&eYou dug out a Griffin Burrow! &r&7(${*}/4)&r", this.burrialClicked)
- this.registerChat("&r&eYou finished the Griffin burrow chain! &r&7(4/4)&r", this.burrialClicked)
- this.inquisWaypointSpawned = false
- }
-
- entityJoinWorldEvent(e) {
- this.todoE.push(e.entity);
- }
-
- inquisData(loc, user) {
- if (!loc) {
- delete this.slayerLocationDataH[user]
- return
- }
- this.slayerLocationDataH[user] = [loc, Date.now()]
- }
-
- renderWorld(ticks) {
- this.shinyBlocks.forEach(([loc]) => {
- drawBoxAtBlockNotVisThruWalls(loc[0], loc[1], loc[2], 0, 255, 0, 0.1, 0.1)
- })
- 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" })
- drawLine(this.guessPoint1[0], this.guessPoint1[1], this.guessPoint1[2], this.guessPoint2[0], this.guessPoint2[1], this.guessPoint2[2], 255, 255, 0)
- }
- this.burrialData.locations.forEach((loc, i) => {
-
- let typeReplace = [
- "Start",
- "Mob",
- "Treasure",
- "Finish",
- "Unknown"
- ]
- if (!loc.clicked) {
- blue = false
- if (loc.lastPing && Date.now() - loc.lastPing < 500) {
- blue = true
- }
-
- let name = ""
-
- if (loc.fromApi) {
- name = (loc.nearest ? "§c" : "§a") + "(" + (loc.chain + 1) + "/4) " + typeReplace[loc.type] + " burrial"
- } else {
- name = (loc.nearest ? "§c" : "§a") + typeReplace[loc.type] + " burrial"
- }
-
- drawCoolWaypoint(loc.x, loc.y, loc.z, 0, blue ? 100 : 255, blue ? 255 : 0, { name: name })
- }
- })
- }
-
- if (this.otherInquisWaypoints.getValue()) {
- Object.keys(this.slayerLocationDataH).forEach(key => {
- drawCoolWaypoint(this.slayerLocationDataH[key][0][0], this.slayerLocationDataH[key][0][1], this.slayerLocationDataH[key][0][2], 255, 0, 0, { name: key + "'s inquis" })
- })
- }
- }
-
- sortBurrialLocations() {
- let sorted = [...this.burrialData.locations]
- sorted.sort((a, b) => {
- let aDist = calculateDistanceQuick([Player.getX(), Player.getY(), Player.getZ()], [a.x + 0.5, a.y + 2.5, a.z + 0.5])
- let bDist = calculateDistanceQuick([Player.getX(), Player.getY(), Player.getZ()], [b.x + 0.5, b.y + 2.5, b.z + 0.5])
-
- return bDist - aDist
- })
- this.burrialData.locations = sorted
- }
-
- step() {
- if (!Player.getInventory()) return
-
- hasDianaShovle = false
- let slots = [0, 1, 2, 3, 4, 5, 6, 7, 8]
- slots.forEach(a => {
- item = Player.getInventory().getStackInSlot(a)
- if (!item) return
- if (ChatLib.removeFormatting(item.getName()) === "Ancestral Spade") {
- hasDianaShovle = true
- }
- })
-
- let showingWaypointsNew = (this.lastWorldChange + 5000 < Date.now() ? hasDianaShovle && this.FeatureManager.features["dataLoader"].class.area === "Hub" && this.loadFromParticles.getValue() : this.showingWaypoints || (hasDianaShovle && this.FeatureManager.features["dataLoader"].class.area === "Hub" && this.loadFromParticles.getValue()))
-
- this.showingWaypoints = showingWaypointsNew
-
- this.shinyBlocks = this.shinyBlocks.filter(([loc, time]) => {
- return time > Date.now() - 5000
- })
-
- if (this.lastParticlePoint && this.showBurrialGuess.getValue() && Date.now() - this.lastDing > 500 && Date.now() - this.lastDing < 100000) {
- // console.log(this.firstPitch, this.lastDingPitch, this.lastDingPitch / this.firstPitch)
- this.lastDing = 0
-
- let distance1 = 142.837 / ((this.lastDingPitch / this.firstPitch) - 0.984354) - 57.1417
- let distance = 142.837 / ((this.lastDingPitch / this.firstPitch + 0.025) - 0.984354) - 57.1417
- let distance2 = 142.837 / ((this.lastDingPitch / this.firstPitch + 0.05) - 0.984354) - 67.1417
-
-
- // this.lastParticlePoint = undefined
- // this.particlePoint = undefined
- let lineDist = Math.hypot(this.lastParticlePoint[0] - this.particlePoint[0], this.lastParticlePoint[1] - this.particlePoint[1], this.lastParticlePoint[2] - this.particlePoint[2])
- let changes = [this.particlePoint[0] - this.lastParticlePoint[0], this.particlePoint[1] - this.lastParticlePoint[1], this.particlePoint[2] - this.lastParticlePoint[2]]
- changes = changes.map(a => a / lineDist)
-
- let finalPoint1 = [this.particlePoint[0] + changes[0] * distance1, this.particlePoint[1] + changes[1] * distance1, this.particlePoint[2] + changes[2] * distance1]
- this.guessPoint1 = finalPoint1
- let finalPoint = [this.particlePoint[0] + changes[0] * distance, this.particlePoint[1] + changes[1] * distance, this.particlePoint[2] + changes[2] * distance]
- this.guessPoint = finalPoint
- let finalPoint2 = [this.particlePoint[0] + changes[0] * distance2, this.particlePoint[1] + changes[1] * distance2, this.particlePoint[2] + changes[2] * distance2]
- this.guessPoint2 = finalPoint2
-
- if (this.showingWaypoints) Client.showTitle("&cGo!", "", 0, 20, 20)
- }
-
-
- Object.keys(this.slayerLocationDataH).forEach(n => {
- if (this.slayerLocationDataH[n][1] + 60000 * 3 < Date.now()) {
- delete this.slayerLocationDataH[n]
- }
- })
-
- this.todoE.forEach(e => {
- e = new Entity(e)
- if (e.getName().toLowerCase().includes("inquis") && Math.abs(e.getY() - Player.getY()) < 10 && Math.abs(e.getX() - Player.getX()) < 10 && Math.abs(e.getZ() - Player.getZ()) < 10) {
- socketConnection.sendInquisData({ loc: [Math.round(Player.getX()), Math.round(Player.getY()), Math.round(Player.getZ())] });
- this.inquisWaypointSpawned = true
- }
- })
- this.todoE = []
- }
-
- step_5s() {
- this.sortBurrialLocations()
- }
-
- worldLoad() {
- this.burrialData.points = []
- this.burrialData.locations = []
- this.burrialData.historicalLocations = []
- this.lastDing = 0
- this.lastDingPitch = 0
- this.firstPitch = 0
- this.lastParticlePoint = undefined
- this.particlePoint = undefined
- this.guessPoint1 = undefined
- this.guessPoint = undefined
- this.guessPoint2 = undefined
- this.dingIndex = 0
-
- this.lastPath = undefined
- this.lastPathCords = undefined
-
- this.lastWorldChange = Date.now()
- }
-
- playSound(pos, name, volume, pitch, categoryName, event) {
- if (!this.showBurrialGuess.getValue()) return
- // if (pos.getX() === Math.floor(Player.getX() * 8) / 8 && pos.getZ() === Math.floor(Player.getZ() * 8) / 8) return
- if (name !== "note.harp") return
- if (this.lastDing === 0) {
- this.firstPitch = pitch
- }
- this.lastDing = Date.now()
- this.lastDingPitch = pitch
- }
-
- spawnParticle(particle, type, event) {
- if (this.showingWaypoints && this.showBurrialGuess.getValue() && particle.toString().startsWith("SparkFX,")) {
- 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) {
- run = true
- }
- if (run) {
- this.lastParticlePoint = this.particlePoint
- this.particlePoint = [particle.getX(), particle.getY(), particle.getZ()]
- Client.showTitle("&cStand still...", "", 0, 20, 20)
- }
- }
- if (this.shinyBlockOverlayEnabled.getValue() && this.FeatureManager.features["dataLoader"].class.areaFine === "The End") {
- if (particle.toString().startsWith("EntitySpellParticleFX,")) {
- if (particle.getUnderlyingEntity().func_70534_d() === particle.getUnderlyingEntity().func_70535_g()) {
- let arr = [particle.getX(), particle.getY(), particle.getZ()]
- if (arr.map(a => Math.abs(a % 1)).includes(0.25) || arr.map(a => Math.abs(a % 1)).includes(0.75)) {
- this.shinyBlocks.push([[particle.getX(), particle.getY(), particle.getZ()], Date.now()])
- }
- }
- }
- }
- if (this.showingWaypoints && this.loadFromParticles.getValue()) {
- let foundEnchant = false
- let foundCrit = false
- let foundStep = false
- let isMob = undefined
-
- if (particle.toString().startsWith('EntityEnchantmentTableParticleFX, ')) {
- foundEnchant = true
- }
- else if (particle.toString().startsWith('EntityCrit2FX, ')) {
- foundCrit = true
-
- isMob = particle.getUnderlyingEntity().func_70534_d() > 0.5 //mob)
- }
- else if (particle.toString().startsWith('EntityFootStepFX, ')) {
- foundStep = true
- }
- else if (particle.toString().startsWith('EntityCritFX, ')) {
-
- let locstr = Math.floor(particle.getX()) + "," + Math.floor(particle.getY() - 1) + "," + Math.floor(particle.getZ())
-
- let removed = false
- this.burrialData.locations.filter((loc, i) => {
- if (!loc.clicked && loc.x + "," + loc.y + "," + loc.z === locstr) {
- loc.clicked = true
- removed = true
-
- this.lastPathCords.shift()
- }
- })
- if (!removed) return;
- this.burrialData.locations = this.burrialData.locations.filter(a => {
- if (!a.clicked) return true
- if (calculateDistanceQuick([a.x, a.y, a.z], [Player.getX(), Player.getY(), Player.getZ()]) < 15 * 15) return true;
-
- this.burrialData.historicalLocations.unshift(a)
-
- return false
- })
- if (this.burrialData.historicalLocations.length > 10) this.burrialData.historicalLocations.pop()
-
- return;
- }
-
- if (!foundEnchant && !foundCrit && !foundStep) return;
-
- let locstr = Math.floor(particle.getX()) + "," + Math.floor(particle.getY() - 1) + "," + Math.floor(particle.getZ())
- let locarr = [Math.floor(particle.getX()), Math.floor(particle.getY() - 1), Math.floor(particle.getZ())]
-
- let found = false
-
- this.burrialData.locations.forEach((loc) => {
- if (loc.x + "," + loc.y + "," + loc.z === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if ((loc.x + 1) + "," + loc.y + "," + loc.z === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if ((loc.x + 1) + "," + (loc.y + 1) + "," + loc.z === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if ((loc.x + 1) + "," + (loc.y - 1) + "," + loc.z === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if ((loc.x - 1) + "," + (loc.y + 1) + "," + loc.z === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if ((loc.x - 1) + "," + (loc.y - 1) + "," + loc.z === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if ((loc.x - 1) + "," + loc.y + "," + loc.z === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if (loc.x + "," + loc.y + "," + (loc.z + 1) === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- if (loc.x + "," + loc.y + "," + (loc.z - 1) === locstr) {
- found = true
- loc.lastPing = Date.now()
- }
- })
- if (this.burrialData.historicalLocations) {
- this.burrialData.historicalLocations.forEach((loc) => {
- if (loc.x + "," + loc.y + "," + loc.z === locstr) {
- found = true
- }
- })
- }
-
- if (found) return;
-
-
- if (!this.potentialParticleLocs[locstr]) this.potentialParticleLocs[locstr] = { enchant: 0, crit: 0, step: 0, isMob: 0, timestamp: Date.now() }
-
- if (foundEnchant) this.potentialParticleLocs[locstr].enchant++
- if (foundCrit) this.potentialParticleLocs[locstr].crit++
- if (foundStep) this.potentialParticleLocs[locstr].step++
- if (foundCrit && isMob) this.potentialParticleLocs[locstr].isMob++
- if (foundCrit && !isMob) this.potentialParticleLocs[locstr].isMob--
-
- this.potentialParticleLocs[locstr].timestamp = Date.now()
-
- if (this.potentialParticleLocs[locstr].enchant > 1 && this.potentialParticleLocs[locstr].step > 3) {
- this.burrialData.locations.push({
- "x": locarr[0],
- "y": locarr[1],
- "z": locarr[2],
- "type": this.potentialParticleLocs[locstr].isMob > 1 ? 1 : (this.potentialParticleLocs[locstr].crit > this.potentialParticleLocs[locstr].enchant / 20 ? 0 : 2),
- "tier": -1,
- "chain": -1,
- "fromApi": false
- })
- World.playSound("note.pling", 100, 2)
- }
- }
- }
-
- burrialClicked() {
- if (this.inquisWaypointSpawned) {
- socketConnection.sendInquisData({ loc: null });
- this.inquisWaypointSpawned = false
- }
- if (!this.showingWaypoints) return
-
- let nearestBurriali = undefined
- let nearestBurrialDist = Infinity
-
- this.burrialData.locations.forEach((loc, i) => {
- let dist = calculateDistanceQuick([loc.x, loc.y, loc.z], [Player.getX(), Player.getY(), Player.getZ()])
- if (dist < nearestBurrialDist) {
- nearestBurrialDist = dist
- nearestBurriali = i
- }
- })
-
- if (nearestBurriali === undefined) return;
- this.burrialData.locations[nearestBurriali].clicked = true
-
- this.burrialData.locations = this.burrialData.locations.filter(a => {
- if (!a.clicked) return true
- if (calculateDistanceQuick([a.x, a.y, a.z], [Player.getX(), Player.getY(), Player.getZ()]) < 15 * 15) return true;
-
- this.burrialData.historicalLocations.unshift(a)
-
- return false
- })
- if (this.burrialData.historicalLocations.length > 10) this.burrialData.historicalLocations.pop()
- if (this.lastPathCords) this.lastPathCords.shift()
- }
-
- initVariables() {
- this.burrialData = undefined
- this.potentialParticleLocs = undefined
- this.showingWaypoints = undefined
- this.lastPath = undefined
- this.updatingPath = undefined
- this.hudElements = undefined
- this.lastPathCords = undefined
- }
-
- onDisable() {
- this.initVariables()
- }
+ constructor() {
+ super()
+ }
+
+ onEnable() {
+ this.initVariables()
+
+ this.burrialData = {
+ points: [],
+ locations: [],
+ historicalLocations: []
+ }
+ this.lastWorldChange = 0
+ this.lastRequest = 0
+ this.potentialParticleLocs = {}
+ this.showingWaypoints = false
+ this.lastPath = []
+ this.updatingPath = false
+ this.lastPathCords = undefined
+
+
+ this.loadFromParticles = new ToggleSetting("Load burrials from particles", "Will load particles from burrows in the world", true, "burrial_from_partles", this)
+ this.showBurrialGuess = new ToggleSetting("Estimate burrial location from ability", "Will show a line + box where it thinks the burrial is", true, "burrial_guess", this)
+ new SettingBase("NOTE: You must have music disabled for burrial guessess to work", "/togglemusic", false, "burrial_guess_into", this).requires(this.showBurrialGuess)
+
+ this.otherInquisWaypoints = new ToggleSetting("Show other users inquis locations", "May be usefull for loot share", true, "inquis_location_other", this)
+
+ this.shinyBlocks = []
+
+ this.particleColorAverages = [0, 0, 0, 0]
+
+ this.lastDing = 0
+ this.lastDingPitch = 0
+ this.firstPitch = 0
+ this.lastParticlePoint = undefined
+ this.firstParticlePoint = undefined
+ this.particlePoint = undefined
+ this.guessPoint = undefined
+ this.particleC = 0
+ this.distance = undefined
+ this.dingIndex = 0
+ this.dingSlope = []
+
+ 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)
+ this.registerEvent("spawnParticle", this.spawnParticle).registeredWhen(() => this.showingWaypoints)
+ this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.showingWaypoints || this.shinyBlockOverlayEnabled.getValue())
+ this.registerStep(true, 2, this.step)
+ this.registerStep(false, 5, this.step_5s)
+
+ this.registerEvent("soundPlay", this.playSound).registeredWhen(() => this.showingWaypoints)
+ this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.showingWaypoints);
+
+ this.registerChat("&r&eYou dug out a Griffin Burrow! &r&7(${*}/4)&r", this.burrialClicked)
+ this.registerChat("&r&eYou finished the Griffin burrow chain! &r&7(4/4)&r", this.burrialClicked)
+ this.inquisWaypointSpawned = false
+ }
+
+ entityJoinWorldEvent(e) {
+ this.todoE.push(e.entity);
+ }
+
+ inquisData(loc, user) {
+ if (!loc) {
+ delete this.slayerLocationDataH[user]
+ return
+ }
+ this.slayerLocationDataH[user] = [loc, Date.now()]
+ }
+
+ renderWorld(ticks) {
+ this.shinyBlocks.forEach(([loc]) => {
+ drawBoxAtBlockNotVisThruWalls(loc[0], loc[1], loc[2], 0, 255, 0, 0.1, 0.1)
+ })
+ 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" })
+ }
+ this.burrialData.locations.forEach((loc, i) => {
+
+ let typeReplace = [
+ "Start",
+ "Mob",
+ "Treasure",
+ "Finish",
+ "Unknown"
+ ]
+ if (!loc.clicked) {
+ blue = false
+ if (loc.lastPing && Date.now() - loc.lastPing < 500) {
+ blue = true
+ }
+
+ let name = ""
+
+ if (loc.fromApi) {
+ name = (loc.nearest ? "§c" : "§a") + "(" + (loc.chain + 1) + "/4) " + typeReplace[loc.type] + " burrial"
+ } else {
+ name = (loc.nearest ? "§c" : "§a") + typeReplace[loc.type] + " burrial"
+ }
+
+ drawCoolWaypoint(loc.x, loc.y, loc.z, 0, blue ? 100 : 255, blue ? 255 : 0, { name: name })
+ }
+ })
+ }
+
+ if (this.otherInquisWaypoints.getValue()) {
+ Object.keys(this.slayerLocationDataH).forEach(key => {
+ drawCoolWaypoint(this.slayerLocationDataH[key][0][0], this.slayerLocationDataH[key][0][1], this.slayerLocationDataH[key][0][2], 255, 0, 0, { name: key + "'s inquis" })
+ })
+ }
+ }
+
+ sortBurrialLocations() {
+ let sorted = [...this.burrialData.locations]
+ sorted.sort((a, b) => {
+ let aDist = calculateDistanceQuick([Player.getX(), Player.getY(), Player.getZ()], [a.x + 0.5, a.y + 2.5, a.z + 0.5])
+ let bDist = calculateDistanceQuick([Player.getX(), Player.getY(), Player.getZ()], [b.x + 0.5, b.y + 2.5, b.z + 0.5])
+
+ return bDist - aDist
+ })
+ this.burrialData.locations = sorted
+ }
+
+ step() {
+ if (!Player.getInventory()) return
+
+ hasDianaShovle = false
+ let slots = [0, 1, 2, 3, 4, 5, 6, 7, 8]
+ slots.forEach(a => {
+ item = Player.getInventory().getStackInSlot(a)
+ if (!item) return
+ if (ChatLib.removeFormatting(item.getName()) === "Ancestral Spade") {
+ hasDianaShovle = true
+ }
+ })
+
+ let showingWaypointsNew = (this.lastWorldChange + 5000 < Date.now() ? hasDianaShovle && this.FeatureManager.features["dataLoader"].class.area === "Hub" && this.loadFromParticles.getValue() : this.showingWaypoints || (hasDianaShovle && this.FeatureManager.features["dataLoader"].class.area === "Hub" && this.loadFromParticles.getValue()))
+
+ this.showingWaypoints = showingWaypointsNew
+
+ this.shinyBlocks = this.shinyBlocks.filter(([loc, time]) => {
+ return time > Date.now() - 5000
+ })
+
+
+ Object.keys(this.slayerLocationDataH).forEach(n => {
+ if (this.slayerLocationDataH[n][1] + 60000 * 3 < Date.now()) {
+ delete this.slayerLocationDataH[n]
+ }
+ })
+
+ this.todoE.forEach(e => {
+ e = new Entity(e)
+ if (e.getName().toLowerCase().includes("inquis") && Math.abs(e.getY() - Player.getY()) < 10 && Math.abs(e.getX() - Player.getX()) < 10 && Math.abs(e.getZ() - Player.getZ()) < 10) {
+ socketConnection.sendInquisData({ loc: [Math.round(Player.getX()), Math.round(Player.getY()), Math.round(Player.getZ())] });
+ this.inquisWaypointSpawned = true
+ }
+ })
+ this.todoE = []
+ }
+
+ step_5s() {
+ this.sortBurrialLocations()
+ }
+
+ worldLoad() {
+ this.burrialData.points = []
+ this.burrialData.locations = []
+ this.burrialData.historicalLocations = []
+ this.lastDing = 0
+ this.lastDingPitch = 0
+ this.firstPitch = 0
+ this.lastParticlePoint = undefined
+ this.lastParticlePoint2 = undefined
+ this.lastParticlePoint3 = undefined
+ this.firstParticlePoint = undefined
+ this.particlePoint = undefined
+ this.guessPoint = undefined
+ this.particleC = 0
+ this.distance = undefined
+ this.dingIndex = 0
+ this.dingSlope = []
+
+ this.lastPath = undefined
+ this.lastPathCords = undefined
+
+ this.lastWorldChange = Date.now()
+ }
+
+ playSound(pos, name, volume, pitch, categoryName, event) {
+ if (!this.showBurrialGuess.getValue()) return
+ // if (this.dingIndex > 13) return
+ // if (pos.getX() === Math.floor(Player.getX() * 8) / 8 && pos.getZ() === Math.floor(Player.getZ() * 8) / 8) return
+ if (name !== "note.harp") return
+ if (this.lastDing === 0) {
+ this.firstPitch = pitch
+ }
+ this.lastDing = Date.now()
+ if (pitch < this.lastDingPitch) {
+ this.firstPitch = pitch
+ this.dingIndex = 0
+ this.dingSlope = []
+ this.lastDingPitch = pitch
+ this.lastParticlePoint = undefined
+ this.lastParticlePoint2 = undefined
+ this.lastParticlePoint3 = undefined
+ this.firstParticlePoint = undefined
+ this.particleC = 0
+ }
+ if (this.lastDingPitch === 0) {
+ this.lastDingPitch = pitch
+ this.lastParticlePoint = undefined
+ this.lastParticlePoint2 = undefined
+ this.lastParticlePoint3 = 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)
+ let slope = this.dingSlope.reduce((a, b) => a + b, 0) / this.dingSlope.length
+ // console.log(slope)
+ this.distance = Math.E / slope
+ // 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]]
+ 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]
+ }
+
+ spawnParticle(particle, type, event) {
+ if (this.showingWaypoints && this.showBurrialGuess.getValue() && particle.toString().startsWith("SparkFX,")) {
+ 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) {
+ 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
+
+ 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]]
+ 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]
+ }
+ }
+ if (this.shinyBlockOverlayEnabled.getValue() && this.FeatureManager.features["dataLoader"].class.areaFine === "The End") {
+ if (particle.toString().startsWith("EntitySpellParticleFX,")) {
+ if (particle.getUnderlyingEntity().func_70534_d() === particle.getUnderlyingEntity().func_70535_g()) {
+ let arr = [particle.getX(), particle.getY(), particle.getZ()]
+ if (arr.map(a => Math.abs(a % 1)).includes(0.25) || arr.map(a => Math.abs(a % 1)).includes(0.75)) {
+ this.shinyBlocks.push([[particle.getX(), particle.getY(), particle.getZ()], Date.now()])
+ }
+ }
+ }
+ }
+ if (this.showingWaypoints && this.loadFromParticles.getValue()) {
+ let foundEnchant = false
+ let foundCrit = false
+ let foundStep = false
+ let isMob = undefined
+
+ if (particle.toString().startsWith('EntityEnchantmentTableParticleFX, ')) {
+ foundEnchant = true
+ }
+ else if (particle.toString().startsWith('EntityCrit2FX, ')) {
+ foundCrit = true
+
+ isMob = particle.getUnderlyingEntity().func_70534_d() > 0.5 //mob)
+ }
+ else if (particle.toString().startsWith('EntityFootStepFX, ')) {
+ foundStep = true
+ }
+ else if (particle.toString().startsWith('EntityCritFX, ')) {
+
+ let locstr = Math.floor(particle.getX()) + "," + Math.floor(particle.getY() - 1) + "," + Math.floor(particle.getZ())
+
+ let removed = false
+ this.burrialData.locations.filter((loc, i) => {
+ if (!loc.clicked && loc.x + "," + loc.y + "," + loc.z === locstr) {
+ loc.clicked = true
+ removed = true
+ }
+ })
+ if (!removed) return;
+ this.burrialData.locations = this.burrialData.locations.filter(a => {
+ if (!a.clicked) return true
+ if (calculateDistanceQuick([a.x, a.y, a.z], [Player.getX(), Player.getY(), Player.getZ()]) < 15 * 15) return true;
+
+ this.burrialData.historicalLocations.unshift(a)
+
+ return false
+ })
+ if (this.burrialData.historicalLocations.length > 10) this.burrialData.historicalLocations.pop()
+
+ return;
+ }
+
+ if (!foundEnchant && !foundCrit && !foundStep) return;
+
+ let locstr = Math.floor(particle.getX()) + "," + Math.floor(particle.getY() - 1) + "," + Math.floor(particle.getZ())
+ let locarr = [Math.floor(particle.getX()), Math.floor(particle.getY() - 1), Math.floor(particle.getZ())]
+
+ let found = false
+
+ this.burrialData.locations.forEach((loc) => {
+ if (loc.x + "," + loc.y + "," + loc.z === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if ((loc.x + 1) + "," + loc.y + "," + loc.z === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if ((loc.x + 1) + "," + (loc.y + 1) + "," + loc.z === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if ((loc.x + 1) + "," + (loc.y - 1) + "," + loc.z === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if ((loc.x - 1) + "," + (loc.y + 1) + "," + loc.z === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if ((loc.x - 1) + "," + (loc.y - 1) + "," + loc.z === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if ((loc.x - 1) + "," + loc.y + "," + loc.z === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if (loc.x + "," + loc.y + "," + (loc.z + 1) === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ if (loc.x + "," + loc.y + "," + (loc.z - 1) === locstr) {
+ found = true
+ loc.lastPing = Date.now()
+ }
+ })
+ if (this.burrialData.historicalLocations) {
+ this.burrialData.historicalLocations.forEach((loc) => {
+ if (loc.x + "," + loc.y + "," + loc.z === locstr) {
+ found = true
+ }
+ })
+ }
+
+ if (found) return;
+
+
+ if (!this.potentialParticleLocs[locstr]) this.potentialParticleLocs[locstr] = { enchant: 0, crit: 0, step: 0, isMob: 0, timestamp: Date.now() }
+
+ if (foundEnchant) this.potentialParticleLocs[locstr].enchant++
+ if (foundCrit) this.potentialParticleLocs[locstr].crit++
+ if (foundStep) this.potentialParticleLocs[locstr].step++
+ if (foundCrit && isMob) this.potentialParticleLocs[locstr].isMob++
+ if (foundCrit && !isMob) this.potentialParticleLocs[locstr].isMob--
+
+ this.potentialParticleLocs[locstr].timestamp = Date.now()
+
+ if (this.potentialParticleLocs[locstr].enchant > 1 && this.potentialParticleLocs[locstr].step > 3) {
+ this.burrialData.locations.push({
+ "x": locarr[0],
+ "y": locarr[1],
+ "z": locarr[2],
+ "type": this.potentialParticleLocs[locstr].isMob > 1 ? 1 : (this.potentialParticleLocs[locstr].crit > this.potentialParticleLocs[locstr].enchant / 20 ? 0 : 2),
+ "tier": -1,
+ "chain": -1,
+ "fromApi": false
+ })
+ World.playSound("note.pling", 100, 2)
+ }
+ }
+ }
+
+ burrialClicked() {
+ this.particleColorAverages = [0, 0, 0, 0]
+ if (this.inquisWaypointSpawned) {
+ socketConnection.sendInquisData({ loc: null });
+ this.inquisWaypointSpawned = false
+ }
+ if (!this.showingWaypoints) return
+
+ let nearestBurriali = undefined
+ let nearestBurrialDist = Infinity
+
+ this.burrialData.locations.forEach((loc, i) => {
+ let dist = calculateDistanceQuick([loc.x, loc.y, loc.z], [Player.getX(), Player.getY(), Player.getZ()])
+ if (dist < nearestBurrialDist) {
+ nearestBurrialDist = dist
+ nearestBurriali = i
+ }
+ })
+
+ if (nearestBurriali === undefined) return;
+ this.burrialData.locations[nearestBurriali].clicked = true
+
+ this.burrialData.locations = this.burrialData.locations.filter(a => {
+ if (!a.clicked) return true
+ if (calculateDistanceQuick([a.x, a.y, a.z], [Player.getX(), Player.getY(), Player.getZ()]) < 15 * 15) return true;
+
+ this.burrialData.historicalLocations.unshift(a)
+
+ return false
+ })
+ if (this.burrialData.historicalLocations.length > 10) this.burrialData.historicalLocations.pop()
+ if (this.lastPathCords) this.lastPathCords.shift()
+ }
+
+ initVariables() {
+ this.burrialData = undefined
+ this.potentialParticleLocs = undefined
+ this.showingWaypoints = undefined
+ this.lastPath = undefined
+ this.updatingPath = undefined
+ this.hudElements = undefined
+ this.lastPathCords = undefined
+ }
+
+ onDisable() {
+ this.initVariables()
+ }
}
module.exports = {
- class: new Events()
+ class: new Events()
} \ No newline at end of file
diff --git a/features/streamsGUI/index.js b/features/streamsGUI/index.js
index bc3fa6e..492728a 100644
--- a/features/streamsGUI/index.js
+++ b/features/streamsGUI/index.js
@@ -18,27 +18,27 @@ class StreamsGui extends Feature {
super()
}
- onEnable(){
+ onEnable() {
this.initVariables()
this.GuiPage = new StreamPage()
}
- initVariables(){
+ initVariables() {
this.GuiPage = undefined
}
- onDisable(){
+ onDisable() {
this.initVariables()
}
}
class StreamPage extends GuiPage {
- constructor(){
+ constructor() {
super(7)
-
+
this.name = "Skyblock Streams"
this.pages = [this.newPage()]
@@ -49,10 +49,10 @@ class StreamPage extends GuiPage {
let button = new ButtonWithArrow().setText("§0Open in browser").setLocation(0.7, 0.05, 0.2, 0.1)
this.pages[0].addChild(button)
- button.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ button.addEvent(new SoopyMouseClickEvent().setHandler(() => {
java.awt.Desktop.getDesktop().browse(
new java.net.URI("https://soopymc.my.to/skyblockstreams")
- );
+ );
}))
this.streamsBox = new SoopyGuiElement().setLocation(0.1, 0.15, 0.8, 0.85)
@@ -64,102 +64,101 @@ class StreamPage extends GuiPage {
this.finaliseLoading()
}
- updateStreams(){
- fetch("http://soopymc.my.to/api/skyblockstreams").json(streams=>{
+ updateStreams() {
+ fetch("http://soopymc.my.to/api/skyblockstreams").json(streams => {
this.streamsBox.clearChildren()
-
+
let y = 0
-
- Object.keys(streams.twitch).forEach((channel, i)=>{
+
+ Object.keys(streams.twitch).forEach((channel, i) => {
let stream = streams.twitch[channel]
-
- if(i%2===0){
+
+ 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){
+ 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
+ y += 0.6
}
})
})
}
- openStreamSidebar(data){
- let sidebar = new SoopyGuiElement().setLocation(0,0,1,1)
+ openStreamSidebar(data) {
+ let sidebar = new SoopyGuiElement().setLocation(0, 0, 1, 1)
this.openSidebarPage(sidebar)
- sidebar.addChild(new SoopyTextElement().setText("§0"+data.user_name).setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1))
+ sidebar.addChild(new SoopyTextElement().setText("§0" + data.user_name).setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1))
let title = new SoopyMarkdownElement().setText(data.title).setLocation(0.1, 0.15, 0.8, 0.1)
sidebar.addChild(title)
- let image = new SoopyImageElement().setImage(data.image).setLocation(0.1, 0.15+title.getHeight(), 0.8, 0.4)
+ let image = new SoopyImageElement().setImage(data.image).setLocation(0.1, 0.15 + title.getHeight(), 0.8, 0.4)
sidebar.addChild(image)
image.loadHeightFromImage()
- let button = new ButtonWithArrow().setText("§0Watch on Twitch").setLocation(0.1, 0.15+image.location.size.y.get()+title.getHeight(), 0.8, 0.1)
+ let button = new ButtonWithArrow().setText("§0Watch on Twitch").setLocation(0.1, 0.15 + image.location.size.y.get() + title.getHeight(), 0.8, 0.1)
sidebar.addChild(button)
- button.addEvent(new SoopyMouseClickEvent().setHandler(()=>{
+ button.addEvent(new SoopyMouseClickEvent().setHandler(() => {
java.awt.Desktop.getDesktop().browse(
new java.net.URI("https://twitch.tv/" + data.user_login)
- );
+ );
}))
let language
- if(data.language){
- language = new BoxWithText().setText("§0Language: "+data.language).setLocation(0.3, 0.25+image.location.size.y.get()+title.getHeight(), 0.4, 0.1)
+ if (data.language) {
+ language = new BoxWithText().setText("§0Language: " + data.language).setLocation(0.3, 0.25 + image.location.size.y.get() + title.getHeight(), 0.4, 0.1)
sidebar.addChild(language)
}
-
- image.onImageHeightChange(()=>{
- button.location.location.y.set(0.15+image.location.size.y.get()+title.getHeight())
- if(language) language.location.location.y.set(0.25+image.location.size.y.get()+title.getHeight())
+
+ image.onImageHeightChange(() => {
+ button.location.location.y.set(0.15 + image.location.size.y.get() + title.getHeight())
+ if (language) language.location.location.y.set(0.25 + image.location.size.y.get() + title.getHeight())
}, this)
}
- onOpen(){
+ onOpen() {
this.updateStreams()
}
}
class StreamElement extends SoopyBoxElement {
- constructor(){
+ constructor() {
super()
this.streamData = undefined
- this.channelElement = new SoopyTextElement().setLocation(0.1,0.025,0.8,0.1).setMaxTextScale(10)
+ 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)
+ this.channelImg = new SoopyImageElement().setLocation(0.1, 0.125, 0.8, 0.2)
- this.titleElement = new SoopyMarkdownElement().setLocation(0.1,0.45,0.8,0.1)
+ 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.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.addEvent(new SoopyMouseClickEvent().setHandler(() => {
this.streamPage.openStreamSidebar(this.streamData)
}))
this.addChild(this.channelElement)
this.addChild(this.titleElement)
this.addChild(this.channelImg)
- this.channelImg.loadHeightFromImage()
}
- setStream(stream, twitch){
+ 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 + " viewer"+(stream.viewer_count!==1?"s":""):""))
-
+ this.channelElement.setText((twitch ? "§0" + stream.user_name : "§0" + stream.channelTitle) + (twitch ? "&7 - " + stream.viewer_count + " viewer" + (stream.viewer_count !== 1 ? "s" : "") : ""))
+
this.streamData.image = twitch ? `https://static-cdn.jtvnw.net/previews-ttv/live_user_${stream.user_login}-640x360.jpg` : stream.thumbnails.high.url
this.channelImg.setImage(this.streamData.image)
this.channelImg.loadHeightFromImage()
@@ -167,9 +166,9 @@ class StreamElement extends SoopyBoxElement {
return this
}
- setStreamPage(page){
+ setStreamPage(page) {
this.streamPage = page
-
+
return this
}
}
diff --git a/features/waypoints/index.js b/features/waypoints/index.js
index bcd3fc5..7d2edb6 100644
--- a/features/waypoints/index.js
+++ b/features/waypoints/index.js
@@ -97,18 +97,18 @@ class Waypoints extends Feature {
ChatLib.chat(this.FeatureManager.messagePrefix + "Error loading from clipboard!")
}
})
- //&r&9Party &8> &6[MVP&4++&6] Soopyboo32&f: &rx: -150, y: 73, z: -97 &r
- //&r&6[MVP&r&4++&r&6] Soopyboo32&r&f: x: 23, y: 100, z: -2&r
- //&r&6[MVP&r&4++&r&6] Soopyboo32&r&f: x: -22, y: 100, z: 7&r
+
this.registerChat("&r${*} &8> ${player}&f: &rx: ${x}, y: ${y}, z: ${z}", (player, x, y, z, e) => {
if (this.loadWaypointsFromSendCoords.getValue()) {
this.patcherWaypoints.push([Date.now(), parseInt(x), parseInt(y), parseInt(ChatLib.removeFormatting(z)), ChatLib.addColor(player)])
+ if (this.patcherWaypoints.length > 10) this.patcherWaypoints.shift()
}
})
this.registerChat("${player}&r&f: x: ${x}, y: ${y}, z: ${z}", (player, x, y, z, e) => {
if (player.includes(">")) return
if (this.loadWaypointsFromSendCoords.getValue()) {
this.patcherWaypoints.push([Date.now(), parseInt(x), parseInt(y), parseInt(ChatLib.removeFormatting(z)), ChatLib.addColor(player)])
+ if (this.patcherWaypoints.length > 10) this.patcherWaypoints.shift()
}
})