Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js')
- const fs = require('fs')
- const Math = require('mathjs')
- function Random_min_max(min, max) {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min +1)) + min;
- }
- var heroList = JSON.parse( fs.readFileSync( "./data-base/hero.json" ) );
- var inventory = JSON.parse(fs.readFileSync("./data-base/inventory.json"));
- module.exports.run = async(client, message, args) => {
- function standard(){
- i=0;
- stars = ":star: " ;
- x = Random_min_max(0,100);
- console.log(x)
- if (x < 70){
- for (i in heroList){
- console.log(heroList[i].stars)
- if (heroList[i].stars === 1){
- let heroEmbed = new Discord.RichEmbed()
- .setTitle(`**Noms :** ${heroList[i].name}`)
- .addField("**Rareté :**",`${stars.repeat(heroList[i].stars)}`)
- .addField(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
- .addField(`**:heart: HP**`,`${heroList[i].HP}`)
- .addField(`**:shield: DEF**`,`${heroList[i].DEF}`)
- .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`)
- .addField(`**:zap: Type**`,`${heroList[i].type}`)
- .setImage(heroList[i].img)
- .setFooter(heroList[i].anime)
- .setColor(heroList[i].couleur)
- .setTimestamp()
- message.channel.send(heroEmbed)
- }
- }
- }else{
- if (x < 95 && x > 70){
- for (i in heroList) {
- if (heroList[i].stars === 2) {
- let heroEmbed = new Discord.RichEmbed()
- .setTitle(`**Noms :** ${heroList[i].name}`)
- .addField("**Rareté :**",`${stars.repeat(heroList[i].stars)}`)
- .addField(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
- .addField(`**:heart: HP**`,`${heroList[i].HP}`)
- .addField(`**:shield: DEF**`,`${heroList[i].DEF}`)
- .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`)
- .addField(`**:zap: Type**`,`${heroList[i].type}`)
- .setImage(heroList[i].img)
- .setFooter(heroList[i].anime)
- .setColor(heroList[i].couleur)
- .setTimestamp()
- message.channel.send(heroEmbed)
- }
- }
- }else{
- for (i in heroList) {
- if (heroList[i].stars === 3) {
- let heroEmbed = new Discord.RichEmbed()
- .setTitle(`**Noms :** ${heroList[i].name}`)
- .addField("**Rareté :**",`${stars.repeat(heroList[i].stars)}`)
- .addField(`**Pouvoir/Arme :**`,`${heroList[i].power}`)
- .addField(`**:heart: HP**`,`${heroList[i].HP}`)
- .addField(`**:shield: DEF**`,`${heroList[i].DEF}`)
- .addField(`**:crossed_swords: ATK**`,`${heroList[i].ATK}`)
- .addField(`**:zap: Type**`,`${heroList[i].type}`)
- .setImage(heroList[i].img)
- .setFooter(heroList[i].anime)
- .setColor(heroList[i].couleur)
- .setTimestamp()
- message.channel.send(heroEmbed)
- }
- }
- }
- }
- }
- for (i in inventory) {
- if (inventory[i].id == message.author.id){
- if (inventory[i].tickets_S != 0){
- inventory[i].tickets_S = inventory[i].tickets_S - 1
- fs.writeFileSync( "./inventory.json", JSON.stringify(inventory, null, 2 ) );
- standard();
- break
- }else{
- message.channel.send("Vous n'avez pas de ticket standard !")
- break
- }
- }else{
- message.channel.send("Merci de taper la commande at!start !")
- }
- }
- };
- module.exports.help = {
- name : "summon"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement