diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/specialMining/index.js | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/features/specialMining/index.js b/features/specialMining/index.js index 9ef7f09..faba13c 100644 --- a/features/specialMining/index.js +++ b/features/specialMining/index.js @@ -51,53 +51,74 @@ class PowderAndScatha extends Feature { 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.hideWishingCompassMessage.getValue() && thing.endsWith("Wishing Compass")) cancel(e) if (this.hideAscensionRope.getValue() && thing.endsWith("Ascension Rope")) cancel(e) - if (this.areaTreasure.getValue()) { - let amount = parseInt(thing.split(" ")[0].removeFormatting()) || 0 + if (this.showAreaTreasure.getValue()) { let treasure = undefined + let amount = Math.floor(Number(thing.split(" ")[0].removeFormatting())) //jungle - if (thing.includes("Sludge Juice")) treasure = "&aSludge_Juice" - else if (thing.includes("Oil Burrow")) treasure = "&aOil_Burrow" - else if (thing.includes("Jungle Heart")) treasure = "&6Jungle_Heart" + 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.includes("Goblin Egg")) { - if (thing.includes("Green")) treasure = "&aGreen_Goblin_Egg" - else if (thing.includes("Red")) treasure = "&cRed_Goblin_Egg" - else if (thing.includes("Yellow")) treasure = "&eYellow_Goblin_Egg" - else if (thing.includes("Blue")) treasure = "&3Blue_Goblin_Egg" + 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 = "&9Goblin_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.includes("Control Switch")) treasure = "&9Control_Switch" - else if (thing.includes("FTX 3070")) treasure = "&9FTX_3070" - else if (thing.includes("Electron Transmitter")) treasure = "&9Electron_Transmitter" - else if (thing.includes("Robotron Reflector")) treasure = "&9Robotron_Reflector" - else if (thing.includes("Synthetic Heart")) treasure = "&9Synthetic_Heart" - else if (thing.includes("Superlite Motor")) treasure = "&9Superlite_Motor" + 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("Lost_Precursor_City", treasure, amount) return } //mithril deposits - if (thing.includes("Treasurite")) treasure = "&5Treasurite" + if (thing.endsWith("Treasurite")) treasure = "Treasurite" if (treasure) { this.addTreasure("Mithril_Deposits", treasure, amount) return } //global - if (thing.includes("Pickonimbus 2000")) treasure = "&5Pickonimbus_2000" - else if (thing.includes("Prehistoric Egg")) treasure = "&fPrehistoric_Egg" + if (thing.endsWith("Pickonimbus 2000")) treasure = "Pickonimbus_2000" + if (thing.endsWith("Prehistoric Egg")) treasure = "Prehistoric_Egg" if (treasure) { this.addTreasure("global", treasure, amount) return @@ -172,14 +193,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) }) }) @@ -310,6 +331,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: {}, Lost_Precursor_City: {}, Mithril_Deposits: {} } } else if (type === "scatha") { Object.keys(this.miningData.scatha).forEach(thing => this.miningData.scatha[thing] = 0) } @@ -392,18 +415,19 @@ class PowderAndScatha extends Feature { this.overlayRight.push(`&d${numberWithCommas(Math.round(this.chestRate * 1000 * 60 * 60))}`) } if (this.showAreaTreasure.getValue()) { - if (!this.tempLocation && this.tempLoot.global !== {}) { + if (Object.keys(this.tempLoot.global).length > 0) { Object.keys(this.tempLoot.global).forEach(t => { - if (t > 0) { - this.overlayLeft.push(`${t}&f:`) - this.overlayRight.push(this.tempLoot.global[t]) + if (this.tempLoot.global[t] > 0) { + this.overlayLeft.push(`${this.treasureColored[t]}&b:`) + this.overlayRight.push(`&b${this.tempLoot.global[t]}`) } }) - } else if (this.tempLoot[this.tempLocation] !== {}) { + } + if (this.tempLocation && Object.keys(this.tempLoot[this.tempLocation]).length > 0) { Object.keys(this.tempLoot[this.tempLocation]).forEach(t => { - if (t > 0) { - this.overlayLeft.push(`${t}&f:`) - this.overlayRight.push(this.tempLoot[this.tempLocation][t]) + if (this.tempLoot[this.tempLocation][t] > 0) { + this.overlayLeft.push(`${this.treasureColored[t]}&b:`) + this.overlayRight.push(`&b${this.tempLoot[this.tempLocation][t]}`) } }) } |