diff options
author | Ninjune <enderknight537@gmail.com> | 2022-12-22 03:21:02 -0600 |
---|---|---|
committer | Ninjune <enderknight537@gmail.com> | 2022-12-22 03:21:02 -0600 |
commit | 329dccf50ed5e9f87531580f679522238b6a019b (patch) | |
tree | 3053852d322db744822a7dd2a05fd59d2b1e90b7 /commands/calculate/tick.js | |
parent | 1ffc0a89be42fcde95a04a87cc00dbc347b27ece (diff) | |
download | coleweight-329dccf50ed5e9f87531580f679522238b6a019b.tar.gz coleweight-329dccf50ed5e9f87531580f679522238b6a019b.tar.bz2 coleweight-329dccf50ed5e9f87531580f679522238b6a019b.zip |
v1.8.3
Diffstat (limited to 'commands/calculate/tick.js')
-rw-r--r-- | commands/calculate/tick.js | 80 |
1 files changed, 60 insertions, 20 deletions
diff --git a/commands/calculate/tick.js b/commands/calculate/tick.js index 5969710..674aa91 100644 --- a/commands/calculate/tick.js +++ b/commands/calculate/tick.js @@ -1,50 +1,86 @@ import constants from "../../util/constants" const PREFIX = constants.PREFIX -export function tick(speed, block) +export function tickCommand(speed, block) { if(speed == undefined || parseInt(speed) != speed) return ChatLib.chat(`${PREFIX}&cMining speed must be an integer!`) if(block == undefined) return ChatLib.chat(constants.CALCULATEERRORMESSAGE) - let strength = findStrength(block) - if(strength < 1) return ChatLib.chat(`${PREFIX}&cBlock must be a gemstone or positive breaking power! (or starting letter of gemstone)`) - let currentBlockTick = strength*30/speed, - currentShardTick = (strength-200)*30/speed, - nextBlockSpeed, nextShardSpeed + const ticks = findTick(speed, block) + if(ticks.err) return ChatLib.chat(`${PREFIX}&cBlock must be a gemstone or positive breaking power! (or starting letter of gemstone)`) + - if(currentBlockTick < Math.floor(currentBlockTick) + 0.5) - nextBlockSpeed = strength*30/(Math.floor(currentBlockTick)-0.5) + ChatLib.chat(`\n&bCurrently mining blocks in &6&l${Math.round(ticks.currentBlockTick)} ticks` + + `\n&bCurrently mining shards in &6&l${Math.round(ticks.currentShardTick)} ticks` + + `\n&bNext block tick will be at: &6&l${Math.round(ticks.nextBlockSpeed)} mining speed` + + `\n&bNext shard tick will be at: &6&l${Math.round(ticks.nextShardSpeed)} mining speed` + + `\n&bYou need &6&l${Math.round(ticks.nextBlockSpeed - speed)} mining speed&b to get the next block tick.` + + `\n&bYou need &6&l${Math.round(ticks.nextShardSpeed - speed)} mining speed&b to get the next shard tick.\n`) +} + + +export function findTick(speed, block) +{ + let ticks = {err: false}, + strength = findStrength(block), + tickStrength = strength-200 + + ticks.currentBlockTick = strength*30/speed + ticks.currentShardTick = tickStrength*30/speed + + if(ticks.currentBlockTick < 4.5) + { + if(ticks.currentBlockTick > 0.5) + ticks.currentBlockTick = 4 + } + + if(ticks.currentShardTick < 4.5) + { + if(ticks.currentShardTick > 0.5) + ticks.currentShardTick = 4 + } + + if(strength < 1) return ticks.err = true + + + if(ticks.currentBlockTick < Math.floor(ticks.currentBlockTick) + 0.5) + ticks.nextBlockSpeed = strength*30/(Math.floor(ticks.currentBlockTick)-0.5) else - nextBlockSpeed = strength*30/(Math.floor(currentBlockTick)+0.5) + ticks.nextBlockSpeed = strength*30/(Math.floor(ticks.currentBlockTick)+0.5) - if(currentShardTick < Math.floor(currentShardTick) + 0.5) - nextShardSpeed = strength*30/(Math.floor(currentShardTick)-0.5) + if(ticks.currentShardTick < Math.floor(ticks.currentShardTick) + 0.5) + ticks.nextShardSpeed = strength*30/(Math.floor(ticks.currentShardTick)-0.5) else - nextShardSpeed = strength*30/(Math.floor(currentShardTick)+0.5) + ticks.nextShardSpeed = strength*30/(Math.floor(ticks.currentShardTick)+0.5) - ChatLib.chat(`\n&bCurrently mining blocks in &6&l${Math.round(currentBlockTick)} ticks` + - `\n&bCurrently mining shards in &6&l${Math.round(currentShardTick)} ticks` + - `\n&bNext block tick will be at: &6&l${Math.round(nextBlockSpeed)} mining speed` + - `\n&bNext shard tick will be at: &6&l${Math.round(nextShardSpeed)} mining speed` + - `\n&bYou need &6&l${Math.round(nextBlockSpeed - speed)} mining speed&b to get the next block tick.` + - `\n&bYou need &6&l${Math.round(nextShardSpeed - speed)} mining speed&b to get the next shard tick.\n`) + return ticks } function findStrength(block) { let strength = -1 - if(block == parseInt(block)) + if(block == parseInt(block) && block > 5) // change if add block to tick speed blocks in settings strength = block else { - switch(block.toLowerCase()) + switch(block.toString().toLowerCase()) { + case "0": + case "green_mithril": + strength = 800 + break + case "1": + case "blue_mithril": + strength = 1500 + break + case "2": case "ruby": case "r": strength = 2500 break + case "3": case "j": case "jade": case "a": @@ -54,11 +90,15 @@ function findStrength(block) case "sapphire": strength = 3200 break + case "4": case "t": case "topaz": case "o": case "opal": strength = 4000 + case "5": + case "jasper": + strength = 5000 } } |