Skip to content

Commit

Permalink
updated to v1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
hemisemidemipresent committed Sep 14, 2020
1 parent 6475c61 commit b8d40ca
Show file tree
Hide file tree
Showing 14 changed files with 462 additions and 409 deletions.
2 changes: 1 addition & 1 deletion aliases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## In Simple Terms

rml has some respectable name-coining skills, the problem is that I have no idea what any of them mean just from reading above
rml has some respectable name-coining skills

The "stack" of a command is:
Args -> converted to standardized args -> sent to `./commands`
Expand Down
4 changes: 3 additions & 1 deletion aliases/towers/magic/druid.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"xyz": ["druid", "drood", "dru"],
"500": ["superstorm", "sstorm"],
"030": ["jungle"],
"040": ["bounty"],
"050": ["spirit_of_the_forest", "spirit", "sotf"],
"003": ["druid_of_wrath", "dow"],
"004": ["poplust", "lust"],
"005": ["avatar_of_wrath", "aow"]
}
}
50 changes: 0 additions & 50 deletions commands/3tcabr-find.js

This file was deleted.

4 changes: 2 additions & 2 deletions commands/cash.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
return message.channel.send(embed);
} else if (parsed.mode == 'halfcash') {
while (cashSoFar <= cashNeeded) {
addToTotal = parseInt(r[startRound].csh);
addToTotal = parseInt(r[startRound].cashThisRound);
cashSoFar += addToTotal / 2; // only difference
addToTotal = 0;
startRound++;
Expand All @@ -75,7 +75,7 @@ module.exports = {
return message.channel.send(embed);
} else {
while (cashSoFar <= cashNeeded) {
addToTotal = parseInt(r[startRound].csh);
addToTotal = parseInt(r[startRound].cashThisRound);
cashSoFar += addToTotal;
addToTotal = 0;
startRound++;
Expand Down
29 changes: 17 additions & 12 deletions commands/chincome.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ module.exports = {
new AnyOrderParser(
new OptionalParser(
new ModeParser('CHIMPS', 'ABR', 'HALFCASH'),
"CHIMPS" // default if not provided
'CHIMPS' // default if not provided
),
new RoundParser("IMPOPPABLE")
new RoundParser('IMPOPPABLE')
)
);

if (parsed.hasErrors()) {
return module.exports.errorMessage(message, parsed.parsingErrors)
return module.exports.errorMessage(message, parsed.parsingErrors);
}

return message.channel.send(chincomeMessage(parsed.mode, parsed.round));
Expand All @@ -47,14 +47,17 @@ module.exports = {
.addField(
'`q!chincome <round> (<gamemode>)` (Order agnostic)',
' • Cash generated during round <round>\n' +
' • Cash generated from start of round 6 through end of round <round>\n' +
' • Cash generated from start of round <round> through end of round 100'
' • Cash generated from start of round 6 through end of round <round>\n' +
' • Cash generated from start of round <round> through end of round 100'
)
.addField('Valid `(<gamemode>)` values', 'CHIMPS, HALFCASH, ABR')
.addField('Valid `<round>` values', '6, 7, ..., 100')
.addField('Ex. #1', 'q!chincome <round> | q!chincome 8')
.addField('Ex. #2', 'q!chincome <mode> <round> | q!chincome abr R8')
.addField('Ex. #3', 'q!chincome <round> <mode> | q!chincome r8 halfcash')
.addField(
'Ex. #3',
'q!chincome <round> <mode> | q!chincome r8 halfcash'
);

return message.channel.send(errorEmbed);
},
Expand Down Expand Up @@ -117,9 +120,11 @@ calculateIncomes = function (mode, round) {
} else {
index = round;

chincome = chimps[index]['cch'] - chimps[5]['cch'] + 650;
rincome = chimps[index]['csh'];
lincome = chimps[100]['cch'] - chimps[index - 1]['cch'];
chincome =
chimps[index]['cumulativeCash'] - chimps[5]['cumulativeCash'] + 650;
rincome = chimps[index]['cashThisRound'];
lincome =
chimps[100]['cumulativeCash'] - chimps[index - 1]['cumulativeCash'];

if (mode == 'hc') {
chincome /= 2;
Expand All @@ -131,6 +136,6 @@ calculateIncomes = function (mode, round) {
return {
rincome: rincome.toFixed(1),
chincome: chincome.toFixed(1),
lincome: lincome.toFixed(1)
}
}
lincome: lincome.toFixed(1),
};
};
8 changes: 6 additions & 2 deletions commands/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const aliases = [
[
'gwendolin',
'g',
'gwen',
'gwendolyn',
'gwendolyn',
'scientist',
Expand Down Expand Up @@ -207,8 +208,8 @@ module.exports = {
.then((res) => res.json())
.then((json) => {
let base = json[`${name}`];
console.log(name);
let object = base.upgrades[level - 1];

if (!object) {
let errorEmbed = new Discord.MessageEmbed()
.setColor(red)
Expand All @@ -217,12 +218,14 @@ module.exports = {
);
return message.channel.send(errorEmbed);
}
let skins = base.skins.toString();
if (!skins) skins = 'none';
const embed = new Discord.MessageEmbed()
.setTitle(`${name} level ${level}`)
.addField('cost (xp)', `${object.xp}`, true)
.addField('desc', `${object.notes}`, true)
.addField('xp modifier', `${base['xp-mod']}`, true)
.addField('skins', `${base.skins.toString()}`)
.addField('skins', `${skins}`)
.setColor(cyber)
.setFooter(
'd:dmg|md:moab dmg|cd:ceram dmg|p:pierce|r:range|s:time btw attacks|j:projectile count|\nq!ap for help and elaboration'
Expand All @@ -249,6 +252,7 @@ module.exports = {
function findName(commandName) {
for (let i = 0; i < aliases.length; i++) {
let heroAliasSet = aliases[i];

for (let j = 0; j < heroAliasSet.length; j++) {
if (commandName == heroAliasSet[j]) {
return heroAliasSet[0];
Expand Down
51 changes: 36 additions & 15 deletions commands/income.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@ const r = require('../jsons/round2.json');
const abr = require('../jsons/abrincome.json');
const Discord = require('discord.js');
const { red, magenta, purple, yellow } = require('../jsons/colours.json');

const OptionalParser = require('../parser/optional-parser');
const ModeParser = require('../parser/mode-parser');
const RoundParser = require('../parser/round-parser');
module.exports = {
name: 'income',
execute(message, args) {
let parsed = CommandParser.parse(
args,
new RoundParser('ALL'),
new RoundParser('ALL'),
new OptionalParser(
new ModeParser('CHIMPS', 'ABR', 'HALFCASH'),
'CHIMPS' // default if not provided
)
);
console.log(parsed.toString());
if (parsed.hasErrors()) {
return module.exports.errorMessage(message, parsed.parsingErrors);
}
if (!args[0] || isNaN(args[0]) || args[0] < -1 || args[0] > 100) {
// error case
let errorEmbed = new Discord.MessageEmbed()
Expand All @@ -22,26 +37,15 @@ module.exports = {
return message.channel.send(errorEmbed);
} else if (!args[1] || isNaN(args[1]) || args[1] < 0 || args[1] > 100) {
// another error case
let errorEmbed = new Discord.MessageEmbed()
.setTitle('Please specify a round from 1 to 100.')
.addField(
'find the cash from round X to round Y',
'**q!income <startround> <endround>**'
)
.addField(
'other difficulties',
'**q!income <startround> <endround> <difficulty>**\n(<difficulty> includes starting cash; deflation, half cash, abr, apop is random)'
)
.setColor(red);
return message.channel.send(errorEmbed);
}

let endround = parseInt(args[1]);
if (!args[2]) {
let normalStartRound = parseInt(args[0]) - 1; // thats just how it works
let startroundObject = r[normalStartRound];
let endroundObject = r[endround];
let income = endroundObject.cch - startroundObject.cch;
let income =
endroundObject.cumulativeCash - startroundObject.cumulativeCash;
let embed = new Discord.MessageEmbed()
.setTitle(
`$${
Expand All @@ -57,7 +61,10 @@ module.exports = {
let normalStartRound = parseInt(args[0]) - 1; // thats just how it works
let startroundObject = r[normalStartRound];
let endroundObject = r[endround];
let income = (endroundObject.cch - startroundObject.cch) / 2;
let income =
(endroundObject.cumulativeCash -
startroundObject.cumulativeCash) /
2;
let embed = new Discord.MessageEmbed()
.setTitle(
`$${
Expand Down Expand Up @@ -97,4 +104,18 @@ module.exports = {
return message.channel.send(embed);
}
},
errorMessage(message, errors) {
let errorEmbed = new Discord.MessageEmbed()
.setTitle(`${errors.join('\n')}`)
.addField(
'find the cash from round X to round Y',
'**q!income <startround> <endround>**'
)
.addField(
'other difficulties',
'**q!income <startround> <endround> <difficulty>**\n(<difficulty> includes deflation, half cash, abr, apop is random)'
)
.setColor(red);
return message.channel.send(errorEmbed);
},
};
2 changes: 1 addition & 1 deletion commands/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
name: 'info',
description: 'shows info',
aliases: ['i'],
execute(message, args) {
execute(message) {
const responseTime = Math.round(Date.now() - message.createdTimestamp);
let totalSeconds = client.uptime / 1000;
const days = Math.floor(totalSeconds / 86400);
Expand Down
10 changes: 6 additions & 4 deletions commands/level.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ module.exports = {
}

if ('rewards'.startsWith(args[0])) {
if (message.guild.id !== 598768024761139240) {
if (message.guild.id == 598768024761139240) {
console.log('l');
return module.exports.rewardsMessage(message);
} else {
return module.exports.showsDiscordServer(message);
}
return module.exports.rewardsMessage(message);
}
},

Expand Down Expand Up @@ -78,14 +80,14 @@ module.exports = {
STORM_OF_ARROWS_ROLE: `<@&645629187322806272>`,

rewardsMessage(message) {
const lvlMebed = new Discord.MessageEmbed()
const rewardsEmbed = new Discord.MessageEmbed()
.setTitle(`XP Rewards`)
.addField('Level 3', module.exports.RAPID_SHOT_ROLE)
.addField('Level 10', module.exports.STORM_OF_ARROWS_ROLE)
.setColor(colours['cyber'])

.setFooter(`You only get role rewards in the bot discord server`);
return message.channel.send(lvlMebed);
return message.channel.send(rewardsEmbed);
},
showsDiscordServer(message) {
const lvlMebed = new Discord.MessageEmbed()
Expand Down
5 changes: 3 additions & 2 deletions commands/patch-notes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { colour } = require('../1/config.json');
const { green } = require('../jsons/colours.json');
module.exports = {
name: 'update',
aliases: ['patch'],
Expand All @@ -7,7 +7,8 @@ module.exports = {
.setTitle('Patch notes')
.setDescription(
'[20.0](https://redd.it/ikvjo7/)\n[19.0](https://redd.it/hnsrp6/)\n[18.0](https://redd.it/gr6c4e/)\n[17.0](https://redd.it/fwth6g/)\n[16.0](https://redd.it/fa4mcx/)\n[15.0](https://redd.it/esyowc/)\n[14.0](https://redd.it/e9y1mo/)\n[13.0](https://redd.it/dm5tw0/)\n[12.0](https://redd.it/d5np4n/)\n[11.0](https://redd.it/c8h56t/)\n[10.0](https://redd.it/bc6rpe/)\n[9.0](https://redd.it/axbviz/)\n[8.0](https://redd.it/alkymt/)\n[7.0](https://redd.it/a5nme0/)\n[6.0](https://redd.it/9yaeeu/)\n[5.0](https://redd.it/9qkili/)\n[4.0](https://redd.it/9fc83u/)\n[3.0](https://redd.it/99inwj/)\n[2.0](https://redd.it/9125va/)\n[release](https://redd.it/8qxky3/)'
);
)
.setColor(green);
message.channel.send(embed);
},
};
56 changes: 56 additions & 0 deletions commands/pop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const r = require('../jsons/round2.json');
const { red, magenta } = require('../jsons/colours.json');
const OrParser = require('../parser/or-parser');
const RoundParser = require('../parser/round-parser');
const EmptyParser = require('../parser/empty-parser');
module.exports = {
name: 'pop',
aliases: ['rbe', 'popcount', 'pops'],
execute(message, args) {
let parsed = CommandParser.parse(
args,
new RoundParser('ALL'),
new OrParser(new RoundParser('ALL'), new EmptyParser())
);
console.log(JSON.stringify(parsed));
if (parsed.hasErrors()) {
return module.exports.errorMessage(message, parsed.parsingErrors);
}
let rounds = parsed.rounds.sort();
const startround = rounds[0];
if (rounds.length == 1) {
return module.exports.oneRound(startround, message.channel);
}
let endround = rounds[1];
return module.exports.showData(startround, endround, message.channel);
},
errorMessage(message, errors) {
let errorEmbed = new Discord.MessageEmbed()
.setTitle(`${errors.join('\n')}`)
.addField(
'find the cash from round X to round Y',
'**q!income <startround> <endround>**'
)
.addField(
'other difficulties',
'**q!income <startround> <endround> <difficulty>**\n(<difficulty> includes deflation, half cash, abr, apop is random)'
)
.setColor(red);
return message.channel.send(errorEmbed);
},
oneRound(startround, channel) {
return channel.send(
`Round ${startround} has a rbe(pop count) of ${r[startround].rbe}`
);
},
showData(startround, endround, channel) {
let totalpopcount =
r[endround].cumulativeRBE - r[startround - 1].cumulativeRBE;
const dataEmbed = new Discord.MessageEmbed()
.setTitle(`<:PopIcon:755016023333404743>${totalpopcount}`)
.setDescription(`from round ${startround} to ${endround}`)
.setFooter('note: towers may count pops differently due to bugs')
.setColor(magenta);
channel.send(dataEmbed);
},
};
Loading

0 comments on commit b8d40ca

Please sign in to comment.