mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Feature] 460 - Reaction Rolls (#481)
* Added a toggle in D20RollDialog for ReactionRolls * DualityRollEnrichment can now use reaction * Added flavor for DualityRollEnrichment
This commit is contained in:
parent
243630878b
commit
e168e3e7ec
10 changed files with 103 additions and 31 deletions
|
|
@ -5,9 +5,12 @@ export const capitalize = string => {
|
|||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
};
|
||||
|
||||
export function rollCommandToJSON(text) {
|
||||
export function rollCommandToJSON(text, raw) {
|
||||
if (!text) return {};
|
||||
|
||||
const flavorMatch = raw?.match(/{(.*)}$/);
|
||||
const flavor = flavorMatch ? flavorMatch[1] : null;
|
||||
|
||||
// Match key="quoted string" OR key=unquotedValue
|
||||
const PAIR_RE = /(\w+)=("(?:[^"\\]|\\.)*"|\S+)/g;
|
||||
const result = {};
|
||||
|
|
@ -28,7 +31,7 @@ export function rollCommandToJSON(text) {
|
|||
}
|
||||
result[key] = value;
|
||||
}
|
||||
return Object.keys(result).length > 0 ? result : null;
|
||||
return Object.keys(result).length > 0 ? { result, flavor } : null;
|
||||
}
|
||||
|
||||
export const getCommandTarget = (options = {}) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue