add armor item
This commit is contained in:
@@ -85,6 +85,11 @@
|
||||
"range": "Range",
|
||||
"properties": "Properties",
|
||||
"weapons": "Weapons",
|
||||
"armors": {
|
||||
"title": "Armors",
|
||||
"physical": "physical",
|
||||
"spiritual": "spiritual"
|
||||
},
|
||||
"items": "Items",
|
||||
"feats": "Feats",
|
||||
"skill": "Skill",
|
||||
@@ -96,14 +101,14 @@
|
||||
"equipment": "Equipment",
|
||||
"rank": "Rank",
|
||||
"name": "Name",
|
||||
"socialstanding": {
|
||||
"social": {
|
||||
"title": "Social Standing",
|
||||
"honor": "Honor",
|
||||
"glory": "Glory",
|
||||
"status": "Status",
|
||||
"ninjo": "Ninjo",
|
||||
"giri": "Giri",
|
||||
"socialtitles": "Titles"
|
||||
"titles": "Titles"
|
||||
},
|
||||
"skills": {
|
||||
"title": "Skills",
|
||||
|
||||
@@ -85,6 +85,11 @@
|
||||
"range": "Rango",
|
||||
"properties": "Propiedades",
|
||||
"weapons": "Armas",
|
||||
"armors": {
|
||||
"title": "Armors",
|
||||
"physical": "physical",
|
||||
"spiritual": "spiritual"
|
||||
},
|
||||
"items": "Equipo",
|
||||
"feats": "Rasgos",
|
||||
"skill": "Habilidad",
|
||||
@@ -96,14 +101,14 @@
|
||||
"equipment": "Equipo",
|
||||
"rank": "Rango",
|
||||
"name": "Nombre",
|
||||
"socialstanding": {
|
||||
"social": {
|
||||
"title": "Posición Social",
|
||||
"honor": "Honor",
|
||||
"glory": "Gloria",
|
||||
"status": "Estatus",
|
||||
"ninjo": "Ninjo",
|
||||
"giri": "Giri",
|
||||
"socialtitles": "Títulos"
|
||||
"titles": "Títulos"
|
||||
},
|
||||
"skills": {
|
||||
"title": "Habilidades",
|
||||
|
||||
@@ -85,6 +85,11 @@
|
||||
"range": "Distance",
|
||||
"properties": "Propriétés",
|
||||
"weapons": "Armement",
|
||||
"armors": {
|
||||
"title": "Armures",
|
||||
"physical": "Physique",
|
||||
"spiritual": "Spirituelle"
|
||||
},
|
||||
"items": "Equipement",
|
||||
"feats": "Techniques",
|
||||
"skill": "Compétence",
|
||||
@@ -96,14 +101,14 @@
|
||||
"equipment": "Equipement",
|
||||
"rank": "Rang",
|
||||
"name": "Nom",
|
||||
"socialstanding": {
|
||||
"social": {
|
||||
"title": "Position Social",
|
||||
"honor": "Honneur",
|
||||
"glory": "Gloire",
|
||||
"status": "Status",
|
||||
"ninjo": "Ninjo",
|
||||
"giri": "Giri",
|
||||
"socialtitles": "Titres"
|
||||
"titles": "Titres"
|
||||
},
|
||||
"skills": {
|
||||
"title": "Compétences",
|
||||
|
||||
47
system/scripts/items/armor-sheet.js
Normal file
47
system/scripts/items/armor-sheet.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import { ItemSheetL5r5e } from "./item-sheet.js";
|
||||
|
||||
/**
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class ArmorSheetL5r5e extends ItemSheetL5r5e {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["l5r5e", "sheet", "armor"],
|
||||
template: CONFIG.L5r5e.paths.templates + "item/armor-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.isArmor = true;
|
||||
sheetData.data.isEquipment = 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);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { NpcSheetL5r5e } from "./sheets/npc-sheet.js";
|
||||
import { RollL5r5e, AbilityDie, RingDie, DicePickerDialog } from "./dice-l5r5e.js";
|
||||
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";
|
||||
|
||||
@@ -63,6 +64,7 @@ Hooks.once("init", async function () {
|
||||
// Items sheet
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
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 });
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ export const PreloadTemplates = async function () {
|
||||
"systems/l5r5e/templates/item/item-entry.html",
|
||||
"systems/l5r5e/templates/item/weapons.html",
|
||||
"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",
|
||||
];
|
||||
|
||||
@@ -58,13 +58,24 @@ export class ActorSheetL5r5e extends ActorSheet {
|
||||
*/
|
||||
_prepareItems(sheetData) {
|
||||
for (let item of sheetData.items) {
|
||||
if (item.type === "weapon") {
|
||||
item.isWeapon = true;
|
||||
item.isEquipment = true;
|
||||
} else if (item.type === "feat") {
|
||||
item.isFeat = true;
|
||||
} else {
|
||||
item.isEquipment = true;
|
||||
switch (item.type) {
|
||||
case "weapon":
|
||||
item.isWeapon = true;
|
||||
item.isEquipment = true;
|
||||
break;
|
||||
|
||||
case "armor":
|
||||
item.isArmor = true;
|
||||
item.isEquipment = true;
|
||||
break;
|
||||
|
||||
case "feat":
|
||||
item.isFeat = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
item.isEquipment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,13 +40,24 @@ export class NpcSheetL5r5e extends ActorSheet {
|
||||
*/
|
||||
_prepareItems(sheetData) {
|
||||
for (let item of sheetData.items) {
|
||||
if (item.type === "weapon") {
|
||||
item.isWeapon = true;
|
||||
item.isEquipment = true;
|
||||
} else if (item.type === "feat") {
|
||||
item.isFeat = true;
|
||||
} else {
|
||||
item.isEquipment = true;
|
||||
switch (item.type) {
|
||||
case "weapon":
|
||||
item.isWeapon = true;
|
||||
item.isEquipment = true;
|
||||
break;
|
||||
|
||||
case "armor":
|
||||
item.isArmor = true;
|
||||
item.isEquipment = true;
|
||||
break;
|
||||
|
||||
case "feat":
|
||||
item.isFeat = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
item.isEquipment = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,12 +121,22 @@
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
"types": ["item", "weapon", "feat", "xp-advancement"],
|
||||
"types": ["item", "armor", "weapon", "feat", "xp-advancement"],
|
||||
"item": {
|
||||
"description": "",
|
||||
"quantity": 1,
|
||||
"weight": 0
|
||||
},
|
||||
"armor": {
|
||||
"quantity": 1,
|
||||
"weight": 0,
|
||||
"description": "",
|
||||
"armor": {
|
||||
"physical": 0,
|
||||
"spiritual": 0
|
||||
},
|
||||
"properties": ""
|
||||
},
|
||||
"weapon": {
|
||||
"quantity": 1,
|
||||
"weight": 0,
|
||||
|
||||
12
system/templates/item/armor-entry.html
Normal file
12
system/templates/item/armor-entry.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<li class="item flexcol" data-item-id="{{item._id}}">
|
||||
<ul class="item-header item-control">
|
||||
<li class="item-img"><img src="{{item.img}}" title="{{item.name}}" width="32px" height="32px"/></li>
|
||||
<li class="item-name">{{ item.name }}</li>
|
||||
<li class="icon-stat-container">{{item.data.weight}}</li>
|
||||
<li class="icon-stat-container">{{item.data.armor.physical}} <i class="fas fa-certificate"></i></li>
|
||||
<li class="icon-stat-container">{{item.data.armor.spiritual}} <i class="fas fa-arrows-alt-h"></i></li>
|
||||
<li class="item-edit" title="Edit Feat"><i class="fas fa-edit"></i></li>
|
||||
<li class="item-delete" title="Delete Feat"><i class="fas fa-trash"></i></li>
|
||||
</ul>
|
||||
<div class="item-description">{{{ item.data.properties }}}</div>
|
||||
</li>
|
||||
41
system/templates/item/armor-sheet.html
Normal file
41
system/templates/item/armor-sheet.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<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 class="resource">
|
||||
<label>{{ localize 'l5r5e.quantity' }}</label>
|
||||
<input type="text" name="data.quantity" value="{{data.quantity}}" data-dtype="Number"/>
|
||||
</div>
|
||||
<div class="resource">
|
||||
<label>{{ localize 'l5r5e.weight' }}</label>
|
||||
<input type="text" name="data.weight" value="{{data.weight}}" data-dtype="Number"/>
|
||||
</div>
|
||||
</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>
|
||||
</nav>
|
||||
{{!-- Description Tab --}}
|
||||
<article class="tab" data-group="primary" data-tab="description">
|
||||
{{ localize 'l5r5e.armors.title' }}
|
||||
<fieldset class="weapon-stats-content">
|
||||
<label class="attribute-label">
|
||||
{{ localize 'l5r5e.armors.physical' }}
|
||||
<input type="text" name="data.armor.physical" value="{{data.armor.physical}}" data-dtype="Number" placeholder="0"/>
|
||||
</label>
|
||||
<label class="attribute-label">
|
||||
{{ localize 'l5r5e.armors.spiritual' }}
|
||||
<input type="text" name="data.armor.spiritual" value="{{data.armor.spiritual}}" data-dtype="Number" placeholder="0"/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="text-block-header">{{ localize 'l5r5e.properties' }}</legend>
|
||||
{{editor content=data.properties target="data.properties" button=true owner=owner editable=editable}}
|
||||
</fieldset>
|
||||
</article>
|
||||
</section>
|
||||
</form>
|
||||
10
system/templates/item/armors.html
Normal file
10
system/templates/item/armors.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<fieldset class="armors-content">
|
||||
<legend class="section-header">{{ localize 'l5r5e.armors.title' }}</legend>
|
||||
<ul class="item-list">
|
||||
{{#each actor.items as |item id|}}
|
||||
{{#if item.isArmor }}
|
||||
{{> 'systems/l5r5e/templates/item/armor-entry.html' item=item id=id }}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</fieldset>
|
||||
@@ -1,14 +1,14 @@
|
||||
<ul class="narrative-content">
|
||||
<li>
|
||||
<label class="attribute-label">{{ localize 'l5r5e.socialstanding.ninjo' }}</label>
|
||||
<label class="attribute-label">{{ localize 'l5r5e.social.ninjo' }}</label>
|
||||
<input type="text" name="data.social_standing.ninjo" value="{{data.social.ninjo}}"/>
|
||||
</li>
|
||||
<li>
|
||||
<label class="attribute-label">{{ localize 'l5r5e.socialstanding.giri' }}</label>
|
||||
<label class="attribute-label">{{ localize 'l5r5e.social.giri' }}</label>
|
||||
<input type="text" name="data.social_standing.giri" value="{{data.social.giri}}"/>
|
||||
</li>
|
||||
<li>
|
||||
<label class="attribute-label">{{ localize 'l5r5e.socialstanding.socialtitles' }}</label>
|
||||
<label class="attribute-label">{{ localize 'l5r5e.social.titles' }}</label>
|
||||
<input type="text" name="data.social_standing.titles" value="{{data.social.titles}}"/>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<ul class="social-content">
|
||||
<li>
|
||||
<label class="attribute-label centered-input">
|
||||
{{ localize 'l5r5e.socialstanding.honor' }}
|
||||
{{ localize 'l5r5e.social.honor' }}
|
||||
<input class="centered-input" type="text" name="data.social.honor" value="{{data.social.honor}}" placeholder="0"/>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label class="attribute-label centered-input">
|
||||
{{ localize 'l5r5e.socialstanding.glory' }}
|
||||
{{ localize 'l5r5e.social.glory' }}
|
||||
<input class="centered-input" type="text" name="data.social.glory" value="{{data.social.glory}}" placeholder="0"/>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label class="attribute-label centered-input">
|
||||
{{ localize 'l5r5e.socialstanding.status' }}
|
||||
{{ localize 'l5r5e.social.status' }}
|
||||
<input class="centered-input" type="text" name="data.social.status" value="{{data.social.status}}" placeholder="0"/>
|
||||
</label>
|
||||
</li>
|
||||
|
||||
@@ -99,5 +99,7 @@
|
||||
|
||||
{{> 'systems/l5r5e/templates/item/weapons.html' }}
|
||||
|
||||
{{> 'systems/l5r5e/templates/item/armor.html' }}
|
||||
|
||||
</section>
|
||||
</form>
|
||||
Reference in New Issue
Block a user