diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-06 21:12:41 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-06 21:12:41 +0800 |
commit | 994b25cf01b1cd5fba879908cb8a524add6c2c24 (patch) | |
tree | 3a69f74c01ee0766c92e574fe3d3a079af1c227b | |
parent | 735d50d9a298a6da66974eeec5efa4fcbb95a733 (diff) | |
parent | 38a8311c803763120571ca33ac4d8c31b5e6af68 (diff) | |
download | SoopyV2-994b25cf01b1cd5fba879908cb8a524add6c2c24.tar.gz SoopyV2-994b25cf01b1cd5fba879908cb8a524add6c2c24.tar.bz2 SoopyV2-994b25cf01b1cd5fba879908cb8a524add6c2c24.zip |
Merge branch 'master' of https://github.com/Soopyboo32/SoopyV2
-rw-r--r-- | features/slayers/index.js | 46 | ||||
-rw-r--r-- | features/specialMining/index.js | 32 | ||||
-rw-r--r-- | utils/numberUtils.js | 12 |
3 files changed, 82 insertions, 8 deletions
diff --git a/features/slayers/index.js b/features/slayers/index.js index 59606a1..da05a68 100644 --- a/features/slayers/index.js +++ b/features/slayers/index.js @@ -2,7 +2,7 @@ /// <reference lib="es2015" /> import Feature from "../../featureClass/class"; import { f, m } from "../../../mappings/mappings"; -import { numberWithCommas, timeNumber } from "../../utils/numberUtils"; +import { numberWithCommas, timeNumber, timeNumberDetailed } from "../../utils/numberUtils"; import { drawBoxAtBlock, drawBoxAtEntity, drawCoolWaypoint, drawFilledBox, drawLine } from "../../utils/renderUtils"; import HudTextElement from "../hud/HudTextElement"; import LocationSetting from "../settings/settingThings/location"; @@ -42,8 +42,24 @@ class Slayers extends Feature { this.expOnKill = new ToggleSetting("Show slayer exp on boss kill", "Says your slayer exp in chat when you kill a boss, also says time taken to spawn+kill", true, "slayer_xp", this); this.slainAlert = new ToggleSetting("Show boss slain alert", "This helps you to not kill mobs for ages with an inactive quest", true, "boss_slain_alert", this); this.spawnAlert = new ToggleSetting("Show boss spawned alert", "This helps you to not miss your boss when you spawn it", true, "boss_spawn_alert", this); + this.spawnKillSetting = { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4" + } this.bossSpawnKillTime = new ToggleSetting("Show boss spawn and kill time", "tells you your slayer boss speed", true, "Slayer_spawn_kill_time", this).contributor("EmeraldMerchant"); + this.bossSpawnKillTimeDetalied = new DropdownSetting("Boss spawn & kill time using Decimal Point", "0 = 5s, 1 = 5.1s, 2 = 5.15s etc.", "full number", "slayer_spawn_kill_time_decimal_point", this, this.spawnKillSetting).requires(this.bossSpawnKillTime).contributor("EmeraldMerchant"); + this.killSetting = { + "0": "0", + "1": "1", + "2": "2", + "3": "3", + "4": "4" + } this.bossKillTime = new ToggleSetting("Shows you bosses kill time", "tells you your slayer boss kill time", true, "slayer_kill_time", this).requires(this.bossSpawnKillTime).contributor("EmeraldMerchant"); + this.bossKillTimeDetalied = new DropdownSetting("Boss kill time using Decimal Point", "0 = 5s, 1 = 5.1s, 2 = 5.15s etc.", "full number", "slayer_kill_time_decimal_point", this, this.killSetting).requires(this.bossKillTime).contributor("EmeraldMerchant"); this.slayerXpGuiElement = new ToggleSetting("Render the xp of your current slayer on your screen", "This will help you to know how much xp u have now w/o looking in chat", true, "slayer_xp_hud", this).contributor("EmeraldMerchant"); this.slayerXpElement = new HudTextElement() .setText("&6Slayer&7> &fLoading...") @@ -143,6 +159,7 @@ class Slayers extends Feature { candidatesDist.push(Math.round(parseFloat(distanceTo(candidate)) * 10)) }) this.emanBoss = this.candidateBoss[candidatesDist.indexOf(Math.min(...candidatesDist))] + assignActualEmanBoss(this.emanBoss) } } }) @@ -183,10 +200,16 @@ class Slayers extends Feature { ChatLib.chat("&r &r&aYou have &d" + numberWithCommas(this.slayerExp[this.lastSlayerType]) + " " + this.lastSlayerType + " XP&r&7!&r"); ChatLib.chat("&r &r&aYou have &d" + numberWithCommas(Object.values(this.slayerExp).reduce((a, t) => t + a, 0)) + " total XP&r&7!&r"); if (this.bossSpawnKillTime.getValue() && Date.now() - this.lastBossSlain < 60000 * 10) { - ChatLib.chat(`&r &r&aBoss took &d${timeNumber(Date.now() - this.lastBossSlain)} &ato spawn and kill&r&7!`); + let time = timeNumber(Date.now() - this.lastBossSlain); + let v = parseInt(this.bossSpawnKillTimeDetalied.getValue()) || 0 + if (v > 0) time = timeNumberDetailed(Date.now() - this.lastBossSlain, v); + ChatLib.chat(`&r &r&aBoss took &d${time} &ato spawn and kill&r&7!`); } if (this.bossKillTime.getValue() && Date.now() - this.lastBossSpawned < 60000 * 4.6) { - ChatLib.chat(`&r &r&aBoss took &d${timeNumber(Date.now() - this.lastBossSpawned)} &ato kill&r&7!`); + let time = timeNumber(Date.now() - this.lastBossSpawned); + let v = parseInt(this.bossKillTimeDetalied.getValue()) || 0 + if (v > 0) time = timeNumberDetailed(Date.now() - this.lastBossSpawned, v); + ChatLib.chat(`&r &r&aBoss took &d${time} &ato kill&r&7!`); } } this.lastBossSlain = Date.now(); @@ -406,6 +429,20 @@ class Slayers extends Feature { } } } + + assignActualEmanBoss(entity) { + if (this.bossSpawnedMessage) { + World.getAllEntitiesOfType(net.minecraft.entity.monster.EntityEnderman).forEach((e) => { + if (e.getName().includes("Voidgloom Seraph")) { + //if distance from e to entity < 5 + if ((e.getX() - entity.getX()) ** 2 + (e.getY() - entity.getY()) ** 2 + (e.getZ() - entity.getZ()) ** 2 < 25) { + this.actualEmanBoss = e; + } + } + }) + } + } + renderWorld(ticks) { this.minibossEntity.forEach((x) => { drawBoxAtEntity(x[0], 0, 1, 0, this.SlayerWidth[x[1]], this.SlayerHeight[x[1]], ticks, 4, false); @@ -492,6 +529,7 @@ class Slayers extends Feature { this.cannotFindEmanBoss = false } else if (nameRemoveFormat.includes("Voidgloom Seraph") && ((name.getX() - Player.getX()) ** 2 + (name.getY() - Player.getY()) ** 2 + (name.getZ() - Player.getZ()) ** 2 < 25)) { this.emanBoss = name + assignActualEmanBoss(this.emanBoss) this.cannotFindEmanBoss = false } } @@ -582,10 +620,12 @@ class Slayers extends Feature { if (e[m.getCustomNameTag]() && e[m.getCustomNameTag]().includes("Voidgloom Seraph")) { if (Date.now() - this.nextIsBoss < 3000) { this.emanBoss = new Entity(e); + assignActualEmanBoss(this.emanBoss) this.nextIsBoss = false; } if (this.cannotFindEmanBoss && ((e[f.posX.Entity] - Player.getX()) ** 2 + (e[f.posY.Entity] - Player.getY()) ** 2 + (e[f.posZ.Entity] - Player.getZ()) ** 2 < 5)) { this.emanBoss = new Entity(e); + assignActualEmanBoss(this.emanBoss) this.cannotFindEmanBoss = false } diff --git a/features/specialMining/index.js b/features/specialMining/index.js index 794b9ca..0da808d 100644 --- a/features/specialMining/index.js +++ b/features/specialMining/index.js @@ -8,6 +8,7 @@ import { delay } from "../../utils/delayUtils"; import TextSetting from "../settings/settingThings/textSetting"; import { drawBoxAtBlock, drawFilledBox } from "../../utils/renderUtils"; import RenderLib2D from "../../utils/renderLib2d"; +import { f, m } from "../../../mappings/mappings"; class PowderAndScatha extends Feature { constructor() { @@ -196,6 +197,14 @@ class PowderAndScatha extends Feature { .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); + this.wormEntity = undefined; + this.scathaHealth = new ToggleSetting("Scatha Health Hud", "This will show worm/scatha mob HP on screen", false, "scatha_hp_hud", this).requires(this.scathaMain).contributor("EmeraldMerchant"); + this.scathaHealthElement = new HudTextElement() + .setText("") + .setToggleSetting(this.scathaHealth) + .setLocationSetting(new LocationSetting("Scatha Health Hud Location", "Allows you to edit the location of Scatha Health Hud", "scatha_hp_hud_location", this, [10, 50, 1, 1]).requires(this.scathaHealth).editTempText(`&8[&7Lv5&8] &cWorm &e5&c❤`)); + this.hudElements.push(this.scathaHealthElement); + 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"] @@ -221,6 +230,7 @@ class PowderAndScatha extends Feature { this.registerStep(true, 2, this.step2fps); this.registerStep(true, 3, this.wormStep); + this.registerStep(true, 5, this.scathaHP); } spawnParticle(particle, type, event) { @@ -240,7 +250,7 @@ class PowderAndScatha extends Feature { Object.keys(this.miningData.powder).forEach(thing => this.miningData.powder[thing] = 0) this.expRateInfo = [] } else if (type === "scatha") { - //TODO + Object.keys(this.miningData.scatha).forEach(thing => this.miningData.scatha[thing] = 0) } } @@ -382,32 +392,48 @@ class PowderAndScatha extends Feature { //§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); + 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 (this.scathaHealth.getValue()) this.wormEntity = entity } 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); + 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; + if (this.scathaHealth.getValue()) this.wormEntity = entity } }); } + scathaHP() { + let tempText = "" + if (this.scathaHealth.getValue()) { + if (this.wormEntity && this.wormEntity.getEntity()[f.isDead]) { + this.wormEntity = undefined; + } + } else if (this.wormEntity) { + this.wormEntity = undefined; + } + tempText = this.wormEntity.getName() + this.scathaHealthElement.setText(tempText) + } + initVariables() { this.hudElements = []; this.inCrystalHollows = false; this.foundWither = true; this.dPowder = 0; this.wormSpawned = false; + this.wormEntity = undefined; } onDisable() { diff --git a/utils/numberUtils.js b/utils/numberUtils.js index 7889d74..97693e1 100644 --- a/utils/numberUtils.js +++ b/utils/numberUtils.js @@ -5,7 +5,7 @@ let utils = { parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); }, - addNotation: function (type, value, joiner="") { + addNotation: function (type, value, joiner = "") { let returnVal = value; let notList = []; if (type === "shortScale") { @@ -91,6 +91,14 @@ let utils = { if (mins === 0) return secs + "s" return `${mins}m ${secs}s` }, + timeNumberDetailed: (time, decimalPoint) => { + let mins = Math.floor(time / 1000 / 60) + let tenToDecimalPower = 10 ** decimalPoint + let secs = Math.floor((time / 1000) * tenToDecimalPower)/tenToDecimalPower % 60 + + if (mins === 0) return secs + "s" + return `${mins}m ${secs}s` + }, timeNumber2: (time) => { let hours = Math.floor(time / 1000 / 60 / 60) let mins = Math.floor(time / 1000 / 60) % 60 @@ -99,4 +107,4 @@ let utils = { return `${hours}h ${mins}m` } } -module.exports = utils
\ No newline at end of file +module.exports = utils |