diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/dataLoader/index.js | 30 | ||||
-rw-r--r-- | features/dungeonSolvers/index.js | 30 | ||||
-rw-r--r-- | features/events/index.js | 227 | ||||
-rw-r--r-- | features/nether/index.js | 39 |
4 files changed, 240 insertions, 86 deletions
diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index 6f71f08..23cf744 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -30,6 +30,27 @@ class DataLoader extends Feature { this.api_loaded_event = this.createCustomEvent("apiLoad") + this.checkingPing = false; + this.lastPingCheck = 0; + this.lastPings = [undefined, undefined, undefined]; + this.ping = 0; + this.pingI = 0; + + this.registerChat("&b&bYou are currently connected to server &6${*}&r", (e) => { + if (this.checkingPing) { + this.lastPings[this.pingI % 3] = Date.now() - this.lastPingCheck; + cancel(e); + this.checkingPing = false; + + if (this.lastPings.includes(undefined)) { + this.ping = this.lastPings[this.pingI % 3]; + } else { + this.ping = [...this.lastPings].sort((a, b) => a - b)[1]; + } + this.pingI++; + } + }); + this.lastServer = undefined this.lastSentServer = 0 @@ -93,6 +114,15 @@ class DataLoader extends Feature { }) } + getPing() { + if (Date.now() - this.lastPingCheck > 60000 * 30 || (Date.now() - this.lastPingCheck > 60000 && this.lastPings.includes(undefined) && this.bloodX !== -1)) { + this.lastPingCheck = Date.now(); + ChatLib.command("whereami"); + this.checkingPing = true; + } + return this.ping || 0 + } + step_5min() { fetch("http://soopy.dev/api/v2/mayor").json(data => { if (!data.success) return diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index 144951a..cc7de31 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -241,11 +241,6 @@ class DungeonSolvers extends Feature { this.totalPuzzleCount = 0; this.completedPuzzleCount = 0; - this.checkingPing = false; - this.lastPingCheck = 0; - this.lastPings = [undefined, undefined, undefined]; - this.ping = 0; - this.pingI = 0; this.ezpz = false this.arrows = []; @@ -341,20 +336,6 @@ class DungeonSolvers extends Feature { this.firstDeath = false this.firstDeathHadSpirit = false - this.registerChat("&b&bYou are currently connected to server &6${*}&r", (e) => { - if (this.checkingPing) { - this.lastPings[this.pingI % 3] = Date.now() - this.lastPingCheck; - cancel(e); - this.checkingPing = false; - - if (this.lastPings.includes(undefined)) { - this.ping = this.lastPings[this.pingI % 3]; - } else { - this.ping = [...this.lastPings].sort((a, b) => a - b)[1]; - } - this.pingI++; - } - }); this.registerForge(net.minecraftforge.event.entity.EntityJoinWorldEvent, this.entityJoinWorldEvent).registeredWhen(() => this.isInDungeon() && !this.inBoss); @@ -754,12 +735,13 @@ class DungeonSolvers extends Feature { let endPoint2 = this.eMovingThing[skull.getUUID().toString()].endPointLast; let endPointUpdated = Math.min(Date.now() - this.eMovingThing[skull.getUUID().toString()].endPointUpdated, 100); if (!endPoint2) return; + let ping = this.FeatureManager.features["dataLoader"].class.getPing() let endPoint = [endPoint2[0] + ((endPoint1[0] - endPoint2[0]) * endPointUpdated) / 100, endPoint2[1] + ((endPoint1[1] - endPoint2[1]) * endPointUpdated) / 100, endPoint2[2] + ((endPoint1[2] - endPoint2[2]) * endPointUpdated) / 100]; - let pingPoint = [startPoint[0] + xSpeed2 * this.ping, startPoint[1] + ySpeed2 * this.ping, startPoint[2] + zSpeed2 * this.ping]; + let pingPoint = [startPoint[0] + xSpeed2 * ping, startPoint[1] + ySpeed2 * ping, startPoint[2] + zSpeed2 * ping]; renderUtils.drawLineWithDepth(startPoint[0], startPoint[1] + 2, startPoint[2], endPoint[0], endPoint[1] + 2, endPoint[2], 255, 0, 0, 2); - if (this.ping < time) { + if (ping < time) { renderUtils.drawBoxAtBlockNotVisThruWalls(pingPoint[0] - 0.5, pingPoint[1] + 1.5, pingPoint[2] - 0.5, 0, 255, 0); renderUtils.drawBoxAtBlockNotVisThruWalls(endPoint[0] - 0.5, endPoint[1] + 1.5, endPoint[2] - 0.5, 255, 0, 0); } else { @@ -1219,12 +1201,6 @@ class DungeonSolvers extends Feature { }); this.todoE = []; - - if (Date.now() - this.lastPingCheck > 60000 * 30 || (Date.now() - this.lastPingCheck > 60000 && this.lastPings.includes(undefined) && this.bloodX !== -1)) { - this.lastPingCheck = Date.now(); - ChatLib.command("whereami"); - this.checkingPing = true; - } } let averageExp = this.lastDungExps.reduce((a, b) => a + b, 0) / this.lastDungExps.length; diff --git a/features/events/index.js b/features/events/index.js index 6a19f94..d0edeb2 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -146,21 +146,23 @@ class Events extends Feature { }) this.locs = [] - this.predictions = [] - this.registerEvent("renderWorld", () => { - for (let loc of this.locs) { - drawBoxAtBlock(loc[0], loc[1], loc[2], 255, 0, 0, 0.05, 0.05) - } - for (let loc of this.predictions) { - drawBoxAtBlock(loc[0], loc[1], loc[2], 0, 255, 0, 0.05, 0.05) - } - }) - - this.registerCommand("clearlocs", () => { - this.locs = [] - this.predictions = [] - ChatLib.chat(this.FeatureManager.messagePrefix + "Cleared all locs!") - }) + // this.predictions = [] + // this.predictionsOld = [] + // this.registerEvent("renderWorld", () => { + // for (let loc of this.locs) { + // drawBoxAtBlock(loc[0], loc[1], loc[2], 255, 0, 0, 0.05, 0.05) + // } + // for (let loc of this.predictions) { + // drawBoxAtBlock(loc[0], loc[1], loc[2], 0, 255, 0, 0.05, 0.05) + // } + // }) + + // this.registerCommand("clearlocs", () => { + // this.locs = [] + // this.predictions = [] + // // this.predictionsOld = [] + // ChatLib.chat(this.FeatureManager.messagePrefix + "Cleared all locs!") + // }) } step_1fps() { @@ -216,7 +218,14 @@ class Events extends Feature { if (this.showingWaypoints) { if (this.guessPoint && this.showBurrialGuess.getValue()) { let warpLoc = this.getClosestWarp() - drawCoolWaypoint(this.guessPoint[0], this.guessPoint[1], this.guessPoint[2], 255, 255, 0, { name: "§eGuess" + (warpLoc ? " §7(" + warpLoc + ")" : "") }) + if (this.guessPoint2) { + let gY = 131 + while (World.getBlockAt(this.guessPoint2[0], gY, this.guessPoint2[2]).getType().getID() !== 2 && gY > 70) { + gY-- + } + drawCoolWaypoint(this.guessPoint2[0], gY, this.guessPoint2[2], 255, 255, 0, { name: "§eGuess" + (warpLoc ? " §7(" + warpLoc + ")" : "") }) + } + // drawCoolWaypoint(this.guessPoint[0], this.guessPoint[1], this.guessPoint[2], 255, 255, 0, { name: "§7OLD Guess" + (warpLoc ? " §7(" + warpLoc + ")" : "") }) } this.burrialData.locations.forEach((loc, i) => { @@ -394,33 +403,48 @@ class Events extends Feature { this.lastParticlePoint2 = undefined this.lastSoundPoint = undefined this.firstParticlePoint = undefined + this.distance = undefined + this.locs = [] + // this.predictionsOld = this.predictions } if (this.lastDingPitch === 0) { this.lastDingPitch = pitch + this.distance = undefined this.lastParticlePoint = undefined this.lastParticlePoint2 = undefined this.lastSoundPoint = undefined this.firstParticlePoint = undefined + this.locs = [] + // this.predictionsOld = this.predictions return } this.dingIndex++ if (this.dingIndex > 1) this.dingSlope.push(pitch - this.lastDingPitch) - if (this.dingSlope.length > 15) this.dingSlope.shift() + if (this.dingSlope.length > 20) this.dingSlope.shift() let slope = this.dingSlope.reduce((a, b) => a + b, 0) / this.dingSlope.length // 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()) + this.distance2 = 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)) 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 distance = this.distance2 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.lastSoundPoint[0] + changes[0] * distance, this.lastSoundPoint[1] + changes[1] * distance, this.lastSoundPoint[2] + changes[2] * distance] + // let minD = Infinity + // for (let i = 0; i < this.predictions.length; i++) { + // let p = this.predictions[i] + // let d = (p[0] - this.guessPoint[0]) ** 2 + (p[2] - this.guessPoint[2]) ** 2 + // if (d < minD) { + // minD = d + // this.guessPoint2 = [Math.floor(p[0]), 255, Math.floor(p[2])] + // } + // } } /** @@ -428,9 +452,6 @@ class Events extends Feature { * returns [a, b, c] */ solveEquasionThing(x, y) { - let x = [2, 5, 9] - let y = [0.20408243164745452, -0.327863161630501, -0.40346259488011876] - let a = (-y[0] * x[1] * x[0] - y[1] * x[1] * x[2] + y[1] * x[1] * x[0] + x[1] * x[2] * y[2] + x[0] * x[2] * y[0] - x[0] * x[2] * y[2]) / (x[1] * y[0] - x[1] * y[2] + x[0] * y[2] - y[0] * x[2] + y[1] * x[2] - y[1] * x[0]) let b = (y[0] - y[1]) * (x[0] + a) * (x[1] + a) / (x[1] - x[0]) let c = y[0] - b / (x[0] + a) @@ -440,48 +461,133 @@ class Events extends Feature { spawnParticle(particle, type, event) { if (this.showingWaypoints && this.showBurrialGuess.getValue() && particle.toString().startsWith("EntityDropParticleFX,")) { - // { - - // let currLoc = [particle.getX(), particle.getY(), particle.getZ()] - // { - // let lastPos = this.locs[this.locs.length - 1] - // console.log(Math.hypot(...currLoc.map((l, i) => { - // return (l - lastPos[i]) ** 2 - // }))) - // } - // this.locs.push(currLoc) - // if (this.locs.length > 4) { - // let slopeThing = this.locs.map((a, i) => { - // if (i === 0) return - // let lastLoc = this.locs[i - 1] - // let currLoc = a - // return y = Math.atan((currLoc[0] - lastLoc[0]) / (currLoc[2] - lastLoc[2])) - // }) - // let [a, b, c] = this.solveEquasionThing([1, 2, 3], [slopeThing[1], slopeThing[2], slopeThing[3]]) - // // console.log(a, b, c) - - // this.predictions = [] - - // let lastPos = [this.locs[4][0], this.locs[4][1], this.locs[4][2]] - // for (let i = 3; i < 50; i++) { - // let y = b / (i + a) + c - - // let xOff = 2 * Math.sin(y) - // let zOff = 2 * Math.cos(y) - // lastPos[0] += xOff - // lastPos[2] -= zOff - // this.predictions.push([...lastPos]) - // } - // // console.log(this.predictions[1].join(" ")) - // } - - // } let run = false 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) { + if (this.locs.length === 0 || particle.getX() + particle.getY() + particle.getZ() !== this.locs[this.locs.length - 1][0] + this.locs[this.locs.length - 1][1] + this.locs[this.locs.length - 1][2]) { + + let currLoc = [particle.getX(), particle.getY(), particle.getZ()] + let distMultiplier = 1 + { + if (this.locs.length > 2) { + + let predictedDist = 0.06507 * this.locs.length + 0.259 + + let lastPos = this.locs[this.locs.length - 1] + let actualDist = Math.hypot(...currLoc.map((l, i) => { + return (l - lastPos[i]) + })) + + distMultiplier = actualDist / predictedDist + } + // if (this.locs.length > 2 && !this.distance) { + // let lastPos = this.locs[this.locs.length - 1] + // let dist = Math.hypot(...currLoc.map((l, i) => { + // return (l - lastPos[i]) + // })) + // let lastPos2 = this.locs[this.locs.length - 2] + // let dist2 = Math.hypot(...currLoc.map((l, i) => { + // return (lastPos[i] - lastPos2[i]) + // })) + // // console.log("------") + // // console.log(dist - dist2) + // this.distance = 20 / (dist - dist2) - (dist - dist2) * 80 + // console.log(this.distance) + // // this.distance -= Math.hypot(this.firstParticlePoint[0] - particle.getX(), this.firstParticlePoint[1] - particle.getY(), this.firstParticlePoint[2] - particle.getZ()) + + // // console.log(Math.sqrt((Player.getX() - this.firstParticlePoint[0]) ** 2 + (Player.getZ() - this.firstParticlePoint[2]) ** 2)) + // } + } + this.locs.push(currLoc) + if (this.locs.length > 5 && this.guessPoint) { + let slopeThing = this.locs.map((a, i) => { + if (i === 0) return + let lastLoc = this.locs[i - 1] + let currLoc = a + return Math.atan((currLoc[0] - lastLoc[0]) / (currLoc[2] - lastLoc[2])) + }) + + let [a, b, c] = this.solveEquasionThing([slopeThing.length - 5, slopeThing.length - 3, slopeThing.length - 1], [slopeThing[slopeThing.length - 5], slopeThing[slopeThing.length - 3], slopeThing[slopeThing.length - 1]]) + // console.log(a, b, c) + + let pr1 = [] + let pr2 = [] + + let start = slopeThing.length - 1 + let lastPos = [this.locs[start][0], this.locs[start][1], this.locs[start][2]] + let lastPos2 = [this.locs[start][0], this.locs[start][1], this.locs[start][2]] + + let distCovered = 0 + // this.locs.forEach((l, i) => { + // if (i === 0) return + + // distCovered += Math.hypot(this.locs[i][0] - this.locs[i - 1][0], this.locs[i][1] - this.locs[i - 1][1], this.locs[i][2] - this.locs[i - 1][2]) + // }) + + let ySpeed = (this.locs[this.locs.length - 1][1] - this.locs[this.locs.length - 2][1]) / Math.hypot(this.locs[this.locs.length - 1][0] - this.locs[this.locs.length - 2][0], this.locs[this.locs.length - 1][2] - this.locs[this.locs.length - 2][2]) + + for (let i = start + 1; i < 100; i++) { + let y = b / (i + a) + c + + let dist = distMultiplier * (0.06507 * i + 0.259) //This is where the inaccuracy's come from + //dist = distance between particles for guessed line + + let xOff = dist * Math.sin(y) + let zOff = dist * Math.cos(y) + + + + let dencity = 5 + for (let o = 0; o < dencity; o++) { + lastPos[0] += xOff / dencity + lastPos[2] += zOff / dencity + + lastPos[1] += ySpeed * dist / dencity + lastPos2[1] += ySpeed * dist / dencity + + lastPos2[0] -= xOff / dencity + lastPos2[2] -= zOff / dencity + + pr1.push([...lastPos]) + pr2.push([...lastPos2]) + + + // distCovered += Math.hypot(xOff, zOff) / dencity + distCovered = Math.hypot(lastPos[0] - this.lastSoundPoint[0], lastPos[2] - this.lastSoundPoint[2]) + if (distCovered > this.distance2) break; + } + if (distCovered > this.distance2) break; + } + // this.predictions = [...pr1, ...pr2] + // let minD = Infinity + + let p1 = pr1[pr1.length - 1] + let p2 = pr2[pr2.length - 1] + + let d1 = (p1[0] - this.guessPoint[0]) ** 2 + (p1[2] - this.guessPoint[2]) ** 2 + let d2 = (p2[0] - this.guessPoint[0]) ** 2 + (p2[2] - this.guessPoint[2]) ** 2 + + if (d1 < d2) { + this.guessPoint2 = [Math.floor(p1[0]), 255, Math.floor(p1[2])] + } else { + this.guessPoint2 = [Math.floor(p2[0]), 255, Math.floor(p2[2])] + } + // for (let i = 0; i < this.predictions.length; i++) { + // let p = this.predictions[i] + // let d2 = (p[0] - this.guessPoint[0]) ** 2 + (p[2] - this.guessPoint[2]) ** 2 + // let d = Math.abs(this.distance ** 2 - (p[0] - this.firstParticlePoint[0]) ** 2 + (p[2] - this.firstParticlePoint[2]) ** 2) + // if (d < minD && d2 < 50 ** 2) { + // minD = d + // this.guessPoint2 = [Math.floor(p[0]), 255, Math.floor(p[2])] + // } + // } + // console.log(this.predictions[1].join(" ")) + } + + } if (this.lastParticlePoint === undefined) { this.firstParticlePoint = [particle.getX(), particle.getY(), particle.getZ()] } @@ -492,7 +598,7 @@ class Events extends Feature { if (!this.lastParticlePoint2 || !this.particlePoint || !this.firstParticlePoint || !this.distance || !this.lastSoundPoint) return 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 distance = this.distance2 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.lastSoundPoint[0] + changes[0] * distance, this.lastSoundPoint[1] + changes[1] * distance, this.lastSoundPoint[2] + changes[2] * distance] @@ -647,6 +753,9 @@ class Events extends Feature { } burrialClicked() { + this.locs = [] + // this.predictions = [] + // this.predictionsOld = [] if (this.inquisWaypointSpawned) { socketConnection.sendInquisData({ loc: null }); this.inquisWaypointSpawned = false diff --git a/features/nether/index.js b/features/nether/index.js index 97f9678..9c346f6 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -8,6 +8,7 @@ import ToggleSetting from "../settings/settingThings/toggle"; const MCBlock = Java.type("net.minecraft.block.Block"); const ArmorStand = Java.type("net.minecraft.entity.item.EntityArmorStand") const MCItem = Java.type("net.minecraft.item.Item"); +const EntitySkeleton = Java.type("net.minecraft.entity.monster.EntitySkeleton") let locationData = { barbarian: { @@ -53,6 +54,7 @@ class Nether extends Feature { this.speedNextBlock = new ToggleSetting("Show next block to stand on for dojo swiftness", "", true, "dojo_swiftness", this) this.tenacityLine = new ToggleSetting("Show line for fireball in dojo tenacity", "This may help you to dodge the fireballs", false, "dojo_tanacity", this) this.disciplineOverlay = new ToggleSetting("Show overlay for zombies in dojo discipline", "", true, "dojo_discipline", this).contributor("Empa") + this.controlHelper = new ToggleSetting("Shows where you actually have to look for", "control dojo task (accounts for ping)", true, "control_helper", this) this.hostageWaypoints = new ToggleSetting("Show hostage waypoints", "Waypoint for location of hostage in rescue missions", true, "hostage_waypoint", this) this.slugfishTimer = new ToggleSetting("Show timer over rod", "This may help with fishing slugfish", false, "slugfish_timer", this) @@ -76,6 +78,14 @@ class Nether extends Feature { this.rescueMissionType = undefined this.lastBlock = undefined this.hookThrown = 0 + this.controlSkeleton = undefined + this.controlLocLast = undefined + this.controlLoc = undefined + this.registerChat(" Test of Control OBJECTIVES", () => { + this.controlSkeleton = undefined + this.controlLocLast = undefined + this.controlLoc = undefined + }) let packetRecieved = this.registerCustom("packetReceived", this.packetReceived).registeredWhen(() => this.isInDojo()) @@ -107,6 +117,10 @@ class Nether extends Feature { this.inSwiftness = false this.lastBlock = undefined this.inDiscipline = false + + this.controlLocLast = undefined + this.controlLoc = undefined + this.controlSkeleton = undefined }) this.registerChat("You completed your rescue quest! Visit the Town Board to claim the rewards,", () => { @@ -159,11 +173,32 @@ class Nether extends Feature { this.todoE2 = this.todoE this.todoE = [] + + + if (this.controlHelper.getValue() && this.controlSkeleton) { + let ping = this.FeatureManager.features["dataLoader"].class.getPing() / 1000 + + let e = this.controlSkeleton + let x = e.getX() + (e.getX() - e.getLastX()) * (20 * ping) + let y = e.getY() + (e.getY() - e.getLastY()) * (20 * ping) + let z = e.getZ() + (e.getZ() - e.getLastZ()) * (20 * ping) + if (x === e.getX() && y === e.getY() && z === e.getZ()) return + + while (World.getBlockAt(x, y, z).getType().getID() !== 0) { y += 0.2 } + + if (this.controlLoc) this.controlLocLast = [...this.controlLoc] + this.controlLoc = [x - 0.5, y, z - 0.5] + } else { + this.controlLocLast = undefined + this.controlLoc = undefined + } } entityJoinWorldEvent(event) { if (this.tenacityLine.getValue() && event.entity instanceof ArmorStand) this.todoE.push(event.entity) if (this.disciplineOverlay.getValue() && this.inDiscipline && event.entity instanceof ArmorStand) this.todoF.push(new Entity(event.entity)) + + if (event.entity instanceof EntitySkeleton && !this.controlSkeleton) this.controlSkeleton = new Entity(event.entity) } packetReceived(packet, event) { @@ -262,6 +297,10 @@ class Nether extends Feature { Tessellator.drawString(((Date.now() - this.hookThrown) / 1000).toFixed(1) + "s", x, y + 0.5, z, Renderer.color(0, 255, 50), false, 0.025, false) } } + + if (this.controlLoc && this.controlLocLast) { + drawBoxAtBlock(this.controlLoc[0] * ticks + this.controlLocLast[0] * (1 - ticks), this.controlLoc[1] * ticks + this.controlLocLast[1] * (1 - ticks), this.controlLoc[2] * ticks + this.controlLocLast[2] * (1 - ticks), 255, 0, 0, 1, 2) + } } step1S() { |