Standardized what gets refreshed by which refreshType

This commit is contained in:
WBHarry 2025-12-06 23:54:58 +01:00
parent 6ae00e15bd
commit f84fe59c9b
3 changed files with 25 additions and 9 deletions

View file

@ -451,3 +451,20 @@ export async function waitForDiceSoNice(message) {
await game.dice3d.waitFor3DAnimationByMessageID(message.id);
}
}
export function refreshIsAllowed(allowedTypes, typeToCheck) {
switch (typeToCheck) {
case CONFIG.DH.GENERAL.refreshTypes.scene.id:
case CONFIG.DH.GENERAL.refreshTypes.session.id:
case CONFIG.DH.GENERAL.refreshTypes.longRest.id:
return allowedTypes.includes(typeToCheck);
case CONFIG.DH.GENERAL.refreshTypes.shortRest.id:
return allowedTypes.some(
x =>
x === CONFIG.DH.GENERAL.refreshTypes.shortRest.id ||
x === CONFIG.DH.GENERAL.refreshTypes.longRest.id
);
default:
return false;
}
}