add -ns decorator
This commit is contained in:
		
							parent
							
								
									3b3ce821bd
								
							
						
					
					
						commit
						d386561855
					
				| 
						 | 
					@ -5,7 +5,7 @@ meta {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
get {
 | 
					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
 | 
					  body: none
 | 
				
			||||||
  auth: inherit
 | 
					  auth: inherit
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -30,4 +30,5 @@ params:query {
 | 
				
			||||||
  rd: [roll-dist-flag]
 | 
					  rd: [roll-dist-flag]
 | 
				
			||||||
  nv-or-vn: [number-variables-flag]
 | 
					  nv-or-vn: [number-variables-flag]
 | 
				
			||||||
  cd: [custom-dice, format value as name:[side1,side2,...,sideN], use ; to separate multiple custom dice]
 | 
					  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
 | 
					    * `-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
 | 
					    * `-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
 | 
					    * `-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.
 | 
					  * The results have some formatting applied on them to provide details on what happened during this roll.
 | 
				
			||||||
    * Critical successes will be **bolded**
 | 
					    * Critical successes will be **bolded**
 | 
				
			||||||
    * Critical fails will be <ins>underlined</ins>
 | 
					    * 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";
 | 
					        "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
 | 
					    // Fill out all of the details and results now
 | 
				
			||||||
    tempReturnData.forEach((e, i) => {
 | 
					    tempReturnData.forEach((e, i) => {
 | 
				
			||||||
      loopCountCheck();
 | 
					      loopCountCheck();
 | 
				
			||||||
| 
						 | 
					@ -118,9 +119,9 @@ export const runCmd = (rollRequest: QueuedRoll): SolvedRoll => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // Populate line2 (the results) and line3 (the details) with their data
 | 
					      // Populate line2 (the results) and line3 (the details) with their data
 | 
				
			||||||
      if (rollRequest.modifiers.order === '') {
 | 
					      if (rollRequest.modifiers.order === '') {
 | 
				
			||||||
        line2 += `${e.rollPreFormat ? escapeCharacters(e.rollPreFormat, '|*_~`') : ' '}${preFormat}${rollRequest.modifiers.commaTotals ? e.rollTotal.toLocaleString() : e.rollTotal}${postFormat}${
 | 
					        line2 += `${e.rollPreFormat ? escapeCharacters(e.rollPreFormat, '|*_~`') : line2Space}${preFormat}${
 | 
				
			||||||
          e.rollPostFormat ? escapeCharacters(e.rollPostFormat, '|*_~`') : ''
 | 
					          rollRequest.modifiers.commaTotals ? e.rollTotal.toLocaleString() : e.rollTotal
 | 
				
			||||||
        }`;
 | 
					        }${postFormat}${e.rollPostFormat ? escapeCharacters(e.rollPostFormat, '|*_~`') : ''}`;
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        // If order is on, turn rolls into csv without formatting
 | 
					        // If order is on, turn rolls into csv without formatting
 | 
				
			||||||
        line2 += `${preFormat}${rollRequest.modifiers.commaTotals ? e.rollTotal.toLocaleString() : e.rollTotal}${postFormat}, `;
 | 
					        line2 += `${preFormat}${rollRequest.modifiers.commaTotals ? e.rollTotal.toLocaleString() : e.rollTotal}${postFormat}, `;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,6 +63,7 @@ export interface RollModifiers {
 | 
				
			||||||
  rollDist: boolean;
 | 
					  rollDist: boolean;
 | 
				
			||||||
  numberVariables: boolean;
 | 
					  numberVariables: boolean;
 | 
				
			||||||
  customDiceShapes: CustomDiceShapes;
 | 
					  customDiceShapes: CustomDiceShapes;
 | 
				
			||||||
 | 
					  noSpaces: boolean;
 | 
				
			||||||
  yVars: Map<string, number>;
 | 
					  yVars: Map<string, number>;
 | 
				
			||||||
  apiWarn: string;
 | 
					  apiWarn: string;
 | 
				
			||||||
  valid: boolean;
 | 
					  valid: boolean;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,7 @@ export const Modifiers = Object.freeze({
 | 
				
			||||||
  NumberVariables: '-nv',
 | 
					  NumberVariables: '-nv',
 | 
				
			||||||
  VariablesNumber: '-vn',
 | 
					  VariablesNumber: '-vn',
 | 
				
			||||||
  CustomDiceShapes: '-cd',
 | 
					  CustomDiceShapes: '-cd',
 | 
				
			||||||
 | 
					  NoSpaces: '-ns',
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// args will look like this: ['-sn', ' ', '10'] as spaces/newlines are split on their own
 | 
					// 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,
 | 
					    rollDist: false,
 | 
				
			||||||
    numberVariables: false,
 | 
					    numberVariables: false,
 | 
				
			||||||
    customDiceShapes: new Map<string, number[]>(),
 | 
					    customDiceShapes: new Map<string, number[]>(),
 | 
				
			||||||
 | 
					    noSpaces: false,
 | 
				
			||||||
    yVars: new Map<string, number>(),
 | 
					    yVars: new Map<string, number>(),
 | 
				
			||||||
    apiWarn: '',
 | 
					    apiWarn: '',
 | 
				
			||||||
    valid: true,
 | 
					    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())}`);
 | 
					        log(LT.LOG, `Generated Custom Dice: ${JSON.stringify(modifiers.customDiceShapes.entries().toArray())}`);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      case Modifiers.NoSpaces:
 | 
				
			||||||
 | 
					        modifiers.noSpaces = true;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
      default:
 | 
					      default:
 | 
				
			||||||
        // Default case should not mess with the array
 | 
					        // Default case should not mess with the array
 | 
				
			||||||
        defaultCase = true;
 | 
					        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 = {
 | 
					export const DecoratorsHelpPages: HelpPage = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,6 +102,7 @@ export const apiRoll = async (query: Map<string, string>, apiUserid: bigint): Pr
 | 
				
			||||||
          rollDist: query.has('rd'),
 | 
					          rollDist: query.has('rd'),
 | 
				
			||||||
          numberVariables: query.has('nv') || query.has('vn'),
 | 
					          numberVariables: query.has('nv') || query.has('vn'),
 | 
				
			||||||
          customDiceShapes: new Map<string, number[]>(),
 | 
					          customDiceShapes: new Map<string, number[]>(),
 | 
				
			||||||
 | 
					          noSpaces: query.has('ns'),
 | 
				
			||||||
          yVars: new Map<string, number>(),
 | 
					          yVars: new Map<string, number>(),
 | 
				
			||||||
          apiWarn: hideWarn ? '' : apiWarning,
 | 
					          apiWarn: hideWarn ? '' : apiWarning,
 | 
				
			||||||
          valid: true,
 | 
					          valid: true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue