This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
const log = require("../log");
|
||||||
exports.name = "cb";
|
exports.name = "cb";
|
||||||
exports.description =
|
exports.description =
|
||||||
":crossed_swords: Calculate calamity blade damage taking in to account projectile speed.";
|
":crossed_swords: Calculate calamity blade damage taking in to account projectile speed.";
|
||||||
@ -23,9 +24,8 @@ exports.run = (client, message, args) => {
|
|||||||
return message.channel.send("Projectile speed should be a number.");
|
return message.channel.send("Projectile speed should be a number.");
|
||||||
initialspeed = 30000 - initialspeed;
|
initialspeed = 30000 - initialspeed;
|
||||||
let t = Math.ceil(initialspeed / 1200);
|
let t = Math.ceil(initialspeed / 1200);
|
||||||
console.log(t);
|
log.info(t);
|
||||||
ups = ups - t;
|
ups = ups - t;
|
||||||
}
|
}
|
||||||
console.log(ups);
|
|
||||||
message.channel.send(`Should be ${cb + ups * 192}.`);
|
message.channel.send(`Should be ${cb + ups * 192}.`);
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
const log = require("../log");
|
||||||
exports.name = "ms";
|
exports.name = "ms";
|
||||||
exports.description =
|
exports.description =
|
||||||
":tada: Calculate moon staff damage taking in to account projectile speed.";
|
":tada: Calculate moon staff damage taking in to account projectile speed.";
|
||||||
@ -23,9 +24,8 @@ exports.run = (client, message, args) => {
|
|||||||
return message.channel.send("Projectile speed should be a number.");
|
return message.channel.send("Projectile speed should be a number.");
|
||||||
initialspeed = 30000 - initialspeed;
|
initialspeed = 30000 - initialspeed;
|
||||||
let t = Math.ceil(initialspeed / 1200);
|
let t = Math.ceil(initialspeed / 1200);
|
||||||
console.log(t);
|
log.info(t);
|
||||||
ups = ups - t;
|
ups = ups - t;
|
||||||
}
|
}
|
||||||
console.log(ups);
|
|
||||||
message.channel.send(`Should be ${moonstaff + ups * 99}.`);
|
message.channel.send(`Should be ${moonstaff + ups * 99}.`);
|
||||||
};
|
};
|
||||||
|
6
index.js
6
index.js
@ -1,6 +1,6 @@
|
|||||||
const { Client, Events, GatewayIntentBits, Collection } = require("discord.js");
|
const { Client, Events, GatewayIntentBits, Collection } = require("discord.js");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const log = require("./log");
|
||||||
let cfg = {};
|
let cfg = {};
|
||||||
try {
|
try {
|
||||||
cfg = require("./config.json");
|
cfg = require("./config.json");
|
||||||
@ -28,7 +28,7 @@ fs.readdir("./commands/", (err, files) => {
|
|||||||
if (!file.endsWith(".js")) return;
|
if (!file.endsWith(".js")) return;
|
||||||
let props = require(`./commands/${file}`);
|
let props = require(`./commands/${file}`);
|
||||||
let commandName = file.split(".")[0];
|
let commandName = file.split(".")[0];
|
||||||
console.log("Loaded command " + commandName);
|
log.info("Loaded command " + commandName);
|
||||||
client.commands.set(commandName, props);
|
client.commands.set(commandName, props);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -47,7 +47,7 @@ client.once(Events.ClientReady, async (readyClient) => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("copyparty is offline, wont work.");
|
console.warn("copyparty is offline, wont work.");
|
||||||
}
|
}
|
||||||
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
log.info(`Ready! Logged in as ${readyClient.user.tag}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on(Events.MessageCreate, async (message) => {
|
client.on(Events.MessageCreate, async (message) => {
|
||||||
|
14
log.js
Normal file
14
log.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// logger.js
|
||||||
|
function log(level, message, ...args) {
|
||||||
|
const now = new Date().toISOString();
|
||||||
|
const levelLabel = `[${level.toUpperCase()}]`.padEnd(8);
|
||||||
|
|
||||||
|
log.info(`${now} ${levelLabel} ${message}`, ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
info: (msg, ...args) => log("info", msg, ...args),
|
||||||
|
warn: (msg, ...args) => log("warn", msg, ...args),
|
||||||
|
error: (msg, ...args) => log("error", msg, ...args),
|
||||||
|
debug: (msg, ...args) => log("debug", msg, ...args),
|
||||||
|
};
|
302
old.js
302
old.js
@ -1,302 +0,0 @@
|
|||||||
const {
|
|
||||||
Client,
|
|
||||||
Events,
|
|
||||||
GatewayIntentBits,
|
|
||||||
EmbedBuilder,
|
|
||||||
} = require("discord.js");
|
|
||||||
let cfg = require("./config.json");
|
|
||||||
const token = process.env.TOKEN || cfg.TOKEN;
|
|
||||||
const prefix = process.env.PREFIX || cfg.PREFIX;
|
|
||||||
const client = new Client({
|
|
||||||
intents: [
|
|
||||||
GatewayIntentBits.Guilds,
|
|
||||||
GatewayIntentBits.GuildMessages,
|
|
||||||
GatewayIntentBits.MessageContent,
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
client.once(Events.ClientReady, (readyClient) => {
|
|
||||||
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
client.on(Events.MessageCreate, (message) => {
|
|
||||||
if (message.author.bot) return;
|
|
||||||
if (message.content.indexOf(prefix) !== 0) return;
|
|
||||||
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
|
||||||
const command = args.shift().toLowerCase();
|
|
||||||
if (command == "ev") {
|
|
||||||
return message.channel.send("not implemented.");
|
|
||||||
if (!args[0] || !args[1])
|
|
||||||
return message.channel.send(
|
|
||||||
"Not enough arguments, consult CLIENT_PREFIX:help."
|
|
||||||
);
|
|
||||||
let ab1 = parseInt(args[0]);
|
|
||||||
let ab2 = parseInt(args[1]);
|
|
||||||
let ab1ratio = 1.063;
|
|
||||||
let ab2ratio = 0.937;
|
|
||||||
message.channel.send(
|
|
||||||
`Aiming for ${ab1 * ab1ratio} and ${ab2 * ab2ratio}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (command == "lt") {
|
|
||||||
return message.channel.send("not implemented.");
|
|
||||||
if (!args[0] || !args[1])
|
|
||||||
return message.channel.send(
|
|
||||||
"Not enough arguments, consult CLIENT_PREFIX:help."
|
|
||||||
);
|
|
||||||
let ab1 = parseInt(args[0]);
|
|
||||||
let ab2 = parseInt(args[1]);
|
|
||||||
let ab1ratio = 1.101;
|
|
||||||
let ab2ratio = 0.899;
|
|
||||||
message.channel.send(
|
|
||||||
`Aiming for ${ab1 * ab1ratio} and ${ab2 * ab2ratio}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (command == "cb") {
|
|
||||||
}
|
|
||||||
if (command == "ms") {
|
|
||||||
if (!args[0] || !args[1])
|
|
||||||
return message.channel.send(
|
|
||||||
"Not enough arguments, consult CLIENT_PREFIX:help."
|
|
||||||
);
|
|
||||||
let cb = parseInt(args[0]);
|
|
||||||
let ups = parseInt(args[1]);
|
|
||||||
let initialspeed = null;
|
|
||||||
if (args[2]) {
|
|
||||||
initialspeed = parseInt(args[2]);
|
|
||||||
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 * 99}.`);
|
|
||||||
}
|
|
||||||
if (command == "res") {
|
|
||||||
for (let i = 0; i < args.length; i++) {
|
|
||||||
if (args[i] == "|") continue;
|
|
||||||
args[i] = parseInt(args[i]);
|
|
||||||
}
|
|
||||||
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 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 between 0 and 29. LMAO"
|
|
||||||
);
|
|
||||||
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)
|
|
||||||
console.log(
|
|
||||||
"gotta spend " +
|
|
||||||
(23 + Math.abs(res)) +
|
|
||||||
" upgrades to max res for negative"
|
|
||||||
);
|
|
||||||
} 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;
|
|
||||||
console.log(
|
|
||||||
"gotta spend " +
|
|
||||||
(am + 4 + 6) +
|
|
||||||
" upgrades to max res for positive, am: " +
|
|
||||||
am
|
|
||||||
);
|
|
||||||
} 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;
|
|
||||||
}
|
|
||||||
console.log(
|
|
||||||
"gotta spend " +
|
|
||||||
resUpgrades +
|
|
||||||
" upgrades to max res for positive, res: " +
|
|
||||||
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!`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (command == "cat") {
|
|
||||||
if (!args[0] || !args[1])
|
|
||||||
return message.channel.send(
|
|
||||||
"Not enough arguments, consult CLIENT_PREFIX:help."
|
|
||||||
);
|
|
||||||
let boost = parseInt(args[0]);
|
|
||||||
let levels = parseInt(args[1]);
|
|
||||||
let extraboost = Math.floor(levels / 3 - 3);
|
|
||||||
let players = Math.floor(levels / 29) + 1;
|
|
||||||
if (players > 4) players = 4;
|
|
||||||
message.channel.send(
|
|
||||||
`Should be atleast ${
|
|
||||||
boost + extraboost
|
|
||||||
}. Will boost atleast ${players} players.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (command == "bident") {
|
|
||||||
if (!args[0] || !args[1])
|
|
||||||
return message.channel.send(
|
|
||||||
"Not enough arguments, consult CLIENT_PREFIX:help."
|
|
||||||
);
|
|
||||||
let damage = parseInt(args[0]);
|
|
||||||
let ups = parseInt(args[1]);
|
|
||||||
let initialcharge = null;
|
|
||||||
let initialspeed = null;
|
|
||||||
if (args[2]) {
|
|
||||||
initialspeed = parseInt(args[2]);
|
|
||||||
initialspeed = 30000 - initialspeed;
|
|
||||||
let t = Math.ceil(initialspeed / 1200);
|
|
||||||
console.log(t);
|
|
||||||
ups = ups - t;
|
|
||||||
}
|
|
||||||
if (args[3]) {
|
|
||||||
initialcharge = parseInt(args[3]);
|
|
||||||
initialcharge = 128 - initialcharge;
|
|
||||||
let t = Math.ceil(initialcharge / 4);
|
|
||||||
console.log(t);
|
|
||||||
ups = ups - t;
|
|
||||||
}
|
|
||||||
message.channel.send(`Should be ${damage + ups * 144}.`);
|
|
||||||
}
|
|
||||||
if (command == "cdrag") {
|
|
||||||
if (!args[0] || !args[1] || !args[2])
|
|
||||||
return message.channel.send(
|
|
||||||
"Not enough arguments, consult CLIENT_PREFIX:help."
|
|
||||||
);
|
|
||||||
let damage = parseInt(args[0]);
|
|
||||||
let upgrades = parseInt(args[1]);
|
|
||||||
let additional = parseInt(args[2]);
|
|
||||||
if (additional < 3) upgrades = upgrades - (3 - additional);
|
|
||||||
message.channel.send(
|
|
||||||
`Should be ${
|
|
||||||
damage + upgrades * 112
|
|
||||||
} damage with maxed additional projectiles.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (command == "help") {
|
|
||||||
let embed = new EmbedBuilder();
|
|
||||||
embed.setTitle("Commands");
|
|
||||||
if (prefix == "?")
|
|
||||||
embed.setDescription("**development build, subject to change**");
|
|
||||||
embed.addFields(
|
|
||||||
{
|
|
||||||
name: "cat",
|
|
||||||
value: ":cat: Calculates boost for cat. (CLIENT_PREFIX:cat <boost> <levels>)",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "cdrag",
|
|
||||||
value: ":dragon: Calculate damage for crystaline dragon taking into account upgrades and additional projectiles. (CLIENT_PREFIX:cdrag <base> <ups> <extra projectiles>)",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "cb",
|
|
||||||
value: ":crossed_swords: Calculate calamity blade damage taking in to account speed. (CLIENT_PREFIX:cb <damage> <ups> [proj speed])",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "bident",
|
|
||||||
value: ":trident: Calculate bident damage taking in to account speed and charge speed. (CLIENT_PREFIX:bident <damage> <ups> [proj speed] [charge speed])",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "ms",
|
|
||||||
value: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "help",
|
|
||||||
value: ":scroll: Shows this message. (bot is a tbot replacement for this server :P)",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
embed.setColor(0x00ff00);
|
|
||||||
message.channel.send({ embeds: [embed] });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Log in to Discord with your client's token
|
|
||||||
client.login(token);
|
|
Reference in New Issue
Block a user