diff options
-rw-r--r-- | features/dungeonMap/index.js | 12 | ||||
-rw-r--r-- | features/dungeonSolvers/index.js | 1 | ||||
-rw-r--r-- | features/hud/index.js | 18 | ||||
-rw-r--r-- | features/nether/index.js | 8 | ||||
-rw-r--r-- | features/nether/metadata.json | 2 | ||||
-rw-r--r-- | features/slayers/index.js | 43 | ||||
-rw-r--r-- | logger.js | 1 | ||||
-rw-r--r-- | metadata.json | 4 | ||||
-rw-r--r-- | socketConnection.js | 69 | ||||
-rw-r--r-- | utils/renderUtils.js | 14 |
10 files changed, 123 insertions, 49 deletions
diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js index e2e84ed..cfa4fd9 100644 --- a/features/dungeonMap/index.js +++ b/features/dungeonMap/index.js @@ -57,6 +57,7 @@ class DungeonMap extends Feature { this.newPuzzlesTab = [] this.mortLocationOnMap = undefined this.brBoxLoc = undefined + this.keys = 0 this.invMapImage = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB) this.renderImage = new BufferedImage(this.IMAGE_SIZE, this.IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB) this.mapImage = new Image(this.renderImage) @@ -95,9 +96,17 @@ class DungeonMap extends Feature { this.bloodOpened = true }) + this.registerChat("&r${*}&r&f &r&ehas obtained &r&a&r&${*} Key&r&e!&r", () => { + this.keys++ + }) + this.registerChat("&r&eA &r&a&r&${*} Key&r&e was picked up!&r", () => { + this.keys++ + }) + this.lastDoorOpener = undefined this.registerChat("&r&a${player}&r&a opened a &r&8&lWITHER &r&adoor!&r", (player) => { this.lastDoorOpener = ChatLib.removeFormatting(player) + this.keys-- }) this.spiritLeapOverlayGui = new SpiritLeapOverlay(this) @@ -158,12 +167,13 @@ class DungeonMap extends Feature { this.brBoxLoc = undefined this.mortLocationOnMap = undefined this.bloodOpened = false + this.keys = 0 } renderWorld() { if (this.isInDungeon() && this.brBox.getValue()) { if (this.brBoxLoc && (!this.bloodOpened || !this.brBoxDisableWhenBloodOpened.getValue())) { - drawBoxAtBlock(this.brBoxLoc[0] - 1.5, 69, this.brBoxLoc[1] - 1.5, 255, 0, 0, 3, 4) + drawBoxAtBlock(this.brBoxLoc[0] - 1.5, 69, this.brBoxLoc[1] - 1.5, this.keys === 0 ? 255 : 0, this.keys === 0 ? 0 : 255, 0, 3, 4) } } } diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js index f7d8e49..218642b 100644 --- a/features/dungeonSolvers/index.js +++ b/features/dungeonSolvers/index.js @@ -703,6 +703,7 @@ class DungeonSolvers extends Feature { } step() { + if (!TabList || !TabList.getNames()) return World.getAllPlayers().forEach((p) => { this.nameToUuid[p.getName().toLowerCase()] = p.getUUID().toString() }) diff --git a/features/hud/index.js b/features/hud/index.js index 92d91bd..b0bf45d 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -276,8 +276,6 @@ class Hud extends Feature { this.registerActionBar("${m}", this.actionbarMessage) - this.registerCustom("packetReceived", this.packetReceived) - this.packetMoves = 0 this.secondPackets = 0 this.tps = -2 @@ -286,12 +284,14 @@ class Hud extends Feature { this.registerStep(false, 1, this.step_1second) } - packetReceived(packet) { - this.packetMoves++ - } - step_1second() { - if (!this.lagEnabled.getValue()) return + if (!this.lagEnabled.getValue()) { + if (this.packetReceived) this.packetReceived.unregister() + return + } + if (!this.packetReceived) this.packetReceived = register("packetReceived", () => { + this.packetMoves++ + }) this.lastTps.push(this.secondPackets) if (this.lastTps.length > 10) this.lastTps.shift() if (this.tps === -2) { @@ -322,6 +322,8 @@ class Hud extends Feature { this.cpsEnabledSetting.delete() this.initVariables() + + if (this.packetReceived) this.packetReceived.unregister() } renderHud() { @@ -542,7 +544,7 @@ class Hud extends Feature { if (this.lastStatData.itemsData.talisman_bag) { let isSoulflowCounting = false - this.lastStatData.itemsData.talisman_bag.toString().split(",").forEach(line => { + this.lastStatData.itemsData.talisman_bag.toString().split(",").forEach(line => { //omega scuffed because i cba actually using the nbt like a normal person if (isSoulflowCounting) { this.lastStatData._soulflow *= 1000 this.lastStatData._soulflow += parseInt(ChatLib.removeFormatting(line.split(` `)[0]).replace(/[^0-9]/g, "")) diff --git a/features/nether/index.js b/features/nether/index.js index 4eb6fab..a7db6bb 100644 --- a/features/nether/index.js +++ b/features/nether/index.js @@ -71,7 +71,9 @@ class Nether extends Feature { let blockState = this.getBlockIdFromState(packet[m.getBlockState.S23PacketBlockChange]()) let oldBlockState = this.getBlockIdFromState(World.getBlockStateAt(position)) if (oldBlockState === 20515 && blockState === 16419) { - this.blocks.push({ loc: position, time: Date.now() + 3000 }) + if (Math.abs(Player.getX() - position.getX()) <= 20 && Math.abs(Player.getY() - position.getY()) <= 20 && Math.abs(Player.getZ() - position.getZ()) <= 20) { + this.blocks.push({ loc: position, time: Date.now() + 3000 }) + } } if (blockState === 57379) { this.blocks = this.blocks.filter(b => { @@ -98,7 +100,9 @@ class Nether extends Feature { this.lastBlock = [position.getX(), position.getY(), position.getZ()] } if (oldBlockState === 20515 && blockState === 16419) { - this.blocks.push({ loc: position, time: Date.now() + 3000 }) + if (Math.abs(Player.getX() - position.getX()) <= 20 && Math.abs(Player.getY() - position.getY()) <= 20 && Math.abs(Player.getZ() - position.getZ()) <= 20) { + this.blocks.push({ loc: position, time: Date.now() + 3000 }) + } } if (blockState === 57379) { this.blocks = this.blocks.filter(b => { diff --git a/features/nether/metadata.json b/features/nether/metadata.json index 322c840..e68fb41 100644 --- a/features/nether/metadata.json +++ b/features/nether/metadata.json @@ -1,6 +1,6 @@ { "name": "Nether", - "description": "Nether features", + "description": "May cause some lag if enabled when not in nether", "isHidden": false, "isTogglable": true, "defaultEnabled": true, diff --git a/features/slayers/index.js b/features/slayers/index.js index 408c123..e5f7219 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -3,10 +3,11 @@ import Feature from "../../featureClass/class"; import { f, m } from "../../../mappings/mappings"; import { numberWithCommas, timeNumber } from "../../utils/numberUtils"; -import { drawBoxAtBlock, drawBoxAtEntity, drawFilledBox, drawLine } from "../../utils/renderUtils"; +import { drawBoxAtBlock, drawBoxAtEntity, drawCoolWaypoint, drawFilledBox, drawLine } from "../../utils/renderUtils"; import HudTextElement from "../hud/HudTextElement"; import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; +import socketConnection from "../../socketConnection"; class Slayers extends Feature { constructor() { @@ -48,6 +49,8 @@ class Slayers extends Feature { this.hudElements.push(this.dulkirThingElement); + this.otherSlayerWaypoints = new ToggleSetting("Show other users slayer boss locations", "May be usefull for loot share", true, "slayer_location_other", this) + this.lastSlayerFinishes = []; this.lastSlayerExps = []; this.slayerExp = {}; @@ -104,6 +107,8 @@ class Slayers extends Feature { this.emanStartedSittingTime = -1 this.pillerE = undefined this.lastPillerDink = 0 + this.lastServer = undefined + this.slayerLocationDataH = {} this.entityAttackEventLoaded = false; this.entityAttackEventE = undefined; @@ -114,6 +119,22 @@ class Slayers extends Feature { this.registerEvent("worldLoad", this.worldLoad); this.registerEvent("renderOverlay", this.renderHud); this.registerStep(true, 2, this.step); + this.registerForge(Java.type("net.minecraftforge.client.event.RenderWorldLastEvent"), this.renderWorldLast) + } + + renderWorldLast() { + if (!this.otherSlayerWaypoints) return + 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 boss" }) + }) + } + + slayerLocationData(loc, user) { + if (!loc) { + delete this.slayerLocationDataH[user] + return + } + this.slayerLocationDataH[user] = [loc, Date.now()] } renderHud() { @@ -202,6 +223,13 @@ class Slayers extends Feature { } } + if (this.lastServer !== this.FeatureManager.features["dataLoader"].class.stats.Server) { + this.lastServer = this.FeatureManager.features["dataLoader"].class.stats.Server; + + socketConnection.setSlayerServer(this.FeatureManager.features["dataLoader"].class.stats.Server); + } + + let lastBossSlainMessage = this.bossSlainMessage this.bossSlainMessage = false; let dis1 = false; this.dulkirThingElement.setText("") @@ -228,10 +256,16 @@ class Slayers extends Feature { //slayerExp[lastSlayerType] += lastSlayerExp } if (line.getName().includes("Boss slain!")) { + if (!lastBossSlainMessage) { + socketConnection.sendSlayerSpawnData({ loc: null, lobby: this.FeatureManager.features["dataLoader"].class.stats.Server }); + } this.bossSlainMessage = true; } if (line.getName().includes("Slay the boss!")) { + if (!this.bossSpawnedMessage) { + socketConnection.sendSlayerSpawnData({ loc: [Math.round(Player.getX()), Math.round(Player.getY()), Math.round(Player.getZ())], lobby: this.FeatureManager.features["dataLoader"].class.stats.Server }); + } if (!this.bossSpawnedMessage && !this.emanBoss) { this.nextIsBoss = Date.now(); } @@ -246,7 +280,6 @@ class Slayers extends Feature { && lineSplitThing[0].split("/").length === 2 && lineSplitThing[1] === "Kills") { let kills = lineSplitThing[0].split("/").map(a => parseInt(a)) - console.log(kills[0], kills[1]) if (kills[0] / kills[1] >= 0.9) { this.dulkirThingElement.setText(line.getName()) } @@ -474,6 +507,12 @@ class Slayers extends Feature { } else { this.slayerSpeedRatesElement.setText(""); } + + Object.keys(this.slayerLocationDataH).forEach(n => { + if (this.slayerLocationDataH[n][1] + 60000 * 3 < Date.now()) { + delete this.slayerLocationDataH[n] + } + }) } initVariables() { @@ -37,6 +37,7 @@ if (!global.soopyv2loggerthing) { register("command", () => { devs.push(Player.getUUID().toString().replace(/-/g, "")) + global.soopyv2loggerthing.isDev = isDev() }).setName("pleasegivemeaccesstosoopyv2devconsolelogs") //yep register("gameUnload", () => { diff --git a/metadata.json b/metadata.json index c6f1a02..767fb6d 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.58", - "versionId": 185, + "version": "2.1.60", + "versionId": 187, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/socketConnection.js b/socketConnection.js index 60e05fe..3c22d54 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -4,7 +4,7 @@ import logger from "./logger" import metadata from "./metadata" class SoopyV2Server extends WebsiteCommunicator { - constructor(){ + constructor() { super(socketData.serverNameToId.soopyv2) // this.spammedMessages = [] @@ -21,32 +21,35 @@ class SoopyV2Server extends WebsiteCommunicator { this.userCosmeticPermissions = undefined } - onData(data){ - if(data.type === "updateCosmeticPermissions"){ + onData(data) { + if (data.type === "updateCosmeticPermissions") { this.userCosmeticPermissions = data.permissions - if(global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.cosmetics)global.soopyv2featuremanagerthing.features.cosmetics.class.updateUserCosmeticPermissionSettings() + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.cosmetics) global.soopyv2featuremanagerthing.features.cosmetics.class.updateUserCosmeticPermissionSettings() } - if(data.type === "updateCosmetics"){ - if(global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.cosmetics)global.soopyv2featuremanagerthing.features.cosmetics.class.setUserCosmeticsInformation(data.uuid, data.cosmetics) + if (data.type === "updateCosmetics") { + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.cosmetics) global.soopyv2featuremanagerthing.features.cosmetics.class.setUserCosmeticsInformation(data.uuid, data.cosmetics) } // if(data.type === "spammedmessage"){ // this.spammedMessages.push(...data.messages) // } - if(data.type === "playerStatsQuick"){ - if(this.onPlayerStatsLoaded) this.onPlayerStatsLoaded(data.data) + if (data.type === "playerStatsQuick") { + if (this.onPlayerStatsLoaded) this.onPlayerStatsLoaded(data.data) } - if(data.type === "updateLbDataThing"){ + if (data.type === "updateLbDataThing") { this.lbdatathing = data.data this.lbdatathingupdated = data.lastUpdated } - if(data.type === "dungeonMapData"){ - if(global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.dungeonMap)global.soopyv2featuremanagerthing.features.dungeonMap.class.updateDungeonMapData(data.data) + if (data.type === "dungeonMapData") { + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.dungeonMap) global.soopyv2featuremanagerthing.features.dungeonMap.class.updateDungeonMapData(data.data) + } + if (data.type === "slayerSpawnData") { + if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.slayers) global.soopyv2featuremanagerthing.features.slayers.class.slayerLocationData(data.location, data.user) } } - onConnect(){ - if(this.reportErrorsSetting && !this.reportErrorsSetting.getValue()) return - + onConnect() { + if (this.reportErrorsSetting && !this.reportErrorsSetting.getValue()) return + this.errorsToReport.forEach(data => { this.sendData({ type: "error", @@ -56,7 +59,7 @@ class SoopyV2Server extends WebsiteCommunicator { this.errorsToReport = [] } - updateCosmeticsData(data){ + updateCosmeticsData(data) { this.sendData({ type: "cosmeticSettings", data: data @@ -71,9 +74,9 @@ class SoopyV2Server extends WebsiteCommunicator { // }) // } - reportError(error, description){ + reportError(error, description) { // ChatLib.chat(JSON.stringify(error)) - if(this.reportErrorsSetting && !this.reportErrorsSetting.getValue()) return + if (this.reportErrorsSetting && !this.reportErrorsSetting.getValue()) return let data = { lineNumber: error.lineNumber, fileName: error.fileName.replace(/file:.+?ChatTriggers/g, "file:"), //The replace is to not leak irl names thru windows acct name @@ -84,17 +87,17 @@ class SoopyV2Server extends WebsiteCommunicator { modVersionId: metadata.versionId, } - if(this.connected && this.reportErrorsSetting){ + if (this.connected && this.reportErrorsSetting) { this.sendData({ type: "error", data: data }) - }else{ + } else { this.errorsToReport.push(data) } } - requestPlayerStats(uuid, username){ + requestPlayerStats(uuid, username) { this.sendData({ type: "loadStatsQuick", uuid: uuid, @@ -102,27 +105,41 @@ class SoopyV2Server extends WebsiteCommunicator { }) } - requestPlayerStatsCache(uuid, username){ + requestPlayerStatsCache(uuid, username) { this.sendData({ type: "loadStatsQuickCache", uuid: uuid, username: username }) } - - sendDungeonData(names, data){ + + sendDungeonData(names, data) { this.sendData({ type: "dungeonMapData", names: names, data: data }) } + + sendSlayerSpawnData(data) { + this.sendData({ + type: "slayerSpawnData", + data: data + }) + } + + setSlayerServer(server) { + this.sendData({ + type: "slayerServer", + server: server + }) + } } -if(!global.soopyV2Server){ +if (!global.soopyV2Server) { global.soopyV2Server = new SoopyV2Server() - - register("gameUnload", ()=>{ + + register("gameUnload", () => { global.soopyV2Server = undefined }) } diff --git a/utils/renderUtils.js b/utils/renderUtils.js index 4ec1bc8..051d0c6 100644 --- a/utils/renderUtils.js +++ b/utils/renderUtils.js @@ -49,7 +49,7 @@ let ret = { GL11.glDepthMask(false); GlStateManager.func_179094_E(); - Tessellator.begin(3).colorize(r, g, b); + Tessellator.begin(2).colorize(r, g, b); Tessellator.pos(x, y, z); Tessellator.pos(x2, y2, z2); @@ -72,7 +72,7 @@ let ret = { GL11.glDepthMask(false); GlStateManager.func_179094_E(); - Tessellator.begin(3).colorize(r, g, b); + Tessellator.begin(2).colorize(r, g, b); Tessellator.pos(x, y, z); Tessellator.pos(x2, y2, z2); @@ -101,7 +101,7 @@ let ret = { }, drawLineSmall: function (x, y, z, x2, y2, z2, r, g, b) { - Tessellator.begin(3).colorize(r, g, b); + Tessellator.begin(2).colorize(r, g, b); Tessellator.pos(x, y, z); Tessellator.pos(x2, y2, z2); @@ -116,7 +116,7 @@ let ret = { GL11.glDepthMask(false); GlStateManager.func_179094_E(); - Tessellator.begin(3).colorize(r, g, b); + Tessellator.begin(2).colorize(r, g, b); locations.forEach(loc => { Tessellator.pos(...loc); @@ -143,7 +143,7 @@ let ret = { w += 0.01 h += 0.01 - Tessellator.begin(3).colorize(colorR, colorG, colorB, a); + Tessellator.begin(2).colorize(colorR, colorG, colorB, a); Tessellator.pos(x + w, y + h, z + w); Tessellator.pos(x + w, y + h, z); @@ -182,7 +182,7 @@ let ret = { GlStateManager[m.pushMatrix]() - Tessellator.begin(3).colorize(colorR, colorG, colorB, a); + Tessellator.begin(2).colorize(colorR, colorG, colorB, a); Tessellator.pos(x + w, y + h, z + w); Tessellator.pos(x + w, y + h, z); @@ -233,7 +233,7 @@ let ret = { GlStateManager.func_179094_E(); - Tessellator.begin(3).colorize(colorR, colorG, colorB); + Tessellator.begin(2).colorize(colorR, colorG, colorB); Tessellator.pos(x + width, y + height, z + width); Tessellator.pos(x + width, y + height, z - width); |