Merge branch 'master' into Dev-Vlyan

# Conflicts:
#	system/l5r-ui/ui/cursors/normal.webp
This commit is contained in:
Vlyan
2020-12-09 21:04:38 +01:00
65 changed files with 939 additions and 661 deletions

View File

@@ -1,17 +1,15 @@
export class ActorSheetL5r5e extends ActorSheet {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "actor"],
template: "systems/l5r5e/templates/sheets/actor-sheet.html",
width: 600,
height: 600,
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}],
dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}]
height: 800,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
});
}
getData() {
const sheetData = super.getData();
@@ -20,123 +18,121 @@ export class ActorSheetL5r5e extends ActorSheet {
const feats = sheetData.items.filter((item) => item.type === "feat");
sheetData.data.feats = feats;
return sheetData;
}
/**
* Update the actor.
* @param event
* @param formData
*/
* Update the actor.
* @param event
* @param formData
*/
_updateObject(event, formData) {
return this.object.update(formData);
}
/**
* Prepare item data to be displayed in the actor sheet.
* @param sheetData Data of the actor been displayed in the sheet.
*/
* Prepare item data to be displayed in the actor sheet.
* @param sheetData Data of the actor been displayed in the sheet.
*/
_prepareItems(sheetData) {
for (let item of sheetData.items) {
if (item.type === "weapon") {
item.isWeapon = true;
item.isEquipment = true;
} else if (item.type === "feat"){
} else if (item.type === "feat") {
item.isFeat = true;
}
else {
} else {
item.isEquipment = true;
}
}
}
_prepareFeats() {
}
_prepareFeats() {}
/**
* Subscribe to events from the sheet.
* @param html HTML content of the sheet.
*/
* Subscribe to events from the sheet.
* @param html HTML content of the sheet.
*/
activateListeners(html) {
super.activateListeners(html);
// Everything below here is only needed if the sheet is editable
if (!this.options.editable) return;
// Update Inventory Item
html.find('.item-edit').click(ev => {
html.find(".item-edit").click((ev) => {
const li = $(ev.currentTarget).parents(".item");
const itemId = li.data("itemId");
const itemId = li.data("itemId");
const item = this.actor.getOwnedItem(itemId);
item.sheet.render(true);
});
// Delete Inventory Item
html.find('.item-delete').click(ev => {
html.find(".item-delete").click((ev) => {
const li = $(ev.currentTarget).parents(".item");
const itemId = li.data("itemId");
const itemId = li.data("itemId");
this.actor.deleteOwnedItem(itemId);
});
html.find('.feat-add').click(ev => {
html.find(".feat-add").click((ev) => {
this._createFeat();
});
html.find('.feat-delete').click(ev => {
html.find(".feat-delete").click((ev) => {
const li = $(ev.currentTarget).parents(".feat");
const featId = li.data("featId");
console.log("Remove feat" + featId + " clicked");
this.actor.deleteOwnedItem(featId);
});
html.find('.feat-edit').click(ev => {
html.find(".feat-edit").click((ev) => {
const li = $(ev.currentTarget).parents(".feat");
const featId = li.data("featId");
const featId = li.data("featId");
const feat = this.actor.getOwnedItem(featId);
feat.sheet.render(true);
});
html.find('.skill-name').click(ev => {
html.find(".skill-name").click((ev) => {
const li = $(ev.currentTarget).parents(".skill");
const skillId = li.data("skill");
this._onSkillClicked(skillId);
});
html.find('.adquisition-add').click(ev => {
html.find(".adquisition-add").click((ev) => {
this._createFeat();
});
}
/**
* Creates a new feat for the character and shows a window to edit it.
*/
* Creates a new feat for the character and shows a window to edit it.
*/
async _createFeat() {
const data = {
name: game.i18n.localize('L5r5e.FeatPlaceholderName'),
type: "feat"
name: game.i18n.localize("L5r5e.FeatPlaceholderName"),
type: "feat",
};
const created = await this.actor.createEmbeddedEntity("OwnedItem", data);
const feat = this.actor.getOwnedItem(created._id);
// Default values
//feat.rank = 1;
//feat.xp_used = 0;
feat.sheet.render(true);
return feat;
}
/**
* React to a skill from the skills list been clicked.
* @param {string} skillId Unique ID of the skill been clicked.
*/
* React to a skill from the skills list been clicked.
* @param {string} skillId Unique ID of the skill been clicked.
*/
async _onSkillClicked(skillId) {
console.log("Clicked on skill " + skillId);
// TODO
}
}
}