Some test on gm toolbox

This commit is contained in:
Vlyan
2021-02-02 18:27:36 +01:00
parent d88d985575
commit 7f987a7682
8 changed files with 86 additions and 12 deletions

View File

@@ -109,6 +109,15 @@
"keep_drop_here": "Keep",
"bt_validate": "Finalize this step"
},
"gm_toolbox": {
"title": "GM ToolBox",
"difficulty_hidden": "Change difficulty visibility",
"difficulty": "Change difficulty (right: add, left: subtract, middle: TN 2)",
"clear_conflict": "Clear all conflict on Characters",
"clear_conflict_info": "All conflict on Characters was reset",
"starting_void_point": "Reset void points on Characters (half max value)",
"starting_void_point_info": "All void points on Characters was reset"
},
"max": "Max",
"current": "Current",
"quantity": "Quantity",

View File

@@ -109,6 +109,15 @@
"keep_drop_here": "Guardar",
"bt_validate": "Finalizar"
},
"gm_toolbox": {
"title": "GM ToolBox",
"difficulty_hidden": "Change difficulty visibility",
"difficulty": "Change difficulty (right: add, left: subtract, middle: TN 2)",
"clear_conflict": "Clear all conflict on Characters",
"clear_conflict_info": "All conflict on Characters was reset",
"starting_void_point": "Reset void points on Characters (half max value)",
"starting_void_point_info": "All void points on Characters was reset"
},
"max": "Máx",
"current": "Actuales",
"quantity": "Cantidad",

View File

@@ -109,6 +109,15 @@
"keep_drop_here": "Garder",
"bt_validate": "Finaliser cette étape"
},
"gm_toolbox": {
"title": "GM ToolBox",
"difficulty_hidden": "Modifier la visibilité de la difficulté",
"difficulty": "Modifier la difficulté (droite: ajout, gauche: soustraction, milieu: ND 2)",
"clear_conflict": "Enlever tous les points de conflit des personnages",
"clear_conflict_info": "Les personnages sont maintenant plus serins",
"starting_void_point": "Réinitialiser les points du vide à leurs moitié",
"starting_void_point_info": "Tous les points du vide ont été réinitialisés"
},
"max": "Max",
"current": "Actuel",
"quantity": "Quantité",

View File

@@ -19,11 +19,8 @@ export class GmToolsDialog extends FormApplication {
id: "l5r5e-gm-tools-dialog",
classes: ["l5r5e", "gm-tools-dialog"],
template: CONFIG.l5r5e.paths.templates + "dice/gm-tools-dialog.html",
title: game.i18n.localize("l5r5e.dicepicker.difficulty_title"),
width: 200, // ignored under 200px
height: 130, // ignored under 50px
scale: 0.5, // so scale /2 :D
left: x - 470,
title: game.i18n.localize("l5r5e.gm_toolbox.title"),
left: x - 540,
top: y - 94,
closeOnSubmit: false,
submitOnClose: false,
@@ -67,6 +64,8 @@ export class GmToolsDialog extends FormApplication {
if (!game.user.isGM) {
return false;
}
this.position.width = "auto";
this.position.height = "auto";
return super.render(force, options);
}
@@ -104,6 +103,8 @@ export class GmToolsDialog extends FormApplication {
// Modify difficulty hidden
html.find(`.difficulty_hidden`).on("click", (event) => {
event.preventDefault();
event.stopPropagation();
this.object.difficultyHidden = !this.object.difficultyHidden;
game.settings
.set("l5r5e", "initiative.difficulty.hidden", this.object.difficultyHidden)
@@ -130,6 +131,13 @@ export class GmToolsDialog extends FormApplication {
}
game.settings.set("l5r5e", "initiative.difficulty.value", this.object.difficulty).then(() => this.submit());
});
// Halve max void points & Clear conflict
html.find(`.gm_actor_updates`).on("click", (event) => {
event.preventDefault();
event.stopPropagation();
this._updatesActors($(event.currentTarget).data("type"));
});
}
/**
@@ -151,4 +159,41 @@ export class GmToolsDialog extends FormApplication {
this.render(false);
}
/**
* Update all actors
* @param {string} type
* @private
*/
_updatesActors(type) {
if (!game.user.isGM) {
return;
}
game.actors.entities.forEach((actor) => {
switch (type) {
case "starting_void_point":
// Starting void points : Max Void point / 2 rounded up for all actors
actor.data.data.void_points.value = Math.ceil(actor.data.data.void_points.max / 2);
break;
case "clear_conflict":
// Clear all actor conflict
actor.data.data.strife.value = 0;
break;
}
actor.update({
data: {
void_points: {
value: actor.data.data.void_points.value,
},
strife: {
value: actor.data.data.strife.value,
},
},
});
});
ui.notifications.info(game.i18n.localize(`l5r5e.gm_toolbox.${type}_info`));
}
}

View File

@@ -50,8 +50,6 @@ export class RollnKeepDialog extends FormApplication {
classes: ["l5r5e", "roll-n-keep-dialog"],
template: CONFIG.l5r5e.paths.templates + "dice/roll-n-keep-dialog.html",
title: game.i18n.localize("l5r5e.roll_n_keep.title"),
width: 660,
height: 454,
closeOnSubmit: false,
});
}
@@ -104,6 +102,8 @@ export class RollnKeepDialog extends FormApplication {
if (!this.message) {
return;
}
this.position.width = "auto";
this.position.height = "auto";
return super.render(force, options);
}

File diff suppressed because one or more lines are too long

View File

@@ -199,8 +199,8 @@
}
#l5r5e-gm-tools-dialog {
bottom: 0;
right: 0.5rem;
//bottom: 0;
//right: 0.5rem;
display: flex;
background-position: center;
background-size: 100%;

View File

@@ -1,6 +1,8 @@
<form class="l5r5e gm-tools-dialog" autocomplete="off">
<p class="gm-tools-container">
<a class="difficulty_hidden"><i class="fa fa-eye{{#if data.difficultyHidden}}-slash{{/if}}"></i></a>
<strong class="difficulty">{{data.difficulty}}</strong>
<a class="difficulty_hidden" title="{{localize 'l5r5e.gm_toolbox.difficulty_hidden'}}"><i class="fa fa-eye{{#if data.difficultyHidden}}-slash{{/if}}"></i></a>
<strong class="difficulty" title="{{localize 'l5r5e.gm_toolbox.difficulty'}}">{{data.difficulty}}</strong>
<a class="gm_actor_updates clear_conflict" data-type="clear_conflict" title="{{localize 'l5r5e.gm_toolbox.clear_conflict'}}"><i class="fa fa-bed"></i></a>
<a class="gm_actor_updates starting_void_point" data-type="starting_void_point" title="{{localize 'l5r5e.gm_toolbox.starting_void_point'}}"><i class="fas fa-star-half-alt"></i></a>
</p>
</form>