searching of talents aborted prematurely.
This commit is contained in:
@ -7,7 +7,7 @@ module.exports = async (message, args, db) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let level = 8;
|
let level = 8;
|
||||||
let attributename;
|
let attributename;
|
||||||
|
|
||||||
await db.find({
|
await db.find({
|
||||||
user: message.author.tag,
|
user: message.author.tag,
|
||||||
@ -19,14 +19,16 @@ module.exports = async (message, args, db) => {
|
|||||||
message.reply('Sorry, Für dich habe ich keinen Eintrag 😥\n' +
|
message.reply('Sorry, Für dich habe ich keinen Eintrag 😥\n' +
|
||||||
'Bitte gib mir den Attributswert, auf welchen du würfeln möchtest.');
|
'Bitte gib mir den Attributswert, auf welchen du würfeln möchtest.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// try to get id of short formatted attributes.
|
// try to get id of short formatted attributes.
|
||||||
if (args[0].length == 2) {
|
if (args[0].length == 2) {
|
||||||
for (const i in globals.Werte) {
|
for (const i in globals.Werte) {
|
||||||
if (globals.Werte[i].kuerzel == args[0].toUpperCase()) attributename = globals.Werte[i].id;
|
if (globals.Werte[i].kuerzel == args[0].toUpperCase()) {
|
||||||
|
attributename = globals.Werte[i].id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
attributename = args[0].toLowerCase();
|
attributename = args[0].toLowerCase();
|
||||||
}
|
}
|
||||||
@ -34,7 +36,7 @@ module.exports = async (message, args, db) => {
|
|||||||
if (docs[0].character.attributes[i].id == attributename) level = docs[0].character.attributes[i].level;
|
if (docs[0].character.attributes[i].id == attributename) level = docs[0].character.attributes[i].level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
level = args[0];
|
level = args[0];
|
||||||
}
|
}
|
||||||
@ -48,7 +50,7 @@ module.exports = async (message, args, db) => {
|
|||||||
if (countOccurrences(dice, 1) == 2) {
|
if (countOccurrences(dice, 1) == 2) {
|
||||||
message.reply('Du hast einen kritischen Erfolg erzielt (' + dice.join(', ') + ')! 🎉🥳🎆');
|
message.reply('Du hast einen kritischen Erfolg erzielt (' + dice.join(', ') + ')! 🎉🥳🎆');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (countOccurrences(dice, 20) == 2) {
|
else if (countOccurrences(dice, 20) == 2) {
|
||||||
message.reply('Du hast einen Patzer (' + dice.join(', ') + ')! 😭 Viel Erfolg beim nächsten mal!');
|
message.reply('Du hast einen Patzer (' + dice.join(', ') + ')! 😭 Viel Erfolg beim nächsten mal!');
|
||||||
return;
|
return;
|
||||||
@ -57,22 +59,22 @@ module.exports = async (message, args, db) => {
|
|||||||
if (attributename) {
|
if (attributename) {
|
||||||
message.reply('Du hast die Probe auf ' + attributename + ' (Stufe ' + level + ') bestanden.\n' +
|
message.reply('Du hast die Probe auf ' + attributename + ' (Stufe ' + level + ') bestanden.\n' +
|
||||||
'Deine 🎲: ' + dice.join(', '));
|
'Deine 🎲: ' + dice.join(', '));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message.reply('Du hast die Probe (Stufe ' + level + ') bestanden.\n' +
|
message.reply('Du hast die Probe (Stufe ' + level + ') bestanden.\n' +
|
||||||
'Deine 🎲: ' + dice.join(', '));
|
'Deine 🎲: ' + dice.join(', '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (attributename) {
|
else if (attributename) {
|
||||||
message.reply('Du hast die Probe auf ' + attributename + ' (Stufe ' + level + ') leider nicht bestanden 😢.\n' +
|
message.reply('Du hast die Probe auf ' + attributename + ' (Stufe ' + level + ') leider nicht bestanden 😢.\n' +
|
||||||
'Deine 🎲: ' + dice.join(', '));
|
'Deine 🎲: ' + dice.join(', '));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message.reply('Du hast die Probe (Stufe ' + level + ') leider nicht bestanden 😢.\n' +
|
message.reply('Du hast die Probe (Stufe ' + level + ') leider nicht bestanden 😢.\n' +
|
||||||
'Deine 🎲: ' + dice.join(', '));
|
'Deine 🎲: ' + dice.join(', '));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -15,18 +15,16 @@ module.exports = async (message, args, db) => {
|
|||||||
}
|
}
|
||||||
const values = [];
|
const values = [];
|
||||||
const roll = [];
|
const roll = [];
|
||||||
let found = false;
|
let talent
|
||||||
let bonus = 0;
|
let bonus = 0;
|
||||||
let ok = 0;
|
let ok = 0;
|
||||||
let patzer = 0;
|
let patzer = 0;
|
||||||
let crit = 0;
|
let crit = 0;
|
||||||
|
|
||||||
for (i in docs[0].character.skills) {
|
for (i in docs[0].character.skills) {
|
||||||
if (docs[0].character.skills[i].id == args[0]) {bonus = docs[0].character.skills[i].level; found = true;}
|
if (docs[0].character.skills[i].id == talent) {bonus = docs[0].character.skills[i].level;}
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
message.reply('Sorry, das Talent ist mir unbekannt.');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bonus_orig = bonus;
|
const bonus_orig = bonus;
|
||||||
const result = globals.Talente.find(talent => talent.id === args[0]);
|
const result = globals.Talente.find(talent => talent.id === args[0]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user