diff options
-rw-r--r-- | features/mining/index.js | 28 | ||||
-rw-r--r-- | metadata.json | 4 | ||||
-rw-r--r-- | socketConnection.js | 14 |
3 files changed, 41 insertions, 5 deletions
diff --git a/features/mining/index.js b/features/mining/index.js index 1c1eb5f..d557aed 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -9,6 +9,7 @@ import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; import { numberWithCommas, timeSince } from "../../utils/numberUtils"; import { fetch } from "../../utils/networkUtils"; +import socketConnection from "../../socketConnection"; class Mining extends Feature { constructor() { @@ -51,6 +52,14 @@ class Mining extends Feature { .editTempText("&6$/h&7> &f$12,345,678\n&6$ made&7> &f$123,456,789\n&6Time tracked&7> &f123m")) this.hudElements.push(this.gemstoneMoneyHudElement) + this.nextChEvent = new ToggleSetting("Show the current and next crystal hollows event", "(syncs the data between all users in ch)", true, "chevent_hud", this) + this.nextChEventElement = new HudTextElement() + .setToggleSetting(this.nextChEvent) + .setLocationSetting(new LocationSetting("HUD Location", "Allows you to edit the location of the hud element", "chevent_hud_location", this, [10, 70, 1, 1]) + .requires(this.nextChEvent) + .editTempText("&6Event&7> &fGONE WITH THE WIND &7->&f 2X POWDER")) + this.hudElements.push(this.nextChEventElement) + this.seenBalDamages = [] this.balHP = 250 this.lastBalAlive = 0 @@ -116,7 +125,6 @@ class Mining extends Feature { money += gemstoneCosts[id] * number - console.log(money) let moneyPerHour = Math.floor(money / ((Date.now() - startingTime) / (1000 * 60 * 60))) let moneyMade = Math.floor(money) let timeTracked = timeSince(startingTime) @@ -128,8 +136,24 @@ class Mining extends Feature { money = 0 startingTime = -1 lastMined = 0 - this.gemstoneMoneyHudElement.setText("") + this.gemstoneMoneyHudElement.setText("&6Event&7> &f" + socketConnection.chEvent.join(" &7->&f ")) } + + this.nextChEventElement.setText() + }) + + // 2X POWDER ENDED! + // Passive Active Event + // 2X POWDER STARTED! + //&r&r&r &r&9&lGONE WITH THE WIND ENDED!&r + //§r§r§r §r§b§l2X POWDER ENDED!§r + //§r§r§r §r§b§l2X POWDER STARTED!§r + + this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} ENDED!&r", (spaces, color, event) => { + socketConnection.sendCHEventData(event.trim(), false) + }) + this.registerChat("&r&r&r ${spaces}&r&${color}&l${event} STARTED!&r", (spaces, color, event) => { + socketConnection.sendCHEventData(event.trim(), true) }) } diff --git a/metadata.json b/metadata.json index 1978a48..efba9b7 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.83", - "versionId": 210, + "version": "2.1.84", + "versionId": 211, "requires": [ "soopyApis", "soopyAddonsData", diff --git a/socketConnection.js b/socketConnection.js index 7e6bb99..e8aa796 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -26,6 +26,8 @@ class SoopyV2Server extends WebsiteCommunicator { this.cookieData = undefined this.cookieDataUpdated = 0 + this.chEvent = ["???", "???"] + register("step", () => { if (this.cookieDataUpdated && Date.now() - this.cookieDataUpdated > 60000) { this.cookieData = 0 @@ -85,7 +87,9 @@ class SoopyV2Server extends WebsiteCommunicator { if (data.type === "pollEvent") { if (global.soopyv2featuremanagerthing && global.soopyv2featuremanagerthing.features.eventsGUI) global.soopyv2featuremanagerthing.features.eventsGUI.class.pollEventData(data.admin) } - + if (data.type === "chEvent") { + this.chEvent = data.event + } } onConnect() { @@ -220,6 +224,14 @@ class SoopyV2Server extends WebsiteCommunicator { code }) } + + sendCHEventData(event, started) { + this.sendData({ + type: "chEvent", + event, + started + }) + } } if (!global.soopyV2Server) { |