GmMonitor : Added ability to add or subtract fatigue/strife/void/casualties/panic points on clic.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
## 1.6.0 - SoftLock
|
||||
- Added SoftLock on PC sheet
|
||||
- GmMonitor : Added ability to add or subtract fatigue/strife/void/casualties/panic points on clic.
|
||||
|
||||
## 1.5.0 - FoundryVTT v9 Compatibility
|
||||
- Updated the System to FoundryVTT v9.
|
||||
|
||||
@@ -148,7 +148,8 @@
|
||||
"title": "GM Monitor",
|
||||
"switch_view": "Switch View",
|
||||
"honor_glory_status": "H/G/S",
|
||||
"focus_vigilance": "Foc./Vig."
|
||||
"focus_vigilance": "Foc./Vig.",
|
||||
"mouse_control": "Right click +1, left: -1, middle: reset to 0"
|
||||
},
|
||||
"max": "Max",
|
||||
"current": "Current",
|
||||
|
||||
@@ -148,7 +148,8 @@
|
||||
"title": "GM Monitor",
|
||||
"switch_view": "Switch View",
|
||||
"honor_glory_status": "H/G/S",
|
||||
"focus_vigilance": "Foc./Vig."
|
||||
"focus_vigilance": "Foc./Vig.",
|
||||
"mouse_control": "Right click +1, left: -1, middle: reset to 0"
|
||||
},
|
||||
"max": "Máx",
|
||||
"current": "Actuales",
|
||||
|
||||
@@ -148,7 +148,8 @@
|
||||
"title": "GM Monitor",
|
||||
"switch_view": "Switch View",
|
||||
"honor_glory_status": "H/G/S",
|
||||
"focus_vigilance": "Att./Vig."
|
||||
"focus_vigilance": "Att./Vig.",
|
||||
"mouse_control": "Click Droit +1, Gauche: -1, Milieu: Remise à 0"
|
||||
},
|
||||
"max": "Max",
|
||||
"current": "Actuel",
|
||||
|
||||
@@ -38,7 +38,7 @@ export class GmMonitor extends FormApplication {
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
|
||||
// Send To Chat
|
||||
// Switch view Characters/Armies
|
||||
buttons.unshift({
|
||||
label: game.i18n.localize("l5r5e.gm_monitor.switch_view"),
|
||||
class: "switch-view",
|
||||
@@ -150,6 +150,9 @@ export class GmMonitor extends FormApplication {
|
||||
// Delete
|
||||
html.find(`.actor-remove-control`).on("click", this._removeActor.bind(this));
|
||||
|
||||
// Add/Subtract
|
||||
html.find(`.actor-modify-control`).on("mousedown", this._modifyActor.bind(this));
|
||||
|
||||
// Tooltips
|
||||
game.l5r5e.HelpersL5r5e.popupManager(html.find(".actor-infos-control"), async (event) => {
|
||||
const type = $(event.currentTarget).data("type");
|
||||
@@ -243,7 +246,102 @@ export class GmMonitor extends FormApplication {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tooltips informations for this character
|
||||
* Add or subtract fatigue/strife/void/casualties/panic
|
||||
* @param event
|
||||
* @return {Promise<void>}
|
||||
* @private
|
||||
*/
|
||||
async _modifyActor(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
const type = $(event.currentTarget).data("type");
|
||||
if (!type) {
|
||||
console.warn("L5R5E | type not set", type);
|
||||
return;
|
||||
}
|
||||
const id = $(event.currentTarget).data("actor-id");
|
||||
if (!id) {
|
||||
console.warn("L5R5E | actor id not set", type);
|
||||
return;
|
||||
}
|
||||
const actor = game.actors.get(id);
|
||||
if (!actor) {
|
||||
console.warn("L5R5E | Actor not found", type);
|
||||
return;
|
||||
}
|
||||
|
||||
// Mouse bt : middle = 0, left +1, right -1
|
||||
const add = event.which === 2 ? -999 : event.which === 1 ? 1 : -1;
|
||||
|
||||
switch (type) {
|
||||
// *** Characters ***
|
||||
case "fatigue":
|
||||
await actor.update({
|
||||
data: {
|
||||
fatigue: {
|
||||
value: Math.max(0, actor.data.data.fatigue.value + add),
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
case "strife":
|
||||
await actor.update({
|
||||
data: {
|
||||
strife: {
|
||||
value: Math.max(0, actor.data.data.strife.value + add),
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
case "void_points":
|
||||
await actor.update({
|
||||
data: {
|
||||
void_points: {
|
||||
value: Math.min(
|
||||
actor.data.data.void_points.max,
|
||||
Math.max(0, actor.data.data.void_points.value + add)
|
||||
),
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
// *** Armies ***
|
||||
case "casualties":
|
||||
await actor.update({
|
||||
data: {
|
||||
battle_readiness: {
|
||||
casualties_strength: {
|
||||
value: Math.max(0, actor.data.data.battle_readiness.casualties_strength.value + add),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
case "panic":
|
||||
await actor.update({
|
||||
data: {
|
||||
battle_readiness: {
|
||||
panic_discipline: {
|
||||
value: Math.max(0, actor.data.data.battle_readiness.panic_discipline.value + add),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn("L5R5E | Unsupported type", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tooltips information for this character
|
||||
* @param {BaseSheetL5r5e} actor
|
||||
* @return {string}
|
||||
* @private
|
||||
|
||||
@@ -54,20 +54,26 @@
|
||||
/ {{actor.data.data.social.status}}
|
||||
</td>
|
||||
<td>
|
||||
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="fatigue" class="actor-modify-control">
|
||||
<span class="{{#ifCond actor.data.data.fatigue.value '>' actor.data.data.fatigue.max}}badvalue{{/ifCond}}">{{actor.data.data.fatigue.value}}</span>
|
||||
/ {{actor.data.data.fatigue.max}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="strife" class="actor-modify-control">
|
||||
<span class="{{#ifCond actor.data.data.strife.value '>' actor.data.data.strife.max}}badvalue{{/ifCond}}">{{actor.data.data.strife.value}}</span>
|
||||
/ {{actor.data.data.strife.max}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{actor.data.data.focus}}
|
||||
/ {{#if actor.data.data.is_compromised}}<span class="badvalue">1</span>{{else}}{{actor.data.data.vigilance}}{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="void_points" class="actor-modify-control">
|
||||
{{actor.data.data.void_points.value}}
|
||||
/ {{actor.data.data.void_points.max}}
|
||||
</a>
|
||||
</td>
|
||||
<td><i data-actor-id="{{actor.id}}" data-type="global" class="fas fa-question-circle actor-infos-control"></i></td>
|
||||
<td><span data-actor-id="{{actor.id}}" class="actor-remove-control pointer" title="{{localize 'Delete'}}"><i class="fas fa-trash"></i></span></td>
|
||||
@@ -101,12 +107,16 @@
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="casualties" class="actor-modify-control">
|
||||
<span class="{{#ifCond actor.data.data.battle_readiness.casualties_strength.value '>' actor.data.data.battle_readiness.casualties_strength.max}}badvalue{{/ifCond}}">{{actor.data.data.battle_readiness.casualties_strength.value}}</span>
|
||||
/ {{actor.data.data.battle_readiness.casualties_strength.max}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="panic" class="actor-modify-control">
|
||||
<span class="{{#ifCond actor.data.data.battle_readiness.panic_discipline.value '>' actor.data.data.battle_readiness.panic_discipline.max}}badvalue{{/ifCond}}">{{actor.data.data.battle_readiness.panic_discipline.value}}</span>
|
||||
/ {{actor.data.data.battle_readiness.panic_discipline.max}}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{#if actor.data.data.commander_actor_id}}
|
||||
|
||||
Reference in New Issue
Block a user