working on advancements
This commit is contained in:
@@ -90,6 +90,7 @@
|
||||
"physical": "physical",
|
||||
"supernatural": "supernatural"
|
||||
},
|
||||
"add": "Add",
|
||||
"items": "Items",
|
||||
"feats": "Feats",
|
||||
"techniques": {
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
"physical": "physical",
|
||||
"supernatural": "supernatural"
|
||||
},
|
||||
"add": "Add",
|
||||
"items": "Equipo",
|
||||
"feats": "Feats",
|
||||
"techniques": {
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
"physical": "Physique",
|
||||
"supernatural": "Spirituelle"
|
||||
},
|
||||
"add": "Ajouter",
|
||||
"items": "Objets",
|
||||
"feats": "Prouesses",
|
||||
"techniques": {
|
||||
|
||||
48
system/scripts/items/advancement-sheet.js
Normal file
48
system/scripts/items/advancement-sheet.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import { ItemSheetL5r5e } from "./item-sheet.js";
|
||||
|
||||
/**
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["l5r5e", "sheet", "advancement"],
|
||||
template: CONFIG.L5r5e.paths.templates + "item/advancement-sheet.html",
|
||||
width: 520,
|
||||
height: 480,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }],
|
||||
});
|
||||
}
|
||||
|
||||
getData() {
|
||||
const sheetData = super.getData();
|
||||
sheetData.data.dtypes = ["String", "Number", "Boolean"];
|
||||
|
||||
sheetData.data.isAdvancement = true;
|
||||
|
||||
return sheetData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 item with values from the sheet.
|
||||
* @param event
|
||||
* @param formData
|
||||
*/
|
||||
_updateObject(event, formData) {
|
||||
return this.object.update(formData);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import { ArmorSheetL5r5e } from "./items/armor-sheet.js";
|
||||
import { WeaponSheetL5r5e } from "./items/weapon-sheet.js";
|
||||
import { TechniqueSheetL5r5e } from "./items/technique-sheet.js";
|
||||
import { QualitySheetL5r5e } from "./items/quality-sheet.js";
|
||||
import { AdvancementSheetL5r5e } from "./items/advancement-sheet.js";
|
||||
|
||||
// Import Dice Types
|
||||
|
||||
@@ -69,6 +70,7 @@ Hooks.once("init", async function () {
|
||||
Items.registerSheet("l5r5e", WeaponSheetL5r5e, { types: ["weapon"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", TechniqueSheetL5r5e, { types: ["technique"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", QualitySheetL5r5e, { types: ["quality"], makeDefault: true });
|
||||
Items.registerSheet("l5r5e", AdvancementSheetL5r5e, { types: ["advancement"], makeDefault: true });
|
||||
|
||||
// for debug
|
||||
Handlebars.registerHelper("json", function (...objects) {
|
||||
@@ -111,7 +113,7 @@ Hooks.once("init", async function () {
|
||||
return game.i18n.localize(key);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("localizeTechniques", function (techniqueName) {
|
||||
Handlebars.registerHelper("localizeTechnique", function (techniqueName) {
|
||||
return game.i18n.localize("l5r5e.techniques." + techniqueName.toLowerCase());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,6 +35,9 @@ export const PreloadTemplates = async function () {
|
||||
"systems/l5r5e/templates/item/qualities.html",
|
||||
"systems/l5r5e/templates/item/quality-sheet.html",
|
||||
"systems/l5r5e/templates/item/quality-entry.html",
|
||||
"systems/l5r5e/templates/item/advancements.html",
|
||||
"systems/l5r5e/templates/item/advancement-sheet.html",
|
||||
"systems/l5r5e/templates/item/advancement-entry.html",
|
||||
];
|
||||
|
||||
return loadTemplates(templatePaths);
|
||||
|
||||
@@ -101,7 +101,6 @@
|
||||
},
|
||||
"character": {
|
||||
"templates": ["identity", "rings", "social", "skills", "techniques", "conflict", "xp"],
|
||||
"advancements": [],
|
||||
"zeni": 0,
|
||||
"notes": "",
|
||||
"twenty_questions": {}
|
||||
@@ -189,7 +188,9 @@
|
||||
"description": ""
|
||||
},
|
||||
"advancement": {
|
||||
"description": "TODO"
|
||||
"xp_used": 0,
|
||||
"rank": "",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
9
system/templates/item/advancement-entry.html
Normal file
9
system/templates/item/advancement-entry.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<li class="item advancement flexcol" data-advancement-id="{{advancement._id}}">
|
||||
<ul class="item-header advancement-controls">
|
||||
<li class="item-img"><img src="{{advancement.img}}" title="{{advancement.name}}" width="32px" height="32px"/></li>
|
||||
<li class="item-name">{{ advancement.name }}</li>
|
||||
<li class="item-control advancement-edit" title="Edit advancement"><i class="fas fa-edit"></i></li>
|
||||
<li class="item-control advancement-delete" title="Delete advancement"><i class="fas fa-trash"></i></li>
|
||||
</ul>
|
||||
<div class="item-description">{{{ advancement.data.description }}}</div>
|
||||
</li>
|
||||
31
system/templates/item/advancement-sheet.html
Normal file
31
system/templates/item/advancement-sheet.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
<header class="sheet-header">
|
||||
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
|
||||
<div class="header-fields">
|
||||
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
|
||||
</div>
|
||||
</header>
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="description">Description</a>
|
||||
<a class="item" data-tab="attributes">Attributes</a>
|
||||
</nav>
|
||||
{{!-- Description Tab --}}
|
||||
<article class="tab flexcol" data-group="primary" data-tab="description">
|
||||
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||
</article>
|
||||
{{!-- Attributes Tab --}}
|
||||
<article class="tab attributes" data-group="primary" data-tab="attributes">
|
||||
<label class="attribute">
|
||||
{{ localize 'l5r5e.xp.spent' }}
|
||||
<input type="text" name="data.xp_used" value="{{data.xp_used}}" data-dtype="Number" placeholder="0"/>
|
||||
</label>
|
||||
<label class="attribute">
|
||||
{{ localize 'l5r5e.rank' }}
|
||||
<input type="text" name="data.rank" value="{{data.rank}}"/>
|
||||
</label>
|
||||
</article>
|
||||
</section>
|
||||
</form>
|
||||
10
system/templates/item/advancements.html
Normal file
10
system/templates/item/advancements.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<fieldset class="weapons-content">
|
||||
<legend class="section-header">{{ localize 'l5r5e.xp.Acquisitions' }}</legend>
|
||||
<ul class="item-list">
|
||||
{{#each actor.items as |item id|}}
|
||||
{{#if item.isAdvancement }}
|
||||
{{> 'systems/l5r5e/templates/item/advancement-entry.html' advancement=item id=id }}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</fieldset>
|
||||
@@ -42,7 +42,7 @@
|
||||
<li class="attribute-value">Value</li>
|
||||
<li class="attribute-label">Label</li>
|
||||
<li class="attribute-dtype">Data Type</li>
|
||||
<li class="attribute-control" data-action="create"><i class="fas fa-plus"></i></li>
|
||||
<li class="attribute-control" data-action="create" title="{{ localize 'l5r5e.add' }}"><i class="fas fa-plus"></i></li>
|
||||
</ul>
|
||||
<ol class="attributes-list">
|
||||
{{#each data.attributes as |attr key|}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<tr class="flexrow row">
|
||||
<th class="name" name="acquisition.name">{{ acquisition.name }}</li>
|
||||
<td class="xp" name="acquisition.xp">{{ acquisition.data.xp_used }}</li>
|
||||
<td class="rank" name="acquisition.rank">{{ acquisition.data.rank }}</li>
|
||||
<td class="name" name="advancement.name">{{ advancement.name }}</td>
|
||||
<td class="xp" name="advancement.xp">{{ advancement.data.xp_used }}</td>
|
||||
<td class="rank" name="advancement.rank">{{ advancement.data.rank }}</td>
|
||||
</tr>
|
||||
@@ -24,9 +24,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="flex">
|
||||
{{#each data.advancements as |acquisition acquisitionId| }}
|
||||
{{> 'systems/l5r5e/templates/sheets/actor/advancement.html' acquisition=acquisition }}
|
||||
{{/each}}
|
||||
{{#each actor.items as |advancement advancementId|}}
|
||||
{{#if advancement.isAdvancement }}
|
||||
{{> 'systems/l5r5e/templates/sheets/actor/advancement.html' advancement=advancement }}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
@@ -2,7 +2,7 @@
|
||||
<fieldset class="section-header flexrow">
|
||||
<legend class="technique-controls">
|
||||
{{ localize 'l5r5e.techniques.title' }}
|
||||
<a class="technique-control technique-add" title="Add {{ localize 'l5r5e.techniques.title' }}"><i class="fas fa-plus"></i></a>
|
||||
<a class="technique-control technique-add" title="{{ localize 'l5r5e.add' }}"><i class="fas fa-plus"></i></a>
|
||||
</legend>
|
||||
<ul class="item-list">
|
||||
{{#each actor.items as |item id|}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<fieldset class="section-header flexrow">
|
||||
<legend class="technique-controls">
|
||||
{{ localize 'l5r5e.techniques.title' }}
|
||||
<a class="technique-control technique-add" title="Add {{ localize 'l5r5e.techniques.title' }}"><i class="fas fa-plus"></i></a>
|
||||
<a class="technique-control technique-add" title="{{ localize 'l5r5e.add' }}"><i class="fas fa-plus"></i></a>
|
||||
</legend>
|
||||
<ul class="item-list">
|
||||
{{#each actor.items as |item id|}}
|
||||
|
||||
Reference in New Issue
Block a user