From bf382d01adcb10f7af352bbb6051f17c118e4fc7 Mon Sep 17 00:00:00 2001 From: "Ean Milligan (Bastion)" Date: Fri, 20 May 2022 00:27:27 -0400 Subject: [PATCH] Added embed generator for Counts, fixed projectKey for sonar --- .github/workflows/sonarcloud.yml | 2 +- src/constantCmds.ts | 35 ++++++++++++++++++++++++++++++++ src/mod.d.ts | 2 +- src/solver/solver.d.ts | 10 +++++++++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 28c8f07..e7fce9c 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -56,7 +56,7 @@ jobs: args: # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) # mandatory - -Dsonar.projectKey=The Artificer + '-Dsonar.projectKey=The Artificer' -Dsonar.organization=milligan.dev # Comma-separated paths to directories containing main source files. #-Dsonar.sources= # optional, default is project base directory diff --git a/src/constantCmds.ts b/src/constantCmds.ts index b87ec67..3120c9f 100644 --- a/src/constantCmds.ts +++ b/src/constantCmds.ts @@ -1,4 +1,5 @@ import config from "../config.ts"; +import { CountDetails } from "./solver/solver.d.ts"; const failColor = 0xe71212; const warnColor = 0xe38f28; @@ -555,3 +556,37 @@ export const generateRollError = (errorType: string, errorMsg: string) => ({ }] }] }); + +export const generateCountDetails = (counts: CountDetails) => ({ + embeds: [{ + color: infoColor1, + title: "Roll Count Details:", + fields: [ + { + name: "Total Rolls:", + details: `${counts.total}`, + inline: true + }, { + name: "Successful Rolls:", + details: `${counts.successful}`, + inline: true + }, { + name: "Failed Rolls:", + details: `${counts.failed}`, + inline: true + }, { + name: "Rerolled Dice:", + details: `${counts.rerolled}`, + inline: true + }, { + name: "Dropped Dice:", + details: `${counts.dropped}`, + inline: true + }, { + name: "Exploded Dice:", + details: `${counts.exploded}`, + inline: true + } + ] + }] +}); diff --git a/src/mod.d.ts b/src/mod.d.ts index dcb8cdf..c99581b 100644 --- a/src/mod.d.ts +++ b/src/mod.d.ts @@ -21,4 +21,4 @@ export type RollModifiers = { order: string, valid: boolean, count: boolean -} +}; diff --git a/src/solver/solver.d.ts b/src/solver/solver.d.ts index 8ac0ae9..a088266 100644 --- a/src/solver/solver.d.ts +++ b/src/solver/solver.d.ts @@ -38,3 +38,13 @@ export type SolvedRoll = { line2: string, line3: string }; + +// CountDetails is the object holding the count data for creating the Count Embed +export type CountDetails = { + total: number, + successful: number, + failed: number, + rerolled: number, + dropped: number, + exploded: number +};