diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/events/index.js | 11 | ||||
-rw-r--r-- | features/globalSettings/index.js | 55 |
2 files changed, 56 insertions, 10 deletions
diff --git a/features/events/index.js b/features/events/index.js index 5028e5d..1b51607 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -18,8 +18,7 @@ let warpData = { "castle": [-250, 130, 45], "da": [91, 75, 176], "museum": [-75, 76, 80], - "hub": [-2, 70, -69], - "worldload": undefined + "hub": [-2, 70, -69] } function getKeyBindFromKey(key, description) { var mcKeyBind = undefined //MinecraftVars.getKeyBindFromKey(key); @@ -95,7 +94,6 @@ class Events extends Feature { this.todoE = [] this.hasWarps = new Set() - this.hasWarps.add("worldload") this.shinyBlockOverlayEnabled = new ToggleSetting("Shiny blocks highlight", "Will highlight shiny blocks in the end", false, "shiny_blocks_overlay", this) @@ -127,11 +125,6 @@ class Events extends Feature { this.registerStep(true, 1, this.step_1fps) this.registerStep(true, 10, this.step_10fps) - - this.registerCommand("sethubwarp", () => { - warpData.worldload = [Player.getX(), Player.getY(), Player.getZ()] - ChatLib.chat(this.FeatureManager.messagePrefix + "Set /hub location!") - }) } step_1fps() { @@ -300,7 +293,6 @@ class Events extends Feature { let d = calculateDistance(warpData[w], this.guessPoint) if (d < minDist) { warp = "warp " + w - if (w === "worldload") warp = "hub" minDist = d } }) @@ -313,7 +305,6 @@ class Events extends Feature { } worldLoad() { - warpData.worldload = [Player.getX(), Player.getY(), Player.getZ()] this.burrialData.points = [] this.burrialData.locations = [] diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index a31631e..5465629 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -315,6 +315,49 @@ class GlobalSettings extends Feature { }) ev.trigger.setPriority(Priority.HIGHEST) + + this.ahAlerts = [ + // { //TODO: add a command/gui to add these + // id: "ATTRIBUTE_SHARD", + // maxPrice: 1500000, + // nbt: [ + // "tag.ExtraAttributes.attributes.mana_pool" + // ] + // } + ] + + this.registerStep(false, 60, () => { + if (this.ahAlerts.length === 0) return + fetch("https://moulberry.codes/auction.json").json(data => { //TODO: use https://moulberry.codes/auction.json.gz + if (!data.success) return + + data.new_auctions.forEach(a => { + let itemData = decompress(a.item_bytes) + let itemJSON = itemData.toObject().i[0] + let itemId = itemJSON.tag.ExtraAttributes.id + + if (a.bin && this.ahAlerts.some(al => { + let ret = al.id === itemId && a.starting_bid <= al.maxPrice + + if (ret && al.nbt) { + if (al.nbt.some(nbtr => { + let steps = nbtr.split(".") + let o = itemJSON + steps.forEach(s => { + o = o?.[s] + }) + + return !o + })) ret = false + } + + return ret + })) { + new TextComponent(this.FeatureManager.messagePrefix + "Bin found " + numberWithCommas(a.starting_bid) + " " + a.item_name).setClick("run_command", "/viewauction " + a.uuid).chat() + } + }) + }) + }) } worldLoad() { @@ -1005,3 +1048,15 @@ class FirstLoadingPage extends GuiPage { module.exports = { class: new GlobalSettings() } + + +const ByteArrayInputStream = Java.type("java.io.ByteArrayInputStream") +const Base64 = Java.type("java.util.Base64") +const CompressedStreamTools = Java.type("net.minecraft.nbt.CompressedStreamTools") +function decompress(compressed) { + if (compressed === null || compressed.length == 0) { + return null + } + + return new NBTTagCompound(CompressedStreamTools.func_74796_a(new ByteArrayInputStream(Base64.getDecoder().decode(compressed)))) +}
\ No newline at end of file |