diff options
Diffstat (limited to 'src/features/specialMining/index.js')
-rw-r--r-- | src/features/specialMining/index.js | 140 |
1 files changed, 125 insertions, 15 deletions
diff --git a/src/features/specialMining/index.js b/src/features/specialMining/index.js index 147193a..e548b87 100644 --- a/src/features/specialMining/index.js +++ b/src/features/specialMining/index.js @@ -20,7 +20,7 @@ class PowderAndScatha extends Feature { 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.fixChatForDoublePowderSuffix = new TextSetting("Suffix of previous message", "(so you can tell whether it's 2x powder) 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("") @@ -30,6 +30,8 @@ class PowderAndScatha extends Feature { this.PowderOverlayElement.disableRendering() new SettingBase("/resetpowderdata", "to reset powder mining data", undefined, "reset_powder_data_command_info", this).requires(this.PowderElement); + this.powderPerHour = new ToggleSetting("Mithril & Gemstone Powder/h", "should it show powder per hour on hud?", false, "powder_per_hour_toggle", this).requires(this.PowderElement); + this.chestsPerHour = new ToggleSetting("Chests/h", "should it show chests per hour on hud?", false, "chests_per_hour_toggle", 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); @@ -39,11 +41,97 @@ class PowderAndScatha extends Feature { 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) + this.showAreaTreasure = new ToggleSetting("Show Area Treasure", "whether or not to show each sub zone's treasures from chests", false, "show_area_treasure", this).requires(this.PowderElement) + + this.tempLoot = { global: {}, Jungle: {}, Goblin_Holdout: {}, Precursor_Remnants: {}, Mithril_Deposits: {} } + this.tempLocation = undefined + //this will add the treasure and switch display location to it (it's from the most recent location) + this.addTreasure = (Area, treasure, amount) => { + if (amount < 0 || !amount) return + if (this.tempLoot[Area][treasure]) this.tempLoot[Area][treasure] += amount + else this.tempLoot[Area][treasure] = amount + if (Area !== "global") this.tempLocation = Area + } + this.treasureColored = { + Sludge_Juice: "&aSludge Juice", + Oil_Barrel: "&aOil Barrel", + Jungle_Heart: "&6Jungle Heart", + Green_Goblin_Egg: "&aGreen Goblin Egg", + Red_Goblin_Egg: "&cRed Goblin Egg", + Yellow_Goblin_Egg: "&eYellow Goblin Egg", + Blue_Goblin_Egg: "&3Blue Goblin Egg", + Goblin_Egg: "&9Goblin Egg", + Control_Switch: "&9Control Switch", + FTX_3070: "&9FTX 3070", + Electron_Transmitter: "&9Electron Transmitter", + Robotron_Reflector: "&9Robotron Reflector", + Synthetic_Heart: "&9Synthetic Heart", + Superlite_Motor: "&9Superlite Motor", + Treasurite: "&5Treasurite", + Pickonimbus_2000: "&5Pickonimbus 2000", + Prehistoric_Egg: "&fPrehistoric Egg" + } + //&r&aYou received &r&f1 &r&a&r&aGreen Goblin Egg&r&a.&r 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.hideGemstoneMessage.getValue() && thing.endsWith("Gemstone") && (this.showFlawlessGemstone.getValue() ? !thing.includes("Flawless") : true)) { + cancel(e) + if (thing.includes("Amethyst")) this.tempLocation = "Jungle" + if (thing.includes("Sapphire")) this.tempLocation = "Precursor_Remnants" + if (thing.includes("Amber")) this.tempLocation = "Goblin_Holdout" + if (thing.includes("Jade")) this.tempLocation = "Mithril_Deposits" + } if (this.hideWishingCompassMessage.getValue() && thing.endsWith("Wishing Compass")) cancel(e) if (this.hideAscensionRope.getValue() && thing.endsWith("Ascension Rope")) cancel(e) + if (this.showAreaTreasure.getValue()) { + let treasure = undefined + let amount = Math.floor(Number(thing.split(" ")[0].removeFormatting())) + //jungle + if (thing.endsWith("Sludge Juice")) treasure = "Sludge_Juice" + if (thing.endsWith("Oil Barrel")) treasure = "Oil_Barrel" + if (thing.endsWith("Jungle Heart")) treasure = "Jungle_Heart" + if (treasure) { + this.addTreasure("Jungle", treasure, amount) + return + } + //goblin holdout + if (thing.endsWith("Goblin Egg")) { + if (thing.includes("Green")) treasure = "Green_Goblin_Egg" + else if (thing.includes("Red")) treasure = "Red_Goblin_Egg" + else if (thing.includes("Yellow")) treasure = "Yellow_Goblin_Egg" + else if (thing.includes("Blue")) treasure = "Blue_Goblin_Egg" + else treasure = "Goblin_Egg" + } + if (treasure) { + this.addTreasure("Goblin_Holdout", treasure, amount) + return + } + //&r&aYou received &r&f1 &r&9Superlite Motor&r&a.&r + //precursor city + if (thing.endsWith("Control Switch")) treasure = "Control_Switch" + if (thing.endsWith("FTX 3070")) treasure = "FTX_3070" + if (thing.endsWith("Electron Transmitter")) treasure = "Electron_Transmitter" + if (thing.endsWith("Robotron Reflector")) treasure = "Robotron_Reflector" + if (thing.endsWith("Synthetic Heart")) treasure = "Synthetic_Heart" + if (thing.endsWith("Superlite Motor")) treasure = "Superlite_Motor" + if (treasure) { + this.addTreasure("Precursor_Remnants", treasure, amount) + return + } + //mithril deposits + if (thing.endsWith("Treasurite")) treasure = "Treasurite" + if (treasure) { + this.addTreasure("Mithril_Deposits", treasure, amount) + return + } + //global + if (thing.endsWith("Pickonimbus 2000")) treasure = "Pickonimbus_2000" + if (thing.endsWith("Prehistoric Egg")) treasure = "Prehistoric_Egg" + if (treasure) { + this.addTreasure("global", treasure, amount) + return + } + } }) this.registerStep(true, 1, () => { @@ -113,14 +201,14 @@ class PowderAndScatha extends Feature { this.registerChat("&r&6You have successfully picked the lock on this chest!&r", (e) => { this.miningData.powder.chests++ delay(100, () => { - this.expRateInfo.push([Date.now(), this.miningData.powder.mithril, this.miningData.powder.gemstone]) + this.expRateInfo.push([Date.now(), this.miningData.powder.mithril, this.miningData.powder.gemstone, this.miningData.powder.chests]) if (this.expRateInfo.length > 20) this.expRateInfo.shift() - let [time, mythril, gemstone] = this.expRateInfo[0] + let [time, mythril, gemstone, chest] = this.expRateInfo[0] this.mythrilRate = (this.miningData.powder.mithril - mythril) / (Date.now() - time) this.gemstoneRate = (this.miningData.powder.gemstone - gemstone) / (Date.now() - time) - this.chestRate = (this.miningData.powder.chestRate - chestRate) / (Date.now() - time) + this.chestRate = (this.miningData.powder.chests - chest) / (Date.now() - time) }) }) @@ -251,6 +339,8 @@ class PowderAndScatha extends Feature { if (type === "powder") { Object.keys(this.miningData.powder).forEach(thing => this.miningData.powder[thing] = 0) this.expRateInfo = [] + this.tempLocation = undefined + this.tempLoot = { global: {}, Jungle: {}, Goblin_Holdout: {}, Precursor_Remnants: {}, Mithril_Deposits: {} } } else if (type === "scatha") { Object.keys(this.miningData.scatha).forEach(thing => this.miningData.scatha[thing] = 0) } @@ -258,7 +348,7 @@ class PowderAndScatha extends Feature { renderOverlay() { if (this.PowderOverlayElement.isEnabled()) { - let width = Renderer.getStringWidth("&b2x Powder: &cINACTIVE") + let width = Renderer.getStringWidth("&b2x Powder: &cINACTIVE") let x = this.PowderOverlayElement.locationSetting.x let y = this.PowderOverlayElement.locationSetting.y @@ -320,18 +410,38 @@ class PowderAndScatha extends Feature { this.overlayLeft.push(`&bGems:`) this.overlayRight.push(`&d${numberWithCommas(g)}`) } - if (this.mythrilRate) { - this.overlayLeft.push(`&bMithril/h:`) - this.overlayRight.push(`&d${numberWithCommas(Math.round(this.mythrilRate * 1000 * 60 * 60))}`) - } - if (this.gemstoneRate) { - this.overlayLeft.push(`&bGems/h:`) - this.overlayRight.push(`&d${numberWithCommas(Math.round(this.gemstoneRate * 1000 * 60 * 60))}`) + if (this.powderPerHour.getValue()) { + if (this.mythrilRate) { + this.overlayLeft.push(`&bMithril/h:`) + this.overlayRight.push(`&d${numberWithCommas(Math.round(this.mythrilRate * 1000 * 60 * 60))}`) + } + if (this.gemstoneRate) { + this.overlayLeft.push(`&bGems/h:`) + this.overlayRight.push(`&d${numberWithCommas(Math.round(this.gemstoneRate * 1000 * 60 * 60))}`) + } } - if (this.chestRate) { + if (this.chestRate && this.chestsPerHour.getValue()) { this.overlayLeft.push(`&bChests/h:`) this.overlayRight.push(`&d${numberWithCommas(Math.round(this.chestRate * 1000 * 60 * 60))}`) } + if (this.showAreaTreasure.getValue()) { + if (Object.keys(this.tempLoot.global).length > 0) { + Object.keys(this.tempLoot.global).forEach(t => { + if (this.tempLoot.global[t] > 0) { + this.overlayLeft.push(`${this.treasureColored[t]}&b:`) + this.overlayRight.push(`&b${numberWithCommas(this.tempLoot.global[t])}`) + } + }) + } + if (this.tempLocation && Object.keys(this.tempLoot[this.tempLocation]).length > 0) { + Object.keys(this.tempLoot[this.tempLocation]).forEach(t => { + if (this.tempLoot[this.tempLocation][t] > 0) { + this.overlayLeft.push(`${this.treasureColored[t]}&b:`) + this.overlayRight.push(`&b${numberWithCommas(this.tempLoot[this.tempLocation][t])}`) + } + }) + } + } } 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` @@ -458,4 +568,4 @@ class PowderAndScatha extends Feature { module.exports = { class: new PowderAndScatha(), -}; +};
\ No newline at end of file |