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
|
## 1.6.0 - SoftLock
|
||||||
- Added SoftLock on PC sheet
|
- 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
|
## 1.5.0 - FoundryVTT v9 Compatibility
|
||||||
- Updated the System to FoundryVTT v9.
|
- Updated the System to FoundryVTT v9.
|
||||||
|
|||||||
@@ -148,7 +148,8 @@
|
|||||||
"title": "GM Monitor",
|
"title": "GM Monitor",
|
||||||
"switch_view": "Switch View",
|
"switch_view": "Switch View",
|
||||||
"honor_glory_status": "H/G/S",
|
"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",
|
"max": "Max",
|
||||||
"current": "Current",
|
"current": "Current",
|
||||||
|
|||||||
@@ -148,7 +148,8 @@
|
|||||||
"title": "GM Monitor",
|
"title": "GM Monitor",
|
||||||
"switch_view": "Switch View",
|
"switch_view": "Switch View",
|
||||||
"honor_glory_status": "H/G/S",
|
"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",
|
"max": "Máx",
|
||||||
"current": "Actuales",
|
"current": "Actuales",
|
||||||
|
|||||||
@@ -148,7 +148,8 @@
|
|||||||
"title": "GM Monitor",
|
"title": "GM Monitor",
|
||||||
"switch_view": "Switch View",
|
"switch_view": "Switch View",
|
||||||
"honor_glory_status": "H/G/S",
|
"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",
|
"max": "Max",
|
||||||
"current": "Actuel",
|
"current": "Actuel",
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class GmMonitor extends FormApplication {
|
|||||||
_getHeaderButtons() {
|
_getHeaderButtons() {
|
||||||
let buttons = super._getHeaderButtons();
|
let buttons = super._getHeaderButtons();
|
||||||
|
|
||||||
// Send To Chat
|
// Switch view Characters/Armies
|
||||||
buttons.unshift({
|
buttons.unshift({
|
||||||
label: game.i18n.localize("l5r5e.gm_monitor.switch_view"),
|
label: game.i18n.localize("l5r5e.gm_monitor.switch_view"),
|
||||||
class: "switch-view",
|
class: "switch-view",
|
||||||
@@ -150,6 +150,9 @@ export class GmMonitor extends FormApplication {
|
|||||||
// Delete
|
// Delete
|
||||||
html.find(`.actor-remove-control`).on("click", this._removeActor.bind(this));
|
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
|
// Tooltips
|
||||||
game.l5r5e.HelpersL5r5e.popupManager(html.find(".actor-infos-control"), async (event) => {
|
game.l5r5e.HelpersL5r5e.popupManager(html.find(".actor-infos-control"), async (event) => {
|
||||||
const type = $(event.currentTarget).data("type");
|
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
|
* @param {BaseSheetL5r5e} actor
|
||||||
* @return {string}
|
* @return {string}
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -54,20 +54,26 @@
|
|||||||
/ {{actor.data.data.social.status}}
|
/ {{actor.data.data.social.status}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="{{#ifCond actor.data.data.fatigue.value '>' actor.data.data.fatigue.max}}badvalue{{/ifCond}}">{{actor.data.data.fatigue.value}}</span>
|
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="fatigue" class="actor-modify-control">
|
||||||
/ {{actor.data.data.fatigue.max}}
|
<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>
|
||||||
<td>
|
<td>
|
||||||
<span class="{{#ifCond actor.data.data.strife.value '>' actor.data.data.strife.max}}badvalue{{/ifCond}}">{{actor.data.data.strife.value}}</span>
|
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="strife" class="actor-modify-control">
|
||||||
/ {{actor.data.data.strife.max}}
|
<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>
|
||||||
<td>
|
<td>
|
||||||
{{actor.data.data.focus}}
|
{{actor.data.data.focus}}
|
||||||
/ {{#if actor.data.data.is_compromised}}<span class="badvalue">1</span>{{else}}{{actor.data.data.vigilance}}{{/if}}
|
/ {{#if actor.data.data.is_compromised}}<span class="badvalue">1</span>{{else}}{{actor.data.data.vigilance}}{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{actor.data.data.void_points.value}}
|
<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.max}}
|
{{actor.data.data.void_points.value}}
|
||||||
|
/ {{actor.data.data.void_points.max}}
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td><i data-actor-id="{{actor.id}}" data-type="global" class="fas fa-question-circle actor-infos-control"></i></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>
|
<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}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<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>
|
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="casualties" class="actor-modify-control">
|
||||||
/ {{actor.data.data.battle_readiness.casualties_strength.max}}
|
<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>
|
||||||
<td>
|
<td>
|
||||||
<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>
|
<a title="{{localize 'l5r5e.gm_monitor.mouse_control'}}" data-actor-id="{{actor.id}}" data-type="panic" class="actor-modify-control">
|
||||||
/ {{actor.data.data.battle_readiness.panic_discipline.max}}
|
<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>
|
||||||
<td>
|
<td>
|
||||||
{{#if actor.data.data.commander_actor_id}}
|
{{#if actor.data.data.commander_actor_id}}
|
||||||
|
|||||||
Reference in New Issue
Block a user