Compare commits
No commits in common. "1c0144b0767a34fb064109dfffafdf41cd305f10" and "ae3a1be106c6aa824eb0a82263515f960b9fc947" have entirely different histories.
1c0144b076
...
ae3a1be106
46
index.js
46
index.js
@ -101,7 +101,7 @@ const avgDiff = (arr) => {
|
||||
// FUN value: Fluctuating Unfairness Normalization value
|
||||
// PASSION: Player Ability/Skill Separation Index Offset Number
|
||||
let funInput = 4; // 1-10
|
||||
let passionInput = 1; // 1-5
|
||||
let passionInput = 2; // 1-5
|
||||
|
||||
// balance attempt counter, not modifiable
|
||||
let attempts = 0;
|
||||
@ -428,7 +428,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||
);
|
||||
}
|
||||
|
||||
const targetPlayerCount = 18;
|
||||
const targetPlayerCount = 3;
|
||||
if (pickingPlayers.length + addupPlayers.length < targetPlayerCount) {
|
||||
return await interaction.followUp(
|
||||
`Can't find enough total players, expected ${targetPlayerCount} (found ${
|
||||
@ -468,13 +468,13 @@ client.on("interactionCreate", async (interaction) => {
|
||||
}
|
||||
fkAttempts++;
|
||||
const idx = Math.floor(Math.random() * pickingPlayers.length);
|
||||
let fk = pickingPlayers[idx];
|
||||
let fk = await pickingPlayers.splice(idx, 1)[0];
|
||||
if (protectedFk.includes(fk.id)) {
|
||||
protectedStr += `${fk.id}, `;
|
||||
} else {
|
||||
pickingPlayers.splice(idx, 1);
|
||||
fatkids.push(fk);
|
||||
pickingPlayers.push(fk);
|
||||
continue;
|
||||
}
|
||||
fatkids.push(fk);
|
||||
}
|
||||
if (protectedStr.length > 0) {
|
||||
console.log(`Protected fks: ${protectedStr}`);
|
||||
@ -758,26 +758,6 @@ client.on("interactionCreate", async (interaction) => {
|
||||
bluPlayers = bluPlayers.concat(bluBalanced);
|
||||
redPlayers = redPlayers.concat(redBalanced);
|
||||
|
||||
// sort alphebetically then build string
|
||||
bluPlayers.sort((a, b) =>
|
||||
a.player.displayName.localeCompare(b.player.displayName)
|
||||
);
|
||||
redPlayers.sort((a, b) =>
|
||||
a.player.displayName.localeCompare(b.player.displayName)
|
||||
);
|
||||
|
||||
let teamStr = `${backticks}BLU:`;
|
||||
for (const player of bluPlayers) {
|
||||
teamStr += `\n${player.player.displayName}`;
|
||||
}
|
||||
teamStr += `\n\nRED:`;
|
||||
for (const player of redPlayers) {
|
||||
teamStr += `\n${player.player.displayName}`;
|
||||
}
|
||||
teamStr += backticks;
|
||||
|
||||
await interaction.followUp(teamStr);
|
||||
|
||||
let moveErr = 0;
|
||||
|
||||
// move to team voice channels
|
||||
@ -992,20 +972,14 @@ client.on("messageCreate", async (message) => {
|
||||
});
|
||||
|
||||
// build string
|
||||
let str = "";
|
||||
let str = backticks;
|
||||
const maxNameLength = Math.max(...players.map((p) => p.name.length));
|
||||
for (const { name, rank } of players) {
|
||||
str += `${name.padEnd(maxNameLength, " ")} - ${"*".repeat(rank)}\n`;
|
||||
}
|
||||
if (str === "") str = "No rankings found";
|
||||
if (str.length > 2000) {
|
||||
let chunks = str.match(/[\s\S]{1,1990}/g);
|
||||
for (let chunk of chunks) {
|
||||
await message.reply(`${backticks}${chunk}${backticks}`);
|
||||
}
|
||||
} else {
|
||||
await message.reply(`${backticks}${str}${backticks}`);
|
||||
}
|
||||
str += backticks;
|
||||
if (str === backticks + backticks) str = "No rankings found";
|
||||
await message.reply(str);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
await message.reply(`Error getting rankings: ${error.message}`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user