├── .env.example ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.md │ └── FEATURE_REQUEST.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── test.yml ├── .gitignore ├── .npmrc ├── LICENSE ├── README.md ├── RPGBot.js ├── commands ├── clash │ ├── clash.js │ ├── clashdeposit.js │ ├── clashhistory.js │ ├── clashinvite.js │ ├── clashkick.js │ └── createclash.js ├── other │ ├── blackjack.js │ ├── characterinfo.js │ ├── help.js │ ├── leaderboard.js │ ├── resetdb.js │ ├── resetuser.js │ └── trivia.js ├── profile │ ├── balance.js │ ├── equip-pet.js │ ├── equip.js │ ├── equipspell.js │ ├── inventory.js │ ├── items.js │ ├── level.js │ ├── pets.js │ ├── profile.js │ ├── sell.js │ ├── unequip.js │ ├── upgrade.js │ ├── use.js │ └── workers.js └── roleplay │ ├── adventure.js │ ├── alchemist-buy.js │ ├── alchemist.js │ ├── battle.js │ ├── bossbattle.js │ ├── buy-worker.js │ ├── buy.js │ ├── collect.js │ ├── marketplace-search.js │ ├── marketplace.js │ ├── open.js │ ├── petbuy.js │ ├── petshop.js │ └── start.js ├── json ├── alchemist.json ├── bosses.json ├── crates.json ├── mobs10.json ├── mobs16.json ├── mobs5.json ├── pets.json ├── trivias.json ├── weapon10.json ├── weapon16.json └── weapon5.json ├── package.json └── util └── jack.js /.env.example: -------------------------------------------------------------------------------- 1 | # Bot-related Information: 2 | RPGBOT_TOKEN= 3 | RPGBOT_PREFIX=! 4 | OWNER_ID= 5 | 6 | # Channel IDs: 7 | BATTLE_CHANNEL= -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Text Files 2 | *.js text eol=lf 3 | *.json text eol=lf 4 | *.md text eol=lf 5 | *.yml text eol=lf 6 | 7 | # Configs and Stuff 8 | .gitattributes text eol=lf 9 | .gitignore text eol=lf 10 | .npmrc text eol=lf 11 | .env.example text eol=lf 12 | 13 | # Asset Files 14 | *.jpg binary 15 | *.png binary 16 | *.mp3 binary 17 | *.ttf binary 18 | *.otf binary -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report incorrect or unexpected behaviour 4 | --- 5 | 6 | **Please describe the problem you are having in as much detail as possible:** 7 | 8 | 9 | **Further details:** 10 | - Version: 11 | - Priority this issue should have – please be realistic and elaborate if possible: 12 | 13 | - [ ] I found this issue while self-hosting the bot. 14 | - Node.js version: 15 | - Commit hash: 16 | - Operating system: 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Request a feature 4 | --- 5 | 6 | **Is your feature request related to a problem? Please describe.** 7 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 8 | 9 | **Describe the ideal solution** 10 | A clear and concise description of what you want to happen. 11 | 12 | **Describe alternatives you've considered** 13 | A clear and concise description of any alternative solutions or features you've considered. 14 | 15 | **Additional context** 16 | Add any other context or screenshots about the feature request here. 17 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Please describe the changes this PR makes and why it should be merged:** 2 | 3 | 4 | **Semantic versioning classification:** 5 | - This PR changes the code in some way 6 | - [ ] SEMVER patch (bug fix) 7 | - [ ] SEMVER minor (commands or args added) 8 | - [ ] SEMVER major (commands removed or renamed, args moved or removed) 9 | - [ ] This PR **only** includes non-code changes, like changes to the README. 10 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | on: [push, pull_request] 3 | jobs: 4 | lint: 5 | name: ESLint 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Checkout repository 9 | uses: actions/checkout@v2 10 | 11 | - name: Install Node v14 12 | uses: actions/setup-node@v1 13 | with: 14 | node-version: 14 15 | 16 | - name: Install ESLint v7 17 | run: npm install -g eslint@7 18 | 19 | - name: Install ESLint Configs and Plugins 20 | run: npm install eslint-config-amber eslint-plugin-json 21 | 22 | - name: Run ESLint 23 | run: npm test 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency Files 2 | node_modules/ 3 | package-lock.json 4 | 5 | # Log Files 6 | logs/ 7 | *.log 8 | 9 | # Config Files 10 | .env 11 | 12 | # In-Development Commands (If any, put them here) 13 | .DS_Store 14 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Shin#0484 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rpgbot 2 | A RPG Discord bot, using Discord.js and Discord.js-commando command framework. It has multiple commands, but isn't fully done yet. 3 | 4 | ## Filling out the .env file 5 | *Note: Remove .example, when you're done!* 6 | 7 | ### Bot-related Information: 8 | * `RPGBOT_TOKEN=` is the token of the bot. You can get yours [here](https://discord.com/developers/applications/). 9 | * `RPGBOT_PREFIX=` is the prefix of the bot. It can be changed to anything you want. Default is ! 10 | * `OWNER_ID=` the owner of the bot. As example, your ID. 11 | 12 | ### Channel IDs: 13 | `BATTLE_CHANNEL=` is a channel ID for a battle channel, where users can battle against eachother. This is most likely set to a own channel, to avoid any spam. 14 | 15 | ## License 16 | For more information see `LICENSE`. 17 | -------------------------------------------------------------------------------- /RPGBot.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | require("dotenv").config(); 4 | const { RPGBOT_TOKEN, RPGBOT_PREFIX, OWNER_ID } = process.env; 5 | const { CommandoClient } = require('discord.js-commando'); 6 | const { RichEmbed } = require('discord.js'); 7 | const path = require('path'); 8 | const Enmap = require('enmap'); 9 | const client = new CommandoClient({ 10 | commandPrefix: RPGBOT_PREFIX, 11 | unknownCommandResponse: false, 12 | owner: OWNER_ID, 13 | disableEveryone: true 14 | }); 15 | 16 | // Client Settings 17 | client.equip = new Enmap({name:"equip"}) 18 | client.boosters = new Enmap({name:"boosters"}) 19 | client.profile = new Enmap({name:"profile"}) 20 | client.clash = new Enmap({name:"guild"}) 21 | client.util = new Enmap({name:"util"}) 22 | client.marketplace = new Enmap({name:"marketplace"}) 23 | client.adventure = new Enmap({name:"adventure"}) 24 | client.registry 25 | .registerDefaultTypes() 26 | .registerGroups([ 27 | ['roleplay', 'Roleplay'], 28 | ['other', 'Other'], 29 | ['profile', 'Profile'], 30 | ['clash', 'Clash'] 31 | ]) 32 | .registerDefaultGroups() 33 | .registerDefaultCommands({help: false}) 34 | .registerCommandsIn(path.join(__dirname, 'commands')); 35 | 36 | // Client Events 37 | client.on('ready', () => { 38 | console.log('Up and running!'); 39 | client.user.setActivity('!help'); 40 | }); 41 | 42 | client.on('message', msg => { 43 | if (msg.author.bot) return; 44 | client.boosters.ensure(msg.author.id, { 45 | xp: "disabled", 46 | xptime: "no", 47 | }) 48 | 49 | client.profile.ensure(`${msg.author.id}`, { 50 | orbs: 0, 51 | weapons: [], 52 | id: msg.author.id, 53 | items: [], 54 | level: 1, 55 | lastCollected: "no", 56 | pets: [], 57 | character: "none", 58 | workers: [], 59 | levelpoints: 0, 60 | damage: 0, 61 | started: "no", 62 | elo: 100, 63 | health: 0, 64 | }) 65 | 66 | client.equip.ensure(msg.author.id, { 67 | boots: [], 68 | necklace: [], 69 | sword: [], 70 | bow: [], 71 | helmet: [], 72 | shield: [], 73 | leggings: [], 74 | staff: [], 75 | chestplate: [], 76 | pet: [], 77 | spell: [], 78 | }) 79 | 80 | client.util.ensure(client.user.id, { 81 | guildnames: [], 82 | weaponids: 1, 83 | }) 84 | 85 | client.clash.ensure(`${msg.author.id}`, { 86 | name: "none", 87 | members: 0, 88 | id: "none", 89 | role: 'none', 90 | deposits: [], 91 | orbs: 0, 92 | storage: [], 93 | memberids: [], 94 | }) 95 | 96 | const curLevel = Math.floor(0.1 * Math.sqrt(client.profile.get(`${msg.author.id}`, "levelpoints"))); 97 | 98 | if (client.profile.get(`${msg.author.id}`, "level") < curLevel) { 99 | let money = curLevel * 50 / 0.50 100 | let embed = new RichEmbed() 101 | .setAuthor(`🆙`, msg.author.displayAvatarURL) 102 | .setDescription(`Congrats, you've leveled up to level **${curLevel}**!\nReward: **${money} 🔮**`) 103 | .setColor("RANDOM") 104 | msg.channel.send(embed) 105 | 106 | client.profile.math(msg.author.id, "+", money, "orbs") 107 | client.profile.set(`${msg.author.id}`, curLevel, "level"); 108 | } 109 | }) 110 | 111 | /* 112 | client.on('guildCreate', guild => { 113 | }) 114 | */ 115 | 116 | client.login(RPGBOT_TOKEN); -------------------------------------------------------------------------------- /commands/clash/clash.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | 6 | module.exports = class ClashCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'clash', 10 | group: 'clash', 11 | memberName: 'clash', 12 | description: 'Shows your clash stats.', 13 | examples: ['clash'], 14 | }); 15 | } 16 | 17 | run(msg) { 18 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 19 | 20 | let get = this.client.clash.get(`${msg.author.id}`, "id") 21 | if (get == "none") return msg.say('You are not a part of a clash.') 22 | let info = this.client.clash.get(`${get}`) 23 | console.log(get) 24 | 25 | let embed = new RichEmbed() 26 | .setTitle(`${info.name} 🏆`) 27 | .setColor("RANDOM") 28 | .addField('Clash Member Count 💹', info.members,true) 29 | .addField('Members 👱',`${info.memberids.length > 10 ? "Too many members, can't be displayed. use `!guildmembers`." : info.memberids.map(id => this.client.users.get(id).tag + ' - ' + this.client.clash.get(`${id}`, "role") + ' - Level: **' + this.client.profile.get(`${id}`, "level") + '**' + `(${this.client.profile.get(id, "character").class})`).join("\n")}`,true) 30 | .addField('Guild Balance 🏦', `**${info.orbs}** 🔮`) 31 | msg.embed(embed) 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /commands/clash/clashdeposit.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class ClashDepositCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'clash-deposit', 9 | group: 'clash', 10 | aliases: ["cdep", "cdeposit", "clashdep", "clashdeposit"], 11 | memberName: 'clash-deposit', 12 | description: 'Deposit orbs into your clash balance.', 13 | examples: ['clash-deposit'], 14 | throttling: { 15 | usages: 1, 16 | duration: 10, 17 | }, 18 | args: [ 19 | { 20 | type:"integer", 21 | key:"amount", 22 | prompt:"How much would you like to deposit?", 23 | } 24 | ] 25 | }); 26 | } 27 | 28 | run(msg, { amount }) { 29 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 30 | 31 | if(msg.content.includes('-')) return msg.say('Negative values can not be deposited.') 32 | if (this.client.clash.get(`${msg.author.id}`, "id") == "none") return msg.say(`${msg.author}, you are not in a clash.`) 33 | if (this.client.profile.get(`${msg.author.id}`, "orbs") < amount) return msg.say(`${msg.author}, you are trying to deposit more orbs than you've got.`) 34 | 35 | let id = this.client.clash.get(`${msg.author.id}`, "id") 36 | 37 | this.client.clash.math(`${id}`, "+", amount, "orbs") 38 | this.client.profile.math(`${msg.author.id}`, "-", amount, "orbs") 39 | this.client.clash.push(`${id}`, { depositer: msg.author.tag, deposited: amount, time: Date.now() }, "deposits") 40 | msg.say(`${msg.author}, you successfully deposited **${amount}** 🔮 to your clash.`) 41 | } 42 | }; -------------------------------------------------------------------------------- /commands/clash/clashhistory.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | const { util } = require('discord.js-commando') 6 | const moment = require('moment') 7 | 8 | module.exports = class ClashHistoryCommand extends Command { 9 | constructor(client) { 10 | super(client, { 11 | name: 'clashhistory', 12 | group: 'clash', 13 | memberName: 'clashhistory', 14 | description: 'Shows recent activites in your clash.', 15 | examples: ['clashhistory'], 16 | args: [ 17 | { 18 | key:"page", 19 | type:"integer", 20 | prompt:"Which page would you like to view?", 21 | default: 1 22 | } 23 | ] 24 | }); 25 | } 26 | 27 | run(msg, { page }) { 28 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 29 | 30 | if (this.client.clash.get(`${msg.author.id}`, "role") != "King") return msg.say('You have to be the King of this clash to view history.') 31 | if (msg.content.includes('--clear')) { 32 | msg.say('Successfully cleared your clash history!') 33 | let array = this.client.clash.get(`${msg.author.id}`, "deposits") 34 | array.forEach(thing => { 35 | this.client.clash.remove(`${msg.author.id}`, thing, "deposits") 36 | }) 37 | return; 38 | } 39 | 40 | let arr = this.client.clash.get(`${msg.author.id}`, "id") 41 | if (this.client.clash.get(`${msg.author.id}`, "role") != "King") return msg.say('You have to be the King of this clash to view history.') 42 | if (arr == "none") return msg.say('You do not own a clash.') 43 | let array = this.client.clash.get(`${arr}`, "deposits") 44 | const paginated = util.paginate(array, page, Math.floor(20)); 45 | console.log(paginated) 46 | 47 | let data = paginated.items 48 | let embed = new RichEmbed() 49 | .setTitle(`${this.client.clash.get(`${arr}`, "name")} Clash History | Page ${paginated.page}`) 50 | .setDescription(`${data.map(mem => `**${mem.depositer}** => $${mem.deposited} => ***${moment(mem.time).format('LLLL')}***`).join('\n')}`) 51 | .setColor("RANDOM") 52 | .setFooter(`!clashhistory `) 53 | msg.embed(embed) 54 | } 55 | }; -------------------------------------------------------------------------------- /commands/clash/clashinvite.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js'); 5 | 6 | module.exports = class ClashInviteCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'clashinvite', 10 | group: 'clash', 11 | memberName: 'clashinvite', 12 | description: 'Invite people to ur clash.', 13 | examples: ['clashinvite '], 14 | args: [ 15 | { 16 | type:"user", 17 | prompt:"Which user would you like to invite?", 18 | key:"user" 19 | } 20 | ] 21 | }); 22 | } 23 | 24 | async run(msg, { user }) { 25 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 26 | 27 | this.client.clash.ensure(`${user.id}`, { 28 | name: "none", 29 | members: 0, 30 | id: "none", 31 | role: 'none', 32 | memberids: [], 33 | }) 34 | 35 | if (this.client.clash.get(`${msg.author.id}`, "role") != "King") { 36 | return msg.say(`You're not the King of your clash, only kings may invite people.`) 37 | } 38 | 39 | if (this.client.clash.get(`${user.id}`, "id") == this.client.clash.get(`${msg.author.id}`, "id")) { 40 | return msg.say(`**${user.tag}** is already with your clash! To kick him, use \`!kick ${user.tag}\``) 41 | } 42 | 43 | if (this.client.clash.get(`${user.id}`, "id") != "none") { 44 | return msg.say(`**${user.tag}** is already with another clash! Tell him to leave before joining yours.`) 45 | } 46 | 47 | let embed = new RichEmbed() 48 | .setTitle(`Invited to Clash`) 49 | .setDescription(`${user.tag} respond to this message with **yes** or **no**.`) 50 | .setColor("RANDOM") 51 | msg.embed(embed) 52 | 53 | const msgs = await msg.channel.awaitMessages(res => res.author.id === user.id, { 54 | max: 1, 55 | time: 30000 56 | }); 57 | 58 | if (!msgs.size) return msg.say(`30 seconds passed, **${user.tag}** did not respond with yes or no.`); 59 | if (msgs.first().content !== "yes") return msg.reply(`**${user.tag}** has declined your invitation.`); 60 | if (msgs.first().content == "yes") { 61 | msg.say(`**${user.tag}** has successfully joined the clash ${this.client.clash.get(`${msg.author.id}`, "name")}!`) 62 | 63 | this.client.clash.set(`${user.id}`, msg.author.id, "id") 64 | this.client.clash.push(`${msg.author.id}`, user.id, "memberids") 65 | this.client.clash.set(`${user.id}`, "Member", "role") 66 | this.client.clash.set(`${user.id}`, this.client.clash.get(`${msg.author.id}`, "name"), "name") 67 | this.client.clash.math(`${msg.author.id}`, "+", 1, "members") 68 | } 69 | } 70 | }; -------------------------------------------------------------------------------- /commands/clash/clashkick.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class ClashKickCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'clashkick', 9 | group: 'clash', 10 | memberName: 'clashkick', 11 | description: 'Kick a member of your clash.', 12 | examples: ['clashkick'], 13 | args: [ 14 | { 15 | key:"user", 16 | prompt:"Which user would you like to kick, mention or give me the ID of the user.", 17 | type:"user" 18 | } 19 | ] 20 | }); 21 | } 22 | 23 | async run(msg, { user }) { 24 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 25 | 26 | 27 | if (this.client.clash.get(`${user.id}`, "id") == "none") { 28 | return msg.say(msg.author.tag + ', Either you are not the king of this clash, or this user is not in your clash.') 29 | } 30 | 31 | if (this.client.clash.get(`${user.id}`, "id") != `${msg.author.id}`) { 32 | return msg.say(msg.author.tag + ', Either you are not the king of this clash, or this user is not in your clash.') 33 | } 34 | 35 | if (this.client.clash.get(`${msg.author.id}`, "role") != "King") { 36 | return msg.say(msg.author.tag + ', Either you are not the king of this clash, or this user is not in your clash.') 37 | } 38 | 39 | msg.say('Are you sure about kicking **' + user.tag + '**? respond with `yes` or `no`') 40 | const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, { 41 | max: 1, 42 | time: 30000 43 | }); 44 | 45 | if (!msgs.size) return msg.say(`30 seconds passed, **${msg.author.tag}** did not respond with yes or no.`); 46 | if (msgs.first().content !== "yes") return msg.say(`${msg.author} \👍`); 47 | msg.say(`${user.tag} was kicked from the **${this.client.clash.get(`${msg.author.id}`, "name")}** clash.`) 48 | this.client.clash.delete(`${user.id}`) 49 | this.client.clash.remove(`${msg.author.id}`, `${user.id}`, "memberids") 50 | this.client.clash.math(`${msg.author.id}`, "-", 1, "members") 51 | } 52 | }; -------------------------------------------------------------------------------- /commands/clash/createclash.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class CreateClashCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'createclash', 9 | group: 'clash', 10 | aliases: ["makeclash", "create-clash", "clashcreate", "clash-create"], 11 | memberName: 'createclash', 12 | description: 'Creates your clash, which you can invite people too for boosts.', 13 | examples: ['createclash'], 14 | args: [ 15 | { 16 | key:"guildname", 17 | prompt:"What should the name of your clash be?", 18 | type:"string", 19 | validate: guildname => { 20 | if (guildname.length < 60) return true; 21 | return 'Clash name can not exceed more than 60 characters.' 22 | } 23 | } 24 | ] 25 | }); 26 | } 27 | 28 | run(msg, { guildname }) { 29 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 30 | 31 | let arr = this.client.util.get(this.client.user.id, "guildnames") 32 | if (arr.includes(guildname)) return msg.say(`The clash name **` + guildname + '** has already been taken!') 33 | if (this.client.profile.get(`${msg.author.id}`, "level") < 5) { 34 | return msg.channel.send({embed: { 35 | color: 0xff0000, 36 | description: "You have to reach level `5` before you can create a clash." 37 | } 38 | }) 39 | } 40 | 41 | if (this.client.clash.get(`${msg.author.id}`, "id") != "none") { 42 | return msg.channel.send({embed: { 43 | color: 0xff0000, 44 | description: "You're already in a clash, leave it before you can create a new one.." 45 | } 46 | }) 47 | } 48 | 49 | if (this.client.profile.get(`${msg.author.id}`, "orbs") < 10000) { 50 | return msg.channel.send({embed: { 51 | color: 0xff0000, 52 | description: "You need atleast `10000` orbs to create a clash." 53 | } 54 | }) 55 | } 56 | 57 | this.client.clash.ensure(`${msg.author.id}`, { 58 | name: "none", 59 | members: 0, 60 | id: msg.author.id, 61 | role: 'none', 62 | memberids: [], 63 | }) 64 | 65 | this.client.clash.set(`${msg.author.id}`, msg.author.id, "id") 66 | this.client.clash.push(`${msg.author.id}`, msg.author.id, "memberids") 67 | this.client.clash.set(`${msg.author.id}`, "King", "role") 68 | this.client.clash.set(`${msg.author.id}`, guildname, "name") 69 | this.client.clash.math(`${msg.author.id}`, "+", 1, "members") 70 | this.client.profile.math(`${msg.author.id}`, "-", 10000, "orbs") 71 | this.client.util.push(this.client.user.id, guildname, "guildnames") 72 | 73 | return msg.say('Successfully created your clash! Check it with **!clash**.') 74 | } 75 | }; -------------------------------------------------------------------------------- /commands/other/blackjack.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { stripIndents } = require('common-tags'); 5 | const { shuffle, verify } = require('../../util/jack'); 6 | const suits = ['♣', '♥', '♦', '♠']; 7 | const faces = ['Jack', 'Queen', 'King']; 8 | 9 | module.exports = class BlackjackCommand extends Command { 10 | constructor(client) { 11 | super(client, { 12 | name: 'blackjack', 13 | group: 'other', 14 | memberName: 'blackjack', 15 | description: 'Play a game of blackjack.', 16 | args: [ 17 | { 18 | type:"integer", 19 | key:"bet", 20 | prompt:"How much would you like to bet?" 21 | } 22 | ] 23 | }); 24 | 25 | this.decks = new Map(); 26 | } 27 | 28 | async run(msg, { bet }) { 29 | 30 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 31 | if (msg.content.includes('-')) return msg.say('Negative values may not be used.') 32 | let deckCount = 1 33 | const money = bet * 2 34 | if (this.decks.has(msg.channel.id)) return msg.reply('One game per channel, to prevent spam.'); 35 | try { 36 | this.decks.set(msg.channel.id, this.generateDeck(deckCount)); 37 | const dealerHand = []; 38 | this.draw(msg.channel, dealerHand); 39 | this.draw(msg.channel, dealerHand); 40 | const playerHand = []; 41 | this.draw(msg.channel, playerHand); 42 | this.draw(msg.channel, playerHand); 43 | const dealerInitialTotal = this.calculate(dealerHand); 44 | const playerInitialTotal = this.calculate(playerHand); 45 | if (dealerInitialTotal === 21 && playerInitialTotal === 21) { 46 | this.decks.delete(msg.channel.id); 47 | return msg.say('Both of you hit 21! Nobody wins.'); 48 | } else if (dealerInitialTotal === 21) { 49 | this.decks.delete(msg.channel.id); 50 | msg.say('Dealer hit blackjack right away, good game 🃏\nLost: **' + bet + ' 🔮**'); 51 | this.client.profile.math(msg.author.id, "-", bet, "orbs") 52 | return; 53 | } else if (playerInitialTotal === 21) { 54 | this.decks.delete(msg.channel.id); 55 | msg.say('You hit blackjack right away, good game 🃏\nWin: **' + money + ' 🔮**'); 56 | this.client.profile.math(msg.author.id, "+", money, "orbs") 57 | return; 58 | } 59 | let playerTurn = true; 60 | let win = false; 61 | let reason; 62 | while (!win) { 63 | if (playerTurn) { 64 | await msg.say(stripIndents` 65 | **First Dealer Card:** ${dealerHand[0].display} 66 | **You (${this.calculate(playerHand)}):** 67 | ${playerHand.map(card => card.display).join('\n')} 68 | _Hit?_ 69 | `); 70 | const hit = await verify(msg.channel, msg.author); 71 | if (hit) { 72 | const card = this.draw(msg.channel, playerHand); 73 | const total = this.calculate(playerHand); 74 | if (total > 21) { 75 | reason = `You drew ${card.display}, total of ${total}! Bust`; 76 | break; 77 | } else if (total === 21) { 78 | reason = `You drew ${card.display} and hit 21`; 79 | win = true; 80 | } 81 | } else { 82 | const dealerTotal = this.calculate(dealerHand); 83 | await msg.say(`Second dealer card is ${dealerHand[1].display}, total of ${dealerTotal}.`); 84 | playerTurn = false; 85 | } 86 | } else { 87 | const inital = this.calculate(dealerHand); 88 | let card; 89 | if (inital < 17) card = this.draw(msg.channel, dealerHand); 90 | const total = this.calculate(dealerHand); 91 | if (total > 21) { 92 | reason = `Dealer drew ${card.display}, total of ${total}! Dealer bust`; 93 | win = true; 94 | } else if (total >= 17) { 95 | const playerTotal = this.calculate(playerHand); 96 | if (total === playerTotal) { 97 | reason = `${card ? `Dealer drew ${card.display}, making it ` : ''}${playerTotal}-${total}`; 98 | break; 99 | } else if (total > playerTotal) { 100 | reason = `${card ? `Dealer drew ${card.display}, making it ` : ''}${playerTotal}-**${total}**`; 101 | break; 102 | } else { 103 | reason = `${card ? `Dealer drew ${card.display}, making it ` : ''}**${playerTotal}**-${total}`; 104 | win = true; 105 | } 106 | } else { 107 | await msg.say(`Dealer drew ${card.display}, total of ${total}.`); 108 | } 109 | } 110 | } 111 | this.decks.delete(msg.channel.id); 112 | if (win) return msg.say(`${reason}! You won!`); 113 | return msg.say(`${reason}! Too bad.`); 114 | } catch (err) { 115 | this.decks.delete(msg.channel.id); 116 | throw err; 117 | } 118 | } 119 | 120 | generateDeck(deckCount) { 121 | const deck = []; 122 | for (let i = 0; i < deckCount; i++) { 123 | for (const suit of suits) { 124 | deck.push({ 125 | value: 11, 126 | display: `${suit} Ace` 127 | }); 128 | for (let j = 2; j <= 10; j++) { 129 | deck.push({ 130 | value: j, 131 | display: `${suit} ${j}` 132 | }); 133 | } 134 | for (const face of faces) { 135 | deck.push({ 136 | value: 10, 137 | display: `${suit} ${face}` 138 | }); 139 | } 140 | } 141 | } 142 | return shuffle(deck); 143 | } 144 | 145 | draw(channel, hand) { 146 | const deck = this.decks.get(channel.id); 147 | const card = deck[0]; 148 | deck.shift(); 149 | hand.push(card); 150 | return card; 151 | } 152 | 153 | calculate(hand) { 154 | return hand.sort((a, b) => a.value - b.value).reduce((a, b) => { 155 | let { value } = b; 156 | if (value === 11 && a + value > 21) value = 1; 157 | return a + value; 158 | }, 0); 159 | } 160 | }; -------------------------------------------------------------------------------- /commands/other/characterinfo.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | module.exports = class CharacterInfoCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'characterinfo', 9 | group: 'other', 10 | memberName: 'characterinfo', 11 | description: 'Checks the info about a [GOD] || [TITAN] || [HALF-GOD].', 12 | examples: ['characterinfo'], 13 | args: [ 14 | { 15 | type:"string", 16 | key:"god", 17 | prompt:"Which Titan/God/HalfGod do you want get the info about?" 18 | } 19 | ] 20 | }); 21 | } 22 | 23 | run(msg, { god }) { 24 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 25 | 26 | let array = [{ name: "kronos", type: "titan", description: "(Cronus) The King of the Titanes, and the god of destructive time. He led his brothers in the castration of Ouranos (Uranus), and was himself deposed by Zeus. Kronos was cast into the pit of Tartaros after his defeat. Some say he was later released by Zeus and made King of Islands of the Blessed (home of the blessed dead).", level: 500}, { name: "hyperion", type: "titan", description: "Hyperion is Titan god of light and the cycles of day and night, sun and moon. He was cast into Tartaros by the gods at the end of the Titan-War.", level: 450}, 27 | { name: "iapetos", type: "titan", description: "IAPETOS (Iapetus) The Titan god of mortality and life-span. He was cast into Tartaros at the end of the Titan-War along with his brothers.", level: 400}, { name: "koios", type: "titan", description: "KOIOS (Coeus) The Titan god of intelligence and the axis of heaven He is also known as Polos. Koios is one of the Titanes cast into Tartaros at the end of the Titan-War. He is sometimes described as a leader of the Gigantes (Giants).", level: 350}, { name: "krios", type: "titan", description: "KRIOS (Crius) The Titan god of the heavenly constellations, also known as Megamedes. He was cast into Tartaros at the end of the Titan-War. Krios was sometimes called a leader of the Gigantes (Giants).", level: 300}, 28 | { name: "mylinos", type: "titan", description: "MYLINOS (Mylinus) A Gigante (Giant) or Titan of the island of Krete (Crete), destroyed by Zeus. He was probably identified with Olympos or Kronos.", level: 250}, { name: "okeanos", type: "titan", description: "OKEANOS (Oceanus) The Titan god of the earth-encircling river Okeanos, the place of rising and setting of the heavenly bodies. He is the only one of the Titanes not to participate in the castration of Ouranos (Uranus), and in the Titan-Wars remained neutral.", level: 200 }, 29 | { name: "olymbros", type: "titan", description: "OLYMBROS (Olymbrus) An alternative name for one of the Titanes. He is the same as Olympos the Kretan (Cretan) mentor of Zeus.", level: 150}, { name: "ophion", type: "titan", description: "OPHION The eldest of the Titanes who was wrestled by Kronos (Cronus) for the throne of heaven and cast into the Ocean-stream. He is identified with both Ouranos (Uranus) and Okeanos (Oceanus).", level: 100}, 30 | { name: "zeus", type: "god", description: "The most powerful of all, Zeus is god of the sky and the king of Olympus. His temper affects the weather, and he throws thunderbolts when he is unhappy. He is married to Hera but had many other lovers. His symbols include the oak and the thunderbolt.", level: 400}, { name: "poseidon", type: "god", description: "Poseidon is god of the sea. He is the most powerful god except for his brother, Zeus. He lives in a beautiful palace under the sea and caused earthquakes when he is in a temper. His symbols include the horse and the trident (a three-pronged pitchfork).", level: 350}, { name: "hades", type: "god", description: "Hades is king of the dead. He lives in the underworld, the heavily guarded land where he rules over the dead. He is the brother of Zeus and the husband of Persephone, Demeter’s daughter, whom he kidnapped.", level: 300}, 31 | { name: "hera", type: "god", description: "Hera is the goddess of marriage and the queen of Olympus. She is Zeus's wife and sister; Her symbols include the peacock and the cow.", level: 275}, { name: "aphrodite", type: "god", description: "Aphrodite is the goddess of love and beauty, and the protector of sailors. She may have been the daughter of Zeus and the Titan Dione, or she may have risen from the sea on a shell. Her symbols include the myrtle tree and the dove.", level: 250}, { name: "apollo", type: "god", description: "Apollo is the god of music and healing. He is also an archer, and hunts with a silver bow. Apollo is the son of Zeus and the Titan Leto, and the twin of Artemis. His symbols include the laurel tree, the crow, and the dolphin.", level: 225}, 32 | { name: "ares", type: "god", description: "Ares is the god of war. He is both cruel and a coward. Ares is the son of Zeus and Hera, but neither of his parents liked him. His symbols include the vulture and the dog, and he often carries a bloody spear.", level: 200}, { name: "artemis", type: "god", description: "Artemis is the goddess of the hunt and the protector of women in childbirth. She hunts with silver arrows and loved all wild animals. Artemis is the daughter of Zeus and Leto, and the twin of Apollo. Her symbols include the cypress tree and the deer.", level: 175}, { name: "athena", type: "god", description: "Athena is the goddess of wisdom. She is also skilled in the art of war, and helped heroes such as Odysseus and Hercules. Athena sprang full-grown from the forehead of Zeus, and became his favorite child. Her symbols include the owl and the olive tree.", level: 150}] 33 | 34 | let data = array.find(info => info.name === god.toLowerCase()) 35 | if (!data) return msg.say('That God, Titan or halfgod does not exist.') 36 | let embed = new RichEmbed() 37 | .setTitle(`${data.name} | Info`) 38 | .addField('Description 📜', data.description) 39 | .addField('Type', data.type.toUpperCase()) 40 | .addField('Unlocked at level', data.level) 41 | .setColor("RANDOM") 42 | msg.embed(embed) 43 | } 44 | }; -------------------------------------------------------------------------------- /commands/other/help.js: -------------------------------------------------------------------------------- 1 | const { Command } = require('discord.js-commando'); 2 | const { RichEmbed } = require('discord.js'); 3 | 4 | module.exports = class HelpCommand extends Command { 5 | constructor(client) { 6 | super(client, { 7 | name: 'help', 8 | aliases: ['commands', 'command-list'], 9 | group: 'other', 10 | memberName: 'help', 11 | description: 'Displays a list of available commands, or detailed information for a specific command.', 12 | guarded: true, 13 | args: [ 14 | { 15 | key: 'command', 16 | prompt: 'Which command would you like to view the help for?', 17 | type: 'command', 18 | default: '' 19 | } 20 | ] 21 | }); 22 | } 23 | 24 | async run(msg, { command }) { 25 | if (!command) { 26 | const embed = new RichEmbed() 27 | .setTitle('Command List') 28 | .setColor("RANDOM") 29 | .setFooter(`${this.client.registry.commands.size} Commands`); 30 | for (const group of this.client.registry.groups.values()) { 31 | embed.addField( 32 | `${group.name}`, 33 | group.commands.map(cmd => `\`${cmd.name}\``).join(', ') || 'None' 34 | ); 35 | } 36 | try { 37 | const msgs = []; 38 | msgs.push(await msg.channel.send({ embed })); 39 | return msgs; 40 | } catch (err) { 41 | return msg.reply('Failed to send help.'); 42 | } 43 | } 44 | let embed = new RichEmbed() 45 | .setTitle(`Command Info for ${command.name} ${command.guildOnly ? '(Usable only in servers)' : ''}`) 46 | .setColor("RANDOM") 47 | .setDescription(`**Aliases:** ${command.aliases.join(', ') || 'None'}\n**Usage:** ${msg.anyUsage(`${command.name} ${command.format || ''}`)}\n**Description:** ${command.description}${command.details ? `\n${command.details}` : ''}`) 48 | return msg.embed(embed) 49 | } 50 | } -------------------------------------------------------------------------------- /commands/other/leaderboard.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command, util } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | 6 | module.exports = class LeaderboardCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'leaderboard', 10 | group: 'other', 11 | memberName: 'leaderboard', 12 | description: 'Shows the leaderboard of what you specify.', 13 | examples: ['leaderboard || !leaderboard money'], 14 | args: [ 15 | { 16 | type:"string", 17 | prompt:"Which leaderboard type would you like to view?", 18 | key:"leaderboard", 19 | default:"orbs", 20 | }, 21 | { 22 | type:"integer", 23 | key:"page", 24 | prompt:"Which page would you like to view?", 25 | default: 1, 26 | } 27 | ] 28 | }); 29 | } 30 | 31 | run(msg, { leaderboard, page }) { 32 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 33 | 34 | if (leaderboard == "orbs") { 35 | let thing = 1; 36 | let data = this.client.profile.array() 37 | let d = data.sort((a, b) => b.orbs - a.orbs) 38 | const paginated = util.paginate(d, page, Math.floor(10)) 39 | console.log(paginated) 40 | let embed = new RichEmbed() 41 | .setTitle(`Orbs Leaderboard 🔮`) 42 | .setColor("RANDOM") 43 | .setDescription(paginated.items.map(user => 44 | 45 | this.client.users.get(user.id) ? `${thing++}. ` + `${this.client.users.get(user.id).tag} - **${user.orbs}** 🔮` : this.client.profile.delete(`${user.id}`)).join("\n")) 46 | .setFooter(`Your rank: ${(this.client.profile.array().sort((a, b) => b.orbs - a.orbs).map(i => i.id).indexOf(msg.author.id)) + 1}/${this.client.profile.array().length} with ${this.client.profile.get(msg.author.id).orbs} 🔮 | Use !leaderboard to view another page!`) 47 | 48 | 49 | msg.embed(embed) 50 | return; 51 | } else if(leaderboard == "level") { 52 | levellb(msg, this.client, page) 53 | return; 54 | } else if(leaderboard == "elo") { 55 | elolb(msg, this.client, page) 56 | return; 57 | } 58 | 59 | 60 | } 61 | }; 62 | 63 | 64 | 65 | function levellb(msg, client, page) { 66 | let thing = 1; 67 | let data = client.profile.array() 68 | let d = data.sort((a, b) => b.level - a.level) 69 | const paginated = util.paginate(d, page, Math.floor(10)) 70 | console.log(paginated) 71 | let embed = new RichEmbed() 72 | .setTitle(`Level Leaderboard ✨`) 73 | .setColor("RANDOM") 74 | .setDescription(paginated.items.map(user => 75 | 76 | client.users.get(user.id) ? `${thing++}. ` + `${client.users.get(user.id).tag} - **${user.level}** ✨` : client.profile.delete(`${user.id}`)).join("\n")) 77 | .setFooter(`Your rank: ${(client.profile.array().sort((a, b) => b.level - a.level).map(i => i.id).indexOf(msg.author.id)) + 1}/${client.profile.array().length} with level ${client.profile.get(msg.author.id).level} ✨ | Use !leaderboard to view another page!`) 78 | 79 | 80 | msg.embed(embed) 81 | } 82 | 83 | function elolb(msg, client, page) { 84 | let thing = 1; 85 | let data = client.profile.array() 86 | let d = data.sort((a, b) => b.elo - a.elo) 87 | const paginated = util.paginate(d, page, Math.floor(10)) 88 | console.log(paginated) 89 | let embed = new RichEmbed() 90 | .setTitle(`Elo Leaderboard 📨`) 91 | .setColor("RANDOM") 92 | .setDescription(paginated.items.map(user => 93 | 94 | client.users.get(user.id) ? `${thing++}. ` + `${client.users.get(user.id).tag} - **${user.elo}** 🔷` : client.profile.delete(`${user.id}`)).join("\n")) 95 | .setFooter(`Your rank: ${(client.profile.array().sort((a, b) => b.elo - a.elo).map(i => i.id).indexOf(msg.author.id)) + 1}/${client.profile.array().length} with ${client.profile.get(msg.author.id).elo} 🔷 | Use !leaderboard to view another page!`) 96 | 97 | 98 | msg.embed(embed) 99 | } -------------------------------------------------------------------------------- /commands/other/resetdb.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class ResetDBCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'resetdb', 9 | group: 'other', 10 | memberName: 'resetdb', 11 | description: 'resetdb', 12 | ownerOnly: true, 13 | examples: ['resetdb'] 14 | }); 15 | } 16 | 17 | run(msg) { 18 | this.client.clash.deleteAll() 19 | this.client.profile.deleteAll() 20 | this.client.marketplace.deleteAll() 21 | this.client.util.deleteAll() 22 | this.client.equip.deleteAll() 23 | this.client.adventure.deleteAll() 24 | return msg.say('Successfully reset the db.'); 25 | } 26 | }; -------------------------------------------------------------------------------- /commands/other/resetuser.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class ResetUserCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'resetuser', 9 | group: 'other', 10 | memberName: 'resetuser', 11 | description: 'resetuser', 12 | ownerOnly: true, 13 | examples: ['resetuser '], 14 | args: [ 15 | { 16 | type:"user", 17 | prompt:"user?", 18 | key:"user", 19 | default: msg => msg.author 20 | } 21 | ] 22 | }); 23 | } 24 | 25 | run(msg, { user }) { 26 | this.client.clash.delete(user.id) 27 | this.client.profile.delete(user.id) 28 | this.client.equip.delete(user.id) 29 | this.client.boosters.delete(user.id) 30 | this.client.adventure.delete(user.id) 31 | return msg.say('Successfully reset the user ' + user); 32 | } 33 | }; -------------------------------------------------------------------------------- /commands/other/trivia.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { RichEmbed } = require('discord.js') 4 | let question1 = require(`../../json/trivias.json`) 5 | let question = question1[Math.floor(Math.random() * question1.length)]; 6 | const { Command } = require('discord.js-commando'); 7 | const moment = require('moment') 8 | 9 | module.exports = class TriviaCommand extends Command { 10 | constructor(client) { 11 | super(client, { 12 | name: 'trivia', 13 | group: 'other', 14 | memberName: 'trivia', 15 | description: 'Play trivia and earn rewards.', 16 | examples: ['trivia'] 17 | }); 18 | } 19 | 20 | run(msg) { 21 | 22 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 23 | let thing = 1; 24 | let rewards; 25 | let random = Math.floor(Math.random() * 1000) + 1; 26 | if (random >= 1 && random <= 800) rewards = {crate: "Normal Crate", rewards: [ {name:"Skullforge Katana", damage: 34, type: "sword"}, {name:"Peacekeeper Sword", damage: 70, type: "sword"}, {name:"Isolated Greatsword", damage: 44, type: "sword"}, {name: "The Black Blade", damage: 58, type:"sword"}], type: "normal"} 27 | if (random >= 801 && random <= 900) rewards = {crate: "Uncommon Crate", rewards: [ {name:"Night's Fall", damage: 90, type: "bow"}, {name:"Lich Slicer", damage: 98, type: "sword"}, {name:"Sailor's Gold Warblade", damage: 104, type:"sword"}, {name:"Chain Leggings", damage: 0, health: 175, type:"leggings"}], type:"uncommon"} 28 | if (random >= 901 && random <= 940) rewards = {crate: "Rare Crate", rewards: [ {name:"Tyrannical Leggings of Storms", damage: 0, health: 240, type:"leggings"}, {name:"Honed Skeletal Boots", damage: 0, health: 165, type:"boots"}, {name:"Tormented Blade", damage: 124, type:"sword"}, {name:"Twilight Silver Swiftblade", damage: 142, type:"sword"}], type:"rare"} 29 | if (random >= 941 && random <= 980) rewards = {crate:"Very Rare Crate", rewards: [ {name:"Wrathful Mageblade", damage: 198, type:"sword"}, {name:"Pride's Silver Quickblade", damage: 202, type:"sword"}, {name:"Frost Longsword", damage: 178, type:"sword"}, {name:"Helmet of Fire", damage: 4, health: 302, type:"helmet"}], type:"very rare"} 30 | if (random >= 981 && random <= 1000) rewards = {crate:"Legendary Crate", rewards: [ {name:"Godslayer", damage: 392, type:"sword"}, {name:"Helmet of Demonic Wars", damage: 0, health: 720, type:"helmet"}, {name:"Holy Ivory Helmet", health: 680, type:"helmet"}, {name:"Feral Sword", damage: 323, type:"sword"}, {name:"Chestplate of Unholy Magic", health: 1200, type:"chestplate"}], type:"legendary"} 31 | console.log(rewards) 32 | console.log(random) 33 | let user = this.client.profile.get(msg.author.id); 34 | if (user.lastTrivia + 2.16e+7 > Date.now()) return msg.channel.send(`There is a cooldown of ${moment((user.lastTrivia + 43200000) - Date.now()).format("HH:mm:ss")} hours to use this command.`); 35 | triva (60000, this.client); 36 | function triva(time, client) { 37 | 38 | let embed = new RichEmbed() 39 | .setTitle(`Trivia`) 40 | .setDescription(`${question.question}\n${question.answers.map(i => `*${thing++})* **_${i}_**\n`)}`.replace(',', '').replace(',', '').replace(',', '').replace(',', '').replace(',', '')) 41 | .setFooter(`Please use the numbers, don't use the answer texts. You have 60 seconds to answer.`) 42 | .setColor("RANDOM") 43 | msg.channel.send(embed).then(m => { 44 | const filter = m => m.author.id === msg.author.id && !m.author.bot; 45 | msg.channel.awaitMessages(filter, { 46 | max: 1, 47 | time: time, 48 | error: ['time'] 49 | }).then(response => { 50 | let answer = response.map(r => r.content)[0].toLowerCase(); 51 | if (isNaN(answer)) return incorrect(msg, question, rewards) 52 | if (question.answers.indexOf(question.answer) + 1 == answer) { 53 | // Correct answer 54 | client.profile.push(msg.author.id, {name: rewards.crate, rewards: rewards.rewards, type: rewards.type }, "items") 55 | msg.channel.send( 56 | new RichEmbed() 57 | .setDescription(`You got it right!\nReward: **${rewards.crate}**`) 58 | .setColor("RANDOM") 59 | ); 60 | } else { 61 | // Incorrect answer 62 | incorrect(msg, question, rewards) 63 | return; 64 | } 65 | }).catch(err => {console.log(err) 66 | msg.channel.send(`Time's up! you took too long to answer.`)}); 67 | return; 68 | }); 69 | client.profile.set(msg.author.id, Date.now(), "lastTrivia") 70 | } 71 | } 72 | }; 73 | 74 | function incorrect(msg, question, rewards) { 75 | let embed = new RichEmbed() 76 | .setTitle('Incorrect Answer!') 77 | .setDescription(`Correct Answer: **${question.answer}**\nReward Lost: **${rewards.crate}**`) 78 | .setColor("RANDOM") 79 | msg.embed(embed) 80 | } -------------------------------------------------------------------------------- /commands/profile/balance.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js'); 5 | 6 | module.exports = class BalanceCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'balance', 10 | group: 'profile', 11 | aliases: ["bal", "money", "cash"], 12 | memberName: 'balance', 13 | description: 'Shows your balance.', 14 | examples: ['balance'], 15 | args: [ 16 | { 17 | key:"user", 18 | type:"user", 19 | prompt:"Which user would you like to get the balance of?", 20 | default: msg => msg.author 21 | } 22 | ] 23 | }); 24 | } 25 | 26 | run(msg, { user }) { 27 | 28 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 29 | 30 | if (this.client.clash.get(`${user.id}`, "id") != 'none') { 31 | let embed = new RichEmbed() 32 | .setTitle(`${user.tag}'s balance`) 33 | .addField('Balance', `**${this.client.profile.get(`${user.id}`, "orbs")}** 🔮`) 34 | .addField('Guild Balance', user.id === msg.author.id ? `**${this.client.clash.get(`${user.id}`, "orbs")}** 🏦` : "[HIDDEN]") 35 | .setColor("RANDOM") 36 | return msg.embed(embed) 37 | } else { 38 | let embed = new RichEmbed() 39 | .setTitle(`${user.tag}'s balance`) 40 | .addField('Balance', `**${Math.round(this.client.profile.get(`${user.id}`, "orbs")).toLocaleString()}** 🔮`) 41 | .setColor("RANDOM") 42 | return msg.embed(embed) 43 | } 44 | 45 | } 46 | }; -------------------------------------------------------------------------------- /commands/profile/equip-pet.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class EquipPetCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'equip-pet', 9 | group: 'profile', 10 | memberName: 'equip-pet', 11 | aliases: ["pet-equip"], 12 | description: 'Equips the pet you choose.', 13 | args: [ 14 | { 15 | key:"itemid", 16 | type:"integer", 17 | prompt:"Which pet would you like to equip? (pet id required)" 18 | } 19 | ] 20 | }); 21 | } 22 | 23 | run(msg, { itemid }) { 24 | 25 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 26 | 27 | let array = this.client.profile.get(msg.author.id, "pets") 28 | let data = array.findIndex(obj => obj.id === itemid) 29 | if (!array[data]) return msg.say('I could not find that item of yours, maybe wrong item id?') 30 | if (this.client.equip.get(msg.author.id, array[data].thing)[0] != undefined) { 31 | this.client.profile.push(msg.author.id, this.client.equip.get(msg.author.id, "pet")[0], "pets") 32 | this.client.equip.delete(msg.author.id, `pet.0`) 33 | } 34 | 35 | msg.say(`Equipped pet ${array[data].name}!`) 36 | this.client.equip.push(msg.author.id, array[data], "pet") 37 | this.client.profile.delete(msg.author.id, `pets.${data}`) 38 | 39 | } 40 | }; -------------------------------------------------------------------------------- /commands/profile/equip.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class EquipCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'equip', 9 | group: 'profile', 10 | memberName: 'equip', 11 | description: 'Equips the weapon you choose.', 12 | args: [ 13 | { 14 | key:"itemid", 15 | type:"integer", 16 | prompt:"Which weapon would you like to equip? (item id required)" 17 | } 18 | ] 19 | }); 20 | } 21 | 22 | run(msg, { itemid }) { 23 | 24 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 25 | 26 | let array = this.client.profile.get(msg.author.id, "weapons") 27 | let data = array.findIndex(obj => obj.id === itemid) 28 | if (!array[data]) return msg.say('I could not find that item of yours, maybe wrong item id?') 29 | if (this.client.equip.get(msg.author.id, array[data].type)[0] != undefined) return msg.say('You already have a ' + array[data].type + ' type equipped, unequip it before.') 30 | if (array[data].type == "bow" && this.client.profile.get(msg.author.id, "character").type !== "bow") return msg.say('You need to be **Archer** to equip a bow!') 31 | if (array[data].type == "sword" && this.client.profile.get(msg.author.id, "character").type !== "sword") return msg.say('You need to be **Knight, Assassin or Thief** to equip a sword!') 32 | if (array[data].type == "staff" && this.client.profile.get(msg.author.id, "character").type !== "staff") return msg.say('You need to be **Mage** to equip a bow!') 33 | 34 | 35 | this.client.profile.math(msg.author.id, "+", array[data].damage, "damage") 36 | this.client.profile.math(msg.author.id, "+", array[data].health, "health") 37 | this.client.profile.delete(msg.author.id, `weapons.${data}`) 38 | msg.say(`${array[data].type} equipped! **${array[data].name}**`) 39 | if (array[data].type === "sword") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "sword") 40 | if (array[data].type === "boots") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "boots") 41 | if (array[data].type === "necklace") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "necklace") 42 | if (array[data].type === "leggings") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "leggings") 43 | if (array[data].type === "chestplate") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "chestplate") 44 | if (array[data].type === "helmet") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "helmet") 45 | if (array[data].type === "bow") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "bow") 46 | if (array[data].type === "shield") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "shield") 47 | if (array[data].type === "staff") this.client.equip.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type }, "staff") 48 | 49 | } 50 | }; -------------------------------------------------------------------------------- /commands/profile/equipspell.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class EquipSpellCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'equipspell', 9 | group: 'profile', 10 | memberName: 'equipspell', 11 | description: 'Equip a spell.', 12 | examples: ['equipspell'], 13 | args: [ 14 | { 15 | key:"spell", 16 | type:"integer", 17 | prompt:"Which spell would you like to equip? give me the ID." 18 | } 19 | ] 20 | }); 21 | } 22 | 23 | run(msg, { spell }) { 24 | 25 | let array = this.client.profile.get(msg.author.id, "items") 26 | let data = array.findIndex(obj => obj.id === spell) 27 | if (data < 0) return msg.say('I could not find a spell of that ID!') 28 | if (this.client.equip.get(msg.author.id, "spell")[0] != undefined) { 29 | this.client.profile.push(msg.author.id, this.client.equip.get(msg.author.id, "spell")[0], "items") 30 | this.client.equip.delete(msg.author.id, `spell.0`) 31 | } 32 | this.client.equip.push(msg.author.id, array[data], "spell") 33 | 34 | this.client.profile.delete(msg.author.id, `items.${data}`) 35 | msg.say('Successfully equipped spell ' + array[data].name) 36 | } 37 | }; -------------------------------------------------------------------------------- /commands/profile/inventory.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { util } = require('discord.js-commando') 5 | const { RichEmbed } = require('discord.js') 6 | 7 | module.exports = class InventoryCommand extends Command { 8 | constructor(client) { 9 | super(client, { 10 | name: 'inventory', 11 | group: 'profile', 12 | aliases: ["i", "inv", "backpack"], 13 | memberName: 'inventory', 14 | description: 'Shows your inventory.', 15 | examples: ['inventory'], 16 | args: [ 17 | { 18 | key:"page", 19 | type:"integer", 20 | prompt:"Which page would you like to view?", 21 | default: 1 22 | } 23 | ] 24 | }); 25 | } 26 | 27 | run(msg, { page }) { 28 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 29 | 30 | let arr = this.client.profile.get(`${msg.author.id}`, "weapons") 31 | const paginated = util.paginate(arr, page, Math.floor(20)); 32 | 33 | 34 | let data = paginated.items 35 | if (data.health === undefined) data.health = 0; 36 | if (data.damage === undefined) data.damage = 0; 37 | let embed = new RichEmbed() 38 | .setTitle(`${msg.author.tag}'s Inventory! 🎒 | Page ${paginated.page}`) 39 | .setDescription(`${data.map(i => `**${i.name}** ***=>*** **Damage: ${i.damage}** ***=>*** **Health: ${i.health}** ***=>*** **ID: ${i.id}** ***=>*** **Type: ${i.type}**`).join("\n")}`) 40 | .setFooter(`To view another page do !inventory `) 41 | .setColor("RANDOM") 42 | msg.embed(embed) 43 | } 44 | }; -------------------------------------------------------------------------------- /commands/profile/items.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { util } = require('discord.js-commando') 5 | const { RichEmbed } = require('discord.js') 6 | 7 | module.exports = class ItemsCommand extends Command { 8 | constructor(client) { 9 | super(client, { 10 | name: 'items', 11 | group: 'profile', 12 | memberName: 'items', 13 | description: 'Shows your items.', 14 | examples: ['items'], 15 | args: [ 16 | { 17 | key:"page", 18 | type:"integer", 19 | prompt:"Which page would you like to view?", 20 | default: 1 21 | } 22 | ] 23 | }); 24 | } 25 | 26 | run(msg, { page }) { 27 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 28 | 29 | let arr = this.client.profile.get(`${msg.author.id}`, "items") 30 | const paginated = util.paginate(arr, page, Math.floor(5)); 31 | 32 | 33 | let embed = new RichEmbed() 34 | .setAuthor(msg.author.tag + ' Items', msg.author.displayAvatarURL) 35 | .setDescription(paginated.items.map(i => `ID: ${i.id} Name: ${i.name}\nDescription: ${i.description}\nDamage: ${i.damage} / Health: ${i.health}`).join("\n")) 36 | .setColor("RANDOM") 37 | msg.embed(embed) 38 | } 39 | }; -------------------------------------------------------------------------------- /commands/profile/level.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | //const { Canvas } = require('canvas-constructor'); 5 | const { RichEmbed } = require('discord.js'); 6 | 7 | module.exports = class LevelCommand extends Command { 8 | constructor(client) { 9 | super(client, { 10 | name: 'level', 11 | group: 'profile', 12 | memberName: 'level', 13 | description: 'Shows your current level.', 14 | examples: ['level'], 15 | args: [ 16 | { 17 | key:"user", 18 | type:"user", 19 | prompt:"Which user would you like to get the level of?", 20 | default: msg => msg.author 21 | } 22 | ] 23 | }); 24 | } 25 | 26 | run(msg, { user }) { 27 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 28 | 29 | const xpForLevel = level => Math.ceil(level*level*100); 30 | const calcLevel = xp => Math.floor(0.1*Math.sqrt(xp)); 31 | 32 | const curLevel = calcLevel(this.client.profile.get(`${user.id}`, "levelpoints")) // 2 33 | // Points needed for currentLevel + 1 34 | const pointsNeeded = xpForLevel(curLevel + 1); 35 | 36 | let embed = new RichEmbed() 37 | .setColor("RANDOM") 38 | .setDescription(`Level: **` + this.client.profile.get(`${user.id}`, "level") + '**' + '\n' + `XP: ${this.client.profile.get(`${user.id}`, "levelpoints")}/${pointsNeeded} (${pointsNeeded - this.client.profile.get(`${user.id}`, "levelpoints")} needed)`) 39 | msg.channel.send(embed) 40 | } 41 | } -------------------------------------------------------------------------------- /commands/profile/pets.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command, util } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | 6 | module.exports = class PetsCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'pets', 10 | group: 'profile', 11 | memberName: 'pets', 12 | description: 'Shows your pet storage.', 13 | examples: ['pets'], 14 | args: [ 15 | { 16 | type:"integer", 17 | key:"page", 18 | prompt:"Which page would you like to view?", 19 | default: 1, 20 | } 21 | ] 22 | }); 23 | } 24 | 25 | run(msg, { page }) { 26 | 27 | let arr = this.client.profile.get(msg.author.id, "pets") 28 | let data = util.paginate(arr, page, 6) 29 | 30 | let embed = new RichEmbed() 31 | .setAuthor(`${msg.author.tag} pets | Page ${page}`, msg.author.displayAvatarURL) 32 | .setColor("RANDOM") 33 | .setFooter('to view another page do !pets ') 34 | 35 | for (var i = 0; i < data.items.length; i++) { 36 | embed.addField(`${data.items[i].name}`, `Damage: ${data.items[i].damage}\nType: ${data.items[i].type}\nPreview: [here](${data.items[i].img})\nID: ${data.items[i].id}`,true) 37 | } 38 | 39 | msg.embed(embed) 40 | } 41 | }; -------------------------------------------------------------------------------- /commands/profile/profile.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | 6 | module.exports = class ProfileCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'profile', 10 | group: 'profile', 11 | memberName: 'profile', 12 | aliases: ["p", "prof"], 13 | description: 'profile', 14 | examples: ['profile [user]'], 15 | args: [ 16 | { 17 | type:"user", 18 | key:"user", 19 | prompt:"Which user would you like to get the profile of?", 20 | default: msg => msg.author 21 | } 22 | ] 23 | }); 24 | } 25 | 26 | run(msg, { user }) { 27 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 28 | 29 | let boots = this.client.equip.get(user.id, "boots").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 30 | let leggings = this.client.equip.get(user.id, "leggings").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 31 | let chestplate = this.client.equip.get(user.id, "chestplate").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 32 | let helmet = this.client.equip.get(user.id, "helmet").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 33 | let sword = this.client.equip.get(user.id, "sword").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 34 | let bow = this.client.equip.get(user.id, "bow").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 35 | let shield = this.client.equip.get(user.id, "shield").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 36 | let staff = this.client.equip.get(user.id, "staff").map(i => `${i.name} => Damage: ${i.damage} => Health: ${i.health} => ID: ${i.id}`) 37 | let spell = this.client.equip.get(user.id, "spell").map(i => `${i.name}\nDescription: ${i.description}\nDamage: ${i.damage == undefined ? 0 : i.damage} / ${i.health == undefined ? 0 : i.health} health.`) 38 | let pet = this.client.equip.get(user.id, "pet").map(i => `${i.name}\nDamage: ${i.damage}\nType: ${i.type}\nPreview: [here](${i.img})\nid: ${i.id}`) 39 | if (pet.length === 0) pet = 'None'; 40 | if (spell.length === 0) spell = 'None'; 41 | if (boots.length === 0) boots = 'None' 42 | if (leggings.length === 0) leggings = 'None' 43 | if (chestplate.length === 0) chestplate = 'None' 44 | if (helmet.length === 0) helmet = 'None' 45 | if (bow.length === 0) bow = 'None'; 46 | if (sword.length === 0) sword = "None"; 47 | if(shield.length === 0) shield = 'None'; 48 | if (staff.length === 0) staff = 'None'; 49 | 50 | 51 | let embed = new RichEmbed() 52 | .setTitle(`${user.tag}'s profile (${this.client.profile.get(user.id, "character").class})`) 53 | .addField('Helmet ⛑', helmet,true) 54 | .addField('Chestplate 🎽', chestplate,true) 55 | .addField('Leggings 👖', leggings,true) 56 | .addField('Boots 👟', boots,true) 57 | .addField('Level', this.client.profile.get(`${user.id}`, "level"),true) 58 | .addField('Sword ⚔', sword,true) 59 | .addField('Spell', spell) 60 | .addField('Bow 🏹', bow,true) 61 | .addField('Shield 🛡', shield,true) 62 | .addField('Pet', pet, true) 63 | .addField('Staff 🕎', staff,true) 64 | .addField('Orbs 🔮', this.client.profile.get(user.id, "orbs"), true) 65 | .addField(`Damage 🎯`, this.client.profile.get(user.id, "damage"),true) 66 | .addField('Health 🌡', this.client.profile.get(user.id, "health"),true) 67 | .setColor("RANDOM"); 68 | msg.embed(embed) 69 | } 70 | }; -------------------------------------------------------------------------------- /commands/profile/sell.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class SellCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'sell', 9 | group: 'profile', 10 | memberName: 'sell', 11 | description: 'Put an item up on market.', 12 | examples: ['sell '], 13 | args: [ 14 | { 15 | key:"itemid", 16 | prompt:"Which item would you like to sell, (itemID required)", 17 | type:"integer", 18 | }, 19 | { 20 | key:"price", 21 | prompt:"What should the price of this item be?", 22 | type:"integer", 23 | } 24 | ] 25 | }); 26 | } 27 | 28 | run(msg, { itemid, price }) { 29 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 30 | 31 | if (msg.content.includes('-')) return msg.say('Negative values may not be used.') 32 | let array = this.client.profile.get(msg.author.id, "weapons") 33 | let data = array.findIndex(obj => obj.id === itemid) 34 | console.log(data) 35 | console.log(array[data]) 36 | if (!array[data]) return msg.say('I could not find that item of yours, maybe wrong item id?') 37 | msg.say(`Item **${array[data].name}** was put up on market with the price of ${price} orbs!`) 38 | this.client.marketplace.push(this.client.user.id, { id: array[data].id, name: array[data].name, price: price, damage: array[data].damage, health: array[data].health, author: msg.author.id, type: array[data].type}, "items") 39 | this.client.profile.delete(msg.author.id, `weapons.${data}`) 40 | } 41 | }; -------------------------------------------------------------------------------- /commands/profile/unequip.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class UnEquipCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'unequip', 9 | group: 'profile', 10 | memberName: 'unequip', 11 | description: 'Unequips the weapon you choose.', 12 | args: [ 13 | { 14 | key:"weapon", 15 | type:"string", 16 | prompt:"Which weapon class is it? sword / leggings etc.", 17 | }, 18 | { 19 | key:"itemid", 20 | type:"integer", 21 | prompt:"Which weapon would you like to unequip? (item id required)" 22 | } 23 | ] 24 | }); 25 | } 26 | 27 | run(msg, { itemid, weapon }) { 28 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 29 | 30 | let array = this.client.equip.get(msg.author.id, weapon.toLowerCase()) 31 | if (array === undefined) return msg.say('I could not find that weapon class!') 32 | 33 | let data = array.findIndex(obj => obj.id === itemid) 34 | 35 | if (!array[data]) return msg.say('I could not find that item of yours, maybe wrong item id?') 36 | msg.say(`${array[data].type} unequipped! **${array[data].name}**`) 37 | this.client.profile.push(msg.author.id, { id: array[data].id, name: array[data].name, damage: array[data].damage, health: array[data].health, type: array[data].type } , "weapons") 38 | 39 | if (array[data].type === "sword") { 40 | this.client.profile.math(msg.author.id, "-", array[data].damage, "damage") 41 | this.client.equip.delete(msg.author.id, `${array[data].type}.${data}`) 42 | this.client.profile.math(msg.author.id, "-", array[data].health, "health") 43 | return; 44 | } 45 | if (array[data].type === "necklace") { 46 | this.client.profile.math(msg.author.id, "-", array[data].damage, "damage") 47 | this.client.equip.delete(msg.author.id, `${array[data].type}.${data}`) 48 | 49 | this.client.profile.math(msg.author.id, "-", array[data].health, "health") 50 | return; 51 | } 52 | if (array[data].type === "leggings") { 53 | this.client.profile.math(msg.author.id, "-", array[data].damage, "damage") 54 | 55 | this.client.equip.delete(msg.author.id, `${array[data].type}.${data}`) 56 | this.client.profile.math(msg.author.id, "-", array[data].health, "health") 57 | return; 58 | } 59 | if (array[data].type === "chestplate") { 60 | this.client.profile.math(msg.author.id, "-", array[data].damage, "damage") 61 | 62 | this.client.equip.delete(msg.author.id, `${array[data].type}.${data}`) 63 | this.client.profile.math(msg.author.id, "-", array[data].health, "health") 64 | return; 65 | } 66 | if (array[data].type === "helmet") { 67 | this.client.profile.math(msg.author.id, "-", array[data].damage, "damage") 68 | this.client.equip.delete(msg.author.id, `${array[data].type}.${data}`) 69 | this.client.profile.math(msg.author.id, "-", array[data].health, "health") 70 | return; 71 | } 72 | if (array[data].type === "boots") { 73 | this.client.profile.math(msg.author.id, "-", array[data].damage, "damage") 74 | this.client.equip.delete(msg.author.id, `${array[data].type}.${data}`) 75 | this.client.profile.math(msg.author.id, "-", array[data].health, "health") 76 | return; 77 | } 78 | if (array[data].type === "shield") { 79 | this.client.profile.math(msg.author.id, "-", array[data].damage, "damage") 80 | this.client.profile.math(msg.author.id, "-", array[data].health, "health") 81 | this.client.equip.delete(msg.author.id, `${array[data].type}.${data}`) 82 | return; 83 | } 84 | } 85 | }; -------------------------------------------------------------------------------- /commands/profile/upgrade.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class UpgradeCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'upgrade', 9 | group: 'profile', 10 | memberName: 'upgrade', 11 | description: 'Upgrade your workers!', 12 | examples: ['upgrade'], 13 | args: [ 14 | { 15 | key:"id", 16 | prompt:"Which worker would you like to upgrade? (id)", 17 | type:"integer", 18 | } 19 | ] 20 | }); 21 | } 22 | 23 | run(msg, { id }) { 24 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 25 | 26 | let array = this.client.profile.get(msg.author.id, "workers") 27 | let data = array.find(obj => obj.number == id) 28 | if (!data) return msg.say('I could not find any worker by that ID.') 29 | 30 | let result = id - 1 31 | this.client.profile.inc(msg.author.id, `workers.${result}.level`) 32 | 33 | msg.say('Successfully upgraded worker with the ID of ' + id + '!') 34 | return; 35 | } 36 | }; -------------------------------------------------------------------------------- /commands/profile/use.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class UseCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'use', 9 | group: 'profile', 10 | memberName: 'use', 11 | description: 'Use boosters which gives you extra stuff.', 12 | examples: ['use'], 13 | args: [ 14 | { 15 | key:"item", 16 | oneOf: ["xp booster"], 17 | type:"string", 18 | prompt:"Which booster would you like to use?" 19 | } 20 | ] 21 | }); 22 | } 23 | 24 | async run(msg, { item }) { 25 | 26 | let arr = this.client.profile.get(msg.author.id, "items") 27 | let data = arr.findIndex(i => i.name === item.toLowerCase()) 28 | 29 | console.log(arr[data]) 30 | 31 | if (data < 0) return msg.say('You do not own that kind of booster.') 32 | 33 | if (arr[data].mark !== "booster") return msg.say('That is not a booster!') 34 | 35 | if (this.client.boosters.get(msg.author.id, arr[data].type) !== "disabled") return msg.say('You already have an ' + arr[data].type + ' booster enabled.') 36 | msg.say('`' + msg.author.tag + '`' + `, Are you sure about using \`` + arr[data].name + '`?') 37 | const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, { 38 | time: 60000, 39 | max: 1, 40 | }) 41 | 42 | if (msgs.first().content !== "yes") msg.say(`Cancelled usage.`) 43 | 44 | msg.say(`Successfully used an ${arr[data].type} booster! will stay on for 30 minutes.`) 45 | 46 | this.client.profile.delete(msg.author.id, `items.${data}`) 47 | this.client.boosters.set(msg.author.id, "enabled", arr[data].type) 48 | this.client.boosters.set(msg.author.id, Date.now(), arr[data].type + 'time') 49 | 50 | setTimeout(() => { 51 | msg.author.send('Your ' + arr[data].type + ' booster has ran out!' ) 52 | this.client.boosters.set(msg.author.id, "disabled", arr[data].type) 53 | this.client.boosters.set(msg.author.id, "no", arr[data].type + 'time') 54 | }, 1800000); 55 | } 56 | }; 57 | -------------------------------------------------------------------------------- /commands/profile/workers.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | 6 | module.exports = class WorkersCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'workers', 10 | group: 'profile', 11 | memberName: 'workers', 12 | description: 'Shows your workers..', 13 | examples: ['workers'] 14 | }); 15 | } 16 | 17 | run(msg) { 18 | 19 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 20 | 21 | let embed = new RichEmbed() 22 | .setTitle(`${msg.author.tag}'s workers!`) 23 | .setDescription(`${this.client.profile.get(msg.author.id).workers.map(i => `ID => **${i.number}** - Level <= **${i.level}** - Earnings <= **$${(i.level * 2 / 1.33).toFixed(2)}**\n`).join("\n")}`) 24 | .setColor("RANDOM") 25 | .setFooter(`!upgrade `) 26 | msg.embed(embed) 27 | } 28 | }; -------------------------------------------------------------------------------- /commands/roleplay/adventure.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js'); 5 | 6 | const level5 = require('../../json/weapon5') 7 | const mobs5 = require('../../json/mobs5') 8 | const level10 = require('../../json/weapon10') 9 | const mobs10 = require('../../json/mobs10') 10 | const level16 = require('../../json/weapon16') 11 | const mobs16 = require('../../json/mobs16') 12 | 13 | module.exports = class AdventureCommand extends Command { 14 | constructor(client) { 15 | super(client, { 16 | name: 'adventure', 17 | group: 'roleplay', 18 | memberName: 'adventure', 19 | description: 'Go on an adventure, earn money, shards & weapons.', 20 | examples: ['adventure'], 21 | throttling: { 22 | usages: 1, 23 | duration: 3, 24 | } 25 | }); 26 | } 27 | 28 | run(msg) { 29 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 30 | 31 | this.client.adventure.ensure(msg.author.id, { 32 | stage: 1 33 | }) 34 | 35 | let damage = this.client.profile.get(msg.author.id, "damage") 36 | let health = this.client.profile.get(msg.author.id, "health") 37 | if (this.client.adventure.get(msg.author.id, "stage") >= 1 && this.client.adventure.get(msg.author.id, "stage") <= 4) { 38 | const item = level5[Math.floor(Math.random() * level5.length)]; 39 | const mob = mobs5[Math.floor(Math.random() * mobs5.length)]; 40 | 41 | let mobhealth = mob.health 42 | let mobdmg = mob.damage 43 | while (health > 1) { 44 | mobhealth = mobhealth - damage 45 | health = health - mobdmg 46 | if (mobhealth < 1) { 47 | let random = Math.floor(Math.random() * 10) 48 | if (random < 8) return noitem(msg, mob, this.client) 49 | stage(msg, item, this.client, mob) 50 | return; 51 | } else if (health < 1) { 52 | lost(msg, mobhealth, item, this.client, mob) 53 | return; 54 | } 55 | } 56 | } else if(this.client.adventure.get(msg.author.id, "stage") >= 5 && this.client.adventure.get(msg.author.id, "stage") <= 15) { 57 | const item = level10[Math.floor(Math.random() * level10.length)]; 58 | const mob = mobs10[Math.floor(Math.random() * mobs10.length)]; 59 | 60 | let mobhealth = mob.health 61 | let mobdmg = mob.damage 62 | while (health > 1) { 63 | mobhealth = mobhealth - damage 64 | health = health - mobdmg 65 | if (mobhealth < 1) { 66 | let random = Math.floor(Math.random() * 10) 67 | if (random < 8) return noitem(msg, mob, this.client) 68 | stage(msg, item, this.client, mob) 69 | return; 70 | } else if (health < 1) { 71 | lost(msg, mobhealth, item, this.client, mob) 72 | return; 73 | } 74 | } 75 | } else if(this.client.adventure.get(msg.author.id, "stage") >= 16 && this.client.adventure.get(msg.author.id, "stage") <= 30) { 76 | const item = level16[Math.floor(Math.random() * level16.length)]; 77 | const mob = mobs16[Math.floor(Math.random() * mobs16.length)]; 78 | 79 | let mobhealth = mob.health 80 | let mobdmg = mob.damage 81 | while (health > 1) { 82 | mobhealth = mobhealth - damage 83 | health = health - mobdmg 84 | if (mobhealth < 1) { 85 | let random = Math.floor(Math.random() * 10) 86 | if (random < 8) return noitem(msg, mob, this.client) 87 | stage(msg, item, this.client, mob) 88 | return; 89 | } else if (health < 1) { 90 | lost(msg, mobhealth, item, this.client, mob) 91 | return; 92 | } 93 | } 94 | } 95 | } 96 | }; 97 | 98 | function stage(msg, weapon, client, mob) { 99 | if(client.boosters.get(msg.author.id, "xp") === "enabled") mob.xp = mob.xp * 2 100 | if (weapon.health === undefined) weapon.health = 0; 101 | if (weapon.damage === undefined) weapon.damage = 0; 102 | 103 | let embed = new RichEmbed() 104 | .setTitle('Adventure Win!') 105 | .setDescription(`Congratulations! you passed the stage **${client.adventure.get(msg.author.id, "stage")}** by killing ${mob.name}!`) 106 | .addField('Item Won 💎', '**' + weapon.name + '**, check it out with !inventory') 107 | .addField('Orbs Won 🔮', '**' + mob.orbs + '**') 108 | .addField('XP Won 🎆', '**' + mob.xp + '**') 109 | .setColor("RANDOM") 110 | msg.embed(embed) 111 | 112 | let weaponid = client.util.get(client.user.id, "weaponids") 113 | client.profile.push(msg.author.id, { id: weaponid + 1, name: weapon.name, health: weapon.health, damage: weapon.damage, type: weapon.type }, "weapons") 114 | client.util.inc(client.user.id, "weaponids") 115 | client.adventure.math(msg.author.id, "+", 1, "stage") 116 | client.profile.math(msg.author.id, "+", mob.orbs, "orbs") 117 | client.profile.math(msg.author.id, "+", mob.xp, "levelpoints") 118 | } 119 | 120 | 121 | function lost(msg, health, weapon, client, mob) { 122 | client.adventure.get(msg.author.id, "stage") == 1 ? '' : client.adventure.math(msg.author.id, "-", 1, "stage"); 123 | let embed = new RichEmbed() 124 | .setTitle('Adventure Lost!') 125 | .setDescription(`Unfortunately you lost the battle to ${mob.name}, it had \`${health}\` health left! you've ranked down to stage **${client.adventure.get(msg.author.id, "stage") - 1}**`) 126 | .addField('Item Lost ❌', '**' + weapon.name + '**') 127 | .setColor("RANDOM") 128 | msg.embed(embed) 129 | } 130 | 131 | function noitem(msg, mob, client) { 132 | if(client.boosters.get(msg.author.id, "xp") === "enabled") mob.xp = mob.xp * 2 133 | let embed = new RichEmbed() 134 | .setTitle('Adventure Win!') 135 | .setDescription(`Congratulations! you passed the stage **${client.adventure.get(msg.author.id, "stage")}** by killing ${mob.name}!`) 136 | .addField('Item Won 💎', 'Nothing!') 137 | .addField('Orbs Won 🔮', '**' + mob.orbs + '**') 138 | .addField('XP Won 🎆', '**' + mob.xp + '**') 139 | .setColor("RANDOM") 140 | msg.embed(embed) 141 | client.profile.math(msg.author.id, "+", mob.orbs, "orbs") 142 | client.profile.math(msg.author.id, "+", mob.xp, "levelpoints") 143 | client.adventure.math(msg.author.id, "+", 1, "stage") 144 | } -------------------------------------------------------------------------------- /commands/roleplay/alchemist-buy.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | let spells = require('../../json/alchemist.json') 5 | 6 | module.exports = class AlchemistBuyCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'alchemist-buy', 10 | group: 'roleplay', 11 | memberName: 'alchemist-buy', 12 | description: 'Buy an item from the alchemist.', 13 | examples: ['alchemist-buy '], 14 | args: [ 15 | { 16 | key:"spell", 17 | type:"string", 18 | prompt:"Which item would you like to buy?", 19 | } 20 | ] 21 | }); 22 | } 23 | 24 | async run(msg, { spell }) { 25 | 26 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 27 | let data = spells.findIndex(obj => obj.name === spell.toLowerCase()) 28 | if (data < 0) return msg.say('I could not find that spell!') 29 | if (this.client.profile.get(msg.author.id, "orbs") < spell[data].price) return msg.say(`You need ${spells[data].price} to buy this spell!`) 30 | msg.say(`Are you sure about buying **${spells[data].name}** for **${spells[data].price}** orbs?`) 31 | 32 | const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, { 33 | max: 1, 34 | time: 30000, 35 | }) 36 | 37 | if (!msgs.size) return msg.say(`Time's up! you forgot to answer withing 30 seconds.`) 38 | if (msgs.first().content !== "yes") return msg.say('Cancelled purchase.') 39 | 40 | if (spells[data].health === undefined) spells[data].health = 0; 41 | if (spells[data].damage === undefined) spells[data].damage = 0; 42 | if (spells[data].mark === undefined) spells[data].mark = 'None'; 43 | msg.say('Successfully bought **' + spells[data].name + '** !') 44 | 45 | this.client.util.math(this.client.user.id, "+", 1, "weaponids") 46 | let weaponid = this.client.util.get(this.client.user.id, "weaponids"); 47 | this.client.profile.push(msg.author.id, { id: weaponid, name: spells[data].name, damage: spells[data].damage, health: spells[data].health, message: spells[data].message, description: spells[data].description, type: spells[data].type, mark: spells[data].mark }, "items") 48 | this.client.profile.math(msg.author.id, "-", spells[data].price, "orbs") 49 | this.client.util.math(this.client.user.id, "+", 1, "weaponids") 50 | } 51 | }; -------------------------------------------------------------------------------- /commands/roleplay/alchemist.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command, util } = require('discord.js-commando'); 4 | const items = require('../../json/alchemist.json') 5 | const { RichEmbed } = require('discord.js') 6 | 7 | module.exports = class AlchemistCommand extends Command { 8 | constructor(client) { 9 | super(client, { 10 | name: 'alchemist', 11 | group: 'roleplay', 12 | memberName: 'alchemist', 13 | description: 'Buy potions / spells from an alchemist.', 14 | examples: ['alchemist buy '], 15 | args: [ 16 | { 17 | type:"integer", 18 | key:"page", 19 | prompt:"Which page would you like to view?", 20 | default: 1 21 | } 22 | ] 23 | }); 24 | } 25 | 26 | run(msg, { page }) { 27 | let data = util.paginate(items, page, Math.floor(5)) 28 | 29 | let embed = new RichEmbed() 30 | .setTitle('Alchemist Shop! ✨') 31 | .setDescription(data.items.map(i => `Name: **${i.name}**\nDescription: ***${i.description}***\n\n`)) 32 | .setColor("RANDOM") 33 | .setFooter('Use !spell buy ') 34 | msg.embed(embed) 35 | } 36 | }; -------------------------------------------------------------------------------- /commands/roleplay/battle.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | const { BATTLE_CHANNEL } = process.env; 6 | 7 | module.exports = class BattleCommand extends Command { 8 | constructor(client) { 9 | super(client, { 10 | name: 'battle', 11 | group: 'roleplay', 12 | memberName: 'battle', 13 | description: 'Battle other users.', 14 | examples: ['battle'], 15 | args: [ 16 | { 17 | type:"user", 18 | key:"user", 19 | prompt:"Which user would you like to battle?", 20 | } 21 | ] 22 | }); 23 | this.battle = new Set() 24 | } 25 | 26 | async run(msg, { user }) { 27 | 28 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 29 | if (user.id == msg.author.id) return msg.say('You can not duel yourself.') 30 | if (this.battle.has(msg.channel.id)) return msg.say('Only one battle may occur per channel! to prevent spam.') 31 | this.battle.add(msg.channel.id) 32 | msg.say(`${user} do you accept the challenge from ${msg.author}? (you have 30 seconds to respond with **yes**)`) 33 | const acceptance = await msg.channel.awaitMessages(res => res.author.id === user.id, { 34 | max: 1, 35 | time: 30000, 36 | }) 37 | 38 | if (!acceptance.size) return msg.say('They were too scared to fight you!') 39 | 40 | if (acceptance.first().content !== "yes") { 41 | msg.say(`${user} was too scared to fight you! ${msg.author}`) 42 | this.battle.delete(msg.channel.id) 43 | return; 44 | } 45 | 46 | this.client.channels.get(BATTLE_CHANNEL).send(`Battle Started: **${msg.author.tag} vs ${user.tag}**`) 47 | let opponentturn = false; 48 | let authorsturn = true; 49 | 50 | 51 | let opponenthealth = this.client.profile.get(user.id, "health") 52 | let authorshealth = this.client.profile.get(msg.author.id, "health") 53 | let author; 54 | 55 | while(authorshealth > 1 && opponenthealth > 1) { 56 | 57 | if (opponentturn == false) author = msg.author.id; 58 | if (authorsturn == false) author = user.id; 59 | 60 | if (authorshealth < 1) { 61 | win(msg, this.client, authorshealth, opponenthealth, user.id, msg.author.id) 62 | this.battle.delete(msg.channel.id) 63 | this.client.channels.get(BATTLE_CHANNEL).send(`Battle Ended: **${msg.author.tag} vs ${user.tag}**\nWinner: **$user.tag}**`) 64 | return; 65 | 66 | } else if(opponenthealth < 1) { 67 | this.client.channels.get(BATTLE_CHANNEL).send(`Battle Ended: **${msg.author.tag} vs ${user.tag}**\nWinner: **${msg.author.tag}**`) 68 | win(msg, this.client, opponenthealth, authorshealth, msg.author.id, user.id) 69 | this.battle.delete(msg.channel.id) 70 | return; 71 | } 72 | 73 | setTimeout(() => { 74 | let spell = this.client.equip.get(author, "spell")[0] 75 | if (spell === undefined) spell = '' 76 | let options = [this.client.profile.get(author, "character").ultimate, "attack", "heal", "heavy", "run", spell] 77 | 78 | msg.channel.send({embed: { 79 | color: 0xf71800, 80 | description: `${this.client.users.get(author).tag}, What do you choose to do? either [${options.map(i => i)}]\n\n${msg.author.tag}: **${authorshealth} HP** ‍ ‍ ‍ ${user.tag}: **${opponenthealth}** HP` 81 | }}) 82 | }, 500); 83 | 84 | const msgs = await msg.channel.awaitMessages(res => res.author.id === author, { 85 | max: 1, 86 | time: 60000 87 | }); 88 | 89 | if(!msgs.size) { 90 | await msg.channel.send({embed: { 91 | color: 0xf71800, 92 | description: 'Times up! you forgot to pick an option.' 93 | }}) 94 | continue; 95 | } 96 | 97 | if (msgs.first().content.toLowerCase() == "attack") { 98 | if (opponentturn == false) { 99 | let damage = this.client.profile.get(author, "damage") 100 | let formula = Math.floor(Math.random(damage / 2) * damage) 101 | authorattack(msg, this.client, author, user.id, formula) 102 | if (this.client.equip.get(msg.author.id, "pet").length > 0) { 103 | petattack(msg, this.client, msg.author.id) 104 | let petdamage = this.client.equip.get(msg.author.id, "pet")[0].damage 105 | if (petdamage > opponenthealth) petdamage = Math.abs(petdamage, opponenthealth) 106 | opponenthealth -= petdamage 107 | } 108 | if (formula > authorshealth) formula = Math.abs(formula, authorshealth) 109 | opponenthealth -= formula 110 | if (opponentturn == false) opponentturn = true; 111 | if (authorsturn == true) authorsturn = false; 112 | continue; 113 | } else if(authorsturn == false) { 114 | let damage = this.client.profile.get(author, "damage") 115 | let formula = Math.floor(Math.random(damage / 2) * damage) 116 | authorattack(msg, this.client, author, msg.author.id, formula) 117 | if (this.client.equip.get(msg.author.id, "pet").length > 0) { 118 | petattack(msg, this.client, author) 119 | let petdamage = this.client.equip.get(author, "pet")[0].damage 120 | if (petdamage > opponenthealth) petdamage = Math.abs(petdamage, opponenthealth) 121 | authorshealth -= petdamage 122 | } 123 | if (formula > authorshealth) formula = Math.abs(formula, authorshealth) 124 | authorshealth -= formula 125 | if (opponentturn == true) opponentturn = false; 126 | if (authorsturn == false) authorsturn = true; 127 | continue; 128 | } 129 | } else if(msgs.first().content.toLowerCase() == this.client.profile.get(author, "character").ultimate) { 130 | if (opponentturn == false) { 131 | let random6 = Math.floor(Math.random() * 10) 132 | if (random6 < 8) { 133 | ultmiss(msg, this.client, author) 134 | if (opponentturn == false) opponentturn = true; 135 | if (authorsturn == true) authorsturn = false; 136 | continue; 137 | } 138 | let damage = this.client.profile.get(msg.author.id, "character").damage 139 | ultimate(msg, this.client, author) 140 | if (this.client.equip.get(msg.author.id, "pet").length > 0) { 141 | petattack(msg, this.client, author) 142 | let petdamage = this.client.equip.get(author, "pet")[0].damage 143 | if (petdamage > opponenthealth) petdamage = Math.abs(petdamage, opponenthealth) 144 | opponenthealth -= petdamage 145 | } 146 | if (damage > opponenthealth) damage = Math.abs(damage, opponenthealth) 147 | opponenthealth -= damage 148 | if (opponentturn == true) opponentturn = false; 149 | if (authorsturn == false) authorsturn = true; 150 | continue; 151 | } else if(authorsturn == false) { 152 | let random6 = Math.floor(Math.random() * 10) 153 | if (random6 < 8) { 154 | ultmiss(msg, this.client, author) 155 | if (opponentturn == true) opponentturn = false; 156 | if (authorsturn == false) authorsturn = true; 157 | continue; 158 | } 159 | if (this.client.equip.get(user.id, "pet").length > 0) { 160 | petattack(msg, this.client, author) 161 | let petdamage = this.client.equip.get(author, "pet")[0].damage 162 | if (petdamage > opponenthealth) petdamage = Math.abs(petdamage, opponenthealth) 163 | authorshealth -= petdamage 164 | } 165 | 166 | let damage = this.client.profile.get(user.id, "character").damage 167 | ultimate(msg, this.client, author) 168 | if (damage > authorshealth) damage = Math.abs(damage, authorshealth) 169 | authorshealth -= damage 170 | if (opponentturn == true) opponentturn = false; 171 | if (authorsturn == false) authorsturn = true; 172 | continue; 173 | } 174 | } else if(msgs.first().content.toLowerCase() == "heal") { 175 | let array = this.client.profile.get(author, "items") 176 | let data = array.findIndex(obj => obj.name === "health potion") 177 | if (data < 0) { 178 | msg.say(`(${this.client.users.get(author).tag})` + 'You do not have any health potions!') 179 | continue; 180 | } 181 | 182 | let embed1 = new RichEmbed() 183 | .setDescription(`${this.client.users.get(author).username} uses a health potion! +${array[data].health} HP`) 184 | .setColor(0xf71800) 185 | msg.embed(embed1) 186 | if (opponentturn == false) { 187 | authorshealth += array[data].health 188 | this.client.profile.delete(msg.author.id, `items.${data}`) 189 | if (opponentturn == false) opponentturn = true; 190 | if (authorsturn == true) authorsturn = false; 191 | continue; 192 | } else if(authorsturn == false) { 193 | opponenthealth += array[data].health 194 | this.client.profile.delete(user.id, `items.${data}`) 195 | if (opponentturn == false) opponentturn = true; 196 | if (authorsturn == true) authorsturn = false; 197 | continue; 198 | } 199 | 200 | } else if(msgs.first().content == "run") { 201 | let random = Math.floor(Math.random() * 10) 202 | 203 | if (random < 5) { 204 | if (opponentturn == false) { 205 | msg.say(`${msg.author.tag} escaped!`) 206 | return; 207 | } else if (authorsturn == false) { 208 | msg.say(`${user.tag} escaped!`) 209 | return; 210 | } 211 | } else if(random > 5) { 212 | if (opponentturn == false) { 213 | if (opponentturn == false) opponentturn = true; 214 | if (authorsturn == true) authorsturn = false; 215 | msg.say(`${msg.author.tag} failed his escape attempt!`) 216 | continue; 217 | } else if (authorsturn == false) { 218 | if (opponentturn == true) opponentturn = false; 219 | if (authorsturn == false) authorsturn = true; 220 | msg.say(`${user.tag} failed his escape attempt!`) 221 | continue; 222 | } 223 | } 224 | } 225 | } 226 | 227 | } 228 | }; 229 | 230 | 231 | function win(msg, client, winnerhealth, winner, loser) { 232 | let formula = client.profile.get(loser, "elo") 233 | let formula2 = Math.floor(formula * 1 / 8) 234 | if (formula == 1) formula2 = 0 235 | let embed = new RichEmbed() 236 | .setTitle(`Battle Won!`) 237 | .setDescription(`${client.users.get(winner).username} you defeated ${client.users.get(loser).username} with **${winnerhealth}** HP left! Good Game.`) 238 | .addField(`${client.users.get(winner).username} Elo Change`, `${client.profile.get(winner, "elo")}\n📥\n${client.profile.get(winner, "elo") + formula2}`) 239 | .addField(`${client.users.get(loser).username} Elo Change`, `${client.profile.get(loser, "elo")}\n📤\n${client.profile.get(loser, "elo") - formula2}`) 240 | .addField(`${client.users.get(winner).username} Orbs Taken From ${client.users.get(loser).username}`, client.profile.get(loser, "orbs") / 4 + ' 🔮') 241 | .setColor(0xf71800) 242 | msg.embed(embed) 243 | client.profile.math(winner, "+", formula2, "elo") 244 | client.profile.math(loser, "-", formula2, "elo") 245 | client.profile.math(winner, "+", client.profile.get(loser, "orbs") / 4, "orbs") 246 | client.profile.math(loser, "-", client.profile.get(loser, "orbs") / 4, "orbs") 247 | } 248 | 249 | function authorattack(msg, client, author, opponent, damage) { 250 | let embed = new RichEmbed() 251 | .setDescription(`${client.users.get(author).username} you attack ${client.users.get(opponent).username}! it deals **${damage}** damage`) 252 | .setColor(0xf71800) 253 | msg.embed(embed) 254 | 255 | } 256 | 257 | function ultimate(msg, client, author) { 258 | let ultmessage = client.profile.get(author, "character").message 259 | let embed = new RichEmbed() 260 | .setDescription(`${client.users.get(author).username} ${ultmessage}`) 261 | .setColor("RANDOM") 262 | msg.embed(embed) 263 | } 264 | 265 | function ultmiss(msg, client, author) { 266 | let embed = new RichEmbed() 267 | .setDescription(`${client.users.get(author).username} used ${client.profile.get(author,"character").ultimate} but it missed!`) 268 | .setColor("RANDOM") 269 | msg.embed(embed) 270 | } 271 | 272 | function petattack(msg, client, author) { 273 | let embed = new RichEmbed() 274 | .setDescription(`${client.users.get(author).username}'s ${client.equip.get(author, "pet")[0].name} attacks which deals ${client.equip.get(author, "pet")[0].damage} damage.`) 275 | .setColor("RANDOM") 276 | msg.embed(embed) 277 | } -------------------------------------------------------------------------------- /commands/roleplay/bossbattle.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const bosses = require('../../json/bosses') 5 | const { RichEmbed } = require('discord.js') 6 | 7 | module.exports = class BossBattleCommand extends Command { 8 | constructor(client) { 9 | super(client, { 10 | name: 'bossbattle', 11 | group: 'roleplay', 12 | memberName: 'bossbattle', 13 | description: 'Battle the bosses.', 14 | examples: ['bossbattle'], 15 | args: [ 16 | { 17 | key:"boss", 18 | prompt:"Which boss would you like to challenge?", 19 | type:"string" 20 | } 21 | ] 22 | }); 23 | this.battle = new Set() 24 | } 25 | 26 | async run(msg, { boss }) { 27 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 28 | if (this.battle.has(msg.channel.id)) return msg.say('Only one battle may occur per channel! to prevent spam.') 29 | this.battle.add(msg.channel.id) 30 | 31 | let mob = bosses.find(obj => obj.name === boss.toLowerCase()) 32 | if (!mob) return msg.say('I could not find that boss! check which ones exist with `!bosses`') 33 | if (this.client.profile.get(msg.author.id, "level") < mob.level) return msg.say('To battle this boss you have to be level ') 34 | let bossattack = mob.attacks[Math.floor(Math.random() * mob.attacks.length)] 35 | let mobhealth = mob.health; // mob health 36 | 37 | let myhealth = this.client.profile.get(msg.author.id, "health"); // users health 38 | let mydmg = this.client.profile.get(msg.author.id, "damage") 39 | 40 | 41 | while(myhealth > 1) { 42 | let random3 = Math.floor(Math.random() * 10) 43 | if (random3 < 7) { 44 | console.log(myhealth) 45 | attack(msg, mob, bossattack.attack, bossattack.damage) 46 | myhealth -= bossattack.damage 47 | } else if(random3 == 7) { 48 | heavy(msg, mob, mob.heavy[0].attack, mob.heavy[0].damage) 49 | myhealth -= mob.heavy[0].damage 50 | } else if(random3 > 7) { 51 | miss(msg, mob, bossattack.attack) 52 | } 53 | 54 | if (myhealth < 1) { 55 | lost(msg, mob, mobhealth) 56 | this.battle.delete(msg.channel.id) 57 | return; 58 | } else if(mobhealth < 1) { 59 | win(msg, mob, mob.xp, mob.orbs, this.client) 60 | this.battle.delete(msg.channel.id) 61 | return; 62 | } 63 | msg.channel.send({embed: { 64 | color: 0xf71800, 65 | description: `What do you choose to do? either [attack, heal, run, heavy]\nYour Health: **${myhealth} HP** ‍ ‍ ‍ Mob Health: **${mobhealth}**` 66 | }}) 67 | 68 | const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, { 69 | max: 1, 70 | time: 60000 71 | }); 72 | 73 | if(!msgs.size) { 74 | await msg.channel.send({embed: { 75 | color: 0xf71800, 76 | description: 'Times up! you forgot to pick an option.' 77 | }}) 78 | continue; 79 | } 80 | if (msgs.first().content == "attack") { 81 | let random = Math.floor(Math.random() * 6) 82 | if (random < 3) { 83 | msg.channel.send({embed: { 84 | color: 0xf71800, 85 | description: `Attacked ${mob.name} but the attack has missed!` 86 | }}) 87 | continue; 88 | } else if(random > 3) { 89 | msg.channel.send({embed: { 90 | color: 0xf71800, 91 | description: `Attacked ${mob.name}, dealing ${mydmg} damage!` 92 | }}) 93 | mobhealth -= mydmg 94 | continue; 95 | } 96 | } else if(msgs.first().content == "run") { 97 | run(msg) 98 | this.battle.delete(msg.channel.id) 99 | return; 100 | } else if(msgs.first().content == "heal") { 101 | let arr = this.client.profile.get(msg.author.id, "items") 102 | let potion = arr.findIndex(obj => obj.name == "Health Potion") 103 | if (!arr[potion]) { 104 | msg.say('You do not have any health potions!') 105 | continue; 106 | } 107 | msg.say(`Applied ${arr[potion].type} health potion! +${arr[potion].health} health.`) 108 | myhealth += arr[potion].health 109 | this.client.profile.delete(msg.author.id, `items.${potion}`) 110 | continue; 111 | } else if(msgs.first().content == "heavy") { 112 | let randomfirst = Math.floor(Math.random() * 5) + 1; 113 | let randomize = Math.floor(Math.random(randomfirst) * this.client.profile.get(msg.author.id, "damage")) 114 | 115 | console.log(randomize) 116 | let ifhit = Math.floor(Math.random() * 6) + 1 117 | if (ifhit < 4) { 118 | usermiss(msg, mob.name) 119 | continue; 120 | } else if(ifhit > 4) { 121 | userheavy(msg, mob.name, randomize) 122 | mobhealth -= randomize 123 | continue; 124 | } 125 | } 126 | 127 | } 128 | } 129 | }; 130 | 131 | 132 | function win(msg, boss, xp, orbs, client) { 133 | let embed = new RichEmbed() 134 | .setTitle(`${boss.name} was defeated!`) 135 | .addField(`Orbs Won 🔮`, '**' + orbs + '**') 136 | .addField('XP Won 🎆', '**' + xp + '**') 137 | .addField('Weapon Won 💠', boss.weapon) 138 | .setColor("RANDOM") 139 | msg.embed(embed) 140 | 141 | let weaponid = client.util.get(client.user.id, "weaponids") 142 | client.profile.push(msg.author.id, { id: weaponid + 1, name: boss.weapon, health: 0, damage: boss.damage, type: boss.type }, "weapons") 143 | client.util.inc(client.user.id, "weaponids") 144 | client.profile.math(msg.author.id, "+", xp, "orbs") 145 | client.profile.math(msg.author.id, "+", orbs, "levelpoints") 146 | } 147 | 148 | function run(msg) { 149 | msg.channel.send('You ran from the battle!') 150 | } 151 | 152 | function attack(msg, boss, attack, dmg) { 153 | msg.channel.send({embed: { 154 | color: 0xf71800, 155 | description: `${boss.name} used \`${attack}\`! it dealt **${dmg}**.` 156 | }}) 157 | } 158 | 159 | function userheavy(msg, boss, dmg) { 160 | msg.channel.send({embed: { 161 | color: 0xf71800, 162 | description: `You hit ${boss} with a heavy! it deals **${dmg}** damage!` 163 | }}) 164 | } 165 | 166 | function heavy(msg, boss, heavy, dmg) { 167 | msg.channel.send({embed: { 168 | color: 0xf71800, 169 | description: `${boss.name} hits you with \`${heavy}[heavy]\`! it dealt **${dmg}**` 170 | }}) 171 | } 172 | 173 | function miss(msg, boss, attack) { 174 | msg.channel.send({embed: { 175 | color: 0xf71800, 176 | description: `${boss.name} hits you with \`${attack}\`! but it missed. ` 177 | }}) 178 | } 179 | 180 | function usermiss(msg, boss) { 181 | msg.channel.send({embed: { 182 | color: 0xf71800, 183 | description: `You used your heavy attack against ${boss}! but it missed. ` 184 | }}) 185 | } 186 | 187 | function lost(msg, boss, health) { 188 | let embed = new RichEmbed() 189 | .setTitle('Boss Battle Lost!') 190 | .setDescription(`You lost the boss battle to ${boss.name} with **${health}** HP left, level up and earn more weapons to beat it and try again later.`) 191 | .setColor("RANDOM") 192 | msg.embed(embed) 193 | } -------------------------------------------------------------------------------- /commands/roleplay/buy-worker.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class BuyWorkerCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'buy-worker', 9 | group: 'roleplay', 10 | memberName: 'buy-worker', 11 | description: 'Buy a worker.', 12 | examples: ['buy-worker'] 13 | }); 14 | } 15 | 16 | run(msg) { 17 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 18 | 19 | let x = this.client.profile.get(`${msg.author.id}`, "workers") 20 | let price; 21 | 22 | if (x.length >= 0 && x.length <= 1) { 23 | price = 50000 24 | if (this.client.profile.get(`${msg.author.id}`, "orbs") < price) return msg.say('You do not have enough orbs to buy this. you need **' + price + '$**') 25 | this.client.profile.push(msg.author.id, {number: x.length + 1, level: 1}, "workers"); 26 | this.client.profile.math(`${msg.author.id}`, "-", price, "orbs") 27 | msg.say(`**${msg.author.tag}**, you successfully bought \`1\` worker!`) 28 | return; 29 | } else if(x.length >= 2 && x.length <= 3) { 30 | price = 1000000 31 | if (this.client.profile.get(`${msg.author.id}`, "orbs") < price) return msg.say('You do not have enough orbs to buy this. you need **' + price + '$**') 32 | this.client.profile.push(msg.author.id, {number: x.length + 1, level: 1}, "workers"); 33 | this.client.profile.math(`${msg.author.id}`, "-", price, "orbs") 34 | msg.say(`**${msg.author.tag}**, you successfully bought \`1\` worker!`) 35 | return; 36 | } else if (x.length >= 4 && x.length <= 6) { 37 | price = 3000000 38 | if (this.client.profile.get(`${msg.author.id}`, "orbs") < price) return msg.say('You do not have enough orbs to buy this. you need **' + price + '$**') 39 | this.client.profile.push(msg.author.id, {number: x.length + 1, level: 1}, "workers"); 40 | this.client.profile.math(`${msg.author.id}`, "-", price, "orbs") 41 | msg.say(`**${msg.author.tag}**, you successfully bought \`1\` worker!`) 42 | return; 43 | } 44 | } 45 | }; -------------------------------------------------------------------------------- /commands/roleplay/buy.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class BuyCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'buy', 9 | group: 'roleplay', 10 | memberName: 'buy', 11 | aliases: ["purchase"], 12 | description: 'buy an item from the marketplace.', 13 | examples: ['buy'], 14 | args: [ 15 | { 16 | key:"item", 17 | type:"integer", 18 | prompt:"Which item would you like to buy? give me the ID." 19 | } 20 | ] 21 | }); 22 | } 23 | 24 | async run(msg, { item } ) { 25 | 26 | let arr = this.client.marketplace.get(this.client.user.id, "items") 27 | let data = arr.findIndex(obj => obj.id === item) 28 | if (!data.length) return msg.say('I could not find an item with that ID!') 29 | console.log(data) 30 | 31 | if (this.client.profile.get(msg.author.id, "orbs") < arr[data].price) return msg.say('You need **' + this.client.profile.get(msg.author.id, "orbs") - arr[data].price + '** orbs more to buy this.') 32 | msg.say(`Are you sure about buying **${arr[data].name}** with the ID of **${arr[data].id}** for **${arr[data].price}** Orbs? (**Yes or **No**)`) 33 | const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, { 34 | max: 1, 35 | time: 30000, 36 | }) 37 | 38 | if (!msgs.size) return msg.say('You did not respond withing 30 seconds, cancelled purchase.') 39 | if (msgs.first().content !== "yes") return msg.say('Cancelled purchase.') 40 | if (arr[data].health === undefined) arr[data].health = 0; 41 | if (arr[data].damage === undefined) arr[data].damage = 0; 42 | msg.say(`You bought **${arr[data].name}**, it has been transfered to ur inventory!`) 43 | 44 | this.client.profile.math(arr[data].author, "+", arr[data].price, "orbs") 45 | this.client.profile.push(msg.author.id, { id: arr[data].id, name: arr[data].name, damage: arr[data].damage, health: arr[data].health, type: arr[data].type}) 46 | this.client.profile.math(msg.author.id, "-", arr[data].price, "orbs") 47 | this.client.marketplace.delete(this.client.user.id, `items.${arr[data]}`) 48 | } 49 | }; -------------------------------------------------------------------------------- /commands/roleplay/collect.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | 6 | module.exports = class CollectCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'collect', 10 | group: 'roleplay', 11 | memberName: 'collect', 12 | description: 'Collect money from your workers.', 13 | examples: ['collect'] 14 | }); 15 | } 16 | 17 | run(msg) { 18 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 19 | 20 | let slaves = this.client.profile.get(msg.author.id, "workers") 21 | if (!slaves.length) return msg.say('You have no workers.') 22 | 23 | var user = this.client.profile.get(msg.author.id); 24 | if ((user.lastCollected + 60000) > Date.now()) return msg.say(`You must wait ${(((user.lastCollected + 60000) - Date.now()) / 1000).toFixed(0)}s before using this command again!`); 25 | 26 | var earned = (Number(user.workers.map(i => i.level * 2 / 1.33).reduce((a, b) => a + b, 0).toFixed(2))) * ((Date.now() / 1000 / 60).toFixed(0) - (user.lastCollected / 1000 / 60).toFixed(0)); 27 | if (isNaN(earned)) earned = 0; 28 | 29 | this.client.profile.math(`${msg.author.id}`, "+", earned, "orbs") 30 | this.client.profile.set(`${msg.author.id}`, Date.now(), "lastCollected") 31 | 32 | let embed = new RichEmbed() 33 | .setTitle(`Income! 📬`) 34 | .setDescription(`You've successfully collected \`${earned} 🔮\` from your worker(s)!`) 35 | .setColor("RANDOM") 36 | msg.embed(embed) 37 | } 38 | }; -------------------------------------------------------------------------------- /commands/roleplay/marketplace-search.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js'); 5 | 6 | module.exports = class MarketplaceSearchCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'marketplace-search', 10 | group: 'roleplay', 11 | memberName: 'marketplace-search', 12 | aliases: ["market-search", "marketsearch"], 13 | description: 'Searches marketplace for your item.', 14 | examples: ['marketplace-search'], 15 | args: [ 16 | { 17 | key:"item", 18 | prompt:"Which item would you like to search for?", 19 | type:"string", 20 | } 21 | ] 22 | }); 23 | } 24 | 25 | run(msg, { item }) { 26 | let arr = this.client.marketplace.get(`${this.client.user.id}`, "items"); 27 | let sorted = arr.filter(i => i.name.startsWith(item)); 28 | console.log(sorted); 29 | 30 | let embed = new RichEmbed() 31 | .setTitle(`Market! 💹`) 32 | .setDescription(sorted.map(i => `**${i.name}**| **ID: ${i.id}**| **Price: ${i.price}**| **Damage: ${i.damage}**| **Health: ${i.health}**| **Author:** __${this.client.users.get(i.author).tag}__`).join("\n")) 33 | .setFooter(`To view another page, do !page | To buy an item, do !buy `) 34 | .setColor("RANDOM") 35 | msg.embed(embed); 36 | } 37 | }; -------------------------------------------------------------------------------- /commands/roleplay/marketplace.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command, util } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js'); 5 | 6 | module.exports = class MarketplaceCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'market', 10 | group: 'roleplay', 11 | aliases: ["marketplace"], 12 | memberName: 'market', 13 | description: 'Shows market, what u can buy.', 14 | examples: ['market'], 15 | args: [ 16 | { 17 | key:"page", 18 | type:"integer", 19 | prompt:"Which page would you like to view?", 20 | default: 1 21 | } 22 | 23 | ] 24 | }); 25 | } 26 | 27 | run(msg, { page } ) { 28 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 29 | 30 | this.client.marketplace.ensure(this.client.user.id, { 31 | items: [], 32 | }) 33 | 34 | let arr = this.client.marketplace.get(`${this.client.user.id}`, "items") 35 | const paginated = util.paginate(arr, page, Math.floor(20)); 36 | 37 | let data = paginated.items 38 | let embed = new RichEmbed() 39 | .setTitle(`Market! 💹`) 40 | .setDescription(data.map(i => `**${i.name}**| **ID: ${i.id}**| **Price: ${i.price}**| **Damage: ${i.damage}**| **Health: ${i.health}**| **Author:** __${this.client.users.get(i.author).tag}__`).join("\n")) 41 | .setFooter(`To view another page, do !page | To buy an item, do !buy `) 42 | .setColor("RANDOM") 43 | msg.embed(embed) 44 | } 45 | }; -------------------------------------------------------------------------------- /commands/roleplay/open.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const { RichEmbed } = require('discord.js') 5 | 6 | module.exports = class OpenCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'open', 10 | group: 'roleplay', 11 | memberName: 'open', 12 | description: 'Open a crate and get rewards.', 13 | examples: ['open'], 14 | args: [ 15 | { 16 | key:"crate", 17 | type:"string", 18 | prompt:"Which crate would you like to open?", 19 | } 20 | ] 21 | }); 22 | } 23 | 24 | run(msg, { crate }) { 25 | if (this.client.profile.get(msg.author.id, "started") == "no") return msg.say('You have not started your adventure, use `!start`.') 26 | 27 | let arr = this.client.profile.get(msg.author.id, "items") 28 | let data = arr.findIndex(obj => obj.type === crate.toLowerCase()) 29 | console.log(data) 30 | 31 | if (data === undefined) return msg.say(`You do not own any of these crates.`) 32 | 33 | let embed = new RichEmbed() 34 | .setTitle(`Unlocking ${crate} 🌀`) 35 | .setDescription('***...***') 36 | .setColor("RANDOM") 37 | let items = arr[data].rewards[Math.floor(Math.random() * arr[data].rewards.length)] 38 | 39 | msg.embed(embed).then(message => { 40 | setTimeout(() => { 41 | let embed2 = new RichEmbed() 42 | .setTitle(`Unlocked ${items.type} 🌀`) 43 | .setDescription(`**Name:** ${items.name}\n**Damage:** ${items.damage}\n**Health:** ${items.health}\n**Type:** ${items.type}`) 44 | .setColor("RANDOM") 45 | message.edit(embed2) 46 | }, 5000); 47 | }) 48 | 49 | if (items.health === undefined) items.health = 0; 50 | if (items.damage === undefined) items.damage = 0; 51 | 52 | let weaponid = this.client.util.get(this.client.user.id, "weaponids") 53 | 54 | this.client.profile.push(msg.author.id, { id: weaponid + 1, name: items.name, health: items.health, damage: items.damage, type: items.type }, "weapons") 55 | this.client.util.math(msg.author.id, "+", 1, "weaponids") 56 | this.client.profile.delete(msg.author.id, `items.${arr[data]}`) 57 | } 58 | }; -------------------------------------------------------------------------------- /commands/roleplay/petbuy.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | const arr = require('../../json/pets') 5 | 6 | module.exports = class PetBuyCommand extends Command { 7 | constructor(client) { 8 | super(client, { 9 | name: 'petbuy', 10 | group: "roleplay", 11 | aliases: ["buy-pet", "buypet", "pet-buy"], 12 | memberName: 'petbuy', 13 | description: 'Buy a pet from the pet shop.', 14 | examples: ['petbuy'], 15 | args: [ 16 | { 17 | key:"pet", 18 | type:"string", 19 | prompt:"What's the name of the pet you want to buy? [case sensitive]" 20 | } 21 | ] 22 | }); 23 | } 24 | 25 | async run(msg, { pet }) { 26 | 27 | let data = arr.findIndex(obj => obj.name === pet) 28 | if (data < 0) return msg.say('I could not find that pet, make sure you entered the name correctly (case sensitive).') 29 | 30 | if (this.client.profile.get(msg.author.id, "orbs") < arr[data].price) return msg.say(arr[data].price + ' orbs required to purchase this pet!') 31 | 32 | msg.say(`Are you sure about buying the pet **${arr[data].name}**?`) 33 | const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, { 34 | max: 1, 35 | time: 30000, 36 | }) 37 | 38 | if (!msgs.size) return msg.say('You did not respond with yes or no withing 30 seconds. cancelled purchase.') 39 | if (msgs.first().content !== "yes") return msg.say('Cancelled purchase.') 40 | 41 | this.client.util.math(this.client.user.id, "+", 1, "weaponids") 42 | msg.say('You purchased the pet **' + arr[data].name + `(${arr[data].type})**!`) 43 | 44 | this.client.profile.math(msg.author.id, "-", arr[data].price, "orbs") 45 | this.client.profile.push(msg.author.id, { id: this.client.util.get(this.client.user.id, "weaponids"), name: arr[data].name, damage: arr[data].damage, type: arr[data].type, img: arr[data].img, level: arr[data].level, evolution: arr[data].evolution, thing: arr[data].thing }, "pets") 46 | this.client.util.math(this.client.user.id, "+", 1, "weaponids") 47 | } 48 | }; -------------------------------------------------------------------------------- /commands/roleplay/petshop.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command, util } = require('discord.js-commando'); 4 | const pets = require('../../json/pets') 5 | const { RichEmbed } = require('discord.js') 6 | 7 | module.exports = class PetShopCommand extends Command { 8 | constructor(client) { 9 | super(client, { 10 | name: 'petshop', 11 | group: 'roleplay', 12 | memberName: 'petshop', 13 | aliases: ["pet-shop"], 14 | description: 'Shows the pet shop.', 15 | examples: ['petshop'], 16 | args: [ 17 | { 18 | key:"page", 19 | type:"integer", 20 | prompt:"Which page would you like to view?", 21 | default: 1, 22 | } 23 | ] 24 | }); 25 | } 26 | 27 | run(msg, { page }) { 28 | 29 | let data = util.paginate(pets, page, Math.floor(6)) 30 | 31 | let embed = new RichEmbed() 32 | .setTitle('Pet Shop | Page ' + page) 33 | .setColor("RANDOM") 34 | .setFooter(`To view another page do: !petshop | to buy do !petbuy `) 35 | for (var i = 0; i < data.items.length; i++) { 36 | embed.addField(`${data.items[i].name}`, `Damage: ${data.items[i].damage}\nType: ${data.items[i].type}\nPrice: ${data.items[i].price} 💰\nPreview: [here](${data.items[i].img})`,true) 37 | } 38 | msg.embed(embed) 39 | } 40 | }; -------------------------------------------------------------------------------- /commands/roleplay/start.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const { Command } = require('discord.js-commando'); 4 | 5 | module.exports = class StartCommand extends Command { 6 | constructor(client) { 7 | super(client, { 8 | name: 'start', 9 | group: 'roleplay', 10 | memberName: 'start', 11 | description: 'Start your adventure.', 12 | examples: ['start'], 13 | args: [ 14 | { 15 | type:"string", 16 | oneOf: ["mage", "assassin", "knight", "archer", "thief"], 17 | key:"character", 18 | prompt:"Which class would you like to play as?\nClasses: **Mage**, **Assassin**, **Knight**, **Archer**, **Thief**", 19 | } 20 | ] 21 | }); 22 | } 23 | 24 | run(msg, { character }) { 25 | if (this.client.profile.get(msg.author.id, "started") != "no") return msg.say('You have already started your adventure.') 26 | if (character.toLowerCase() == "mage") this.client.profile.set(msg.author.id, { class: "Mage", type:"staff", ultimate:"blink", message:"Blinks behind the opponent and deals 560 damage", damage: 560}, "character") 27 | if (character.toLowerCase() == "thief") this.client.profile.set(msg.author.id, { class: "Thief", type:"sword", ultimate:"stolen", message:"Uses stolen! sneaks up on the enemy and stabs him in the back! dealing 570 damage", damage: 570}, "character") 28 | if (character.toLowerCase() == "assassin") this.client.profile.set(msg.author.id, { class: "Assassin", type:"sword", ultimate:"blind", message:"Uses blind! throws smoke bombs at the enemy and comes up behind dealing 530 damage", damage: 530}, "character") 29 | if (character.toLowerCase() == "knight") this.client.profile.set(msg.author.id, { class:"Knight", type:"sword", ultimate:"torment", message:"Uses Torment! making 8 cuts in each part of the enemies body! dealing 620 damage.", damage: 620 }, "character") 30 | if (character.toLowerCase() == "archer") this.client.profile.set(msg.author.id, { class:"Archer", type:"bow", ultimate:"rapidfire", message: "Uses Rapid Fire! Fires 200 arrows in 3 seconds dealing 580 damage", damage: 580}, "character") 31 | 32 | let weaponid = this.client.util.get(this.client.user.id, "weaponids") 33 | this.client.util.math(this.client.user.id, "+", 1, "weaponids") 34 | let weapon; 35 | weapon = weaponid + 1; 36 | msg.channel.send('Successfully started your adventure, you have been given a weapon. Equip it with !equip , to get the item id do !inventory') 37 | 38 | if (character.toLowerCase() == "mage") { 39 | mage(msg, this.client, weaponid, weapon) 40 | } else if(character.toLowerCase == "archer") { 41 | archer(msg, this.client, weaponid, weapon) 42 | } else if(character.toLowerCase() == "knight") { 43 | knight(msg, this.client, weaponid, weapon) 44 | } else if(character.toLowerCase() == "assassin") { 45 | assassin(msg, this.client, weaponid, weapon) 46 | } else if(character.toLowerCase() == "thief") { 47 | thief(msg, this.client, weaponid, weapon) 48 | } 49 | 50 | this.client.util.math(this.client.user.id, "+", 3, "weaponids") 51 | this.client.profile.set(msg.author.id, "yes", "started") 52 | } 53 | }; 54 | 55 | 56 | function mage(msg, client, weaponid, weapon) { 57 | client.profile.push(msg.author.id, { id: weaponid, name:"Dreambender", health: 35, damage: 5, type: "staff"}, "weapons") 58 | client.profile.push(msg.author.id, { id: weapon, name: "Frozen Shield", health: 200, damage: 0, type: "shield" }, "weapons") 59 | } 60 | 61 | function archer(msg, client, weaponid, weapon) { 62 | client.profile.push(msg.author.id, { id: weaponid, name:"Valkyrie Bow", health: 0, damage: 9, type: "bow"}, "weapons") 63 | client.profile.push(msg.author.id, { id: weapon, name: "Frozen Shield", health: 200, damage: 0, type: "shield" }, "weapons") 64 | } 65 | 66 | function knight(msg, client, weaponid, weapon) { 67 | client.profile.push(msg.author.id, { id: weaponid, name:"Grieving Blade", health: 0, damage: 10, type: "sword"}, "weapons") 68 | client.profile.push(msg.author.id, { id: weapon, name: "Frozen Shield", health: 200, damage: 0, type: "shield" }, "weapons") 69 | } 70 | 71 | function thief(msg, client, weaponid, weapon) { 72 | client.profile.push(msg.author.id, { id: weaponid, name:"Grieving Blade", health: 0, damage: 23, type: "sword"}, "weapons") 73 | client.profile.push(msg.author.id, { id: weapon, name: "Frozen Shield", health: 120, damage: 0, type: "shield"}, "weapons") 74 | } 75 | 76 | function assassin(msg, client, weaponid, weapon) { 77 | client.profile.push(msg.author.id, { id: weaponid, name:"Grieving Blade", health: 0, damage: 10, type: "sword"}, "weapons") 78 | client.profile.push(msg.author.id, { id: weapon, name: "Cloak of Faded Worlds", health: 230, damage: 0, type: "shield" }, "weapons") 79 | } -------------------------------------------------------------------------------- /json/alchemist.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "holy blast", 4 | "description": "Causes a huge explosion which deals 500 damage.", 5 | "price": 7500, 6 | "damage": 500, 7 | "type": "damage", 8 | "message": "Used holy blast! exploded near enemy deals 500 damage." 9 | }, 10 | { 11 | "name": "thunderstorm", 12 | "description": "Summons a thunderstorm which deals 540 damage", 13 | "price": 9500, 14 | "damage": 540, 15 | "type":"damage", 16 | "message": "Used thunderstorm! lightning strikes was thrown at the enemy dealing 540 damage." 17 | }, 18 | { 19 | "name": "lava flash", 20 | "description": "Summons a lava flood which burns the enemy and deals 620 damage.", 21 | "price": 11000, 22 | "damage": 620, 23 | "type":"damage", 24 | "message": "Used Lava Flash! enemy is burnt & you deal 620 damage." 25 | }, 26 | { 27 | "name":"ceremony of water", 28 | "description": "Water starts circeling you which increases your health by 1200 HP.", 29 | "price": 13000, 30 | "health": 1200, 31 | "type":"heal", 32 | "message": "Used Ceremony of Water! water circles you. Your hp was increased by **1200**." 33 | }, 34 | { 35 | "name":"aura of recovery", 36 | "description":"Your own glowing aura heals you by 2000 HP!", 37 | "price": 16500, 38 | "health": 2000, 39 | "type": "heal", 40 | "message": "An Aura spawns glowing around you. This causes rapid healing which increases your health by **2000** HP." 41 | }, 42 | { 43 | "name": "bolt of demon fire", 44 | "description": "A quick blast but a lot of power! causing 1430 damage.", 45 | "price": 34000, 46 | "damage": 1430, 47 | "type": "damage", 48 | "message": "Fires bolt! hit & caused 1430 damage to opponent." 49 | }, 50 | { 51 | "name":"health potion", 52 | "description": "Heals you in a battle.", 53 | "price": 5000, 54 | "type": "heal", 55 | "health": 1000 56 | }, 57 | { 58 | "name":"xp booster", 59 | "description": "Applies a potion which lasts for 30 minutes giving you double xp.", 60 | "price": 3000, 61 | "time": 1800000, 62 | "type": "xp", 63 | "mark": "booster" 64 | } 65 | ] -------------------------------------------------------------------------------- /json/bosses.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"zeus", 4 | "orbs": 70000, 5 | "xp": 140000, 6 | "damage": 4620, 7 | "health": 5000000, 8 | "attacks": [{"attack": "Bolt", "damage": 5600 }, {"attack": "ThunderStrike", "damage": 3500}, {"attack": "Lightning Strike", "damage": 4000}], 9 | "level": 500, 10 | "type": "bow", 11 | "heavy": [{"heavy": "Lightnings Of Heaven", "damage": 25000}], 12 | "weapon": "Zeus ThunderBolt", 13 | "description": "Zeus was the father of the famous Greek hero Hercules.The name Zeus means [bright] or [sky]. His weapon of choice was the thunderbolt, made for him by the Cyclops." 14 | }, 15 | { 16 | "name":"poseidon", 17 | "orbs": 60000, 18 | "xp": 120000, 19 | "damage": 3405, 20 | "health": 4300000, 21 | "type": "sword", 22 | "level": 450, 23 | "heavy": [{"heavy": "Attack Of The Sea", "damage": 23500}], 24 | "weapon":"Poseidons Trident", 25 | "attacks": [{"attack": "Water Flow", "damage": 3600}, {"attack": "Tsunami", "damage": 2670}, {"attack": "Creatures Of The Sea", "damage": 1950}], 26 | "description": "Poseidon was allotted his dominion after the fall of the Titans. He wielded the trident or three-pronged spear, and this image of him is reflected in art. Poseidon was most notably the God of the sea and the protector of all waters. " 27 | }, 28 | { 29 | "name":"hades", 30 | "orbs": 50000, 31 | "xp": 100000, 32 | "damage": 3100, 33 | "health": 4000000, 34 | "heavy": [{"heavy": "Creatures Of The Night", "damage": 22000}], 35 | "attacks": [{"attack": "Blazing Spear", "damage": 2430}, {"attack":"Roaring Blaze", "damage": 1200}, {"attack":"Bursting Flame", "damage": 2120}], 36 | "weapon": "Hades Bident", 37 | "type": "sword", 38 | "level": 400, 39 | "description": "He was also called the God of Wealth or “the rich one” because he possessed the precious metals of the earth. Hades had a cap or helmet that made its wearer invisible. His wife was Persephone, Demeter’s only daughter, whom he kidnapped and made his queen. also the ruler of the underworld." 40 | }, 41 | { 42 | "name":"apollo", 43 | "orbs": 40000, 44 | "xp": 80000, 45 | "damage": 2540, 46 | "type": "bow", 47 | "health": 1200000, 48 | "attacks": [{ "attack": "Burning Arrow", "damage": 2430 }, { "attack": "Rain Of Arrows", "damage": 3403}, { "attack": "Quick Shot", "damage": 1200}], 49 | "weapon": "Apollo's Bow", 50 | "heavy": [{"heavy": "Rain Of Arrows", "damage": 19500}], 51 | "level": 200, 52 | "description": "Apollo was the son of Leto and Zeus. He was born on the island of Delos. He and his twin sister Artemis, also an Olympian, shared an aptitude for archery.The nine Muses were companions of his; they were goddesses known for inspiring art and music." 53 | }, 54 | { 55 | "name":"ares", 56 | "orbs": 36000, 57 | "type": "sword", 58 | "xp": 75000, 59 | "damage": 2300, 60 | "health": 1000000, 61 | "weapon": "Sword Of Ares", 62 | "heavy": [{"attack": "Burning Ashes", "damage": 19200}], 63 | "level": 175, 64 | "attacks": [{"attack": "Pure Strike", "damage": 2102 }, {"attack": "Slash", "damage": 1820 }, { "attack": "Quivering Blade", "damage": 1405 }], 65 | "description": "He was the son of Zeus and Hera, both of whom hated him (according to Homer). Eros (more commonly known as Cupid) was the child of Ares and Aphrodite. Ares was most notably referred to as the God of War; he represented the unpleasant aspects of battle." 66 | }, 67 | { 68 | "name":"athena", 69 | "orbs": 78000, 70 | "xp": 82000, 71 | "damage": 3020, 72 | "type": "sword", 73 | "health": 1400000, 74 | "level": 225, 75 | "heavy": [{"heavy": "Art of War", "damage": 21200}], 76 | "weapon": "Spear Of Athena", 77 | "attacks": [{"attack": "Blazing Spear", "damage": 2403 }, {"attack": "Spear of Fury", "damage": 1800 }, {"attack": "Disrupting Throw", "damage": 1200 }], 78 | "description": "Athena was the Goddess of War, the female counterpart of Ares. She is one of three virgin goddesses; the other two were Hestia and Artemis.Athena served as a guardian of Athens, where the Parthenon served as her temple." 79 | }, 80 | { 81 | "name":"Hera", 82 | "orbs": 60000, 83 | "xp": 78000, 84 | "level": 235, 85 | "weapon": "Flower Of Love", 86 | "type": "bow", 87 | "heavy": [{"heavy": "Power Of Love", "damage": 18600}], 88 | "description": "Hera was Queen of the Olympian gods. In the story of the Quest of the Golden Fleece, Hera was a gracious protector of the heroes.Hera had few, if any, redeeming qualities. She never forgot an injury.", 89 | "damage": 2300, 90 | "health": 1200000, 91 | "attacks": [{"attack": "Love Rush", "damage": 2120}, {"attack": "Flower Spike", "damage": 1980 }, {"attack": "Confusion Of Love", "damage": 1560}] 92 | } 93 | ] -------------------------------------------------------------------------------- /json/crates.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "crate": "Normal Crate", 4 | "rewards": [ {"name":"Skullforge Katana", "damage": 34, "type": "sword"}, {"name":"Peacekeeper Sword", "damage": 70, "type": "sword"}, {"name":"Isolated Greatsword", "damage": 44, "type": "sword"}, {"name": "The Black Blade", "damage": 58, "type":"sword"}], 5 | "type": "normal" 6 | } 7 | ] -------------------------------------------------------------------------------- /json/mobs10.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"Cyclope", 4 | "orbs": 35, 5 | "xp": 32, 6 | "damage": 27, 7 | "health": 540 8 | }, 9 | { 10 | "name":"Daemons", 11 | "orbs": 30, 12 | "xp": 28, 13 | "damage": 4, 14 | "health": 1230 15 | }, 16 | { 17 | "name":"Gegenees", 18 | "orbs": 34, 19 | "xp": 31, 20 | "damage": 24, 21 | "health": 403 22 | }, 23 | { 24 | "name":"Gorgons", 25 | "orbs": 55, 26 | "xp": 14, 27 | "damage": 22, 28 | "health": 752 29 | }, 30 | { 31 | "name":"Graeae", 32 | "orbs": 36, 33 | "xp": 30, 34 | "damage": 24, 35 | "health": 924 36 | }, 37 | { 38 | "name":"Griffin", 39 | "orbs": 33, 40 | "xp": 31, 41 | "damage": 21, 42 | "health": 643 43 | }, 44 | { 45 | "name":"Hecatonchire", 46 | "orbs": 39, 47 | "xp": 25, 48 | "damage": 19, 49 | "health": 521 50 | }, 51 | { 52 | "name":"Harpies", 53 | "orbs": 14, 54 | "xp": 65, 55 | "damage": 21, 56 | "health": 653 57 | }, 58 | { 59 | "name":"Hippalectryon", 60 | "orbs": 25, 61 | "xp": 25, 62 | "damage": 22, 63 | "health": 451 64 | }, 65 | { 66 | "name":"Hippocampus", 67 | "orbs": 22, 68 | "xp": 43, 69 | "damage": 23, 70 | "health": 432 71 | } 72 | ] -------------------------------------------------------------------------------- /json/mobs16.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"Ichthyocentaur", 4 | "orbs": 65, 5 | "xp": 54, 6 | "damage": 89, 7 | "health": 870 8 | }, 9 | { 10 | "name":"Ipotane", 11 | "orbs": 58, 12 | "xp": 47, 13 | "damage": 70, 14 | "health": 800 15 | }, 16 | { 17 | "name":"Keres", 18 | "orbs": 70, 19 | "xp": 65, 20 | "damage": 65, 21 | "health": 750 22 | }, 23 | { 24 | "name":"Laestrygonians", 25 | "orbs": 49, 26 | "xp": 45, 27 | "damage": 55, 28 | "health": 900 29 | }, 30 | { 31 | "name":"Manticore", 32 | "orbs": 55, 33 | "xp": 65, 34 | "damage": 53, 35 | "health": 820 36 | }, 37 | { 38 | "name":"Minotaur", 39 | "orbs": 140, 40 | "xp": 170, 41 | "damage": 102, 42 | "health": 940 43 | }, 44 | { 45 | "name":"Odontotyrannos", 46 | "orbs": 100, 47 | "xp": 120, 48 | "damage": 89, 49 | "health": 920 50 | }, 51 | { 52 | "name":"Ophiotaurus", 53 | "orbs": 240, 54 | "xp": 170, 55 | "damage": 134, 56 | "health": 990 57 | } 58 | ] -------------------------------------------------------------------------------- /json/mobs5.json: -------------------------------------------------------------------------------- 1 | 2 | [ 3 | { 4 | "name":"Catoblepas", 5 | "orbs": 10, 6 | "xp": 12, 7 | "damage": 12, 8 | "health": 70 9 | 10 | }, 11 | { 12 | "name": "Centaur", 13 | "orbs": 14, 14 | "xp": 16, 15 | "damage": 16, 16 | "health": 132 17 | 18 | }, 19 | { 20 | "name": "Kentauride", 21 | "orbs": 18, 22 | "xp": 20, 23 | "damage": 20, 24 | "health": 120 25 | 26 | }, 27 | { 28 | "name": "Cerastes", 29 | "orbs": 22, 30 | "xp": 24, 31 | "damage": 24, 32 | "health": 150 33 | 34 | }, 35 | { 36 | "name": "Cetus", 37 | "orbs": 24, 38 | "xp": 26, 39 | "damage": 26, 40 | "health": 2404 41 | }, 42 | { 43 | "name": "Ceuthonymus", 44 | "orbs": 20, 45 | "xp": 21, 46 | "damage": 21, 47 | "health": 160 48 | 49 | }, 50 | { 51 | "name": "Charon", 52 | "orbs": 24, 53 | "xp": 20, 54 | "damage": 20, 55 | "health": 160 56 | 57 | }, 58 | { 59 | "name": "Charybdis", 60 | "orbs": 19, 61 | "xp": 16, 62 | "damage": 16, 63 | "health": 100 64 | 65 | }, 66 | { 67 | "name": "Chimera", 68 | "orbs": 14, 69 | "xp": 13, 70 | "damage": 13, 71 | "health": 100 72 | 73 | }, 74 | { 75 | "name": "Crocotta", 76 | "orbs": 23, 77 | "xp": 26, 78 | "damage": 26, 79 | "health": 160 80 | 81 | } 82 | ] -------------------------------------------------------------------------------- /json/pets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name":"Flameshadow", 4 | "damage": 34, 5 | "type": "dragon", 6 | "img": "https://cdn.playbuzz.com/cdn/4165c285-a228-4799-8920-2315d2bace19/cb0ec50d-e213-47aa-893a-39a9c39028a6.jpg", 7 | "level": 1, 8 | "thing": "pet", 9 | "evolution": 1, 10 | "price": 8900 11 | }, 12 | { 13 | "name":"Dust Serpent", 14 | "damage": 45, 15 | "type": "serpent", 16 | "price":9300, 17 | "thing": "pet", 18 | "img": "http://corwyn.wdfiles.com/local--files/serpent-folk/Serpent%20Folk.jpg", 19 | "level": 1, 20 | "evolution": 1 21 | }, 22 | { 23 | "name":"Toxinwing", 24 | "damage": 55, 25 | "thing": "pet", 26 | "type": "eagle", 27 | "price": 10000, 28 | "img": "https://png.pngtree.com/element_origin_min_pic/16/09/01/2257c8410f8e377.jpg", 29 | "level": 1, 30 | "evolution": 1 31 | }, 32 | { 33 | "name":"Shadowflayer", 34 | "damage": 70, 35 | "price":10500, 36 | "thing": "pet", 37 | "type": "eagle", 38 | "img": "https://vignette.wikia.nocookie.net/amanecer-rojo/images/5/57/Grifo.png/revision/latest?cb=20180429020739&path-prefix=es", 39 | "level": 1, 40 | "evolution": 1 41 | }, 42 | { 43 | "name":"Phantom", 44 | "damage": 89, 45 | "thing": "pet", 46 | "type": "ghost", 47 | "price": 11000, 48 | "img": "https://vignette.wikia.nocookie.net/castleage/images/b/ba/Monster_phantom_fire_large_dead.jpg/revision/latest?cb=20161026221041", 49 | "level": 1, 50 | "evolution": 1 51 | }, 52 | { 53 | "name":"Hell slayer", 54 | "damage": 102, 55 | "price": 12000, 56 | "thing": "pet", 57 | "type": "demon", 58 | "img": "https://cache.desktopnexus.com/thumbseg/154/154597-bigthumbnail.jpg", 59 | "level": 1, 60 | "evolution": 1 61 | }, 62 | { 63 | "name":"Devil's sergeant", 64 | "damage": 206, 65 | "thing": "pet", 66 | "type": "demon", 67 | "price":17500, 68 | "img": "https://i.pinimg.com/originals/4b/ea/b8/4beab82f2bcd6f72cfb0907642c36d4a.jpg", 69 | "level": 1, 70 | "evolution": 1 71 | } 72 | ] -------------------------------------------------------------------------------- /json/trivias.json: -------------------------------------------------------------------------------- 1 | 2 | [ 3 | { 4 | "question": "How much does the world's smallest phone weigh?", 5 | "answer": "13 grams", 6 | "answers": ["11 grams", "13 grams", "15 grams", "20 grams"], 7 | "topic": "facts" 8 | }, 9 | { 10 | "question": "Orcinus orca is the scientific name for which animal?", 11 | "answer": "Killer Whale", 12 | "answers": ["Lion", "Killer Whale", "Blue Whale", "Dolphin"], 13 | "topic": "Animal" 14 | }, 15 | { 16 | "question": "Which bird has eyes that are larger than its brain?", 17 | "answer": "Ostrich", 18 | "answers": ["Chaffinch", "Blackbird", "Collared Dove", "Ostrich"], 19 | "topic": "Animal" 20 | }, 21 | { 22 | "question": "What is the only snake in the world that builds a nest for its eggs?", 23 | "answer": "King Cobra", 24 | "answers": ["Black Snake", "Bull Snake", "King Cobra", "Cobra"], 25 | "topic": "Animal" 26 | }, 27 | { 28 | "question": "What does the online acronym SMH stand for?", 29 | "answer": "Shaking my head", 30 | "answers": ["Shaking my head", "Smash my head", "Scratching my head", "Slow my head"], 31 | "topic": "computer" 32 | }, 33 | { 34 | "question": "What was the first publicly traded U.S. company to reach a $1 trillion market cap?", 35 | "answer": "Apple", 36 | "answers": ["Apple", "Android", "Nokia", "FaceBook"], 37 | "topic": "computer" 38 | }, 39 | { 40 | "question": "What year did the Spanish Civil War end?", 41 | "answer": "1939", 42 | "answers": ["1939", "1924", "1976", "1892"], 43 | "topic": "history" 44 | }, 45 | { 46 | "question": "When did the First World War start?", 47 | "answer": "1914", 48 | "answers": ["1914", "1945", "1935", "1912"], 49 | "topic": "history" 50 | }, 51 | { 52 | "question": "What does the roman numeral C represent?", 53 | "answer": "100", 54 | "answers": ["50", "100", "540", "200"], 55 | "topic": "math" 56 | }, 57 | { 58 | "question": "When did the American Civil War end?", 59 | "answer": "1865", 60 | "answers": ["1843", "1865", "1892", "1901"], 61 | "topic": "history" 62 | }, 63 | { 64 | "question": "Who said E=mc2", 65 | "answer": "Einstein", 66 | "answers": ["Einstein", "Nikolas Tesla", "Isaac Newton", "Shakespeare"], 67 | "topic": "history" 68 | }, 69 | { 70 | "question": "Which is the largest ocean?", 71 | "answer": "Pacific", 72 | "answers": ["Ocean", "Pacific", "Atlanta", "Black Sea"], 73 | "topic": "geography" 74 | }, 75 | { 76 | "question": "How many squares are there on a chess board?", 77 | "answer": "64", 78 | "answers": ["32", "16", "64", "12"], 79 | "topic": "facts" 80 | }, 81 | { 82 | "question": "How many prongs are there on a fork?", 83 | "answer": "4", 84 | "answers": ["4", "8", "16", "12"], 85 | "topic": "facts" 86 | }, 87 | { 88 | "question": "How many events are there in the decathlon?", 89 | "answer": "10", 90 | "answers": ["10", "12", "24", "64"], 91 | "topic": "facts" 92 | }, 93 | { 94 | "question": "What language has the most words?", 95 | "answer": "English", 96 | "answers": ["English", "Spanish", "Italian", "Portugese"], 97 | "topic": "facts" 98 | }, 99 | { 100 | "question": "What nationality was Marco Polo?", 101 | "answer": "Italian", 102 | "answers": ["Italian", "Mongolian", "Spanish", "Moroccan"], 103 | "topic": "history" 104 | }, 105 | { 106 | "question": "Which city's landmarks include: The Pantheon, The Spanish Steps and Trevi Fountain?", 107 | "answer": "Rome", 108 | "answers": ["Barcelona", "Rome", "Athens", "Istanbul"], 109 | "topic": "facts" 110 | }, 111 | { 112 | "question": "Which truck is produced by the Ford Motor Company?", 113 | "answer": "F-150", 114 | "answers": ["F-150", "Silverado 1500", "RAV4", "CR-V"], 115 | "topic": "cars" 116 | }, 117 | { 118 | "question": "What temperature is the same in Celsius and Fahrenheit?", 119 | "answer": "-40°", 120 | "answers": ["+100°", "+40°", "-40°", "0°"], 121 | "topic": "facts" 122 | }, 123 | { 124 | "question": "Which actor does not appear in 'Saving Private Ryan'?", 125 | "answer": "Ralph Fiennes", 126 | "answers": ["Giovanni Ribisi", "Tom Hanks", "Vin Diesel", "Ralph Fiennes"], 127 | "topic": "facts" 128 | }, 129 | { 130 | "question": "Other than eggs, what is a primary ingredient in Eggs Florentine?", 131 | "answer": "Spinach", 132 | "answers": ["Gorgonzola", "Ham", "Avocado", "Spinach"], 133 | "topic": "facts" 134 | }, 135 | { 136 | "question": "Which mammal first reached Earth's orbit alive?", 137 | "answer": "Dog", 138 | "answers": ["Dog", "Cat", "Human", "Monkey"], 139 | "topic": "history" 140 | }, 141 | { 142 | "question": "What religion is the most practiced one in India?", 143 | "answer": "Hinduism", 144 | "answers": ["Shinto", "Islam", "Sikhism", "Hinduism"], 145 | "topic": "facts" 146 | }, 147 | { 148 | "question": "In which language was the book 'War and Peace' originally written?", 149 | "answer": "Russian", 150 | "answers": ["English", "German", "French", "Russian"], 151 | "topic": "facts" 152 | }, 153 | { 154 | "question": "How many blue stripes does the United States of America national flag have?", 155 | "answer": "0", 156 | "answers": ["13", "7", "6", "0"], 157 | "topic": "facts" 158 | }, 159 | { 160 | "question": "What is the largest country, by area, that has only one time zone?", 161 | "answer": "China", 162 | "answers": ["China", "Turkey", "Australia", "Russia"], 163 | "topic": "facts" 164 | }, 165 | { 166 | "question": "What is the largest planet in our Solar System?", 167 | "answer": "Jupiter", 168 | "answers": ["Pluto", "Saturn", "Jupiter", "Earth"], 169 | "topic": "space" 170 | }, 171 | { 172 | "question": "Which country hosted the Summer Olympics in 2016?", 173 | "answer": "Brazil", 174 | "answers": ["China", "Brazil", "Spain", "Greece"], 175 | "topic": "facts" 176 | }, 177 | { 178 | "question": "How many spaces are on a standard Monopoly board?", 179 | "answer": "40", 180 | "answers": ["20", "40", "80", "60"], 181 | "topic": "facts" 182 | }, 183 | { 184 | "question": "What did Alfred Nobel develop?", 185 | "answer": "Dynamite", 186 | "answers": ["Dynamite", "Nobelium", "Atomic Bomb", "Gunpowder"], 187 | "topic": "facts" 188 | }, 189 | { 190 | "question": "What was the first successful vaccine developed in history?", 191 | "answer": "Smallpox", 192 | "answers": ["Scarlet Fever", "Cholera", "Rabies", "Smallpox"], 193 | "topic": "history" 194 | }, 195 | { 196 | "question": "Adele performed the theme song to which James Bond film?", 197 | "answer": "Skyfall", 198 | "answers": ["Skyfall", "Quantum of Solace", "From Russia With Love", "Casino Royale"], 199 | "topic": "movie" 200 | }, 201 | { 202 | "question": "What is the color of Donald Duck's bowtie?", 203 | "answer": "Red", 204 | "answers": ["Red", "Yellow", "Green", "Blue"], 205 | "topic": "facts" 206 | } 207 | ] 208 | -------------------------------------------------------------------------------- /json/weapon10.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Polished Steel Sword", 4 | "damage": 32, 5 | "type": "sword" 6 | }, 7 | { 8 | "name": "Lightbringer", 9 | "damage": 34, 10 | "type": "sword" 11 | }, 12 | { 13 | "name": "Gladiator's Broadsword", 14 | "damage": 30, 15 | "type": "sword" 16 | }, { 17 | "name": "Battleworn Broadsword", 18 | "damage": 29, 19 | "type": "sword" 20 | }, 21 | { 22 | "name": "Dire Silver Spellblade", 23 | "damage": 34, 24 | "type": "sword" 25 | }, 26 | { 27 | "name": "Cold-Forged Silver Katana", 28 | "damage": 28, 29 | "type": "sword" 30 | }, 31 | { 32 | "name": "Shadow Silk Chestplate", 33 | "damage": 0, 34 | "health": 150, 35 | "type": "chestplate" 36 | }, 37 | { 38 | "name": "Wit of Dawn Chestplate", 39 | "damage": 0, 40 | "health": 179, 41 | "type": "chestplate" 42 | }, 43 | { 44 | "name": "Cursed Ivory Leggings", 45 | "damage": 0, 46 | "health": 80, 47 | "type": "leggings" 48 | }, 49 | { 50 | "name": "Leggings of Infinite Sorrow", 51 | "damage": 0, 52 | "health": 109, 53 | "type": "leggings" 54 | }, 55 | { 56 | "name": "Warrior's Demon Boots", 57 | "damage": 0, 58 | "health": 45, 59 | "type": "boots" 60 | }, 61 | { 62 | "name": "Baneful Quilted Boots", 63 | "damage": 0, 64 | "health": 60, 65 | "type": "boots" 66 | }, 67 | { 68 | "name": "Helmet of the Frozen Illusions", 69 | "damage": 0, 70 | "health": 40, 71 | "type": "helmet" 72 | } 73 | ] -------------------------------------------------------------------------------- /json/weapon16.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "The Royal Necklace", 4 | "damage": 74, 5 | "health": 182, 6 | "type": "necklace" 7 | }, 8 | { 9 | "name": "Diamond Necklace", 10 | "damage": 92, 11 | "health": 156, 12 | "type": "necklace" 13 | }, 14 | { 15 | "name": "Soul Reaper", 16 | "damage": 58, 17 | "health": 1, 18 | "type": "sword" 19 | }, 20 | { 21 | "name": "Fearful Slicer", 22 | "damage": 60, 23 | "type": "sword" 24 | }, 25 | { 26 | "name": "Wretched Mageblade", 27 | "damage": 63, 28 | "type": "sword" 29 | }, 30 | { 31 | "name": "Mournblade", 32 | "damage": 54, 33 | "type": "sword" 34 | }, 35 | { 36 | "name": "Ghostly Iron Shortsword", 37 | "damage": 59, 38 | "type": "sword" 39 | }, 40 | { 41 | "name": "Blazing Fury", 42 | "damage": 78, 43 | "type": "sword" 44 | }, 45 | { 46 | "name": "Yew Bow", 47 | "damage": 26, 48 | "health": 56, 49 | "type": "bow" 50 | }, 51 | { 52 | "name": "Maple Warbow", 53 | "damage": 23, 54 | "health": 52, 55 | "type": "bow" 56 | } 57 | ] -------------------------------------------------------------------------------- /json/weapon5.json: -------------------------------------------------------------------------------- 1 | 2 | 3 | [ 4 | { 5 | "name": "Anger's Tear", 6 | "damage": 10, 7 | "type": "sword" 8 | 9 | }, 10 | { 11 | "name": "Sinister Sabre", 12 | "damage": 15, 13 | "type": "sword" 14 | 15 | }, 16 | { 17 | "name": "Phantom Warblade", 18 | "damage": 25, 19 | "type": "sword" 20 | }, 21 | { 22 | "name":"Nethersbane Blade", 23 | "damage": 20, 24 | "type": "sword" 25 | }, 26 | { 27 | "name":"Skullforge Katana", 28 | "damage": 30, 29 | "type": "sword" 30 | }, 31 | { 32 | "name":"Lusting Gold Warblade", 33 | "damage": 22, 34 | "type": "sword" 35 | }, 36 | { 37 | "name":"Desire's Warblade", 38 | "damage": 24, 39 | "type": "sword" 40 | 41 | }, 42 | { 43 | "name":"Shadowfang", 44 | "damage": 21, 45 | "type": "sword" 46 | 47 | }, 48 | { 49 | "name":"Singing Spellblade", 50 | "damage": 26, 51 | "type": "sword" 52 | 53 | } 54 | ] -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rpgbot", 3 | "version": "0.8.7", 4 | "description": "A Discord bot with a few useful roleplay commands, made with Discord.js.", 5 | "main": "RPGBot.js", 6 | "scripts": { 7 | "start": "node RPGBot.js" 8 | }, 9 | "repository": "git+https://github.com/Shinmercy/rpgbot.git", 10 | "bugs": { 11 | "url": "https://github.com/Shinmercy/rpgbot/issues" 12 | }, 13 | "homepage": "https://github.com/Shinmercy/rpgbot#readme", 14 | "engines": { 15 | "node": ">=12" 16 | }, 17 | "author": "Shin#0484", 18 | "license": "MIT", 19 | "dependencies": { 20 | "common-tags": "^1.8.0", 21 | "discord.js": "^12.2.0", 22 | "discord.js-commando": "^0.10.0", 23 | "dotenv": "^8.2.0", 24 | "enmap": "^5.2.5", 25 | "path": "^0.12.7" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /util/jack.js: -------------------------------------------------------------------------------- 1 | // Copyright (©) 2020-2021 Shin#0484. All rights reserved. MIT License. 2 | 3 | const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea', 'ya']; 4 | const no = ['no', 'n', 'nah', 'nope', 'nop']; 5 | 6 | module.exports = class Util { 7 | 8 | static shuffle(array) { 9 | const arr = array.slice(0); 10 | for (let i = arr.length - 1; i >= 0; i--) { 11 | const j = Math.floor(Math.random() * (i + 1)); 12 | const temp = arr[i]; 13 | arr[i] = arr[j]; 14 | arr[j] = temp; 15 | } 16 | return arr; 17 | } 18 | 19 | 20 | static async verify(channel, user, time = 30000) { 21 | const filter = res => { 22 | const value = res.content.toLowerCase(); 23 | return res.author.id === user.id && (yes.includes(value) || no.includes(value)); 24 | }; 25 | const verify = await channel.awaitMessages(filter, { 26 | max: 1, 27 | time 28 | }); 29 | if (!verify.size) return 0; 30 | const choice = verify.first().content.toLowerCase(); 31 | if (yes.includes(choice)) return true; 32 | if (no.includes(choice)) return false; 33 | return false; 34 | } 35 | } 36 | --------------------------------------------------------------------------------