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