aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--features/dungeonMap/index.js40
-rw-r--r--features/dungeonSolvers/index.js112
-rw-r--r--features/events/index.js2
-rw-r--r--features/statHistoryGui/index.js164
-rw-r--r--features/statHistoryGui/metadata.json8
-rw-r--r--features/streamsGUI/index.js6
6 files changed, 273 insertions, 59 deletions
diff --git a/features/dungeonMap/index.js b/features/dungeonMap/index.js
index 207d480..bc54aa5 100644
--- a/features/dungeonMap/index.js
+++ b/features/dungeonMap/index.js
@@ -55,6 +55,7 @@ class DungeonMap extends Feature {
this.puzzlesTab = []
this.roomWidth = 1
this.nameToUUID = {}
+ this.deadPlayers = new Set()
this.newPuzzlesTab = []
this.mortLocationOnMap = undefined
this.brBoxLoc = undefined
@@ -62,6 +63,7 @@ class DungeonMap extends Feature {
// 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.mapData = undefined
+ this.idToPlayer = {}
this.barrier_block_item = new Item("minecraft:barrier")
this.puzzleItems = {
@@ -120,7 +122,7 @@ class DungeonMap extends Feature {
this.spiritLeapOverlayGui = new SpiritLeapOverlay(this)
// this.registerEvent("tick", this.tick)
- this.registerStep(true, 3, this.step).registeredWhen(() => this.isInDungeon())
+ this.registerStep(true, 3, this.step)
this.registerStep(true, 10, () => {
this.spiritLeapOverlayGui.tick()
}).registeredWhen(() => this.isInDungeon())
@@ -154,6 +156,16 @@ class DungeonMap extends Feature {
this.registerEvent("gameUnload", () => {
this.running = false
})
+ this.registerChat("&r&c ☠ ${info} and became a ghost&r&7.&r", (info, e) => {
+ let player = ChatLib.removeFormatting(info.split(" ")[0])
+
+ this.deadPlayers.add(this.nameToUUID[player])
+ });
+ this.registerChat("&r&a ❣ &r${info} was revived${*}!&r", (info, e) => {
+ let player = ChatLib.removeFormatting(info.split(" ")[0])
+
+ this.deadPlayers.delete(this.nameToUUID[player])
+ });
this.registerStep(true, 3, () => {
if (!this.isInDungeon()) return
@@ -178,6 +190,7 @@ class DungeonMap extends Feature {
this.mortLocationOnMap = undefined
this.bloodOpened = false
this.keys = 0
+ this.idToPlayer = {}
}
renderOverlay() {
@@ -314,6 +327,7 @@ class DungeonMap extends Feature {
})
Object.keys(this.mapDataPlayers).forEach((uuid) => {
+ if (this.deadPlayers.has(uuid)) return
if (uuid === Player.getUUID().toString()) return
let renderX
let renderY
@@ -366,6 +380,22 @@ class DungeonMap extends Feature {
step() {
if (!World.getWorld()) return
+ if (!this.isInDungeon()) return
+ if (Player.getContainer().getName().startsWith("Catacombs - Floor ")) {
+ this.nameToUUID = {}
+ World.getAllPlayers().forEach(p => {
+ this.nameToUUID[p.getName()] = p.getUUID().toString()
+ })
+ let playerI = 0
+ for (let i = 0; i < 5; i++) {
+ let name = ChatLib.removeFormatting(Player.getContainer().getStackInSlot(3 + i)?.getName()?.split(" ")?.pop() || "")
+ if (this.nameToUUID[name]) {
+ this.idToPlayer[playerI] = this.nameToUUID[name]
+ }
+ if (name) playerI++
+ }
+ if (playerI !== World.getAllPlayers().filter(p => p.getPing() === 1).length) this.idToPlayer = {}
+ }
// console.log("asjbfoasbgp")
this.people = []
this.puzzlesTab = []
@@ -389,7 +419,6 @@ class DungeonMap extends Feature {
// console.log(name)
})
let puzzlesTab2 = this.puzzlesTab.map(a => a)
-
// console.log(this.puzzlesTab.length)
// Object.keys(this.puzzles).forEach(key=>{
// let y = (key%128)
@@ -593,7 +622,7 @@ class DungeonMap extends Feature {
if (this.brBox.getValue() && !this.bloodOpened) this.dungeonBrBoxElm.startRender()
- this.dungeonBrBoxElm.setLocationSize([this.brBoxLoc[0] - 1.5, 69, this.brBoxLoc[1] - 1.5], [3, 4, 3])
+ if (this.brBoxLoc) this.dungeonBrBoxElm.setLocationSize([this.brBoxLoc[0] - 1.5, 69, this.brBoxLoc[1] - 1.5], [3, 4, 3])
if (roomOffsets) {
// for(let x = 0;x<128;x++){
@@ -634,6 +663,7 @@ class DungeonMap extends Feature {
let deco = mapData[f.mapDecorations]
this.extraDeco = []
try {
+ let i = 0
deco.forEach((icon, vec4b) => {
let x = vec4b.func_176112_b()
let y = vec4b.func_176113_c()
@@ -660,12 +690,15 @@ class DungeonMap extends Feature {
closestP = uuid
}
})
+ while (this.idToPlayer[i] && this.deadPlayers.has(this.idToPlayer[i])) i++
+ if (this.idToPlayer[i]) closestP = this.idToPlayer[i]
if (closestP) {
// console.log(closestP, x, y)
this.mapDataPlayers[closestP].x = x
this.mapDataPlayers[closestP].y = y
this.mapDataPlayers[closestP].rot = rot
}
+ i++
});
} catch (e) { }
}
@@ -703,6 +736,7 @@ class DungeonMap extends Feature {
username: player.getName(),
uuid: player.getUUID().toString()
})
+ this.nameToUUID[player.getName()] = player.getUUID().toString()
})
// console.log("Sending: " + JSON.stringify(this.people, undefined, 2)+JSON.stringify(data, undefined, 2))
socketConnection.sendDungeonData(this.people, data)
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 2ec0267..14f8b88 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -183,7 +183,7 @@ class DungeonSolvers extends Feature {
this.bloodOpenedBonus = true;
this.goneInBonus = true;
});
- this.registerChat("&r&c[BOSS] The Watcher&r&f: You have proven yourself. You may pass.&r", () => {
+ this.registerChat("[BOSS] The Watcher: You have proven yourself. You may pass.", () => {
this.bloodOpenedBonus = false; //TODO: add 5second delay
this.goneInBonus = true;
});
@@ -252,61 +252,64 @@ class DungeonSolvers extends Feature {
//TODO: finish this
- // let saidLocations = new Set()
- // let data = []
- // let area = 0
- // this.registerChat("", () => {
- // area++
- // })
- // this.registerStep(false, 3, () => {
- // World.getAllEntities().forEach(e => {
- // if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive device")) {
- // addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "device")
- // }
- // if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive terminal")) {
- // addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "terminal")
- // }
- // if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("not activated")) {
- // addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "lever")
- // }
- // })
- // })
+ let saidLocations = new Set()
+ let data = []
+ let area = 0
+ this.registerChat("", () => {
+ area++
+ })
+ this.registerStep(false, 3, () => {
+ World.getAllEntities().forEach(e => {
+ if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive device")) {
+ addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "device")
+ }
+ if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("inactive terminal")) {
+ addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "terminal")
+ }
+ if (ChatLib.removeFormatting(e.getName()).toLowerCase().includes("not activated")) {
+ addThing([Math.trunc(e.getX()), Math.trunc(e.getY()), Math.trunc(e.getZ())], "lever")
+ }
+ })
+ })
- // function addThing(location, type) {
- // if (saidLocations.has(location.join(","))) return
+ function addThing(location, type) {
+ if (saidLocations.has(location.join(","))) return
- // saidLocations.add(location.join(","))
+ saidLocations.add(location.join(","))
- // if (type === "lever") {
- // let finalLoc = undefined
- // for (let i = 5; i > -5; i--) {
- // if (World.getBlockAt(location[0], location[1] + i, location[2])?.getType()?.getID() === 69) {
- // finalLoc = [location[0], location[1] + i, location[2]]
- // }
- // }
- // data.push({ type: "lever", location: finalLoc, phase: area })
- // return
- // }
- // if (type === "terminal") {
- // let finalLoc = undefined
- // for (let x = 5; x > -5; x--) {
- // for (let y = 5; y > -5; y--) {
- // for (let z = 5; z > -5; z--) {
- // if (World.getBlockAt(location[0] + x, location[1] + y, location[2] + x)?.getType()?.getID() === 137) {
- // finalLoc = [location[0] + x, location[1] + y, location[2] + x]
- // }
- // }
- // }
- // }
- // data.push({ type: "terminal", location: finalLoc, phase: area })
- // return
- // }
- // data.push({ type: type, location: location, phase: area })
- // }
+ if (type === "lever") {
+ let finalLoc = undefined
+ for (let i = 5; i > -5; i--) {
+ if (World.getBlockAt(location[0], location[1] + i, location[2])?.getType()?.getID() === 69) {
+ finalLoc = [location[0], location[1] + i, location[2]]
+ }
+ }
+ ChatLib.chat("Loaded " + type)
+ data.push({ type: "lever", location: finalLoc, phase: area })
+ return
+ }
+ if (type === "terminal") {
+ let finalLoc = undefined
+ for (let x = 5; x > -5; x--) {
+ for (let y = 5; y > -5; y--) {
+ for (let z = 5; z > -5; z--) {
+ if (World.getBlockAt(location[0] + x, location[1] + y, location[2] + x)?.getType()?.getID() === 137) {
+ finalLoc = [location[0] + x, location[1] + y, location[2] + x]
+ }
+ }
+ }
+ }
+ ChatLib.chat("Loaded " + type)
+ data.push({ type: "terminal", location: finalLoc, phase: area })
+ return
+ }
+ ChatLib.chat("Loaded " + type)
+ data.push({ type: type, location: location, phase: area })
+ }
- // this.registerCommand("getdata", () => {
- // ChatLib.chat(JSON.stringify(data))
- // })
+ this.registerCommand("getdata", () => {
+ ChatLib.chat(JSON.stringify(data))
+ })
//§r§6Soopyboo32§r§a activated a lever! (§r§c8§r§a/8)§r
//§r§6Soopyboo32§r§a completed a device! (§r§c3§r§a/8)§r
@@ -778,6 +781,11 @@ class DungeonSolvers extends Feature {
}
step() {
+ if (this.bearSpawning && this.bearSpawning > 0) {
+ this.spiritBearSpawnElement.setText("&dBear spawned in: &c" + (Math.max(0, this.bearSpawning - Date.now()) / 1000).toFixed(2) + "s");
+ } else {
+ this.spiritBearSpawnElement.setText("");
+ }
if (!Player.getX()) return
World.getAllPlayers().forEach((p) => {
this.nameToUuid[p.getName().toLowerCase()] = p.getUUID().toString()
diff --git a/features/events/index.js b/features/events/index.js
index 9ff7078..9e08d94 100644
--- a/features/events/index.js
+++ b/features/events/index.js
@@ -57,7 +57,7 @@ class Events extends Feature {
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("spawnParticle", this.spawnParticle).registeredWhen(() => this.showingWaypoints || this.shinyBlockOverlayEnabled.getValue())
this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.showingWaypoints || this.shinyBlockOverlayEnabled.getValue())
this.registerStep(true, 2, this.step)
this.registerStep(false, 5, this.step_5s)
diff --git a/features/statHistoryGui/index.js b/features/statHistoryGui/index.js
new file mode 100644
index 0000000..173137f
--- /dev/null
+++ b/features/statHistoryGui/index.js
@@ -0,0 +1,164 @@
+/// <reference types="../../../CTAutocomplete" />
+/// <reference lib="es2015" />
+import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement";
+import Feature from "../../featureClass/class";
+import GuiPage from "../soopyGui/GuiPage";
+import BoxWithLoading from "../../../guimanager/GuiElement/BoxWithLoading";
+import BoxWithTextAndDescription from "../../../guimanager/GuiElement/BoxWithTextAndDescription";
+import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement";
+import TextBox from "../../../guimanager/GuiElement/TextBox";
+import SoopyKeyPressEvent from "../../../guimanager/EventListener/SoopyKeyPressEvent";
+import { firstLetterWordCapital } from "../../utils/stringUtils";
+import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent";
+import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow";
+import { fetch } from "../../utils/networkUtils";
+import SoopyImageElement from "../../../guimanager/GuiElement/SoopyImageElement";
+import renderLibs from "../../../guimanager/renderLibs";
+
+class StatHistoryGUI extends Feature {
+ constructor() {
+ super()
+ }
+
+ onEnable() {
+ this.initVariables()
+
+ this.GuiPage = new StatGraphPage()
+
+ }
+
+ initVariables() {
+ this.GuiPage = undefined
+ }
+
+ onDisable() {
+ this.initVariables()
+ }
+}
+
+
+class StatGraphPage extends GuiPage {
+ constructor() {
+ super(7)
+
+ this.name = "Stat Graphs"
+
+ this.pages = [this.newPage()]
+
+ this.pages[0].addChild(new SoopyTextElement().setText("§0Stat Graphs").setMaxTextScale(3).setLocation(0.1, 0.05, 0.6, 0.1))
+ 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(() => {
+ java.awt.Desktop.getDesktop().browse(
+ new java.net.URI("https://soopymc.my.to/stathistory")
+ );
+ }))
+
+ this.nameInput = new TextBox().setPlaceholder("Click to search").setLocation(0.1, 0.225, 0.8, 0.1)
+ this.pages[0].addChild(this.nameInput)
+
+ this.nameInput.addEvent(new SoopyKeyPressEvent().setHandler((key, keyId) => {
+ if (this.nameInput.text.selected && keyId === 28) {
+ this.playerLoad = this.nameInput.text.text
+ this.nameInput.setText("")
+ this.updateData(this.playerLoad)
+ }
+ }))
+
+ this.statArea = new SoopyGuiElement().setLocation(0.05, 0.325, 0.9, 0.675).setScrollable(true)
+ this.pages[0].addChild(this.statArea)
+
+ this.loadingElm = new BoxWithLoading().setLocation(0.35, 0.4, 0.3, 0.2)
+ this.errorElm = new BoxWithTextAndDescription().setLocation(0.2, 0.3, 0.6, 0.4).setText("Error!").setDesc("An error occured while loading the data!")
+ this.statArea.addChild(this.loadingElm)
+
+ this.playerLoad = undefined
+
+ this.finaliseLoading()
+ }
+
+ updateData(player) {
+ this.playerLoad = player
+
+ this.statArea._scrollAmount = 0
+ this.statArea.location.scroll.y.set(0, 100)
+
+ this.statArea.clearChildren()
+ this.statArea.addChild(this.loadingElm)
+
+ fetch("http://soopymc.my.to/api/v2/player/" + player).json(playerData => {
+
+ if (player !== this.playerLoad) return
+
+ if (!playerData.success) {
+ this.statArea.clearChildren()
+ this.statArea.addChild(this.errorElm)
+ this.errorElm.setText("§0" + playerData.error.name)
+ this.errorElm.setDesc("§0" + playerData.error.description)
+ return
+ }
+
+ fetch("http://soopymc.my.to/api/v2/player_skyblock/" + playerData.data.uuid).json(skyblockData => {
+
+ if (player !== this.playerLoad) return
+
+ this.statArea.clearChildren()
+
+ if (!skyblockData.success) {
+ this.statArea.addChild(this.errorElm)
+ this.errorElm.setText("§0" + skyblockData.error.name)
+ this.errorElm.setDesc("§0" + skyblockData.error.description)
+ return
+ }
+
+ let nameElm = new SoopyTextElement().setText(playerData.data.stats.nameWithPrefix.replace(/§f/g, "§7")).setMaxTextScale(2).setLocation(0.1, 0.05, 0.8, 0.1)
+ this.statArea.addChild(nameElm)
+
+ fetch("http://soopymc.my.to/statgraphgenerations/" + playerData.data.uuid + "/" + skyblockData.data.stats.bestProfileId).json(graphData => {
+ if (player !== this.playerLoad) return
+
+ new Thread(() => {
+ let y = 0.2
+ Object.keys(graphData).forEach(type => {
+ let typeElm = new SoopyTextElement().setText("§0" + firstLetterWordCapital(type.replace("total", ""))).setMaxTextScale(2).setLocation(0.1, y, 0.8, 0.1)
+ this.statArea.addChild(typeElm)
+ y += 0.15
+ let x = 0.05
+ Object.keys(graphData[type]).forEach((graph, i) => {
+ renderLibs.getImage(graphData[type][graph], true) //load image synchronously into cache so it knows the height
+ console.log(graphData[type][graph])
+ let graphElm = new SoopyImageElement()
+ this.statArea.addChild(graphElm)
+ graphElm.setImage(graphData[type][graph])
+
+ if (i === 0) {
+ graphElm.setLocation(0.1, y, 0.8, 0.25)
+ graphElm.loadHeightFromImage()
+ y += graphElm.location.size.y.get() + 0.05
+ } else {
+ graphElm.setLocation(x, y, 0.4, 0.25)
+ graphElm.loadHeightFromImage()
+ x += 0.5
+ if (x > 0.7 || i === Object.keys(graphData[type]).length - 1) {
+ x = 0.05
+ y += graphElm.location.size.y.get() + 0.05
+ }
+ }
+ })
+ })
+ }).start()
+ })
+ })
+ })
+ }
+
+ onOpen() {
+ this.playerLoad = Player.getName()
+ this.updateData(Player.getName())
+ }
+}
+
+module.exports = {
+ class: new StatHistoryGUI()
+} \ No newline at end of file
diff --git a/features/statHistoryGui/metadata.json b/features/statHistoryGui/metadata.json
new file mode 100644
index 0000000..9345e0e
--- /dev/null
+++ b/features/statHistoryGui/metadata.json
@@ -0,0 +1,8 @@
+{
+ "name": "Stat History GUI",
+ "description": "Gui for Stat History",
+ "isHidden": true,
+ "isTogglable": false,
+ "defaultEnabled": true,
+ "sortA": 0
+} \ No newline at end of file
diff --git a/features/streamsGUI/index.js b/features/streamsGUI/index.js
index 492728a..d7d75cd 100644
--- a/features/streamsGUI/index.js
+++ b/features/streamsGUI/index.js
@@ -10,7 +10,6 @@ import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement";
import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent";
import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow";
import BoxWithText from "../../../guimanager/GuiElement/BoxWithText";
-import { drawBoxAtBlock } from "../../utils/renderUtils";
import { fetch } from "../../utils/networkUtils";
class StreamsGui extends Feature {
@@ -94,9 +93,9 @@ class StreamPage extends GuiPage {
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().setLocation(0.1, 0.15 + title.getHeight(), 0.8, 0.4).setImage(data.image)
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)
sidebar.addChild(button)
@@ -118,6 +117,7 @@ class StreamPage extends GuiPage {
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)
+ image.loadHeightFromImage()
}
onOpen() {