Added SoftLock on NPC sheet and +/- button to add or subtract Casualties and Panic.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 1.6.0 - SoftLock
|
||||
- Added SoftLock on PC/NPC sheet
|
||||
- PC & NPC Sheet : Added +/- button to add or subtract Fatigue and Strife
|
||||
- Added SoftLock on PC/NPC/Armies sheet.
|
||||
- PC & NPC Sheet : Added +/- button to add or subtract Fatigue and Strife.
|
||||
- Armies Sheet : Added +/- button to add or subtract Casualties and Panic.
|
||||
- GmMonitor : Added ability to add or subtract fatigue/strife/void/casualties/panic points on mouse clic (left/right).
|
||||
|
||||
## 1.5.0 - FoundryVTT v9 Compatibility
|
||||
|
||||
@@ -113,6 +113,13 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
|
||||
return;
|
||||
}
|
||||
|
||||
// Casualties/Panic +/-
|
||||
html.find(".addsub-control").on("click", this._modifyCasualtiesOrPanic.bind(this));
|
||||
|
||||
if (this.actor.data.data.soft_locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete the linked Actor (warlord/commander)
|
||||
html.find(".actor-remove-control").on("click", this._removeLinkedActor.bind(this));
|
||||
}
|
||||
@@ -152,7 +159,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
|
||||
*/
|
||||
async _onDrop(event) {
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.isEditable) {
|
||||
if (!this.isEditable || this.actor.data.data.soft_locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,7 +191,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
|
||||
*/
|
||||
async _onDropActors(type, event) {
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.isEditable) {
|
||||
if (!this.isEditable || this.actor.data.data.soft_locked) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,4 +277,53 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
|
||||
}
|
||||
return this.actor.update({ data: actorData });
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Subtract Casualties/Panic (+/- buttons)
|
||||
* @param {Event} event
|
||||
* @private
|
||||
*/
|
||||
async _modifyCasualtiesOrPanic(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
const elmt = $(event.currentTarget);
|
||||
const type = elmt.data("type");
|
||||
let mod = elmt.data("value");
|
||||
if (!mod) {
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case "casualties":
|
||||
await this.actor.update({
|
||||
data: {
|
||||
battle_readiness: {
|
||||
casualties_strength: {
|
||||
value: Math.max(
|
||||
0,
|
||||
this.actor.data.data.battle_readiness.casualties_strength.value + mod
|
||||
),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
case "panic":
|
||||
await this.actor.update({
|
||||
data: {
|
||||
battle_readiness: {
|
||||
panic_discipline: {
|
||||
value: Math.max(0, this.actor.data.data.battle_readiness.panic_discipline.value + mod),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
console.warn("L5R5E | Unsupported type", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
|
||||
// Split Items by types
|
||||
sheetData.data.splitItemsList = this._splitItems(sheetData);
|
||||
|
||||
// Shortcut for some tests
|
||||
sheetData.data.editable_not_soft_locked = sheetData.editable && !sheetData.data.data.soft_locked;
|
||||
|
||||
return sheetData;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
||||
// Shortcut for some tests
|
||||
sheetData.data.editable_not_soft_locked = sheetData.editable && !sheetData.data.data.soft_locked;
|
||||
|
||||
return sheetData;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -24,6 +24,11 @@
|
||||
display: inline-grid;
|
||||
position: relative;
|
||||
|
||||
.attributes-buttons {
|
||||
line-height: 13px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
strong {
|
||||
color: $l5r5e-label;
|
||||
text-align: center;
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
}
|
||||
},
|
||||
"army": {
|
||||
"templates": ["softlock"],
|
||||
"warlord": "",
|
||||
"warlord_actor_id": null,
|
||||
"allies_backers": "",
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
<form class="{{cssClass}}" data-lang="{{localize 'I18N.Language'}}" autocomplete="off">
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
<img class="profile-img dragndrop-actor-id pointer" src="{{data.img}}" data-edit="img" data-actor-id="{{actor.id}}" draggable="true" title="{{data.name}}"/>
|
||||
<img class="profile-img dragndrop-actor-id pointer" src="{{data.img}}" {{#if data.editable_not_soft_locked}}data-edit="img"{{/if}} data-actor-id="{{actor.id}}" draggable="true" title="{{data.name}}"/>
|
||||
<div class="header-fields identity-wrapper">
|
||||
<h1 class="charname"><input name="name" type="text" value="{{data.name}}" placeholder="Name"/></h1>
|
||||
<h1 class="charname"><input name="name" type="text" value="{{data.name}}" placeholder="Name" {{^if data.editable_not_soft_locked}}disabled{{/if}}/></h1>
|
||||
<div class="readiness">
|
||||
<ul>
|
||||
<li>
|
||||
<input name="data.battle_readiness.casualties_strength.value" type="number" value="{{data.data.battle_readiness.casualties_strength.value}}" />
|
||||
<input name="data.battle_readiness.casualties_strength.value" type="number" value="{{data.data.battle_readiness.casualties_strength.value}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
<strong>{{localize 'l5r5e.army.battle_readiness.casualties'}}</strong>
|
||||
<span class="attributes-buttons">
|
||||
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="casualties" data-value="-1"></i>
|
||||
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="casualties" data-value="1"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<input name="data.battle_readiness.casualties_strength.max" type="number" value="{{data.data.battle_readiness.casualties_strength.max}}" />
|
||||
<input name="data.battle_readiness.casualties_strength.max" type="number" value="{{data.data.battle_readiness.casualties_strength.max}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
<strong>{{localize 'l5r5e.army.battle_readiness.strength'}}</strong>
|
||||
</li>
|
||||
<li>
|
||||
<input name="data.battle_readiness.panic_discipline.value" type="number" value="{{data.data.battle_readiness.panic_discipline.value}}" />
|
||||
<input name="data.battle_readiness.panic_discipline.value" type="number" value="{{data.data.battle_readiness.panic_discipline.value}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
<strong>{{localize 'l5r5e.army.battle_readiness.panic'}}</strong>
|
||||
<span class="attributes-buttons">
|
||||
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="panic" data-value="-1"></i>
|
||||
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="panic" data-value="1"></i>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<input name="data.battle_readiness.panic_discipline.max" type="number" value="{{data.data.battle_readiness.panic_discipline.max}}" />
|
||||
<input name="data.battle_readiness.panic_discipline.max" type="number" value="{{data.data.battle_readiness.panic_discipline.max}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
<strong>{{localize 'l5r5e.army.battle_readiness.discipline'}}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -1,58 +1,62 @@
|
||||
<div class="header-fields warlord">
|
||||
<fieldset>
|
||||
<legend>{{^if data.data.warlord_actor_id}}<i class="fa fa-sign-in-alt" aria-hidden="true"></i> {{/if}}{{localize 'l5r5e.army.warlord'}}</legend>
|
||||
<legend>{{#if data.editable_not_soft_locked}}{{^if data.data.warlord_actor_id}}<i class="fa fa-sign-in-alt" aria-hidden="true"></i> {{/if}}{{/if}}{{localize 'l5r5e.army.warlord'}}</legend>
|
||||
<p class="warlord-name">
|
||||
{{#if data.data.warlord_actor_id}}
|
||||
<label>
|
||||
<a data-actor-id="{{data.data.warlord_actor_id}}" class="open-sheet-actor-id">{{data.data.warlord}}</a>
|
||||
{{#if data.editable_not_soft_locked}}
|
||||
<span data-actor-id="{{actor.id}}" data-type="warlord" class="actor-remove-control pointer" title="{{localize 'Delete'}}"><i class="fas fa-trash"></i></span>
|
||||
{{/if}}
|
||||
</label>
|
||||
{{else}}
|
||||
<input name="data.warlord" type="text" value="{{data.data.warlord}}" />
|
||||
<input name="data.warlord" type="text" value="{{data.data.warlord}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
{{/if}}
|
||||
</p>
|
||||
<p>
|
||||
<strong>{{localize 'l5r5e.army.allies_backers'}}</strong>
|
||||
<textarea type="text" name="data.allies_backers">{{data.data.allies_backers}}</textarea>
|
||||
<textarea type="text" name="data.allies_backers" {{^if data.editable_not_soft_locked}}disabled{{/if}}>{{data.data.allies_backers}}</textarea>
|
||||
</p>
|
||||
<p>
|
||||
<strong>{{localize 'l5r5e.army.purpose_mustering'}}</strong>
|
||||
<textarea type="text" name="data.purpose_mustering">{{data.data.purpose_mustering}}</textarea>
|
||||
<textarea type="text" name="data.purpose_mustering" {{^if data.editable_not_soft_locked}}disabled{{/if}}>{{data.data.purpose_mustering}}</textarea>
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="header-fields commander">
|
||||
<fieldset>
|
||||
<legend>{{^if data.data.commander_actor_id}}<i class="fa fa-sign-in-alt" aria-hidden="true"></i> {{/if}}{{localize 'l5r5e.army.commander'}}</legend>
|
||||
<legend>{{#if data.editable_not_soft_locked}}{{^if data.data.commander_actor_id}}<i class="fa fa-sign-in-alt" aria-hidden="true"></i> {{/if}}{{/if}}{{localize 'l5r5e.army.commander'}}</legend>
|
||||
<div class="warlord-name">
|
||||
{{#if data.data.commander_actor_id}}
|
||||
<label>
|
||||
<a data-actor-id="{{data.data.commander_actor_id}}" class="open-sheet-actor-id">{{data.data.commander}}</a>
|
||||
{{#if data.editable_not_soft_locked}}
|
||||
<span data-actor-id="{{actor.id}}" data-type="commander" class="actor-remove-control pointer" title="{{localize 'Delete'}}"><i class="fas fa-trash"></i></span>
|
||||
{{/if}}
|
||||
</label>
|
||||
{{else}}
|
||||
<input name="data.commander" type="text" value="{{data.data.commander}}" />
|
||||
<input name="data.commander" type="text" value="{{data.data.commander}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="standing">
|
||||
<ul>
|
||||
<li>
|
||||
<strong>{{localize 'l5r5e.social.honor'}}</strong>
|
||||
<input name="data.commander_standing.honor" type="number" value="{{data.data.commander_standing.honor}}" />
|
||||
<input name="data.commander_standing.honor" type="number" value="{{data.data.commander_standing.honor}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
</li>
|
||||
<li>
|
||||
<strong>{{localize 'l5r5e.social.glory'}}</strong>
|
||||
<input name="data.commander_standing.glory" type="number" value="{{data.data.commander_standing.glory}}" />
|
||||
<input name="data.commander_standing.glory" type="number" value="{{data.data.commander_standing.glory}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
</li>
|
||||
<li>
|
||||
<strong>{{localize 'l5r5e.social.status'}}</strong>
|
||||
<input name="data.commander_standing.status" type="number" value="{{data.data.commander_standing.status}}" />
|
||||
<input name="data.commander_standing.status" type="number" value="{{data.data.commander_standing.status}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<label>
|
||||
<strong>{{localize 'l5r5e.army.commander_abilities'}}</strong>
|
||||
<textarea type="text" name="data.commander_abilities">{{data.data.commander_abilities}}</textarea>
|
||||
<textarea type="text" name="data.commander_abilities" {{^if data.editable_not_soft_locked}}disabled{{/if}}>{{data.data.commander_abilities}}</textarea>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset class="army-abilities">
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<fieldset class="cohort-content">
|
||||
<legend class="section-header">
|
||||
{{localize 'l5r5e.army.cohort.title'}}
|
||||
{{#if options.editable}}
|
||||
{{#if data.editable_not_soft_locked}}
|
||||
<a data-item-type="army_cohort" class="army-cohort-control item-add" title="{{localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
{{/if}}
|
||||
</legend>
|
||||
<ul class="item-list">
|
||||
{{#each data.splitItemsList.army_cohort as |item|}}
|
||||
{{> 'systems/l5r5e/templates/items/army-cohort/army-cohort-entry.html' cohort=item editable=../options.editable}}
|
||||
{{> 'systems/l5r5e/templates/items/army-cohort/army-cohort-entry.html' cohort=item editable=../data.editable_not_soft_locked}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</fieldset>
|
||||
@@ -1,13 +1,13 @@
|
||||
<fieldset class="fortification-content">
|
||||
<legend class="section-header">
|
||||
{{localize 'l5r5e.army.fortification.title'}}
|
||||
{{#if options.editable}}
|
||||
{{#if data.editable_not_soft_locked}}
|
||||
<a data-item-type="army_fortification" class="army-fortification-control item-add" title="{{localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
{{/if}}
|
||||
</legend>
|
||||
<ul class="item-list">
|
||||
{{#each data.splitItemsList.army_fortification as |item|}}
|
||||
{{> 'systems/l5r5e/templates/items/army-fortification/army-fortification-entry.html' fortification=item editable=../options.editable}}
|
||||
{{> 'systems/l5r5e/templates/items/army-fortification/army-fortification-entry.html' fortification=item editable=../data.editable_not_soft_locked}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</fieldset>
|
||||
Reference in New Issue
Block a user