some renaming

This commit is contained in:
Vlyan
2020-12-16 12:10:20 +01:00
parent 48356701b2
commit e079971168
28 changed files with 166 additions and 139 deletions

View File

@@ -3,12 +3,12 @@ import { ItemSheetL5r5e } from "./item-sheet.js";
/**
* @extends {ItemSheet}
*/
export class FeatSheetL5r5e extends ItemSheetL5r5e {
export class TechniqueSheetL5r5e extends ItemSheetL5r5e {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["l5r5e", "sheet", "feat"],
template: CONFIG.L5r5e.paths.templates + "item/feat-sheet.html",
classes: ["l5r5e", "sheet", "technique"],
template: CONFIG.L5r5e.paths.templates + "item/technique-sheet.html",
width: 520,
height: 480,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
@@ -20,8 +20,8 @@ export class FeatSheetL5r5e extends ItemSheetL5r5e {
const sheetData = super.getData();
sheetData.data.dtypes = ["String", "Number", "Boolean"];
sheetData.data.isFeat = true;
sheetData.data.isEquipment = false;
sheetData.data.isTechnique = true;
// sheetData.data.isEquipment = false;
return sheetData;
}

View File

@@ -10,7 +10,7 @@ import { ItemL5r5e } from "./items/item.js";
import { ItemSheetL5r5e } from "./items/item-sheet.js";
import { ArmorSheetL5r5e } from "./items/armor-sheet.js";
import { WeaponSheetL5r5e } from "./items/weapon-sheet.js";
import { FeatSheetL5r5e } from "./items/feat-sheet.js";
import { TechniqueSheetL5r5e } from "./items/technique-sheet.js";
import { QualitySheetL5r5e } from "./items/quality-sheet.js";
// Import Dice Types
@@ -67,7 +67,7 @@ Hooks.once("init", async function () {
Items.registerSheet("l5r5e", ItemSheetL5r5e, { types: ["item"], makeDefault: true });
Items.registerSheet("l5r5e", ArmorSheetL5r5e, { types: ["armor"], makeDefault: true });
Items.registerSheet("l5r5e", WeaponSheetL5r5e, { types: ["weapon"], makeDefault: true });
Items.registerSheet("l5r5e", FeatSheetL5r5e, { types: ["feat"], makeDefault: true });
Items.registerSheet("l5r5e", TechniqueSheetL5r5e, { types: ["technique"], makeDefault: true });
Items.registerSheet("l5r5e", QualitySheetL5r5e, { types: ["quality"], makeDefault: true });
// for debug
@@ -111,8 +111,8 @@ Hooks.once("init", async function () {
return game.i18n.localize(key);
});
Handlebars.registerHelper("localizeFeat", function (featName) {
return game.i18n.localize("l5r5e.feats." + featName.toLowerCase());
Handlebars.registerHelper("localizeTechniques", function (techniqueName) {
return game.i18n.localize("l5r5e.techniques." + techniqueName.toLowerCase());
});
});

View File

@@ -11,9 +11,9 @@ export const PreloadTemplates = async function () {
"systems/l5r5e/templates/sheets/actor/attributes.html",
"systems/l5r5e/templates/sheets/actor/conflict.html",
"systems/l5r5e/templates/sheets/actor/stance.html",
"systems/l5r5e/templates/sheets/actor/feats.html",
"systems/l5r5e/templates/sheets/actor/techniques.html",
"systems/l5r5e/templates/sheets/actor/experience.html",
"systems/l5r5e/templates/sheets/actor/acquisition.html",
"systems/l5r5e/templates/sheets/actor/advancement.html",
// npc
"systems/l5r5e/templates/sheets/npc/identity.html",
"systems/l5r5e/templates/sheets/npc/narrative.html",
@@ -21,7 +21,7 @@ export const PreloadTemplates = async function () {
"systems/l5r5e/templates/sheets/npc/rings.html",
"systems/l5r5e/templates/sheets/npc/attributes.html",
"systems/l5r5e/templates/sheets/npc/skill.html",
"systems/l5r5e/templates/sheets/npc/feats.html",
"systems/l5r5e/templates/sheets/npc/techniques.html",
// items
"systems/l5r5e/templates/item/weapon-sheet.html",
"systems/l5r5e/templates/item/items.html",
@@ -30,8 +30,8 @@ export const PreloadTemplates = async function () {
"systems/l5r5e/templates/item/weapon-entry.html",
"systems/l5r5e/templates/item/armors.html",
"systems/l5r5e/templates/item/armor-entry.html",
"systems/l5r5e/templates/item/feat-sheet.html",
"systems/l5r5e/templates/item/feat-entry.html",
"systems/l5r5e/templates/item/technique-sheet.html",
"systems/l5r5e/templates/item/technique-entry.html",
"systems/l5r5e/templates/item/qualities.html",
"systems/l5r5e/templates/item/quality-sheet.html",
"systems/l5r5e/templates/item/quality-entry.html",

View File

@@ -10,9 +10,9 @@ export class BaseSheetL5r5e extends ActorSheet {
this._prepareItems(sheetData);
const feats = sheetData.items.filter((item) => item.type === "feat");
const techniques = sheetData.items.filter((item) => item.type === "technique");
sheetData.data.feats = feats;
sheetData.data.techniques.list = techniques;
sheetData.data.stances = CONFIG.L5r5e.stances;
return sheetData;
@@ -44,16 +44,24 @@ export class BaseSheetL5r5e extends ActorSheet {
item.isEquipment = true;
break;
case "feat":
item.isFeat = true;
case "technique":
item.isTechnique = true;
break;
case "quality":
item.isQuality = true;
break;
case "xp-advancement":
item.isXpAdvancement = true;
case "advancement":
item.isAdvancement = true;
break;
case "advantage":
item.isAdvantage = true;
break;
case "disadvantage":
item.isDisadvantage = true;
break;
default:
@@ -66,7 +74,7 @@ export class BaseSheetL5r5e extends ActorSheet {
/**
* TODO
*/
_prepareFeats() {}
_prepareTechniques() {}
/**
* Subscribe to events from the sheet.
@@ -80,6 +88,7 @@ export class BaseSheetL5r5e extends ActorSheet {
return;
}
// *** Items ***
// Update Inventory Item
html.find(".item-edit").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".item");
@@ -94,60 +103,75 @@ export class BaseSheetL5r5e extends ActorSheet {
this.actor.deleteOwnedItem(li.data("itemId"));
});
html.find(".feat-add").on("click", (ev) => {
this._createFeat();
// *** Techniques ***
html.find(".technique-add").on("click", (ev) => {
this._createTechnique();
});
html.find(".feat-delete").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".feat");
const featId = li.data("featId");
console.log("Remove feat" + featId + " clicked");
html.find(".technique-delete").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".technique");
const techniqueId = li.data("techniqueId");
console.log("Remove technique" + techniqueId + " clicked");
this.actor.deleteOwnedItem(featId);
this.actor.deleteOwnedItem(techniqueId);
});
html.find(".feat-edit").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".feat");
const featId = li.data("featId");
const feat = this.actor.getOwnedItem(featId);
feat.sheet.render(true);
html.find(".technique-edit").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".technique");
const techniqueId = li.data("techniqueId");
const technique = this.actor.getOwnedItem(techniqueId);
technique.sheet.render(true);
});
// *** Skills ***
html.find(".skill-name").on("click", (ev) => {
const li = $(ev.currentTarget).parents(".skill");
this._onSkillClicked(li.data("skill"));
new game.l5r5e.DicePickerDialog({ skillId: li.data("skill"), actor: this.actor }).render(true);
});
// *** Advancement ***
html.find(".acquisition-add").on("click", (ev) => {
this._createFeat();
this._createAdvancement();
});
}
/**
* Creates a new feat for the character and shows a window to edit it.
*/
async _createFeat() {
async _createTechnique() {
const data = {
name: game.i18n.localize("l5r5e.featplaceholdername"),
type: "feat",
name: game.i18n.localize("l5r5e.techniques.title_new"),
type: "technique",
};
const created = await this.actor.createEmbeddedEntity("OwnedItem", data);
const feat = this.actor.getOwnedItem(created._id);
const technique = this.actor.getOwnedItem(created._id);
// Default values
//feat.rank = 1;
//feat.xp_used = 0;
//technique.rank = 1;
//technique.xp_used = 0;
feat.sheet.render(true);
technique.sheet.render(true);
return feat;
return technique;
}
/**
* React to a skill from the skills list been clicked.
* @param {string} skillId Unique ID of the skill been clicked.
* Creates a new feat for the character and shows a window to edit it.
*/
async _onSkillClicked(skillId) {
new game.l5r5e.DicePickerDialog({ skillId: skillId, actor: this.actor }).render(true);
async _createAdvancement() {
const data = {
name: game.i18n.localize("l5r5e.xp.acquisitions"),
type: "advancement",
};
const created = await this.actor.createEmbeddedEntity("OwnedItem", data);
const acquisition = this.actor.getOwnedItem(created._id);
acquisition.sheet.render(true);
// Default values
//acquisition.rank = 1;
//acquisition.xp_used = 0;
return acquisition;
}
}

View File

@@ -51,7 +51,7 @@ export class TwentyQuestionsDialog extends FormApplication {
...super.getData(options),
elementsList: this._getElements(),
skillsList: this._getSkills(),
featsList: CONFIG.L5r5e.techniques,
techniquesList: CONFIG.L5r5e.techniques,
datas: this.datas,
};
}
@@ -116,16 +116,16 @@ export class TwentyQuestionsDialog extends FormApplication {
};
actorDatas.techniques = {
kata: !!formData.step3_feat_kata,
kiho: formData.step3_feat_kiho,
invocation: !!formData.step3_feat_invocation,
ritual: !!formData.step3_feat_ritual,
shuji: !!formData.step3_feat_shuji,
maho: !!formData.step3_feat_maho,
ninjutsu: !!formData.step3_feat_ninjutsu,
kata: !!formData.step3_technique_kata,
kiho: formData.step3_technique_kiho,
invocation: !!formData.step3_technique_invocation,
ritual: !!formData.step3_technique_ritual,
shuji: !!formData.step3_technique_shuji,
maho: !!formData.step3_technique_maho,
ninjutsu: !!formData.step3_technique_ninjutsu,
};
// actorDatas = formData.step3_feats;
// actorDatas = formData.step3_techniques;
// actorDatas = formData.step3_school_ability;
// actorDatas = formData.step3_equipment;
// actorDatas = formData.step4_stand_out;
@@ -230,13 +230,13 @@ export class TwentyQuestionsDialog extends FormApplication {
step2_social_glory: actorDatas.social.glory,
step3_school: actorDatas.identity.school,
step3_roles: actorDatas.identity.roles,
step3_feat_kata: actorDatas.techniques.kata,
step3_feat_kiho: actorDatas.techniques.kiho,
step3_feat_invocations: actorDatas.techniques.invocation,
step3_feat_rituals: actorDatas.techniques.ritual,
step3_feat_shuji: actorDatas.techniques.shuji,
step3_feat_maho: actorDatas.techniques.maho,
step3_feat_ninjutsu: actorDatas.techniques.ninjutsu,
step3_technique_kata: actorDatas.techniques.kata,
step3_technique_kiho: actorDatas.techniques.kiho,
step3_technique_invocation: actorDatas.techniques.invocation,
step3_technique_ritual: actorDatas.techniques.ritual,
step3_technique_shuji: actorDatas.techniques.shuji,
step3_technique_maho: actorDatas.techniques.maho,
step3_technique_ninjutsu: actorDatas.techniques.ninjutsu,
step3_social_honor: actorDatas.social.honor,
step5_social_giri: actorDatas.social.giri,
step6_social_ninjo: actorDatas.social.ninjo,