Initiative rework, with some broken css

This commit is contained in:
Vlyan
2021-01-15 20:14:50 +01:00
parent 58a4e71b32
commit 27e88be49d
23 changed files with 425 additions and 156 deletions

View File

@@ -175,6 +175,7 @@ export class BaseSheetL5r5e extends ActorSheet {
new game.l5r5e.DicePickerDialog({
skillId: li.data("skill") || null,
skillCatId: li.data("skillcat") || null,
isInitiativeRoll: li.data("initiative") || false,
actor: this.actor,
}).render(true);
});
@@ -186,6 +187,16 @@ export class BaseSheetL5r5e extends ActorSheet {
event.target.select();
});
// Prepared (Initiative)
html.find(".prepared-control").on("click", (event) => {
event.preventDefault();
event.stopPropagation();
const preparedId = $(event.currentTarget).data("id");
if (["adversary", "character"].includes(preparedId)) {
this._switchPrepared();
}
});
// *** Items : add, edit, delete ***
html.find(".item-add").on("click", (event) => {
event.preventDefault();
@@ -204,6 +215,20 @@ export class BaseSheetL5r5e extends ActorSheet {
});
}
/**
* Switch the state "prepared" (initiative)
* @private
*/
_switchPrepared() {
this.actor.data.data.prepared = !this.actor.data.data.prepared;
this.actor.update({
data: {
prepared: this.actor.data.data.prepared,
},
});
this.render(false);
}
/**
* Add a generic item with sub type
* @private

View File

@@ -21,7 +21,7 @@ export class NpcSheetL5r5e extends BaseSheetL5r5e {
sheetData.data.types = NpcSheetL5r5e.types.map((e) => ({
id: e,
label: game.i18n.localize("l5r5e.npc.types." + e),
label: game.i18n.localize("l5r5e.character_types." + e),
}));
return sheetData;