From 96f5936ef52870a5255d44f5caa22994e0a17862 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Sun, 4 Sep 2022 10:21:08 +0800 Subject: + detailed price + meta --- features/globalSettings/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 8372c58..3a211f4 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -360,6 +360,29 @@ class GlobalSettings extends Feature { }) }) }) + + this.registerCommand("price", () => { + + fetch("http://soopy.dev/api/soopyv2/itemPriceDetailed", { + postData: { + item: Player.getHeldItem().getNBT().toObject() + } + }).json(json => { + ChatLib.chat(this.FeatureManager.messagePrefix + "PRICE ANALASIS:") + 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))) + }) + }) } worldLoad() { -- cgit