diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/globalSettings/index.js | 100 | ||||
-rw-r--r-- | features/slayers/index.js | 90 | ||||
-rw-r--r-- | features/specialMining/index.js | 207 | ||||
-rw-r--r-- | features/specialMining/metadata.json | 8 | ||||
-rw-r--r-- | features/waypoints/index.js | 7 |
5 files changed, 375 insertions, 37 deletions
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 429cb23..1173c16 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -147,6 +147,8 @@ class GlobalSettings extends Feature { this.GuiPage = new FirstLoadingPage(this) // soopyV2Server.reportErrorsSetting = this.reportErrorsSetting + this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.itemWorth.getValue() || this.showChampion.getValue() || this.showHecatomb.getValue()) + this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey) const EntityFallingBlock = Java.type("net.minecraft.entity.item.EntityFallingBlock"); @@ -209,6 +211,27 @@ class GlobalSettings extends Feature { this.registerCommand("lobbyday", () => { ChatLib.chat(this.FeatureManager.messagePrefix + "Current lobby is day " + (World.getTime() / 20 / 60 / 20).toFixed(2)) }) + this.registerCommand("tps", (time = "3") => { + time = parseInt(time) + ChatLib.chat(this.FeatureManager.messagePrefix + "Loading tps... this will take " + time + "s") + + let packetMoves = 0 + let ticks = 0 + let packetReceived = register("packetReceived", () => { + packetMoves++ + }) + + let tick = register("tick", () => { + if (packetMoves > 0) ticks++ + packetMoves = 0 + }) + + delay(time * 1000, () => { + packetReceived.unregister() + tick.unregister() + ChatLib.chat(this.FeatureManager.messagePrefix + "Tps: " + (ticks / time).toFixed(1)) + }) + }) this.lastCookies = 0 @@ -308,7 +331,7 @@ class GlobalSettings extends Feature { max = Number(max) if (max < 0 || isNaN(max)) this.maxAmount.setValue("0"); } - let inGui = Client.isInGui(); + let inGui = Client.isInGui() if (!old && !pick && !thunder) return if (inGui) { this.todoPickUpLog = {}; @@ -342,9 +365,9 @@ class GlobalSettings extends Feature { if (!oldItem && !newItem) return //they both are air if (j > 36 || j == 9) return //sbmenu and armors (when switching wardrobe it goes brrr w/o this) let oldItemAmount = oldItem ? oldItem.getNBT().getDouble("Count") : undefined - let oldItemName = oldItem ? oldItem.getName() : "" + let oldItemName = oldItem ? oldItem.getName().replace(/ §8x\d+$/, "") : "" let newItemAmount = newItem ? newItem.getNBT().getDouble("Count") : undefined - let newItemName = newItem ? newItem.getName() : "" + let newItemName = newItem ? newItem.getName().replace(/ §8x\d+$/, "") : "" this.oldItemData[j] = newItem if (oldItemName === newItemName) { //only amount is changed if (oldItemAmount === newItemAmount || !newItemAmount || !oldItemAmount) return @@ -428,10 +451,49 @@ class GlobalSettings extends Feature { }) } - updateItemLores() { - if (!this.itemWorth.getValue() && !this.showChampion.getValue() && !this.showHecatomb.getValue()) return; + itemTooltipEvent(lore, i, event) { + let uuid = getSBUUID(i) + if (!uuid) return + + if (this.itemWorth.getValue()) { + let a = socketConnection.itemPricesCache.get(uuid) + + if (!a && socketConnection.itemPricesCache2.get(uuid)) { + a = socketConnection.itemPricesCache2.get(uuid) + socketConnection.itemPricesCache.set(uuid, a) + } + + if (a) { + addLore(i, "§eWorth: ", "§6$" + numberWithCommas(Math.round(a))) + } + } + + if (this.showChampion.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp")) { + let xp = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp") + + let level = 1 + championLevels.forEach(l => { + if (xp >= l) level++ + }) + let xpNext = championLevels[level - 1] - if (!Client.currentGui.get()) return + addLore(i, "§eChampion: ", "§d" + level + " §6" + numberWithCommas(Math.round(xp)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : "")) + } + if (this.showHecatomb.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs")) { + let runs = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs") + + let level = 1 + hecatombLevels.forEach(l => { + if (runs >= l) level++ + }) + let xpNext = hecatombLevels[level - 1] + + addLore(i, "§eHecatomb: ", "§d" + level + " §6" + numberWithCommas(Math.round(runs)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : "")) + } + } + + updateItemLores() { + if (!this.itemWorth.getValue()) return; let items = [...Player.getInventory().getItems(), ...Player.getContainer().getItems()] @@ -447,9 +509,7 @@ class GlobalSettings extends Feature { socketConnection.itemPricesCache.set(uuid, a) } - if (a) { - addLore(i, "§eWorth: ", "§6$" + numberWithCommas(Math.round(a))) - } else { + if (!a) { if (!this.requestingPrices.has(uuid)) { this.requestingPrices.add(uuid) @@ -460,28 +520,6 @@ class GlobalSettings extends Feature { } - if (this.showChampion.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp")) { - let xp = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp") - - let level = 1 - championLevels.forEach(l => { - if (xp >= l) level++ - }) - let xpNext = championLevels[level - 1] - - addLore(i, "§eChampion: ", "§d" + level + " §6" + numberWithCommas(Math.round(xp)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : "")) - } - if (this.showHecatomb.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs")) { - let runs = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs") - - let level = 1 - hecatombLevels.forEach(l => { - if (runs >= l) level++ - }) - let xpNext = hecatombLevels[level - 1] - - addLore(i, "§eHecatomb: ", "§d" + level + " §6" + numberWithCommas(Math.round(runs)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : "")) - } }) } diff --git a/features/slayers/index.js b/features/slayers/index.js index fb3cc33..3a06139 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -48,14 +48,22 @@ class Slayers extends Feature { this.slayerXpElement = new HudTextElement() .setText("&6Slayer&7> &fLoading...") .setToggleSetting(this.slayerXpGuiElement) - .setLocationSetting(new LocationSetting("Slayer Xp Location", "Allows you to edit the location of you current slayer xp", "slayer_xp_location", this, [10, 50, 1, 1]).requires(this.slayerXpGuiElement).editTempText("&6Enderman&7> &d&l2,147,483,647 XP").contributor("EmeraldMerchant")); + .setLocationSetting(new LocationSetting("Slayer Xp Location", "Allows you to edit the location of your current slayer xp", "slayer_xp_location", this, [10, 50, 1, 1]).requires(this.slayerXpGuiElement).editTempText("&6Enderman&7> &d&l2,147,483,647 XP").contributor("EmeraldMerchant")); this.hudElements.push(this.slayerXpElement); this.MinibossAlert = new ToggleSetting("Alert when miniboss spawned nearby", "Pops up notification when a miniboss spawned", false, "miniboss_title_ping", this).contributor("EmeraldMerchant"); this.MinibossPing = new ToggleSetting("Also make a sound when miniboss spawned", "Sound ping when a miniboss spawned", false, "miniboss_sound_ping", this).contributor("EmeraldMerchant"); this.BoxAroundMiniboss = new ToggleSetting("Draws boxes around minibosses.", "If they are too far away it doesnt draw.", false, "box_around_miniboss", this).contributor("EmeraldMerchant"); + this.BoxAroundAreaMiniboss = new ToggleSetting("Draws boxes around area minibosses", "eg. Voidling Extremist in void sepulture", false, "box_around_area_mini", this).contributor("EmeraldMerchant"); this.MinibossOffWhenBoss = new ToggleSetting("Disable miniboss features when your boss spawned", "this will boost your fps a little bit during boss", true, "miniboss_off_when_boss", this).contributor("EmeraldMerchant"); + this.MinibossGuiElement = new ToggleSetting("Lists Nearby Miniboss HP on Screen", "This will help you to know if theres miniboss nearby/ know their hp", true, "miniboss_hud", this).contributor("EmeraldMerchant"); + this.MinibossElement = new HudTextElement() + .setText("") + .setToggleSetting(this.MinibossGuiElement) + .setLocationSetting(new LocationSetting("Nearby Miniboss HP Location", "Allows you to edit the location of Nearby Miniboss HP hud", "miniboss_hud_location", this, [10, 50, 1, 1]).requires(this.MinibossGuiElement).editTempText("&5Voidling Radical &a25M&c❤").contributor("EmeraldMerchant")); + this.hudElements.push(this.MinibossElement); + this.betterHideDeadEntity = new ToggleSetting("Also hides mob nametag when it's dead.", "An improvement for Skytils's hide dead entity", false, "hide_dead_mob_nametag", this); this.beaconSoundType = { @@ -246,6 +254,7 @@ class Slayers extends Feature { this.beaconLocations = {}; this.eyeE = []; this.minibossEntity = []; + this.areaMiniEntity = []; this.todoE2 = []; this.emanBoss = undefined; this.actualEmanBoss = undefined @@ -270,6 +279,13 @@ class Slayers extends Feature { enderman: new Set(["Voidling Devotee", "Voidling Radical", "Voidcrazed Maniac"]), blaze: new Set(["Flare Demon", "Kindleheart Demon", "Burningsoul Demon"]) } + //dont think spider has an area mini + this.areaMini = { + zombie: new Set(["Golden Ghoul"]), + wolf: new Set(["Old Wolf", "Soul of the Alpha"]), + enderman: new Set(["Voidling Extremist"]), + blaze: new Set(["Millenia-Aged Blaze"]) + } this.SlayerWidth = { zombie: 1, @@ -285,6 +301,28 @@ class Slayers extends Feature { enderman: -3, blaze: -2 } + this.areaColor = { + zombie: { + r: 1, + g: 0.67, + b: 0 + }, + wolf: { + r: 0, + g: 0.67, + b: 0.67 + }, + enderman: { + r: 1, + g: 0.33, + b: 1 + }, + blaze: { + r: 0.67, + g: 0, + b: 0 + } + } //the volume of miniboss spawning is 0.6000000238418579 this.registerSoundPlay("random.explode", (pos, name, vol, pitch, categoryName, event) => { if (Math.round(10 * vol) !== 6 || Math.abs(pos.getY() - Player.getY()) > 5 || pos.getX() - Player.getX() > 20 || pos.getZ() - Player.getZ() > 20) return @@ -341,6 +379,7 @@ class Slayers extends Feature { this.beaconLocations = {}; this.eyeE = []; this.minibossEntity = []; + this.areaMiniEntity = []; this.emanBoss = undefined; this.actualEmanBoss = undefined; this.hideSummons = false @@ -377,7 +416,12 @@ class Slayers extends Feature { } renderWorld(ticks) { this.minibossEntity.forEach((x) => { - drawBoxAtEntity(x[0], 0, 255, 0, this.SlayerWidth[x[1]], this.SlayerHeight[x[1]], ticks, 4, false); + drawBoxAtEntity(x[0], 0, 1, 0, this.SlayerWidth[x[1]], this.SlayerHeight[x[1]], ticks, 4, false); + }) + + + this.areaMiniEntity.forEach((x) => { + drawBoxAtEntity(x[0], this.areaColor[x[1]].r, this.areaColor[x[1]].g, this.areaColor[x[1]].b, this.SlayerWidth[x[1]], this.SlayerHeight[x[1]], ticks, 4, false); }) if (this.emanBoss && this.boxAroundEmanBoss.getValue()) drawBoxAtEntity(this.emanBoss, 0, 255, 0, 1, -3, ticks, 4, false); @@ -430,7 +474,7 @@ class Slayers extends Feature { this.renderEntityEvent.unregister(); } - if (this.BoxAroundMiniboss.getValue() || this.betterHideDeadEntity.getValue() || this.summonsHideNametag.getValue() || this.summonHPGuiElement.getValue() || this.summonsLowWarning.getValue() || (this.isCorrectBind && this.bossBindDefault.getValue() != "CHAR_NONE")) { + if (this.BoxAroundMiniboss.getValue() || this.BoxAroundAreaMiniboss.getValue() || this.betterHideDeadEntity.getValue() || this.summonsHideNametag.getValue() || this.summonHPGuiElement.getValue() || this.summonsLowWarning.getValue() || (this.isCorrectBind && this.bossBindDefault.getValue() != "CHAR_NONE")) { World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach((name) => { let nameRemoveFormat = name.getName().removeFormatting() if (this.cannotFindEmanBoss) { @@ -449,6 +493,8 @@ class Slayers extends Feature { } let nameSplit = nameRemoveFormat.split(" ") let MobName = `${nameSplit[0]} ${nameSplit[1]}` + let MobName12 = `${nameSplit[1]} ${nameSplit[2]}` + let MobName1234 = `${nameSplit[1]} ${nameSplit[2]} ${nameSplit[3]} ${nameSplit[4]}` //so cringe that soul of the alpha is 4 words if (this.summonEntity.length !== parseInt(this.maxSummons.getValue())) { if (this.summonsHideNametag.getValue() || this.summonsLowWarning.getValue() || this.summonHPGuiElement.getValue()) { // 2nd statement makes it to support both tank zombie and super tank zombie @@ -463,8 +509,12 @@ class Slayers extends Feature { if (this.BoxAroundMiniboss.getValue() && !this.bossSpawnedMessage && this.Miniboss[this.lastSlayerType]?.has(MobName) && !this.minibossEntity.map(a => a[0].getUUID().toString()).includes(name.getUUID().toString())) { this.minibossEntity.push([name, this.lastSlayerType]); } + if (this.BoxAroundAreaMiniboss.getValue() && !this.bossSpawnedMessage && (this.areaMini[this.lastSlayerType]?.has(MobName12) || this.areaMini[this.lastSlayerType]?.has(MobName1234)) && !this.areaMiniEntity.map(a => a[0].getUUID().toString()).includes(name.getUUID().toString())) { + this.areaMiniEntity.push([name, this.lastSlayerType]); + } if (this.betterHideDeadEntity.getValue()) { - if (nameSplit[nameSplit.length - 1].startsWith("0") && nameSplit[nameSplit.length - 1].endsWith("❤")) { + let lastArgs = nameSplit[nameSplit.length - 1] + if (lastArgs.startsWith("0") && lastArgs.endsWith("❤")) { name.getEntity()[m.setAlwaysRenderNameTag](false) } } @@ -536,12 +586,20 @@ class Slayers extends Feature { } if (!this.bossSpawnedMessage && e instanceof net.minecraft.entity.item.EntityArmorStand) { - let mobName = `${e[m.getCustomNameTag]().removeFormatting().split(" ")[0]} ${e[m.getCustomNameTag]().removeFormatting().split(" ")[1]}` + let nameSplit = e[m.getCustomNameTag]().removeFormatting().split(" ") + let mobName = `${nameSplit[0]} ${nameSplit[1]}` + let MobName12 = `${nameSplit[1]} ${nameSplit[2]}` + let MobName1234 = `${nameSplit[1]} ${nameSplit[2]} ${nameSplit[3]} ${nameSplit[4]}` if (this.Miniboss[this.lastSlayerType]?.has(mobName)) { if (this.BoxAroundMiniboss.getValue() && !this.minibossEntity.map(a => a[0].getUUID().toString()).includes(e[m.getEntityId.Entity]().toString())) { this.minibossEntity.push([new Entity(e), this.lastSlayerType]); } } + if (this.areaMini[this.lastSlayerType]?.has(MobName12) || this.areaMini[this.lastSlayerType]?.has(MobName1234)) { + if (this.BoxAroundAreaMiniboss.getValue() && !this.areaMiniEntity.map(a => a[0].getUUID().toString()).includes(e[m.getEntityId.Entity]().toString())) { + this.areaMiniEntity.push([new Entity(e), this.lastSlayerType]); + } + } } if (e instanceof net.minecraft.entity.item.EntityArmorStand && e[m.getCustomNameTag]() && this.blazeTowerDink.getValue()) { @@ -612,6 +670,11 @@ class Slayers extends Feature { this.minibossEntity.splice(this.minibossEntity.indexOf(eArray)) } }) + this.areaMiniEntity.forEach((eArray) => { + if (eArray[0].getEntity()[f.isDead]) { + this.areaMiniEntity.splice(this.areaMiniEntity.indexOf(eArray)) + } + }) this.eyeE = this.eyeE.filter((e) => !e.getEntity()[f.isDead]); this.candidateBoss = this.candidateBoss.filter((e) => !e[f.isDead]); this.beaconE = this.beaconE.filter((e) => { @@ -734,6 +797,22 @@ class Slayers extends Feature { } else { this.emanHpElement.setText(""); } + + if (this.MinibossGuiElement.getValue() && !this.bossSpawnedMessage && this.minibossEntity.length > 0) { + let PY = Player.getY() + let minis = this.minibossEntity + let tempArray = [] + let tempEntity = [] + minis.forEach((x) => {//this.SlayerHeight[slayerType] values are negative + if (tempEntity.includes(x[0])) return + if (Math.abs((x[0].getY() + this.SlayerHeight[x[1]] - PY)) > 6) return + let name = x[0].getName() + if (name.split(" ")[2] === "§e0§c❤") return + tempEntity.push(x[0]) + tempArray.push(name) + }) + this.MinibossElement.setText(tempArray.join("\n")) + } else this.MinibossElement.setText("") if (this.pillerE) { if (this.pillerE.getEntity()[f.isDead]) this.pillerE = undefined @@ -900,6 +979,7 @@ class Slayers extends Feature { this.emanStartedSittingTime = undefined this.eyeE = undefined; this.minibossEntity = undefined; + this.areaMiniEntity = undefined; this.nextIsBoss = undefined; this.hudElements = []; this.entityAttackEventLoaded = undefined; diff --git a/features/specialMining/index.js b/features/specialMining/index.js new file mode 100644 index 0000000..c75d687 --- /dev/null +++ b/features/specialMining/index.js @@ -0,0 +1,207 @@ +import Feature from "../../featureClass/class"; +import SettingBase from "../settings/settingThings/settingBase"; +import { numberWithCommas } from "../../utils/numberUtils"; +import HudTextElement from "../hud/HudTextElement"; +import LocationSetting from "../settings/settingThings/location"; +import ToggleSetting from "../settings/settingThings/toggle"; +import { delay } from "../../utils/delayUtils"; + +class PowderAndScatha extends Feature { + constructor() { + super(); + } + + onEnable() { + this.initVariables(); + new SettingBase("Chest Miner", "Powder mining feature here are made mainly for powder chest grinding", undefined, "chest_mining_info", this); + this.PowderElement = new ToggleSetting("Powder Mining Info Hud (MAIN TOGGLE)", "This will show your current powder mining section (only in CH)", false, "powder_mining_hud", this).contributor("EmeraldMerchant"); + this.PowderOverlayElement = new HudTextElement() + .setText("") + .setToggleSetting(this.PowderElement) + .setLocationSetting(new LocationSetting("Powder Mining Info Hud Location", "Allows you to edit the location of Powder Mining Info Hud", "powder_mining_hud_location", this, [10, 50, 1, 1]).requires(this.PowderElement).editTempText(`&b2x Powder: "&cINACTIVE"\n&aChests: &b32\n&bMithril: &d12,768\n&bGems: &d21,325`).contributor("EmeraldMerchant")); + this.hudElements.push(this.PowderOverlayElement); + this.PowderOverlayElement.disableRendering() + + new SettingBase("/resetpowderdata", "to reset powder mining data", undefined, "reset_powder_data_command_info", this).requires(this.PowderElement); + this.resetPowderWhenLeaveCH = new ToggleSetting("Reset Powder When Left CH", "Should it reset powder hud whenever you left ch", false, "reset_powder_when_left_ch", this).requires(this.PowderElement); + this.resetPowderWhenLeaveGame = new ToggleSetting("Reset Powder When Left Game", "Should it reset powder hud whenever you left game", false, "reset_powder_when_left_game", this).requires(this.PowderElement); + this.chestUncoverAlert = new ToggleSetting("Alert When You Dug a Chest Out", "so you don't miss it", false, "chest_uncover_alert", this).requires(this.PowderElement); + this.chestUncoverAlertSound = new ToggleSetting("Alert Sound for Chest Alert", "should the alert also play a sound? (sound: levelup)", false, "chest_uncover_alert_sound", this).requires(this.chestUncoverAlert); + this.hideGemstoneMessage = new ToggleSetting("Gemstone Messages Hider", "like: &r&aYou received &r&f16 &r&f❈ &r&fRough Amethyst Gemstone&r&a.&r", false, "gemstone_message_hider", this).requires(this.PowderElement) + this.showFlawlessGemstone = new ToggleSetting("Gemstone Messages Hider Show Flawless", "should the hider ^ ignore flawless gemstones?", false, "gemstone_show_flawless", this).requires(this.hideGemstoneMessage) + this.hideWishingCompassMessage = new ToggleSetting("Wishing Compass Message Hider", "like: &r&aYou received &r&f1 &r&aWishing Compass&r&a.&r", false, "compass_message_hider", this).requires(this.PowderElement) + this.hideAscensionRope = new ToggleSetting("Ascension Rope Hider", "like: &r&aYou received &r&f1 &r&9Ascension Rope&r&a.&r", false, "ascension_rope_hider", this).requires(this.PowderElement) + + new SettingBase("SCATHA FEATURE TODO!", "This will come in a later date...", undefined, "scatha_todo", this); + + this.registerChat("&r&aYou received ${thing}&r&a.&r", (thing, e) => { + if (this.hideGemstoneMessage.getValue() && thing.endsWith("Gemstone") && (this.showFlawlessGemstone.getValue() ? !thing.includes("Flawless") : true)) cancel(e) + if (this.hideWishingCompassMessage.getValue() && thing.endsWith("Wishing Compass")) cancel(e) + if (this.hideAscensionRope.getValue() && thing.endsWith("Ascension Rope")) cancel(e) + }) + + this.registerStep(true, 1, () => { + if (this.FeatureManager.features["dataLoader"].class.area === "Crystal Hollows") { + if (!this.leftCH && !this.inCrystalHollows) { + this.foundWither = false + this.inCrystalHollows = true + } + } else if (this.inCHfromChest) { + this.inCrystalHollows = true + this.dPowder = false + this.inCHfromChest = false + } + }) + this.dPowder = false; + this.registerStep(true, 2, this.step2fps); + this.sL = Renderer.getStringWidth(" ") + + this.overlayLeft = [] + this.overlayRight = [] + + this.leftCH = false; + this.registerChat("&7Sending to server ${s}&r", (s, e) => { + if (this.inCrystalHollows) { + this.leftCH = true; + this.inCrystalHollows = false; + if (this.resetPowderWhenLeaveCH.getValue()) { + this.resetMiningData("powder") + } + } else this.leftCH = false + }) + + this.miningData = {} + this.saveMiningData = () => { + new Thread(() => { + FileLib.write("soopyAddonsData", "miningData.json", JSON.stringify(this.miningData)); + }).start(); + } + this.miningData = JSON.parse(FileLib.read("soopyAddonsData", "miningData.json") || "{}") || {} + if (!this.miningData.powder) this.miningData.powder = { chests: 0, mithril: 0, gemstone: 0 } + //TODO if (!this.miningData.scatha) this.miningData.scatha = {} + this.saveMiningData(); + + this.registerCommand("resetpowderdata", () => { + this.resetMiningData("powder"); + ChatLib.chat(`&6[SOOPY V2] &aSuccessfully reset powder data.`) + }, this) + + this.registerChat("&r&aYou uncovered a treasure chest!&r", (e) => { + if (!this.inCrystalHollows) { + this.inCrystalHollows = true + this.inCHfromChest = true + } + if (this.chestUncoverAlert.getValue()) Client.showTitle("&aTreasure Chest!", "", 0, 60, 20); + if (this.chestUncoverAlertSound.getValue()) World.playSound("random.levelup", 1, 1); + }) + + this.registerChat("&r&r&r${space}&r&b&l2X POWDER ${status}!&r", (space, status, e) => { + if (status.removeFormatting() === "STARTED") { + this.dPowder = true + } else this.dPowder = false + }) + this.inCHfromChest = false; + this.registerChat("&r&6You have successfully picked the lock on this chest!&r", (e) => { + this.miningData.powder.chests++ + }) + this.registerChat("&r&aYou received &r&b+${amount} &r&aMithril Powder&r", (amount, e) => { + this.miningData.powder.mithril += (this.dPowder ? 2 : 1) * parseInt(amount) + }) + this.registerChat("&r&aYou received &r&b+${amount} &r&aGemstone Powder&r", (amount, e) => { + this.miningData.powder.gemstone += (this.dPowder ? 2 : 1) * parseInt(amount) + }) + + this.registerEvent("renderOverlay", this.renderOverlay) + } + + + resetMiningData(type) { + if (type === "powder") { + Object.keys(this.miningData.powder).forEach(thing => this.miningData.powder[thing] = 0) + } else if (type === "scatha") { + //TODO + } + } + + renderOverlay() { + if (this.PowderOverlayElement.isEnabled()) { + let width = Renderer.getStringWidth(this.overlayLeft[0]) + + let x = this.PowderOverlayElement.locationSetting.x + let y = this.PowderOverlayElement.locationSetting.y + let scale = this.PowderOverlayElement.locationSetting.scale + + Renderer.retainTransforms(true) + Renderer.scale(scale) + Renderer.translate(x / scale, y / scale) + + this.overlayLeft.forEach((l, i) => { + Renderer.drawString(l, 0, 10 * i) + }) + + this.overlayRight.forEach((l, i) => { + Renderer.drawString(l, width - Renderer.getStringWidth(l), 10 * i) + }) + + Renderer.retainTransforms(false) + } + } + + step2fps() { + if (!this.foundWither) { + World.getAllEntitiesOfType(net.minecraft.entity.boss.EntityWither)?.forEach(e => { + if (e.getName().includes("§e§lPASSIVE EVENT §b§l2X POWDER §e§lRUNNING FOR §a§l")) { + this.dPowder = true; + }; + this.foundWither = true; + }); + } + + this.overlayLeft = [] + this.overlayRight = [] + + if (this.PowderElement.getValue() && this.inCrystalHollows) { + this.overlayLeft.push(`&b2x Powder: ${this.dPowder ? "&aACTIVE" : "&cINACTIVE"}`) + this.overlayRight.push("") + + if (this.miningData.powder.chests && this.miningData.powder.chests > 0) { + let c = this.miningData.powder.chests + + this.overlayLeft.push(`&aChests:`) + this.overlayRight.push(`&b${numberWithCommas(c)}`) + } + if (this.miningData.powder.mithril && this.miningData.powder.mithril > 0) { + let m = this.miningData.powder.mithril + + this.overlayLeft.push(`&bMithril:`) + this.overlayRight.push(`&d${numberWithCommas(m)}`) + } + if (this.miningData.powder.gemstone && this.miningData.powder.gemstone > 0) { + let g = this.miningData.powder.gemstone + + this.overlayLeft.push(`&bGems:`) + this.overlayRight.push(`&d${numberWithCommas(g)}`) + } + } + } + + initVariables() { + this.hudElements = []; + this.inCrystalHollows = false; + this.foundWither = true; + this.dPowder = false; + } + + onDisable() { + this.hudElements.forEach(h => h.delete()) + this.saveMiningData(); + if (this.resetPowderWhenLeaveGame.getValue()) { + this.resetMiningData("powder"); + } + this.initVariables(); + } +} + +module.exports = { + class: new PowderAndScatha(), +}; diff --git a/features/specialMining/metadata.json b/features/specialMining/metadata.json new file mode 100644 index 0000000..0e311c0 --- /dev/null +++ b/features/specialMining/metadata.json @@ -0,0 +1,8 @@ +{ + "name": "SpecialMining", + "description": "Powder & Scatha Mining", + "isHidden": false, + "isTogglable": true, + "defaultEnabled": true, + "sortA": 1 +}
\ No newline at end of file diff --git a/features/waypoints/index.js b/features/waypoints/index.js index 85edc88..2a064b3 100644 --- a/features/waypoints/index.js +++ b/features/waypoints/index.js @@ -38,7 +38,12 @@ class Waypoints extends Feature { this.loadWaypointsFromSendCoords = new ToggleSetting("Load waypoints from /patcher sendcoords messages", "Will dissapear after 1min", true, "load_waypoints_from_sendcoords", this) this.mineWaypointsSetting = new ToggleSetting("CH waypoints", "Will sync between users", true, "minwaypoints", this) - this.userWaypoints = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2userwaypoints.json") || "{}") + try { + this.userWaypoints = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2userwaypoints.json") || "{}") + } catch (e) { + ChatLib.chat(this.messagePrefix + "&cYour waypoints file corrupted and could not be read! Resetting to defaults.") + this.userWaypoints = {} + } this.userWaypointsHash = {} this.userWaypointsAll = [] this.lastArea = undefined |