2023-11-03 20:21:17 +01:00
|
|
|
import { RdDUtility } from "../rdd-utility.js";
|
|
|
|
import { RdDBaseActorSheet } from "./base-actor-sheet.js";
|
2021-01-10 22:12:07 +01:00
|
|
|
|
2022-01-01 14:01:41 +01:00
|
|
|
/* -------------------------------------------- */
|
2023-11-03 20:21:17 +01:00
|
|
|
export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
|
2021-01-10 22:12:07 +01:00
|
|
|
|
|
|
|
/** @override */
|
2022-01-01 14:01:41 +01:00
|
|
|
static get defaultOptions() {
|
2021-01-10 22:12:07 +01:00
|
|
|
RdDUtility.initAfficheContenu();
|
|
|
|
|
2023-11-06 23:02:22 +01:00
|
|
|
return mergeObject(RdDBaseActorSheet.defaultOptions, {
|
2022-01-01 14:01:41 +01:00
|
|
|
template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html",
|
2023-11-06 23:02:22 +01:00
|
|
|
width: 640, height: 720,
|
2021-01-10 22:12:07 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-11-03 20:21:17 +01:00
|
|
|
/* -------------------------------------------- */
|
|
|
|
async getData() {
|
|
|
|
let formData = await super.getData();
|
|
|
|
mergeObject(formData,
|
|
|
|
{
|
|
|
|
editable: this.isEditable,
|
|
|
|
cssClass: this.isEditable ? "editable" : "locked",
|
|
|
|
effects: this.actor.effects.map(e => foundry.utils.deepClone(e)),
|
|
|
|
limited: this.actor.limited,
|
|
|
|
owner: this.actor.isOwner,
|
|
|
|
});
|
|
|
|
|
|
|
|
this.timerRecherche = undefined;
|
|
|
|
return formData;
|
|
|
|
}
|
|
|
|
|
2022-11-28 21:01:28 +01:00
|
|
|
activateListeners(html) {
|
|
|
|
super.activateListeners(html);
|
|
|
|
if (!this.options.editable) return;
|
|
|
|
|
2022-12-09 02:00:31 +01:00
|
|
|
this.html.find('.resistance-moins').click(async event => {
|
2022-11-28 21:01:28 +01:00
|
|
|
this.actor.vehicleIncDec("resistance", -1);
|
|
|
|
});
|
2022-12-09 02:00:31 +01:00
|
|
|
this.html.find('.resistance-plus').click(async event => {
|
2022-11-28 21:01:28 +01:00
|
|
|
this.actor.vehicleIncDec("resistance", 1);
|
|
|
|
});
|
2022-12-09 02:00:31 +01:00
|
|
|
this.html.find('.structure-moins').click(async event => {
|
2022-11-28 21:01:28 +01:00
|
|
|
this.actor.vehicleIncDec("structure", -1);
|
|
|
|
});
|
2022-12-09 02:00:31 +01:00
|
|
|
this.html.find('.structure-plus').click(async event => {
|
2022-11-28 21:01:28 +01:00
|
|
|
this.actor.vehicleIncDec("structure", 1);
|
|
|
|
});
|
|
|
|
}
|
2021-03-17 01:21:37 +01:00
|
|
|
|
2021-01-10 22:12:07 +01:00
|
|
|
}
|