From a57aa17deb92437fcf1ca3ce1c8750e55bb54f9c Mon Sep 17 00:00:00 2001 From: koneko <67551503+koneko@users.noreply.github.com> Date: Fri, 8 Aug 2025 13:10:50 +0200 Subject: [PATCH] so funn, clamping --- commands/estimate.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/commands/estimate.js b/commands/estimate.js index 964693c..3e26072 100644 --- a/commands/estimate.js +++ b/commands/estimate.js @@ -168,6 +168,12 @@ exports.run = async (client, message, args) => { estimatedPrice = Math.round( weightedInterpolatePrice(subtable, gameValue) ); + if (idx == 0 && closestInTable.diff > 100) { + estimatedPrice = 0; + } + if (estimatedPrice > 100000) { + estimatedPrice = 100000; + } } }); if (entryFound) { @@ -179,16 +185,19 @@ exports.run = async (client, message, args) => { message.channel.send( `Displaying data price table for \`${returnKeyWord}\`.\n\`\`\`\nGame Value\tPrice\n${res}\`\`\`` ); - } else + } else { + let stringprice; + if (estimatedPrice > 499) { + stringprice = `**__${estimatedPrice}__** (atleast 1 cheater, worth auctioning)`; + } else if (estimatedPrice == 0) { + stringprice = "**0** (<:TavKeep:1179145911180480563>)"; + } else { + stringprice = `**${estimatedPrice}**`; + } message.channel.send( - `Hmm... I estimate your **${gameValue} ${returnKeyWord}** to be worth approximately ${ - estimatedPrice > 499 - ? `**__${estimatedPrice}__** (atleast 1 cheater, worth auctioning)` - : `**${estimatedPrice}**` - } cv.\n*Estimation is provided through looking at past trades/price checks/sheets in DDRNG.*\n*Closest price in table: **${ - closestInTable.val - }** cv, diff: **${closestInTable.diff}***.` + `Hmm... I estimate your **${gameValue} ${returnKeyWord}** to be worth approximately ${stringprice} cv.\n*Estimation is provided through looking at past trades/price checks/sheets in DDRNG.*\n*Closest price in table: **${closestInTable.val}** cv, diff: **${closestInTable.diff}***.` ); + } } else message.channel.send( "Your query couldn't be matched with anything, please refine your query or reffer to `<