This commit is contained in:
@ -2,7 +2,58 @@ const priceTable = [
|
|||||||
{
|
{
|
||||||
regex: /\b(?:thp|summoner|summ)\b/i,
|
regex: /\b(?:thp|summoner|summ)\b/i,
|
||||||
returnKeyWord: "summoner piece",
|
returnKeyWord: "summoner piece",
|
||||||
prices: ["1000;10", "1100;15", "1200;30", "1250;100", "1300;1000"],
|
prices: [
|
||||||
|
"1000;10",
|
||||||
|
"1050;12",
|
||||||
|
"1100;15",
|
||||||
|
"1150;25",
|
||||||
|
"1200;30",
|
||||||
|
"1250;100",
|
||||||
|
"1300;500",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
regex: /\b(?:dps|ab2)\b/i,
|
||||||
|
returnKeyWord: "dps/ab2 piece",
|
||||||
|
prices: [
|
||||||
|
"1400;20",
|
||||||
|
"1450;35",
|
||||||
|
"1500;50",
|
||||||
|
"1550;75",
|
||||||
|
"1600;150",
|
||||||
|
"1650;500",
|
||||||
|
"1700;1000",
|
||||||
|
"1750;2000",
|
||||||
|
"1800;50000",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
regex: /\b(?:tb|ab1)\b/i,
|
||||||
|
returnKeyWord: "tb/ab1 piece",
|
||||||
|
prices: ["980;5", "1050;15", "1100;40", "1150;70", "1200;500"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
regex: /\b(?:app builder staff|apprentice build staff|app staff|apprentice staff)\b/i,
|
||||||
|
returnKeyWord: "apprentice staff",
|
||||||
|
prices: [
|
||||||
|
"2200;5",
|
||||||
|
"2250;15",
|
||||||
|
"2300;25",
|
||||||
|
"2350;35",
|
||||||
|
"2400;45",
|
||||||
|
"2450;70",
|
||||||
|
"2500;100",
|
||||||
|
"2550;175",
|
||||||
|
"2600;250",
|
||||||
|
"2700;400",
|
||||||
|
"2800;500",
|
||||||
|
"2900;2000",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
regex: /\b(?:aura|trange)\b/i,
|
||||||
|
returnKeyWord: "aura/trange piece",
|
||||||
|
prices: ["980;5", "1050;15", "1100;40", "1150;70", "1200;500"],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -40,27 +91,34 @@ exports.description =
|
|||||||
":money_with_wings: Give an estimated price of certain items in cv. [WIP]";
|
":money_with_wings: Give an estimated price of certain items in cv. [WIP]";
|
||||||
exports.usage = "<<estimate [summary of item you want the price of]";
|
exports.usage = "<<estimate [summary of item you want the price of]";
|
||||||
exports.example =
|
exports.example =
|
||||||
"<<estimate 1600 monk dps\n<<estimate 1100 thp\n<<estimate 2400 app builder staff\n(please use slang(thp,tdmg,etc), do not put the slang first instead always number first\n do not include armor type, conflicting or superflous data to avoid confusion)";
|
"<<estimate 1600 ab2 (ab2 dps)\n<<estimate 1100 thp\n<<estimate 2400 app builder staff\n(please use slang(thp,tdmg,etc), do not put the slang first instead always number first\n do not include armor type, conflicting or superflous data to avoid confusion)";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = async (client, message, args) => {
|
exports.run = async (client, message, args) => {
|
||||||
|
if (!args[0]) {
|
||||||
|
let tbl = "";
|
||||||
|
priceTable.forEach((p) => {
|
||||||
|
tbl += p.returnKeyWord + "\n";
|
||||||
|
});
|
||||||
|
return message.channel
|
||||||
|
.send(`Available items in pricing table:\n\`\`\`\n${tbl}\`\`\`\nFor usage, consult \`<<help estimate\`
|
||||||
|
`);
|
||||||
|
}
|
||||||
const combined = args.join(" ");
|
const combined = args.join(" ");
|
||||||
console.log(combined);
|
console.log(combined);
|
||||||
// regex's are split for readability
|
// regex's are split for readability
|
||||||
const builderRegex =
|
const builderRegex = /\b(?:app|apprentice|tdmg|tdamage|aura|trange)\b/i;
|
||||||
/\b(?:app|apprentice|thp|summoner|summ|tdmg|tdamage|aura|trange)\b/i;
|
|
||||||
const dpsRegex = /\b(?:dps|hhp|hdmg)\b/i;
|
|
||||||
const otherRegex = /\b(?:frost rifle|mm|mischief maker|)\b/i;
|
const otherRegex = /\b(?:frost rifle|mm|mischief maker|)\b/i;
|
||||||
|
|
||||||
let entryFound = false;
|
let entryFound = false;
|
||||||
let estimatedPrice = 0;
|
let estimatedPrice = 0;
|
||||||
|
let priceDiffFromTable = 0;
|
||||||
let gameValue = 0;
|
let gameValue = 0;
|
||||||
|
let returnKeyWord = "";
|
||||||
args.forEach((arg) => {
|
args.forEach((arg) => {
|
||||||
if (!isNaN(parseInt(arg))) {
|
if (!isNaN(parseInt(arg)) && !gameValue) {
|
||||||
gameValue = parseInt(arg);
|
gameValue = parseInt(arg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(gameValue);
|
|
||||||
let returnKeyWord = "";
|
|
||||||
if (!gameValue) {
|
if (!gameValue) {
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"You didn't include any numbers in your query. Try again or consult `<<help estimate`."
|
"You didn't include any numbers in your query. Try again or consult `<<help estimate`."
|
||||||
@ -70,19 +128,21 @@ exports.run = async (client, message, args) => {
|
|||||||
if (price.regex.test(combined)) {
|
if (price.regex.test(combined)) {
|
||||||
entryFound = true;
|
entryFound = true;
|
||||||
returnKeyWord = price.returnKeyWord;
|
returnKeyWord = price.returnKeyWord;
|
||||||
estimatedPrice = findClosestPrice(
|
let closestInTable = findClosestPrice(
|
||||||
constructPriceSubTable(idx),
|
constructPriceSubTable(idx),
|
||||||
gameValue
|
gameValue
|
||||||
).val;
|
);
|
||||||
|
estimatedPrice = closestInTable.val;
|
||||||
|
priceDiffFromTable = closestInTable.diff;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (entryFound) {
|
if (entryFound) {
|
||||||
message.channel.send(
|
message.channel.send(
|
||||||
`Hmm... I estimate your ${gameValue} ${returnKeyWord} to be worth approximately ${
|
`Hmm... I estimate your **${gameValue} ${returnKeyWord}** to be worth approximately ${
|
||||||
estimatedPrice > 500
|
estimatedPrice > 499
|
||||||
? `**${estimatedPrice}** (probably auction)`
|
? `**__${estimatedPrice}__** (auction it!)`
|
||||||
: estimatedPrice
|
: `**${estimatedPrice}**`
|
||||||
} cv.\n*Take this info with a grain of salt though. Estimation is provided through looking at past trades/price checks/sheets in DDRNG. GLHF.*`
|
} cv.\n*Take this info with a grain of salt though. Estimation is provided through looking at past trades/price checks/sheets in DDRNG. GLHF.*\n*Calc diff: ${priceDiffFromTable}*.`
|
||||||
);
|
);
|
||||||
} else
|
} else
|
||||||
message.channel.send(
|
message.channel.send(
|
||||||
|
@ -6,7 +6,7 @@ function format(seconds) {
|
|||||||
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
var minutes = Math.floor((seconds % (60 * 60)) / 60);
|
||||||
var seconds = Math.floor(seconds % 60);
|
var seconds = Math.floor(seconds % 60);
|
||||||
|
|
||||||
return pad(hours) + ":" + pad(minutes) + ":" + pad(seconds);
|
return pad(hours) + "h " + pad(minutes) + "m " + pad(seconds) + "s.";
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.name = "ping";
|
exports.name = "ping";
|
||||||
@ -21,7 +21,7 @@ exports.run = async (client, message, args) => {
|
|||||||
m.createdTimestamp - message.createdTimestamp
|
m.createdTimestamp - message.createdTimestamp
|
||||||
}ms**.\nAPI Latency is **${Math.round(
|
}ms**.\nAPI Latency is **${Math.round(
|
||||||
client.ws.ping
|
client.ws.ping
|
||||||
)}ms**.\n**Client uptime is ${format(process.uptime())}**`
|
)}ms**.\nClient uptime is **${format(process.uptime())}**`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user