mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Fixed DSN rolling; removed console messages; chat message clean up
This commit is contained in:
parent
bfc84bdb2d
commit
2e6a17d787
9 changed files with 11 additions and 21 deletions
|
|
@ -249,7 +249,6 @@ Hooks.on('chatMessage', (_, message) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.startsWith('/fr')) {
|
if (message.startsWith('/fr')) {
|
||||||
console.log("fr message", message);
|
|
||||||
const result =
|
const result =
|
||||||
message.trim().toLowerCase() === '/fr' ? { result: {} } : rollCommandToJSON(message.replace(/\/fr\s?/, ''));
|
message.trim().toLowerCase() === '/fr' ? { result: {} } : rollCommandToJSON(message.replace(/\/fr\s?/, ''));
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
|
@ -259,12 +258,10 @@ Hooks.on('chatMessage', (_, message) => {
|
||||||
|
|
||||||
const { result: rollCommand, flavor } = result;
|
const { result: rollCommand, flavor } = result;
|
||||||
|
|
||||||
console.log("rollCommand", rollCommand);
|
|
||||||
const fateType = rollCommand.type ?? "Hope";
|
const fateType = rollCommand.type ?? "Hope";
|
||||||
console.log("fateType", fateType);
|
|
||||||
|
|
||||||
const target = getCommandTarget({ allowNull: true });
|
const target = getCommandTarget({ allowNull: true });
|
||||||
const title = 'Fate';
|
const title = fateType + ' Fate Roll';
|
||||||
|
|
||||||
enrichedFateRoll({
|
enrichedFateRoll({
|
||||||
target,
|
target,
|
||||||
|
|
|
||||||
|
|
@ -2056,6 +2056,7 @@
|
||||||
"plural": "Experiences"
|
"plural": "Experiences"
|
||||||
},
|
},
|
||||||
"failure": "Failure",
|
"failure": "Failure",
|
||||||
|
"fateRoll": "Fate Roll",
|
||||||
"fear": "Fear",
|
"fear": "Fear",
|
||||||
"features": "Features",
|
"features": "Features",
|
||||||
"formula": "Formula",
|
"formula": "Formula",
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
||||||
}),
|
}),
|
||||||
damage: new fields.ObjectField(),
|
damage: new fields.ObjectField(),
|
||||||
costs: new fields.ArrayField(new fields.ObjectField()),
|
costs: new fields.ArrayField(new fields.ObjectField()),
|
||||||
successConsumed: new fields.BooleanField({ initial: false }),
|
successConsumed: new fields.BooleanField({ initial: false })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,6 @@ export default class DualityRoll extends D20Roll {
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static fromData(data) {
|
static fromData(data) {
|
||||||
console.log("data", data);
|
|
||||||
data.terms[0].class = foundry.dice.terms.Die.name;
|
data.terms[0].class = foundry.dice.terms.Die.name;
|
||||||
data.terms[2].class = foundry.dice.terms.Die.name;
|
data.terms[2].class = foundry.dice.terms.Die.name;
|
||||||
return super.fromData(data);
|
return super.fromData(data);
|
||||||
|
|
@ -175,9 +174,6 @@ export default class DualityRoll extends D20Roll {
|
||||||
|
|
||||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||||
await super.buildEvaluate(roll, config, message);
|
await super.buildEvaluate(roll, config, message);
|
||||||
console.log("roll", config);
|
|
||||||
console.log("config", config);
|
|
||||||
console.log("message", message);
|
|
||||||
|
|
||||||
await setDiceSoNiceForDualityRoll(
|
await setDiceSoNiceForDualityRoll(
|
||||||
roll,
|
roll,
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ export default class FateRoll extends D20Roll {
|
||||||
|
|
||||||
|
|
||||||
get fateDie() {
|
get fateDie() {
|
||||||
console.log("fateRoll this", this);
|
|
||||||
return this.data.fateType;
|
return this.data.fateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -59,7 +58,6 @@ export default class FateRoll extends D20Roll {
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
static fromData(data) {
|
static fromData(data) {
|
||||||
console.log("data", data);
|
|
||||||
data.terms[0].class = foundry.dice.terms.Die.name;
|
data.terms[0].class = foundry.dice.terms.Die.name;
|
||||||
return super.fromData(data);
|
return super.fromData(data);
|
||||||
}
|
}
|
||||||
|
|
@ -74,9 +72,6 @@ export default class FateRoll extends D20Roll {
|
||||||
|
|
||||||
static async buildEvaluate(roll, config = {}, message = {}) {
|
static async buildEvaluate(roll, config = {}, message = {}) {
|
||||||
await super.buildEvaluate(roll, config, message);
|
await super.buildEvaluate(roll, config, message);
|
||||||
console.log("roll", config);
|
|
||||||
console.log("config", config);
|
|
||||||
console.log("message", message);
|
|
||||||
|
|
||||||
if (roll.fateDie === "Hope") {
|
if (roll.fateDie === "Hope") {
|
||||||
await setDiceSoNiceForHopeFateRoll(
|
await setDiceSoNiceForHopeFateRoll(
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||||
}
|
}
|
||||||
if (this.type === 'fateRoll') {
|
if (this.type === 'fateRoll') {
|
||||||
html.classList.add('fate');
|
html.classList.add('fate');
|
||||||
html.classList.add('hope');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const autoExpandRoll = game.settings.get(
|
const autoExpandRoll = game.settings.get(
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,15 @@ export default function DhFateRollEnricher(match, _options) {
|
||||||
|
|
||||||
function getFateMessage(roll, flavor) {
|
function getFateMessage(roll, flavor) {
|
||||||
const label = flavor ?? 'Fate';
|
const label = flavor ?? 'Fate';
|
||||||
console.log("ROLL", roll);
|
|
||||||
|
|
||||||
const dataLabel = game.i18n.localize('DAGGERHEART.GENERAL.fate');
|
const dataLabel = game.i18n.localize('DAGGERHEART.GENERAL.fate');
|
||||||
|
|
||||||
const fateElement = document.createElement('span');
|
const fateElement = document.createElement('span');
|
||||||
fateElement.innerHTML = `
|
fateElement.innerHTML = `
|
||||||
<button type="button" class="fate-roll-button${roll?.inline ? ' inline' : ''}"
|
<button type="button" class="fate-roll-button${roll?.inline ? ' inline' : ''}"
|
||||||
data-title="${label}"
|
data-title="${label}"
|
||||||
data-label="${dataLabel}"
|
data-label="${dataLabel}"
|
||||||
data-hope="${roll?.hope ?? 'd12'}"
|
data-hope="${roll?.hope ?? 'd12'}"
|
||||||
${label}
|
${label}
|
||||||
</button>
|
</button>
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -73,14 +73,14 @@ export const setDiceSoNiceForHopeFateRoll = async (rollResult, hopeFaces) => {
|
||||||
if (!game.modules.get('dice-so-nice')?.active) return;
|
if (!game.modules.get('dice-so-nice')?.active) return;
|
||||||
const { diceSoNice } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
const { diceSoNice } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
||||||
const diceSoNicePresets = await getDiceSoNicePreset(diceSoNice.hope, hopeFaces);
|
const diceSoNicePresets = await getDiceSoNicePreset(diceSoNice.hope, hopeFaces);
|
||||||
rollResult.dice[0].options = diceSoNicePresets.hope;
|
rollResult.dice[0].options = diceSoNicePresets;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setDiceSoNiceForFearFateRoll = async (rollResult, fearFaces) => {
|
export const setDiceSoNiceForFearFateRoll = async (rollResult, fearFaces) => {
|
||||||
if (!game.modules.get('dice-so-nice')?.active) return;
|
if (!game.modules.get('dice-so-nice')?.active) return;
|
||||||
const { diceSoNice } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
const { diceSoNice } = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance);
|
||||||
const diceSoNicePresets = await getDiceSoNicePreset(diceSoNice.fear, fearFaces);
|
const diceSoNicePresets = await getDiceSoNicePreset(diceSoNice.fear, fearFaces);
|
||||||
rollResult.dice[0].options = diceSoNicePresets.fear;
|
rollResult.dice[0].options = diceSoNicePresets;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const chunkify = (array, chunkSize, mappingFunc) => {
|
export const chunkify = (array, chunkSize, mappingFunc) => {
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="roll-formula">{{roll.formula}}</div>
|
{{#if roll.fate}}
|
||||||
|
{{else}}
|
||||||
|
<div class="roll-formula">{{roll.formula}}</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue