20Q added a summary

Some language refactoring
Allow toggle even without editing perm
Fix DnD on school rank with npc as they don't have it
This commit is contained in:
Vlyan
2021-01-03 12:22:53 +01:00
parent b1298c50c4
commit 791a98eb3c
10 changed files with 308 additions and 221 deletions

View File

@@ -109,7 +109,9 @@ export class BaseSheetL5r5e extends ActorSheet {
case "advancement": // no break
case "peculiarity":
// Modify the bought at rank to the current actor rank
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
if (this.actor.data.data.identity?.school_rank) {
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
}
break;
case "technique":
@@ -161,7 +163,9 @@ export class BaseSheetL5r5e extends ActorSheet {
}
// Modify the bought at rank to the current actor rank
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
if (this.actor.data.data.identity?.school_rank) {
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
}
break;
}
@@ -180,6 +184,13 @@ export class BaseSheetL5r5e extends ActorSheet {
activateListeners(html) {
super.activateListeners(html);
// Toggle
html.find(".toggle-on-click").on("click", (event) => {
const elmt = $(event.currentTarget).data("toggle");
const tgt = html.find("." + elmt);
tgt.hasClass("toggle-active") ? tgt.removeClass("toggle-active") : tgt.addClass("toggle-active");
});
// *** Everything below here is only needed if the sheet is editable ***
if (!this.options.editable) {
return;
@@ -201,13 +212,6 @@ export class BaseSheetL5r5e extends ActorSheet {
event.target.select();
});
// Toggle
html.find(".toggle-on-click").on("click", (event) => {
const elmt = $(event.currentTarget).data("toggle");
const tgt = html.find("." + elmt);
tgt.hasClass("toggle-active") ? tgt.removeClass("toggle-active") : tgt.addClass("toggle-active");
});
// *** Items : add, edit, delete ***
html.find(".item-add").on("click", (event) => {
this._addSubItem(event);