This commit is contained in:
2025-08-07 23:35:29 +02:00
parent 5381bed30a
commit 805fc266d5
11 changed files with 961 additions and 398 deletions

29
commands/bonus.js Normal file
View File

@ -0,0 +1,29 @@
exports.name = "bonus";
exports.description =
":star: Sums and calculates bonus for player stat numbers.";
exports.usage = "<<bonus <number> <number> [inf optional extra numbers]";
exports.example = "<<bonus 100 100";
exports.run = (client, message, args) => {
let is1nan = false;
if (!args[0])
return message.channel.send("Not enough arguments, consult <<help.");
args.forEach((arg) => {
if (isNaN(parseInt(arg))) {
is1nan = true;
}
arg = parseInt(arg);
});
if (is1nan)
return message.channel.send(
"You have provided invalid arguments to this command, please consult <<help."
);
let sum = 0;
args.forEach((arg) => {
if (arg > 2000) arg = 2000; // just dont bother for anything higher than 2000
sum += parseInt(arg);
});
sum--;
message.channel.send(
`Will reach ${sum}, ${Math.ceil(sum * 1.4)} with bonus.`
);
};

22
commands/cat.js Normal file
View File

@ -0,0 +1,22 @@
exports.name = "cat";
exports.description = ":cat: Calculates boost for cat.";
exports.usage = "<<cat <boost> <levels>";
exports.example = "<<cat 80 120";
exports.run = (client, message, args) => {
if (!args[0] || !args[1])
return message.channel.send("Not enough arguments, consult <<help.");
let boost = parseInt(args[0]);
let levels = parseInt(args[1]);
if (isNaN(boost) || isNaN(levels))
return message.channel.send(
"Boost or levels is not a number. Consult <<help."
);
let extraboost = Math.floor(levels / 3 - 3);
let players = Math.floor(levels / 29) + 1;
if (players > 4) players = 4;
message.channel.send(
`Your cat's boost should be atleast **${
boost + extraboost
}**. It will boost atleast **${players}** players.`
);
};

25
commands/cb.js Normal file
View File

@ -0,0 +1,25 @@
exports.name = "cb";
exports.description =
":crossed_swords: Calculate calamity blade damage taking in to account projectile speed.";
exports.usage = "<<cb <damage> <ups> [projectile speed]";
exports.example = "<<cb 10000 250 10000";
exports.run = (client, message, args) => {
if (!args[0] || !args[1])
return message.channel.send("Not enough arguments, consult <<help.");
let cb = parseInt(args[0]);
let ups = parseInt(args[1]);
if (isNaN(cb) || isNaN(ups))
return message.channel.send("Damage or ups should be a number.");
let initialspeed = null;
if (args[2]) {
initialspeed = parseInt(args[2]);
if (isNaN(initialspeed))
return message.channel.send("Projectile speed should be a number.");
initialspeed = 30000 - initialspeed;
let t = Math.ceil(initialspeed / 1200);
console.log(t);
ups = ups - t;
}
console.log(ups);
message.channel.send(`Should be ${cb + ups * 192}.`);
};

38
commands/help.js Normal file
View File

@ -0,0 +1,38 @@
const { EmbedBuilder } = require("discord.js");
exports.name = "help";
exports.description =
":scroll: Shows this message. (this bot is a crude imitation of tbolt's better bot :P)";
exports.usage = "<<help [optional other command]";
exports.example = "<<help res";
exports.run = (client, message, args) => {
let embed = new EmbedBuilder();
embed.setTitle("Commands Helper");
if (args[0]) {
const cmd = client.commands.get(args[0]);
if (!cmd)
return message.channel.send(
"Command not found, try `<<help` first."
);
embed.setTitle(`Help for \`${cmd.name}\` command`);
embed.setDescription(cmd.description);
embed.addFields(
{
name: "Usage",
value: cmd.usage,
},
{
name: "Example",
value: cmd.example,
}
);
} else {
client.commands.forEach((cmd) => {
embed.addFields({
name: cmd.name,
value: cmd.description,
});
});
}
embed.setColor(0x00ff00);
message.channel.send({ embeds: [embed] });
};

25
commands/ms.js Normal file
View File

@ -0,0 +1,25 @@
exports.name = "ms";
exports.description =
":tada: Calculate moon staff damage taking in to account projectile speed.";
exports.usage = "<<ms <elemental damage> <ups> [projectile speed]";
exports.example = "<<ms 10000 250 10000";
exports.run = (client, message, args) => {
if (!args[0] || !args[1])
return message.channel.send("Not enough arguments, consult <<help.");
let moonstaff = parseInt(args[0]);
let ups = parseInt(args[1]);
if (isNaN(moonstaff) || isNaN(ups))
return message.channel.send("Damage or ups should be a number.");
let initialspeed = null;
if (args[2]) {
initialspeed = parseInt(args[2]);
if (isNaN(initialspeed))
return message.channel.send("Projectile speed should be a number.");
initialspeed = 30000 - initialspeed;
let t = Math.ceil(initialspeed / 1200);
console.log(t);
ups = ups - t;
}
console.log(ups);
message.channel.send(`Should be ${moonstaff + ups * 99}.`);
};

121
commands/res.js Normal file
View File

@ -0,0 +1,121 @@
exports.name = "res";
exports.description =
":shield: Calculates how much upgrades you need to max your resistances. For Ult pieces and better. (slightly inaccurate but this is hard to calculate)";
exports.usage =
"<<res <res> <res> <res> [res] | <hero stat> <levels> [second hero stat]";
exports.example = "<<res -3 1 -16 14 | 406 440";
exports.run = (client, message, args) => {
for (let i = 0; i < args.length; i++) {
if (args[i] == "|") continue;
args[i] = parseInt(args[i]);
if (isNaN(args[i]))
message.channel.send(
"Unable to parse argument `" +
i +
1 +
"` as number, try again or report this issue."
);
}
let type;
if (args[4] == "|") type = 4;
else if (args[3] == "|") type = 3;
else return message.channel.send("Please provide 3 or 4 resistances.");
let resistances = [args[0], args[1], args[2], type == 4 ? args[3] : null];
let mainStat = type == 4 ? args[5] : args[4];
let upgrades = type == 4 ? args[6] : args[5];
let substat = type == 4 ? args[7] : args[6];
upgrades = upgrades - 1;
if (!mainStat || !upgrades)
return message.channel.send("Please provide atleast 2 stats.");
if (!substat) substat = 0;
let resUpgrades = 0;
resistances.forEach((res) => {
if (res == null) return;
if (res > 29)
return message.channel.send(
"Please provide a number less than 29 for resistances."
);
if (res < 29) {
if (res < 0) {
let underzero = Math.abs(res);
if (underzero < 13) {
resUpgrades += 23 + Math.abs(res);
} else {
if (underzero == 13 || underzero == 14) {
resUpgrades += 23 + 13;
}
if (underzero == 15 || underzero == 16) {
resUpgrades += 23 + 13 + 1;
}
if (underzero == 17 || underzero == 18) {
resUpgrades += 23 + 13 + 2;
}
if (underzero == 19 || underzero == 20 || underzero == 22) {
resUpgrades += 23 + 13 + 3;
}
if (underzero == 21 || underzero == 23) {
resUpgrades += 23 + 13 + 4;
}
if (underzero > 23) {
resUpgrades += 29 - underzero;
}
}
// from 1% to 23% takes 17-18 ups
// from 23% to 29% takes 6 ups
// from 1% to 29% takes 23 ups
// 23 + Math.abs(res)
} else {
//14 skips 15 to 16
//15 skips 16 to 17
//17 skips 18 to 19
//19 skips 20 to 21
//21 skips to 24
// list: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,18,20,23
// possible if 15,17,19,21,24
//amount of numbers: 18
// skipped 5 upgrades
//example 4
// 5,6,7,8,9,10,11,12,13,14,16,18,20,23
// count: 14
// to 29% + 6, result 20
if (res < 14) {
let am = 14 - res;
resUpgrades += am + 4 + 6;
} else {
if (res == 14) {
resUpgrades += 4 + 6;
}
if (res == 15 || res == 16) {
resUpgrades += 3 + 6;
}
if (res == 17 || res == 18) {
resUpgrades += 2 + 6;
}
if (res == 19 || res == 20 || res == 22) {
resUpgrades += 1 + 6;
}
if (res == 21 || res == 23) {
resUpgrades += 6;
}
if (res > 23) {
resUpgrades += 29 - res;
}
}
}
}
});
upgrades -= resUpgrades;
mainStat += upgrades;
let over = 0;
if (mainStat > 999) {
let over = mainStat - 999;
mainStat -= over;
substat += over;
}
message.channel.send(
`With ${resUpgrades} upgrades spent in resistances, your piece will reach ${
mainStat + substat
}, or ${Math.ceil(mainStat * 1.4 + substat * 1.4)} with set bonus!`
);
};