diff options
-rw-r--r-- | features/dataLoader/index.js | 6 | ||||
-rw-r--r-- | features/mining/index.js | 6 | ||||
-rw-r--r-- | socketConnection.js | 6 | ||||
-rw-r--r-- | utils/numberUtils.js | 42 |
4 files changed, 35 insertions, 25 deletions
diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index f0ede23..b933e31 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -151,11 +151,11 @@ class DataLoader extends Feature { this.area = this.stats["Area"] - if (this.lastServer !== this.FeatureManager.features["dataLoader"].class.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { - this.lastServer = this.FeatureManager.features["dataLoader"].class.stats.Server; + if (this.lastServer !== this.stats.Server || Date.now() - this.lastSentServer > 60000 * 5) { + this.lastServer = this.stats.Server; this.lastSentServer = Date.now() - socketConnection.setServer(this.FeatureManager.features["dataLoader"].class.stats.Server); + socketConnection.setServer(this.stats.Server, this.area, this.areaFine); } } diff --git a/features/mining/index.js b/features/mining/index.js index dec8728..9a9a881 100644 --- a/features/mining/index.js +++ b/features/mining/index.js @@ -76,7 +76,7 @@ class Mining extends Feature { this.armourstandClass = Java.type("net.minecraft.entity.item.EntityArmorStand").class - this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue() || this.gemstoneMoneyHud.getValue()) + this.registerEvent("renderOverlay", this.renderOverlay).registeredWhen(() => this.balRespawnHud.getValue() || this.compactProgressHud.getValue() || this.gemstoneMoneyHud.getValue() || this.nextChEvent.getValue()) this.registerEvent("tick", this.tick) this.registerEvent("itemTooltip", this.itemTooltipEvent).registeredWhen(() => this.showContainedGemstoneSlots.getValue() || this.showUnlockedGemstoneSlots.getValue()) this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.guessBalHp.getValue()) @@ -133,12 +133,12 @@ class Mining extends Feature { let moneyPerHour = Math.floor(money / ((Date.now() - startingTime) / (1000 * 60 * 60))) let moneyMade = Math.floor(money) - let timeTracked = timeSince(startingTime) + let timeTracked = timeSince2(startingTime) this.gemstoneMoneyHudElement.setText("&6$/h&7> &f$" + numberWithCommas(moneyPerHour) + "\n&6$ made&7> &f$" + numberWithCommas(moneyMade) + "\n&6Time tracked&7> &f" + timeTracked) }) this.registerStep(false, 10, () => { - if (lastMined && Date.now() - lastMined > 60000) { + if (lastMined && Date.now() - lastMined > 2 * 60000) { money = 0 startingTime = -1 lastMined = 0 diff --git a/socketConnection.js b/socketConnection.js index 7cea440..6479dee 100644 --- a/socketConnection.js +++ b/socketConnection.js @@ -189,10 +189,12 @@ class SoopyV2Server extends WebsiteCommunicator { }) } - setServer(server) { + setServer(server, area, areaFine) { this.sendData({ type: "server", - server: server + server, + area, + areaFine }) } diff --git a/utils/numberUtils.js b/utils/numberUtils.js index 96a6b74..82a6805 100644 --- a/utils/numberUtils.js +++ b/utils/numberUtils.js @@ -1,11 +1,11 @@ module.exports = { - numberWithCommas: function(x){ + numberWithCommas: function (x) { if (x === undefined) { return "" } var parts = x.toString().split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); }, - addNotation: function(type, value) { + addNotation: function (type, value) { let returnVal = value; let notList = []; if (type === "shortScale") { @@ -47,14 +47,14 @@ module.exports = { return returnVal; }, - timeSince:function (date) { + timeSince: function (date) { if (typeof date !== 'object') { date = new Date(date); } - - var seconds = Math.floor((new Date()-date) / 1000); + + var seconds = Math.floor((new Date() - date) / 1000); var intervalType; - + var interval = Math.floor(seconds / 31536000); interval = Math.floor(seconds / 86400); if (interval >= 1) { @@ -73,21 +73,29 @@ module.exports = { } } } - + return interval + '' + intervalType; }, - timeNumber: function(time){ - let mins = Math.floor(time/1000/60) - let secs = Math.floor(time/1000)%60 - - if(mins === 0) return secs + "s" + timeSince2: function (date) { + let time = Date.now() - date + + if (time > 30 * 60000) { + return this.timeNumber2(time) + } + return this.timeNumber(time) + }, + timeNumber: function (time) { + let mins = Math.floor(time / 1000 / 60) + let secs = Math.floor(time / 1000) % 60 + + if (mins === 0) return secs + "s" return `${mins}m ${secs}s` }, - timeNumber2: function(time){ - let hours = Math.floor(time/1000/60/60) - let mins = Math.floor(time/1000/60)%60 - - if(hours === 0) return mins + "m" + timeNumber2: function (time) { + let hours = Math.floor(time / 1000 / 60 / 60) + let mins = Math.floor(time / 1000 / 60) % 60 + + if (hours === 0) return mins + "m" return `${hours}h ${mins}m` } }
\ No newline at end of file |