1
1
mirror of https://github.com/Burn-E99/TheArtificer.git synced 2026-06-04 09:03:50 -04:00

Started work on adding count decorator

This commit is contained in:
Ean Milligan (Bastion)
2022-05-19 02:53:30 -04:00
parent 04d7324769
commit a270a4b8f7
7 changed files with 50 additions and 27 deletions

View File

@@ -42,7 +42,7 @@ export const roll = async (message: DiscordenoMessage, args: string[], command:
// Rejoin all of the args and send it into the solver, if solver returns a falsy item, an error object will be substituded in
const rollCmd = `${command} ${args.join(" ")}`;
const returnmsg = solver.parseRoll(rollCmd, config.prefix, config.postfix, modifiers.maxRoll, modifiers.nominalRoll, modifiers.order) || { error: true, errorCode: "EmptyMessage", errorMsg: "Error: Empty message", line1: "", line2: "", line3: "" };
const returnmsg = solver.parseRoll(rollCmd, modifiers) || { error: true, errorCode: "EmptyMessage", errorMsg: "Error: Empty message", line1: "", line2: "", line3: "" };
let returnText = "";

View File

@@ -22,7 +22,8 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
gmRoll: false,
gms: [],
order: "",
valid: false
valid: false,
count: false
};
// Check if any of the args are command flags and pull those out into the modifiers object
@@ -30,6 +31,9 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
log(LT.LOG, `Checking ${command}${args.join(" ")} for command modifiers ${i}`);
let defaultCase = false;
switch (args[i].toLowerCase()) {
case "-c":
modifiers.count = true;
break;
case "-nd":
modifiers.noDetails = true;
break;
@@ -69,6 +73,7 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri
}
break;
case "-o":
// Shift the -o out of the array so the next item is the direction
args.splice(i, 1);
if (!args[i] || args[i].toLowerCase()[0] !== "d" && args[i].toLowerCase()[0] !== "a") {