Added remaining options and fixed secure loading of dice models (#413)

This commit is contained in:
WBHarry 2025-07-26 04:12:22 +02:00 committed by GitHub
parent dddee78356
commit bf31ced3df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 167 additions and 100 deletions

View file

@ -166,8 +166,8 @@ export default class DualityRoll extends D20Roll {
return modifiers;
}
static postEvaluate(roll, config = {}) {
const data = super.postEvaluate(roll, config);
static async postEvaluate(roll, config = {}) {
const data = await super.postEvaluate(roll, config);
data.hope = {
dice: roll.dHope.denomination,
@ -198,7 +198,13 @@ export default class DualityRoll extends D20Roll {
if (roll._rallyIndex && roll.data?.parent)
roll.data.parent.deleteEmbeddedDocuments('ActiveEffect', [roll._rallyIndex]);
setDiceSoNiceForDualityRoll(roll, data.advantage.type);
await setDiceSoNiceForDualityRoll(
roll,
data.advantage.type,
data.hope.dice,
data.fear.dice,
data.advantage.dice
);
return data;
}
@ -220,10 +226,10 @@ export default class DualityRoll extends D20Roll {
options: { appearance: {} }
};
const diceSoNicePresets = getDiceSoNicePresets();
const diceSoNicePresets = await getDiceSoNicePresets();
const type = target.dataset.type;
if (diceSoNicePresets[type]) {
diceSoNiceRoll.dice[0].options = { appearance: diceSoNicePresets[type] };
diceSoNiceRoll.dice[0].options = diceSoNicePresets[type];
}
await game.dice3d.showForRoll(diceSoNiceRoll, game.user, true);
@ -231,7 +237,7 @@ export default class DualityRoll extends D20Roll {
await parsedRoll.evaluate();
const newRoll = game.system.api.dice.DualityRoll.postEvaluate(parsedRoll, {
const newRoll = await game.system.api.dice.DualityRoll.postEvaluate(parsedRoll, {
targets: message.system.targets,
roll: {
advantage: message.system.roll.advantage?.type,