diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-07 19:49:54 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-07 19:49:54 +0800 |
commit | f404f4f94a4394328b3d1f94b012e7d9cc0aa0d2 (patch) | |
tree | a327a09fae90b15652d849954074378ef5105756 /features/globalSettings/index.js | |
parent | 440138a8c05cb5cfbe28c5e77387e049b1db7108 (diff) | |
parent | cd7b714f5e344359b7606c57282376f834084e99 (diff) | |
download | SoopyV2-f404f4f94a4394328b3d1f94b012e7d9cc0aa0d2.tar.gz SoopyV2-f404f4f94a4394328b3d1f94b012e7d9cc0aa0d2.tar.bz2 SoopyV2-f404f4f94a4394328b3d1f94b012e7d9cc0aa0d2.zip |
Merge pull request #60 from Soopyboo32/terminal-solvers
Terminal solvers
Diffstat (limited to 'features/globalSettings/index.js')
-rw-r--r-- | features/globalSettings/index.js | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 0fd74e9..e8b86ab 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -370,19 +370,43 @@ class GlobalSettings extends Feature { item: Player.getHeldItem().getNBT().toObject() } }).json(json => { - ChatLib.chat(this.FeatureManager.messagePrefix + "PRICE ANALASIS:") - json.details.sort((a, b) => { + ChatLib.chat(this.FeatureManager.messagePrefix + "PRICE ANALYSIS (Total: $" + numberWithCommas(Math.round(json.price)) + ")") + // json.details.sort((a, b) => { + // if (typeof (a) === "string") return 1 + // if (typeof (b) === "string") return -1 + // return a[1] - b[1] + // }).forEach(d => { + // if (typeof (d) === "string") { + // ChatLib.chat(d) + // } else { + // ChatLib.chat("&f" + d[0] + "&7: &6" + numberWithCommas(Math.round(d[1]))) + // } + // }) + // ChatLib.chat(this.FeatureManager.messagePrefix + "Final price: " + numberWithCommas(Math.round(json.price))) + json.details.sort((b, a) => { if (typeof (a) === "string") return 1 if (typeof (b) === "string") return -1 - return a[1] - b[1] + return a.price - b.price }).forEach(d => { if (typeof (d) === "string") { ChatLib.chat(d) } else { - ChatLib.chat("&f" + d[0] + "&7: &6" + numberWithCommas(Math.round(d[1]))) + if (!d.price) return + let lore = [] + d.items.sort((b, a) => { + if (typeof (a) === "string") return 1 + if (typeof (b) === "string") return -1 + return a[1] - b[1] + }).forEach(d2 => { + if (typeof (d2) === "string") { + lore.push(d2) + } else { + lore.push("&f" + d2[0] + "&7: $&6" + numberWithCommas(Math.round(d2[1]))) + } + }) + new TextComponent("&d" + d.name + "&7: $&6" + numberWithCommas(Math.round(d.price))).setHover("show_text", lore.join("\n")).chat() } }) - ChatLib.chat(this.FeatureManager.messagePrefix + "Final price: " + numberWithCommas(Math.round(json.price))) }) }) |