diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-08 16:13:36 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-08 16:13:36 +0800 |
commit | adb4dd3c8f01c4b732cd5b85ccdcffd4b2138737 (patch) | |
tree | ba5d09cf87ae76dbf35a94f453507594526838f0 /features/slayers | |
parent | 2ee951ceaa9daebfbbe673b2f96d30b3642a2d69 (diff) | |
download | SoopyV2-adb4dd3c8f01c4b732cd5b85ccdcffd4b2138737.tar.gz SoopyV2-adb4dd3c8f01c4b732cd5b85ccdcffd4b2138737.tar.bz2 SoopyV2-adb4dd3c8f01c4b732cd5b85ccdcffd4b2138737.zip |
fix rounding error
Diffstat (limited to 'features/slayers')
-rw-r--r-- | features/slayers/index.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/features/slayers/index.js b/features/slayers/index.js index f7d5c9f..590c5b6 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, timeNumberDetailed } from "../../utils/numberUtils"; +import { numberWithCommas, timeNumber } from "../../utils/numberUtils"; import { drawBoxAtBlock, drawBoxAtEntity, drawCoolWaypoint, drawFilledBox, drawLine } from "../../utils/renderUtils"; import HudTextElement from "../hud/HudTextElement"; import LocationSetting from "../settings/settingThings/location"; @@ -200,15 +200,17 @@ 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) { - let time = timeNumber(Date.now() - this.lastBossSlain); - let v = parseInt(this.bossSpawnKillTimeDetalied.getValue()) || 0 - if (v > 0) time = timeNumberDetailed(Date.now() - this.lastBossSlain, v); + let decimals = parseInt(this.bossSpawnKillTimeDetalied.getValue()) || 0 + + let time = timeNumber(Date.now() - this.lastBossSlain, decimals); + 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) { - let time = timeNumber(Date.now() - this.lastBossSpawned); - let v = parseInt(this.bossKillTimeDetalied.getValue()) || 0 - if (v > 0) time = timeNumberDetailed(Date.now() - this.lastBossSpawned, v); + let decimals = parseInt(this.bossKillTimeDetalied.getValue()) || 0 + + let time = timeNumber(Date.now() - this.lastBossSpawned, decimals); + ChatLib.chat(`&r &r&aBoss took &d${time} &ato kill&r&7!`); } } |