Skip to content

Commit

Permalink
Updated banlist and added src!dream
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-NCSU committed Sep 21, 2021
1 parent e06a4d7 commit e1b788f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions messagecommands/banlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ async function add(id, message) {
if(!player) {
return await message.reply('Player does not exist');
}
if(!player.id) {
return await message.reply('Error getting UUID');
}
const doc = {
id: player.id,
owner: message.author.id,
Expand Down
51 changes: 51 additions & 0 deletions messagecommands/dream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const { MessageEmbed } = require('discord.js');
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
data: {
name: 'dream'
},
async execute(command, message) {
let sim = parseInt(command[1]);
if(!sim) {
sim = 1;
}
if(sim > 100000) {
return await message.reply('Too many simulations (' + sim + ')');
}
let pMax = 0;
let rMax = 0;
let pTotal = 0;
let rTotal = 0;
for(let count = 0; count < sim; count++) {
let pCount = 0;
for(let i = 0; i < 263; i++) {
if(Math.random() <= (20/423)) {
pCount++;
}
}
let rCount = 0;
for(let i = 0; i < 306; i++) {
if(Math.random() * 100 <= 50) {
rCount++;
}
}
pMax = Math.max(pMax, pCount);
rMax = Math.max(rMax, rCount);
pTotal += pCount;
rTotal += rCount;
}
const difference = pMax >= 42 ? '+' + pMax - 42 : pMax - 42;
const difference2 = rMax >= 211 ? '+' + rMax - 211 : rMax - 211;
const embed = new MessageEmbed()
.setColor('118855')
.setTitle('Your Results:')
.addField('Number of simulations: ', String(sim))
.addField('Average number of pearl trades: ', String(pTotal / sim))
.addField('Average number of rods: ', String(rTotal / sim))
.addField('Max number of pearl trades: ' + pMax + '/262', 'Number of pearl trades (Dream): 42/262')
.addField('Max number of rods: ' + rMax + '/305', 'Number of rods (Dream): 211/305')
.setFooter('Difference: ' + difference + '/' + difference2)
await message.reply({ embeds: [embed] });
},
};

0 comments on commit e1b788f

Please sign in to comment.