diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/betterGuis/index.js | 146 | ||||
-rw-r--r-- | features/slayers/index.js | 89 | ||||
-rw-r--r-- | features/specialMining/index.js | 166 |
3 files changed, 254 insertions, 147 deletions
diff --git a/features/betterGuis/index.js b/features/betterGuis/index.js index e748227..d0e7802 100644 --- a/features/betterGuis/index.js +++ b/features/betterGuis/index.js @@ -222,23 +222,21 @@ class BetterGuis extends Feature { } postGuiRender(x, y, gui) { - if (gui.class.toString() !== "class net.minecraft.client.gui.inventory.GuiChest") return - - this.invSearchSoopyGui._render(x, y, 0) + if (gui instanceof class net.minecraft.client.gui.inventory.GuiChest) + this.invSearchSoopyGui._render(x, y, 0); } guiMouseClick(x, y, button, gui) { - if (gui.class.toString() !== "class net.minecraft.client.gui.inventory.GuiChest") return - - this.invSearchSoopyGui._onClick(x, y, button) + if (gui instanceof net.minecraft.client.gui.inventory.GuiChest) + this.invSearchSoopyGui._onClick(x, y, button); } guiKey(char, code, gui, event) { - if (gui.class.toString() !== "class net.minecraft.client.gui.inventory.GuiChest") return + if (!(gui instanceof net.minecraft.client.gui.inventory.GuiChest)) return; - this.invSearchSoopyGui._onKeyPress(char, code) + this.invSearchSoopyGui._onKeyPress(char, code); if (this.invSearchTextBox.text.selected) { - cancel(event) - this.slotMatches.clear() + cancel(event); + this.slotMatches.clear(); } } guiOpened() { @@ -246,81 +244,79 @@ class BetterGuis extends Feature { } renderSlot(slot, gui, event) { - if (gui.class.toString() !== "class net.minecraft.client.gui.inventory.GuiChest") return - if (!this.invSearchTextBox.getText()) return + if (!(gui instanceof class net.minecraft.client.gui.inventory.GuiChest)) return; + if (!this.invSearchTextBox.getText()) return; - let searchText = this.invSearchTextBox.getText().toLowerCase() + let searchText = this.invSearchTextBox.getText().toLowerCase(); - let isMatching = false - let slotMatches = this.slotMatches.get(slot.getIndex()) + let isMatching = false; + let slotMatches = this.slotMatches.get(slot.getIndex()); if (slotMatches && Date.now() - slotMatches.timestamp < 500) { if (!slotMatches.isMatching) { - Renderer.translate(0, 0, 100) - Renderer.drawRect(Renderer.color(0, 0, 0, 200), slot.getDisplayX(), slot.getDisplayY(), 8 * Renderer.screen.getScale(), 8 * Renderer.screen.getScale()) + Renderer.translate(0, 0, 100); + Renderer.drawRect(Renderer.color(0, 0, 0, 200), slot.getDisplayX(), slot.getDisplayY(), 8 * Renderer.screen.getScale(), 8 * Renderer.screen.getScale()); } - return + return; } - let item = slot.getItem() + let item = slot.getItem(); if (item) { isMatching = !searchText.split("&").map(a => { - a = a.trim() - let isMatching2 = false - if (ChatLib.removeFormatting(item.getName()).toLowerCase().includes(a)) isMatching2 = true - if (!isMatching2 && item.getLore().some(b => ChatLib.removeFormatting(b).toLowerCase().includes(a))) isMatching2 = true - return isMatching2 - }).includes(false) + a = a.trim(); + let isMatching2 = false; + if (ChatLib.removeFormatting(item.getName()).toLowerCase().includes(a)) isMatching2 = true; + if (!isMatching2 && item.getLore().some(b => ChatLib.removeFormatting(b).toLowerCase().includes(a))) isMatching2 = true; + return isMatching2; + }).includes(false); } - this.slotMatches.set(slot.getIndex(), { isMatching, timestamp: Date.now() }) + this.slotMatches.set(slot.getIndex(), { isMatching, timestamp: Date.now() }); if (!isMatching) { - Renderer.translate(0, 0, 100) - Renderer.drawRect(Renderer.color(0, 0, 0, 200), slot.getDisplayX(), slot.getDisplayY(), 8 * Renderer.screen.getScale(), 8 * Renderer.screen.getScale()) + Renderer.translate(0, 0, 100); + Renderer.drawRect(Renderer.color(0, 0, 0, 200), slot.getDisplayX(), slot.getDisplayY(), 8 * Renderer.screen.getScale(), 8 * Renderer.screen.getScale()); } } guiClicked(mouseX, mouseY, button, gui, event) { - if (gui.class.toString() === "class net.minecraft.client.gui.inventory.GuiChest" && button === 0 && this.replaceSbMenuClicks.getValue()) { + if (!(gui instanceof class net.minecraft.client.gui.inventory) || button !== 0 || !this.replaceSbMenuClicks.getValue()) return; - let hoveredSlot = gui.getSlotUnderMouse() - if (!hoveredSlot) return + let hoveredSlot = gui.getSlotUnderMouse(); + if (!hoveredSlot) return; - let hoveredSlotId = hoveredSlot[f.slotNumber] + let hoveredSlotId = hoveredSlot[f.slotNumber]; - // logger.logMessage(hoveredSlotId, 4) + // logger.logMessage(hoveredSlotId, 4) - if (this.guiSlotClicked(ChatLib.removeFormatting(Player.getContainer().getName()), hoveredSlotId)) { - cancel(event) - } - } + if (this.guiSlotClicked(ChatLib.removeFormatting(Player.getContainer().getName()), hoveredSlotId)) + cancel(event); } step() { - if (this.museumGuiEnabled.getValue()) this.museumGui.tick.call(this.museumGui) - if (this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.tick.call(this.dungeonReady) - - if (this.replaceSbMenuClicks.getValue()) { - if (Player.getContainer() && Player.getContainer().getName() === "SkyBlock Menu") { - if (this.lastWindowId === 0) { - this.lastWindowId = Player.getContainer().getWindowId() - return; - } - if (Player.getContainer().getWindowId() !== this.lastWindowId) { - this.lastWindowId = Player.getContainer().getWindowId() - this.shouldHold += 10 - if (Date.now() - this.clickSlotTime > 1000) { - this.clickSlot = -1 - } - if (this.clickSlot && this.clickSlot != -1) { - Player.getContainer().click(this.clickSlot, false, "MIDDLE") - this.clickSlot = -1 - } - } else { - this.shouldHold-- - } - } else { - this.lastWindowId = 0 - } + if (this.museumGuiEnabled.getValue()) this.museumGui.tick.call(this.museumGui); + if (this.dungeonReadyGuiEnabled.getValue()) this.dungeonReady.tick.call(this.dungeonReady); + + if (!this.replaceSbMenuClicks.getValue()) return + if (Player.getContainer() && Player.getContainer().getName() !== "SkyBlock Menu") { + this.lastWindowId = 0; + return; + } + if (this.lastWindowId === 0) { + this.lastWindowId = Player.getContainer().getWindowId(); + return; + } + if (Player.getContainer().getWindowId() === this.lastWindowId) { + this.shouldHold-- + return; + } + + this.lastWindowId = Player.getContainer().getWindowId(); + this.shouldHold += 10; + if (Date.now() - this.clickSlotTime > 1000) { + this.clickSlot = -1; + } + if (this.clickSlot && this.clickSlot != -1) { + Player.getContainer().click(this.clickSlot, false, "MIDDLE"); + this.clickSlot = -1; } } @@ -369,23 +365,23 @@ class BetterGuis extends Feature { } initVariables() { - this.replaceSbMenuClicks = undefined - this.lastWindowId = undefined - this.shouldHold = undefined - this.clickSlot = undefined - this.clickSlotTime = undefined - this.reliableSbMenuClicks = undefined - this.middleClickGuis = undefined - this.middleClickStartsWith = undefined - this.middleClickEndsWith = undefined - - this.museumGui = undefined + this.replaceSbMenuClicks = undefined; + this.lastWindowId = undefined; + this.shouldHold = undefined; + this.clickSlot = undefined; + this.clickSlotTime = undefined; + this.reliableSbMenuClicks = undefined; + this.middleClickGuis = undefined; + this.middleClickStartsWith = undefined; + this.middleClickEndsWith = undefined; + + this.museumGui = undefined; } onDisable() { - this.initVariables() + this.initVariables(); - this.invSearchSoopyGui.delete() + this.invSearchSoopyGui.delete(); } } diff --git a/features/slayers/index.js b/features/slayers/index.js index 3a06139..efea67b 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -91,7 +91,6 @@ class Slayers extends Feature { this.summonFeatureMaster = new ToggleSetting("Summon Features Main Toggle", "enable this to use summon features", false, "summons_master", this).contributor("EmeraldMerchant"); this.summonsHideNametag = new ToggleSetting("Hide your summons' nametags", "so u can see your boss more clearly", false, "hide_summons_nametags", this).requires(this.summonFeatureMaster).contributor("EmeraldMerchant"); this.summonsLowWarning = new ToggleSetting("Warns you when a summon is low", "this warns you after a delay after each bosses, until you respawn them", false, "warn_when_summon_low", this).requires(this.summonFeatureMaster).contributor("EmeraldMerchant"); - this.warnDelay = new TextSetting("Delay for warning", "How long should it wait after the boss to warn you a summon is low", "3", "summon_warn_delay", this, "(seconds)", false).requires(this.summonsLowWarning).contributor("EmeraldMerchant"); this.summonPercentage = new TextSetting("When will it start warning you", "Below how many % hp (your summons) should it start warning you", "30", "summon_warn_percentage", this, "(%)", false).requires(this.summonsLowWarning).contributor("EmeraldMerchant"); this.summonHPGuiElement = new ToggleSetting("Render the HP of your summons on your screen", "This will help you to know how much HP your summons have left while hide summons nametags is on", false, "summon_hp_hud", this).requires(this.summonFeatureMaster).contributor("EmeraldMerchant"); this.summonHPElement = new HudTextElement() @@ -99,8 +98,6 @@ class Slayers extends Feature { .setToggleSetting(this.summonHPGuiElement) .setLocationSetting(new LocationSetting("Summon HP Location", "Allows you to edit the location of your summons' HP info", "summon_hp_location", this, [10, 50, 1, 1]).requires(this.summonHPGuiElement).editTempText("&a160k&c❤ &a160k&c❤ &a160k&c❤ &a160k&c❤").contributor("EmeraldMerchant")); this.hudElements.push(this.summonHPElement); - this.maxSummons = new TextSetting("Maximum amount of your summons", "How many summons you are using", "", "max_summons", this, "Max Summons (1-8)", false).requires(this.summonFeatureMaster).contributor("EmeraldMerchant"); - this.emanLazerTimer = new ToggleSetting("Adds a timer for the boss lazer phase", "The timer will be inside the boss's body during the phase", true, "eman_lazer_timer", this); this.slayerSpeedRates = new ToggleSetting("Show slayer speed and exp rates", "(Slayer speed includes downtime inbetween slayers, only shows while doing slayers)", true, "slayer_speed_rates", this); @@ -190,19 +187,6 @@ class Slayers extends Feature { } } this.lastBossSlain = Date.now(); - - if (this.summonFeatureMaster.getValue() && this.summonsLowWarning.getValue() && this.warnAfterBoss) { - this.warnAfterBoss = false - let delayForWarn = parseInt(this.warnDelay.getValue()) * 1000 - if (delayForWarn < 0 || delayForWarn > 10000) { - ChatLib.chat("&6[MVP&0++&6] Soopyboo32&7: &dMan idk why you use such short/long delay, so I set it to 3 seconds for you.\n&6[MVP&0++&6] Soopyboo32&7: &cPlease use a number between 0 and 10!\n&6[MVP&0++&6] Soopyboo32&7: &c&lDon't dm me i didn't make this warning LMAO!") - delayForWarn = 3000 - } - delay(delayForWarn, () => { - Client.showTitle("&c!ONE OF THE SUMMON IS LOW!", "", 0, 40, 10); - World.playSound("random.orb", 1, 1); - }) - } }); this.registerChat("&r &r&c&lSLAYER QUEST FAILED!&r", () => { @@ -227,16 +211,6 @@ class Slayers extends Feature { } else if (!this.summonsHideNametag.getValue() && !this.summonHPGuiElement.getValue() && !this.summonsLowWarning.getValue()) { return } - if (!soul.removeFormatting().includes("Tank Zombie")) { - if (!this.wrongSummons) { - delay(300, () => { - ChatLib.chat("&6[MVP&0++&6] Soopyboo32&7: &dMy mod only support Tank Zombie summons!\n&6[MVP&0++&6] Soopyboo32&7: &cPlease either use them or DISABLE the feature!\n&6[MVP&0++&6] Soopyboo32&7: &c&lDon't dm me i didn't make this warning LMAO!") - this.wrongSummons = false - }) - } - this.wrongSummons = true - return - } if (this.summonAtHPShouldWarn != 0 && !this.canCaptureSummonHPInfo) { this.canCaptureSummonHPInfo = true } @@ -245,6 +219,16 @@ class Slayers extends Feature { this.registerChat("&r&cYou have despawned your monsters!&r", () => { this.summonAtHPShouldWarn = 0 this.canCaptureSummonHPInfo = false + this.shouldWarn = false + }) + + this.registerStep(true, 4, () => { + if (this.summonFeatureMaster.getValue() && this.summonsLowWarning.getValue()) { + if (this.shouldWarn) { + Client.showTitle("&c!ONE OF THE SUMMON IS LOW!", "", 0, 3, 1); + World.playSound("random.orb", 1, 1); + } + } }) this.todoE = []; @@ -268,7 +252,6 @@ class Slayers extends Feature { this.hasQuest = false this.summonEntity = [] this.summonAtHPShouldWarn = 0 - this.warnAfterBoss = false this.canCaptureSummonHPInfo = false this.wrongSummons = false @@ -332,8 +315,6 @@ class Slayers extends Feature { } }) - this.summonHPPossibilities = new Set(["60000❤", "105k❤", "160k❤", "180k❤", "300k❤", "525k❤", "1M❤"]) - this.registerForge(net.minecraftforge.event.entity.living.LivingAttackEvent, this.entityAttackEvent).registeredWhen(() => this.hasQuest && this.lastSlayerType === "enderman") this.renderEntityEvent = this.registerEvent("renderEntity", this.renderEntity); this.renderEntityEvent.unregister(); @@ -386,7 +367,6 @@ class Slayers extends Feature { this.slayerLocationDataH = {} this.summonEntity = [] - this.warnAfterBoss = false this.canCaptureSummonHPInfo = false this.cannotFindEmanBoss = false this.candidateBoss = [] @@ -495,17 +475,14 @@ class Slayers extends Feature { 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 - if (nameSplit[0] === `${Player.getName()}'s` && `${nameSplit[nameSplit.length - 3]} ${nameSplit[nameSplit.length - 2]}` === "Tank Zombie") { - if (!this.summonEntity?.map(a => a.getUUID().toString()).includes(name.getUUID().toString())) { - this.summonEntity.push(name) - } + if (this.summonsHideNametag.getValue() || this.summonsLowWarning.getValue() || this.summonHPGuiElement.getValue()) { + if (nameRemoveFormat.startsWith(this.summonNamePrefixs)) { + if (!this.summonEntity?.map(a => a.getUUID().toString()).includes(name.getUUID().toString())) { + this.summonEntity.push(name) } } } - if (this.MinibossOffWhenBoss.getValue() && !this.bossSpawnedMessage) { + if ((this.MinibossOffWhenBoss.getValue() && !this.bossSpawnedMessage) || !this.MinibossOffWhenBoss.getValue()) { 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]); } @@ -585,23 +562,6 @@ class Slayers extends Feature { } - if (!this.bossSpawnedMessage && e instanceof net.minecraft.entity.item.EntityArmorStand) { - 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()) { let name = ChatLib.removeFormatting(e[m.getCustomNameTag]()) let isPiller = true @@ -635,6 +595,7 @@ class Slayers extends Feature { } summonHpFloatText = "" + shouldWarnNow = false this.summonEntity?.forEach((eArray) => { let splitted = eArray.getName().split(" ") let summonHP = splitted[splitted.length - 1] @@ -648,19 +609,16 @@ class Slayers extends Feature { } if (this.summonsLowWarning.getValue()) { - if (this.formatNumber(summonHP) <= this.summonAtHPShouldWarn && !this.warnAfterBoss) { - this.warnAfterBoss = true + if (this.formatNumber(summonHP) <= this.summonAtHPShouldWarn) { + shouldWarnNow = true } if (this.canCaptureSummonHPInfo) { - if (this.summonHPPossibilities.has(summonHP.removeFormatting())) { - this.canCaptureSummonHPInfo = false - this.summonAtHPShouldWarn = this.formatNumber(summonHP) * (parseInt(this.summonPercentage.getValue()) / 100) - } else { - this.canCaptureSummonHPInfo = false - } + this.canCaptureSummonHPInfo = false + this.summonAtHPShouldWarn = this.formatNumber(summonHP) * (parseInt(this.summonPercentage.getValue()) / 100) } } }) + this.shouldWarn = shouldWarnNow this.summonEntity = this.summonEntity?.filter((e) => !e.getEntity()[f.isDead]); if (this.summonHPGuiElement.getValue()) { this.summonHPElement.setText(summonHpFloatText) @@ -797,7 +755,7 @@ 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 @@ -987,10 +945,11 @@ class Slayers extends Feature { this.entityAttackEventE = undefined; this.hideSummons = false; this.summonAtHPShouldWarn = undefined; - this.warnAfterBoss = false this.canCaptureSummonHPInfo = false this.cannotFindEmanBoss = false this.candidateBoss = [] + this.summonNamePrefixs = `${Player.getName()}'s`; + this.shouldWarn = false; } onDisable() { diff --git a/features/specialMining/index.js b/features/specialMining/index.js index 7bd91be..e35388f 100644 --- a/features/specialMining/index.js +++ b/features/specialMining/index.js @@ -5,6 +5,7 @@ import HudTextElement from "../hud/HudTextElement"; import LocationSetting from "../settings/settingThings/location"; import ToggleSetting from "../settings/settingThings/toggle"; import { delay } from "../../utils/delayUtils"; +import TextSetting from "../settings/settingThings/textSetting"; import { drawBoxAtBlock, drawFilledBox } from "../../utils/renderUtils"; import RenderLib2D from "../../utils/renderLib2d"; @@ -16,6 +17,9 @@ class PowderAndScatha extends Feature { onEnable() { this.initVariables(); new SettingBase("Chest Miner", "Powder mining feature here are made mainly for powder chest grinding", undefined, "chest_mining_info", this); + this.compactedChat = new ToggleSetting("Compact Powder Messages", "same as the one in skytils but support following setting", false, "compact_powder_chat", this) + this.fixChatForDoublePowder = new ToggleSetting("Fix Chat Messages During Double Powder", "so it's the correct amount of powder you received during the event", false, "fix_chat_dpowder", this) + this.fixChatForDoublePowderSuffix = new TextSetting("Suffix of previous message", "(so you can tell )change it yourself!", "&a(&b2X Powder&a)", "chat_dpowder_suffix", this, "(none)", false).requires(this.fixChatForDoublePowder); this.PowderElement = new ToggleSetting("Powder Mining Info Hud (MAIN TOGGLE)", "This will show your current powder mining section (only in CH)", true, "powder_mining_hud", this).contributor("EmeraldMerchant"); this.PowderOverlayElement = new HudTextElement() .setText("") @@ -35,8 +39,6 @@ class PowderAndScatha extends Feature { 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) @@ -56,7 +58,6 @@ class PowderAndScatha extends Feature { } }) this.dPowder = 0; - this.registerStep(true, 2, this.step2fps); this.sL = Renderer.getStringWidth(" ") this.overlayLeft = [] @@ -85,7 +86,6 @@ class PowderAndScatha extends Feature { this.expRateInfo = [] this.mythrilRate = 0 this.gemstoneRate = 0 - //TODO if (!this.miningData.scatha) this.miningData.scatha = {} this.saveMiningData(); this.registerCommand("resetpowderdata", () => { @@ -120,13 +120,42 @@ class PowderAndScatha extends Feature { this.gemstoneRate = (this.miningData.powder.gemstone - gemstone) / (Date.now() - time) }) }) + + this.lastPowderReceived = { mithril: 0, gemstone: 0 } + this.lastPowderReceivedExecuted = false; this.registerChat("&r&aYou received &r&b+${amount} &r&aMithril Powder&r", (amount, e) => { - this.miningData.powder.mithril += (this.dPowder ? 2 : 1) * parseInt(amount) + let p = (this.dPowder ? 2 : 1) * parseInt(amount) + this.miningData.powder.mithril += p + if (this.compactedChat.getValue()) { + cancel(e) + this.lastPowderReceived.mithril += p + return + } + if (this.fixChatForDoublePowder.getValue() && this.dPowder) { + cancel(e) + let suffix = ""; + if (this.fixChatForDoublePowderSuffix.getValue() !== "") suffix = this.fixChatForDoublePowderSuffix.getValue() + ChatLib.chat(`&r&aYou received &r&b+${2 * amount} &r&aMithril Powder&r ${suffix}`) + } }) this.registerChat("&r&aYou received &r&b+${amount} &r&aGemstone Powder&r", (amount, e) => { - this.miningData.powder.gemstone += (this.dPowder ? 2 : 1) * parseInt(amount) + let p = (this.dPowder ? 2 : 1) * parseInt(amount) + this.miningData.powder.gemstone += p + if (this.compactedChat.getValue()) { + cancel(e) + this.lastPowderReceived.gemstone += p + return + } + if (this.fixChatForDoublePowder.getValue() && this.dPowder) { + cancel(e) + let suffix = ""; + if (this.fixChatForDoublePowderSuffix.getValue() !== "") suffix = this.fixChatForDoublePowderSuffix.getValue() + ChatLib.chat(`&r&aYou received &r&b+${2 * amount} &r&aGemstone Powder&r ${suffix}`) + } }) + this.registerStep(true, 5, this.compactPowderChat) + this.chests = new Map() @@ -152,6 +181,45 @@ class PowderAndScatha extends Feature { del.forEach(k => this.chests.delete(k)) }) this.registerEvent("spawnParticle", this.spawnParticle) + + //==============================================Scatha=Feature=Below================================================================ + + if (!this.miningData.scatha) this.miningData.scatha = { total_worms: 0, worms: 0, scathas: 0, rare: 0, epic: 0, legandary: 0, since_scatha: 0, since_pet: 0 } + this.saveMiningData(); + + this.scathaMain = new ToggleSetting("SCATHA!", "This is the main toggle of Scatha Feature", false, "scatha_main", this); + + this.scathaCounter = new ToggleSetting("Scatha Counter Hud", "This will show your scatha mining progress (only in CH)", false, "scatha_mining_hud", this).requires(this.scathaMain).contributor("EmeraldMerchant"); + this.scathaCounterElement = new HudTextElement() + .setText("") + .setToggleSetting(this.scathaCounter) + .setLocationSetting(new LocationSetting("Scatha Counter Hud Location", "Allows you to edit the location of Scatha Counter Hud", "scatha_mining_hud_location", this, [10, 50, 1, 1]).requires(this.scathaCounter).editTempText(`&6Scatha Counter\n&bKills: 1,000\n&bWorms: 800\n&bScathas: 200\n&bSince Scatha: 10\n&9Rare Scatha Pets: 5\n&5Epic Scatha Pets: 3\n&6Leg Scatha Pets: 1\n&bSince Pet: 20`)); + this.hudElements.push(this.scathaCounterElement); + + new SettingBase("/scathaset <thing> <value>", "This command will change values in the counter", undefined, "scatha_cmd", this).requires(this.scathaMain); + new SettingBase("/ss <thing> <value> works too", "you can press TAB for <thing> auto-complete", undefined, "scatha_cmd2", this).requires(this.scathaMain); + this.scathaCmdComp = ["worms", "scathas", "rare", "epic", "legandary", "since_scatha", "since_pet"] + this.registerCommand("scathaset", (thing, value) => this.scathaCmd(thing, value), this.scathaCmdComp); + this.registerCommand("ss", (thing, value) => this.scathaCmd(thing, value), this.scathaCmdComp); + + this.wormSpawnedWarn = new ToggleSetting("Worm/Scatha Spawned Alert", "make a title and a sound when a worm/scatha spawned", false, "worm_spawned_alert", this).requires(this.scathaMain); + this.registerChat("&r&7&oYou hear the sound of something approaching...&r", this.wormSpawning); + this.wormSpawnedChatMessage = new ToggleSetting("Worm/Scatha Spawned Chat Message", "if a chat info should be sent when a worm/scatha spawned", false, "worm_spawned_chat_message", this).requires(this.scathaMain); + this.petDroppedAlert = new ToggleSetting("Pet Dropped Alert", "Big title when a scatha pet dropped", false, "scatha_pet_dropped_alert", this).requires(this.scathaMain); + this.colorToRarity = { "&9": "rare", "&5": "epic", "&6": "legandary" } + this.registerChat("&r&6&lPET DROP! &r${rarity}Scatha &r&b(+${mf}% ✯ Magic Find!)&r", (rarity, mf, e) => { + let r = this.colorToRarity[rarity] + this.miningData.scatha[r]++ + this.miningData.scatha.since_pet = 0 + this.saveMiningData() + if (this.petDroppedAlert.getValue()) { + World.playSound('note.pling', 1, 1); + Client.showTitle(`${rarity}${r.toUpperCase()} SCATHA PET!`, ChatLib.getChatMessage(e), 0, 100, 10); + } + }) + + this.registerStep(true, 2, this.step2fps); + this.registerStep(true, 3, this.wormStep); } spawnParticle(particle, type, event) { @@ -202,7 +270,7 @@ class PowderAndScatha extends Feature { 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")) { + if (e.getName().startsWith("§e§lPASSIVE EVENT §b§l2X POWDER §e§lRUNNING FOR §a§l")) { this.dPowder = Date.now(); let time = ChatLib.removeFormatting(e.getName()).split("RUNNING FOR ").pop() @@ -248,6 +316,89 @@ class PowderAndScatha extends Feature { this.overlayRight.push(`&d${numberWithCommas(Math.round(this.gemstoneRate * 1000 * 60 * 60))}`) } } + if (this.scathaCounter.getValue() && this.inCrystalHollows) { + let tempText = `&6Scatha Counter\n&bKills: ${this.miningData.scatha.total_worms}\n&bWorms: ${this.miningData.scatha.worms}\n&bScathas: ${this.miningData.scatha.scathas}\n&bSince Scatha: ${this.miningData.scatha.since_scatha}\n` + if (this.miningData.scatha.rare > 0) tempText += `&9Rare Scatha Pets: ${this.miningData.scatha.rare}\n` + if (this.miningData.scatha.epic > 0) tempText += `&5Epic Scatha Pets: ${this.miningData.scatha.epic}\n` + if (this.miningData.scatha.legandary > 0) tempText += `&6Leg Scatha Pets: ${this.miningData.scatha.legandary}` + if (this.miningData.scatha.rare + this.miningData.scatha.epic + this.miningData.scatha.legandary > 0) tempText += `&bSince Pet: ${this.miningData.scatha.since_pet}` + this.scathaCounterElement.setText(tempText) + } + } + + compactPowderChat() { + if (this.lastPowderReceived.mithril > 0 && this.lastPowderReceived.gemstone > 0 && !this.lastPowderReceivedExecuted) { + this.lastPowderReceivedExecuted = true + delay(300, () => { + let m = this.lastPowderReceived.mithril + let g = this.lastPowderReceived.gemstone + let msg = "" + if (g > 0) msg += `&r&aYou received &r&b+${g} &r&aGemstone ` + if (m > 0) { + if (!msg) msg += `&r&aYou received &r&b+${m} &r&aMithril ` + else msg += `and &r&b+${m} &r&aMithril ` + } + msg += `Powder&r` + if (this.dPowder) { + let suffix = ""; + if (this.fixChatForDoublePowderSuffix.getValue() !== "") suffix = this.fixChatForDoublePowderSuffix.getValue() + ChatLib.chat(`${msg} ${suffix}`) + } else ChatLib.chat(msg) + this.lastPowderReceived = { mithril: 0, gemstone: 0 } + this.lastPowderReceivedExecuted = false + }) + } + } + + scathaCmd(thing, value) { + if (!this.scathaCmdComp.includes(thing) || parseInt(value) === NaN) { + ChatLib.chat(this.FeatureManager.messagePrefix + "Invalid inputs! Usage: /scathaset <thing> <value>") + return + } + let v = parseInt(value); + this.miningData.scatha[thing] = v; + this.miningData.scatha.total_worms = this.miningData.scatha.worms + this.miningData.scatha.scathas + ChatLib.chat(this.FeatureManager.messagePrefix + "Successfully set " + thing + " to " + v + "!") + this.saveMiningData(); + } + + wormSpawning() { + if (this.wormSpawnedWarn.getValue()) { + World.playSound('note.pling', 1, 1); + Client.showTitle("&cWorm Spawning", "", 0, 20, 10); + this.wormSpawned = true + } + } + + wormStep() { + if (!this.inCrystalHollows || !this.scathaMain.getValue()) { + this.scathaCounterElement.setText("") + return + } + if (!this.wormSpawned) return + World.getAllEntitiesOfType(net.minecraft.entity.item.EntityArmorStand).forEach(entity => { + let name = entity.getName() + //§8[§7Lv5§8] §cWorm§r §e5§c❤ + if (name.startsWith("§8[§7Lv5§8] §cWorm")) { + if (this.wormSpawnedChatMessage.getValue()) ChatLib.chat("&c&lWorm Spawned. (Since Scatha: " + (this.miningData.scatha.since_scatha + 1) + ")"); + if (this.wormSpawnedWarn.getValue()) Client.showTitle("&c&lWorm Spawned.", "", 0, 20, 10); + this.miningData.scatha.total_worms++; + this.miningData.scatha.worms++; + this.miningData.scatha.since_scatha++; + this.saveMiningData() + this.wormSpawned = false; + } + if (name.startsWith("§8[§7Lv10§8] §cScatha")) { + if (this.wormSpawnedChatMessage.getValue()) ChatLib.chat("&c&lScatha Spawned."); + if (this.wormSpawnedWarn.getValue()) Client.showTitle("&c&lScatha Spawned.", "", 0, 20, 10); + this.miningData.scatha.total_worms++; + this.miningData.scatha.scathas++; + this.miningData.scatha.since_pet++; + this.miningData.scatha.since_scatha = 0 + this.saveMiningData() + this.wormSpawned = false; + } + }); } initVariables() { @@ -255,6 +406,7 @@ class PowderAndScatha extends Feature { this.inCrystalHollows = false; this.foundWither = true; this.dPowder = 0; + this.wormSpawned = false; } onDisable() { |