PC & NPC Sheet : Added +/- button to add or subtract Fatigue and Strife

This commit is contained in:
Vlyan
2022-01-20 09:28:20 +01:00
parent 7abb46ea77
commit c9be3013e8
6 changed files with 70 additions and 2 deletions

View File

@@ -2,7 +2,8 @@
## 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. - PC & NPC Sheet : Added +/- button to add or subtract Fatigue and Strife
- GmMonitor : Added ability to add or subtract fatigue/strife/void/casualties/panic points on mouse clic (left/right).
## 1.5.0 - FoundryVTT v9 Compatibility ## 1.5.0 - FoundryVTT v9 Compatibility
- Updated the System to FoundryVTT v9. - Updated the System to FoundryVTT v9.

View File

@@ -313,6 +313,9 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
// Others Advancements // Others Advancements
html.find(".item-advancement-choose").on("click", this._showDialogAddSubItem.bind(this)); html.find(".item-advancement-choose").on("click", this._showDialogAddSubItem.bind(this));
// Fatigue/Strife +/-
html.find(".addsub-control").on("click", this._modifyFatigueOrStrife.bind(this));
} }
/** /**
@@ -509,6 +512,48 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
return false; return false;
} }
/**
* Add or Subtract Fatigue/Strife (+/- buttons)
* @param {Event} event
* @private
*/
async _modifyFatigueOrStrife(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 "fatigue":
await this.actor.update({
data: {
fatigue: {
value: Math.max(0, this.actor.data.data.fatigue.value + mod),
},
},
});
break;
case "strife":
await this.actor.update({
data: {
strife: {
value: Math.max(0, this.actor.data.data.strife.value + mod),
},
},
});
break;
default:
console.warn("L5R5E | Unsupported type", type);
break;
}
}
/** /**
* Switch Readied state on a weapon * Switch Readied state on a weapon
* @param {Event} event * @param {Event} event

File diff suppressed because one or more lines are too long

View File

@@ -385,6 +385,12 @@
width: 3.5rem; width: 3.5rem;
} }
} }
.attributes-buttons {
line-height: 13px;
position: relative;
right: -1.5rem;
top: 0.3rem;
}
.void-content { .void-content {
width: 100%; width: 100%;
padding-top: 0.25rem; padding-top: 0.25rem;

View File

@@ -8,6 +8,10 @@
<strong>{{localize 'l5r5e.attributes.fatigue'}}</strong> <strong>{{localize 'l5r5e.attributes.fatigue'}}</strong>
<input class="centered-input select-on-focus" type="number" name="data.fatigue.value" value="{{data.data.fatigue.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/> <input class="centered-input select-on-focus" type="number" name="data.fatigue.value" value="{{data.data.fatigue.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label> </label>
<span class="attributes-buttons">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="fatigue" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="fatigue" data-value="-1"></i>
</span>
<p class="item-description"> {{localize 'l5r5e.attributes.endurancetip'}}</p> <p class="item-description"> {{localize 'l5r5e.attributes.endurancetip'}}</p>
</li> </li>
<li class="composure-content"> <li class="composure-content">
@@ -19,6 +23,10 @@
<strong>{{localize 'l5r5e.attributes.strife'}}</strong> <strong>{{localize 'l5r5e.attributes.strife'}}</strong>
<input class="centered-input select-on-focus" type="number" name="data.strife.value" value="{{data.data.strife.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/> <input class="centered-input select-on-focus" type="number" name="data.strife.value" value="{{data.data.strife.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label> </label>
<span class="attributes-buttons">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="strife" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="strife" data-value="-1"></i>
</span>
<p class="item-description"> {{localize 'l5r5e.attributes.composuretip'}}</p> <p class="item-description"> {{localize 'l5r5e.attributes.composuretip'}}</p>
</li> </li>
<li class="focus-content"> <li class="focus-content">

View File

@@ -8,6 +8,10 @@
<strong>{{localize 'l5r5e.attributes.fatigue'}}</strong> <strong>{{localize 'l5r5e.attributes.fatigue'}}</strong>
<input class="centered-input select-on-focus" type="number" name="data.fatigue.value" value="{{data.data.fatigue.value}}" data-dtype="Number" min="0" placeholder="0"/> <input class="centered-input select-on-focus" type="number" name="data.fatigue.value" value="{{data.data.fatigue.value}}" data-dtype="Number" min="0" placeholder="0"/>
</label> </label>
<span class="attributes-buttons">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="fatigue" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="fatigue" data-value="-1"></i>
</span>
<p class="item-description"> {{localize 'l5r5e.attributes.endurancetip'}}</p> <p class="item-description"> {{localize 'l5r5e.attributes.endurancetip'}}</p>
</li> </li>
<li class="composure-content"> <li class="composure-content">
@@ -19,6 +23,10 @@
<strong>{{localize 'l5r5e.attributes.strife'}}</strong> <strong>{{localize 'l5r5e.attributes.strife'}}</strong>
<input class="centered-input select-on-focus" type="number" name="data.strife.value" value="{{data.data.strife.value}}" data-dtype="Number" min="0" placeholder="0"/> <input class="centered-input select-on-focus" type="number" name="data.strife.value" value="{{data.data.strife.value}}" data-dtype="Number" min="0" placeholder="0"/>
</label> </label>
<span class="attributes-buttons">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="strife" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="strife" data-value="-1"></i>
</span>
<p class="item-description"> {{localize 'l5r5e.attributes.composuretip'}}</p> <p class="item-description"> {{localize 'l5r5e.attributes.composuretip'}}</p>
</li> </li>
<li class="focus-content"> <li class="focus-content">