add -ns decorator
This commit is contained in:
parent
3b3ce821bd
commit
d386561855
|
@ -5,7 +5,7 @@ meta {
|
|||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:8166/api/roll?user=[discord-user-id]&channel=[discord-channel-id]&rollstr=[artificer-roll-cmd]&documentation=All items below are optional. Flags do not need values.&nd=[no-details-flag]&snd=[super-no-details-flag]&hr=[hide-raw-roll-details-flag]&s=[spoiler-results-flag]&m-or-max=[max-roll-flag, cannot be used with n flag]&min=[min-roll-flag, cannot be used with n, sn, or max]&n=[nominal-roll-flag, cannot be used with sn, max or min flag]&sn=[simulated-nominal-flag, can pass number with it, cannot be used with max, min, n. or cc]&gms=[csv-of-discord-user-ids-to-be-dmed-results]&o=[order-rolls, must be a or d]&c=[count-flag]&cc=[confirm-crit-flag, cannot be used with sn]&rd=[roll-dist-flag]&nv-or-vn=[number-variables-flag]&cd=[custom-dice, format value as name:[side1,side2,...,sideN], use ; to separate multiple custom dice]
|
||||
url: http://localhost:8166/api/roll?user=[discord-user-id]&channel=[discord-channel-id]&rollstr=[artificer-roll-cmd]&documentation=All items below are optional. Flags do not need values.&nd=[no-details-flag]&snd=[super-no-details-flag]&hr=[hide-raw-roll-details-flag]&s=[spoiler-results-flag]&m-or-max=[max-roll-flag, cannot be used with n flag]&min=[min-roll-flag, cannot be used with n, sn, or max]&n=[nominal-roll-flag, cannot be used with sn, max or min flag]&sn=[simulated-nominal-flag, can pass number with it, cannot be used with max, min, n. or cc]&gms=[csv-of-discord-user-ids-to-be-dmed-results]&o=[order-rolls, must be a or d]&c=[count-flag]&cc=[confirm-crit-flag, cannot be used with sn]&rd=[roll-dist-flag]&nv-or-vn=[number-variables-flag]&cd=[custom-dice, format value as name:[side1,side2,...,sideN], use ; to separate multiple custom dice]&ns=[no-spaces, removes the default added space between rolls]
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
@ -30,4 +30,5 @@ params:query {
|
|||
rd: [roll-dist-flag]
|
||||
nv-or-vn: [number-variables-flag]
|
||||
cd: [custom-dice, format value as name:[side1,side2,...,sideN], use ; to separate multiple custom dice]
|
||||
ns: [no-spaces, removes the default added space between rolls]
|
||||
}
|
||||
|
|
|
@ -193,6 +193,7 @@ The Artificer comes with a few supplemental commands to the main rolling command
|
|||
* `-hr` - Hide Raw - Hide the raw input, showing only the results/details of the roll
|
||||
* `-nv` or `-vn` - Number Variables - Adds `xN` before each roll command in the details section for debug reasons
|
||||
* `-cd` - Custom Dice shapes - Allows a list of `name:[side1,side2,...,sideN]` separated by `;` to be passed to create special shaped dice
|
||||
* `-ns` - No Spaces - Removes the default padding added space between rolls (`[[d4]][[d4]]` will output `22` instead of `2 2`)
|
||||
* The results have some formatting applied on them to provide details on what happened during this roll.
|
||||
* Critical successes will be **bolded**
|
||||
* Critical fails will be <ins>underlined</ins>
|
||||
|
|
|
@ -96,6 +96,7 @@ export const runCmd = (rollRequest: QueuedRoll): SolvedRoll => {
|
|||
"One or more of the rolls requested appear to be more complex than what the Nominal calculator is intended for. For a better approximation of this roll's nominal value, please rerun this roll with the `-sn` flag.\n";
|
||||
}
|
||||
|
||||
const line2Space = rollRequest.modifiers.noSpaces ? '' : ' ';
|
||||
// Fill out all of the details and results now
|
||||
tempReturnData.forEach((e, i) => {
|
||||
loopCountCheck();
|
||||
|
@ -118,9 +119,9 @@ export const runCmd = (rollRequest: QueuedRoll): SolvedRoll => {
|
|||
|
||||
// Populate line2 (the results) and line3 (the details) with their data
|
||||
if (rollRequest.modifiers.order === '') {
|
||||
line2 += `${e.rollPreFormat ? escapeCharacters(e.rollPreFormat, '|*_~`') : ' '}${preFormat}${rollRequest.modifiers.commaTotals ? e.rollTotal.toLocaleString() : e.rollTotal}${postFormat}${
|
||||
e.rollPostFormat ? escapeCharacters(e.rollPostFormat, '|*_~`') : ''
|
||||
}`;
|
||||
line2 += `${e.rollPreFormat ? escapeCharacters(e.rollPreFormat, '|*_~`') : line2Space}${preFormat}${
|
||||
rollRequest.modifiers.commaTotals ? e.rollTotal.toLocaleString() : e.rollTotal
|
||||
}${postFormat}${e.rollPostFormat ? escapeCharacters(e.rollPostFormat, '|*_~`') : ''}`;
|
||||
} else {
|
||||
// If order is on, turn rolls into csv without formatting
|
||||
line2 += `${preFormat}${rollRequest.modifiers.commaTotals ? e.rollTotal.toLocaleString() : e.rollTotal}${postFormat}, `;
|
||||
|
|
|
@ -63,6 +63,7 @@ export interface RollModifiers {
|
|||
rollDist: boolean;
|
||||
numberVariables: boolean;
|
||||
customDiceShapes: CustomDiceShapes;
|
||||
noSpaces: boolean;
|
||||
yVars: Map<string, number>;
|
||||
apiWarn: string;
|
||||
valid: boolean;
|
||||
|
|
|
@ -24,6 +24,7 @@ export const Modifiers = Object.freeze({
|
|||
NumberVariables: '-nv',
|
||||
VariablesNumber: '-vn',
|
||||
CustomDiceShapes: '-cd',
|
||||
NoSpaces: '-ns',
|
||||
});
|
||||
|
||||
// args will look like this: ['-sn', ' ', '10'] as spaces/newlines are split on their own
|
||||
|
@ -46,6 +47,7 @@ export const getModifiers = (args: string[]): [RollModifiers, string[]] => {
|
|||
rollDist: false,
|
||||
numberVariables: false,
|
||||
customDiceShapes: new Map<string, number[]>(),
|
||||
noSpaces: false,
|
||||
yVars: new Map<string, number>(),
|
||||
apiWarn: '',
|
||||
valid: true,
|
||||
|
@ -199,6 +201,9 @@ export const getModifiers = (args: string[]): [RollModifiers, string[]] => {
|
|||
log(LT.LOG, `Generated Custom Dice: ${JSON.stringify(modifiers.customDiceShapes.entries().toArray())}`);
|
||||
break;
|
||||
}
|
||||
case Modifiers.NoSpaces:
|
||||
modifiers.noSpaces = true;
|
||||
break;
|
||||
default:
|
||||
// Default case should not mess with the array
|
||||
defaultCase = true;
|
||||
|
|
|
@ -194,6 +194,19 @@ If multiple custom dice are needed, separate their configurations with a \`;\`.
|
|||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
'-ns',
|
||||
{
|
||||
name: 'No Spaces',
|
||||
description: `**Usage:** \`-ns\`
|
||||
|
||||
Removes the default padding added space between rolls.`,
|
||||
example: [
|
||||
'`[[d4]][[d4]]` will normally return as `2 2` for readability',
|
||||
'`[[d4]][[d4]] -ns` will remove the added padding to follow the exact input format and return as `22`',
|
||||
],
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
||||
export const DecoratorsHelpPages: HelpPage = {
|
||||
|
|
|
@ -102,6 +102,7 @@ export const apiRoll = async (query: Map<string, string>, apiUserid: bigint): Pr
|
|||
rollDist: query.has('rd'),
|
||||
numberVariables: query.has('nv') || query.has('vn'),
|
||||
customDiceShapes: new Map<string, number[]>(),
|
||||
noSpaces: query.has('ns'),
|
||||
yVars: new Map<string, number>(),
|
||||
apiWarn: hideWarn ? '' : apiWarning,
|
||||
valid: true,
|
||||
|
|
Loading…
Reference in New Issue