Add active growth indicator

This commit is contained in:
Skylar Grant 2023-01-23 18:27:52 -05:00
parent 37c0436b51
commit af93bb68f0
2 changed files with 9 additions and 4 deletions

View File

@ -148,13 +148,18 @@ const functions = {
let replyString = 'Current Tree Height: ' + treeHeight + 'ft\n\n'; let replyString = 'Current Tree Height: ' + treeHeight + 'ft\n\n';
guildInfo[interaction.guildId].rankings.forEach(e => { guildInfo[interaction.guildId].rankings.forEach(e => {
let difference = parseFloat(e.height).toFixed(1) - treeHeight; let difference = parseFloat(e.height).toFixed(1) - treeHeight;
let decimal = (e.height % 1).toFixed(1);
let growthIndicator = "";
if (decimal > 0) {
growthIndicator += "[+]";
}
const absDifference = parseFloat(Math.abs(difference)).toFixed(1); const absDifference = parseFloat(Math.abs(difference)).toFixed(1);
if (difference > 0) { if (difference > 0) {
replyString += `#${e.rank} - ${absDifference}ft shorter `; replyString += `#${e.rank} - ${absDifference}ft${growthIndicator} shorter `;
} else if (difference < 0) { } else if (difference < 0) {
replyString += `#${e.rank} - ${absDifference}ft taller `; replyString += `#${e.rank} - ${absDifference}ft${growthIndicator} taller `;
} else if (difference == 0) { } else if (difference == 0) {
replyString += `#${e.rank} - Same height `; replyString += `#${e.rank} - Same height${growthIndicator} `;
} }
replyString += `[${functions.getWaterTime(e.height)}m]\n`; replyString += `[${functions.getWaterTime(e.height)}m]\n`;
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "treeanalyzer", "name": "treeanalyzer",
"version": "1.0.2", "version": "1.0.3",
"description": "Analyze Grow A Tree", "description": "Analyze Grow A Tree",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {