Reformat with prettier

This commit is contained in:
Manuel Vögele
2022-09-28 07:35:16 +02:00
parent 71424cd284
commit 5e82049686
19 changed files with 956 additions and 710 deletions
+14 -7
View File
@@ -11,8 +11,13 @@ Hooks.once("socketlib.ready", () => {
export function updateCombatantDragRulerFlags(combat, updates) {
const combatId = combat.id;
// TODO Check if canvas.tokens.get is still neccessary in future foundry versions
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates)
.then(() => currentSpeedProvider.onMovementHistoryUpdate(updates.map(update => canvas.tokens.get(combat.combatants.get(update._id).token.id))));
return socket
.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates)
.then(() =>
currentSpeedProvider.onMovementHistoryUpdate(
updates.map(update => canvas.tokens.get(combat.combatants.get(update._id).token.id)),
),
);
}
async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
@@ -21,12 +26,15 @@ async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
const requestedUpdates = updates.length;
updates = updates.filter(update => {
const actor = combat.combatants.get(update._id).actor;
if (!actor)
return false;
if (!actor) return false;
return actor.testUserPermission(user, "OWNER");
});
if (updates.length !== requestedUpdates) {
console.warn(`Some of the movement history updates requested by user '${game.users.get(this.socketdata.userId).name}' were not performed because the user lacks owner permissions for those tokens`);
console.warn(
`Some of the movement history updates requested by user '${
game.users.get(this.socketdata.userId).name
}' were not performed because the user lacks owner permissions for those tokens`,
);
}
updates = updates.map(update => {
return {_id: update._id, flags: {dragRuler: update.dragRulerFlags}};
@@ -40,6 +48,5 @@ export function recalculate(tokens) {
function _socketRecalculate(tokenIds) {
const ruler = canvas.controls.ruler;
if (ruler.isDragRuler)
ruler.dragRulerRecalculate(tokenIds);
if (ruler.isDragRuler) ruler.dragRulerRecalculate(tokenIds);
}