aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-08-27 20:39:37 +0800
committerGitHub <noreply@github.com>2022-08-27 20:39:37 +0800
commit9f3684f8b451d7b082f9006d70ad2bfc0d52fb93 (patch)
treedbfd6edbc9bb677ac861d8cf3ceddfabd79d0238
parent8b79714d25d56d876c7c7593e4c3a45a28eb1230 (diff)
parent8aea67f96c130cb4e2d7e1c9381429fcbf13423a (diff)
downloadSoopyV2-9f3684f8b451d7b082f9006d70ad2bfc0d52fb93.tar.gz
SoopyV2-9f3684f8b451d7b082f9006d70ad2bfc0d52fb93.tar.bz2
SoopyV2-9f3684f8b451d7b082f9006d70ad2bfc0d52fb93.zip
Merge pull request #51 from EmeraldMerchant/patch-49
+scatha counter
-rw-r--r--features/specialMining/index.js103
1 files changed, 99 insertions, 4 deletions
diff --git a/features/specialMining/index.js b/features/specialMining/index.js
index 72ee843..d896f82 100644
--- a/features/specialMining/index.js
+++ b/features/specialMining/index.js
@@ -39,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)
@@ -60,7 +58,6 @@ class PowderAndScatha extends Feature {
}
})
this.dPowder = 0;
- this.registerStep(true, 2, this.step2fps);
this.sL = Renderer.getStringWidth(" ")
this.overlayLeft = []
@@ -89,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", () => {
@@ -185,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) {
@@ -281,6 +316,14 @@ 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() {
@@ -307,11 +350,63 @@ class PowderAndScatha extends Feature {
}
}
+ 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() {
this.hudElements = [];
this.inCrystalHollows = false;
this.foundWither = true;
this.dPowder = 0;
+ this.wormSpawned = false;
}
onDisable() {