Split Items by category in actor sheet (pc & npc) for better readability
Fix actor fromData
This commit is contained in:
@@ -19,7 +19,8 @@
|
||||
- Added confirm dialog on item's deletion (Hold "ctrl" on the click, if you want to bypass it)
|
||||
- Added "Sleep" & "Scene End" buttons in "GM ToolBox" (old "difficulty" box)
|
||||
- Added an option to reverse the token's bar on fatigue (thanks to Jzrzmy), and colorize in red the strife bar if compromise
|
||||
- Split techniques in actor sheet for better readability
|
||||
- Split Techniques & Items by category in actor sheet (pc & npc) for better readability
|
||||
- Armor & Weapon added in the conflict tab now set the "eqquiped" props by default
|
||||
|
||||
## 1.1.2 - One Compendium to bring them all
|
||||
- Added compendiums (Thanks to Stéfano Fara for the English version !) Partial for French as PoW and CR are not translated yet
|
||||
|
||||
@@ -32,14 +32,17 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
||||
// Split techniques by types
|
||||
// Split Techniques by types
|
||||
sheetData.data.splitTechniquesList = this._splitTechniques(sheetData);
|
||||
|
||||
// Split Items by types
|
||||
sheetData.data.splitItemsList = this._splitItems(sheetData);
|
||||
|
||||
return sheetData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split techniques by types for better readability
|
||||
* Split Techniques by types for better readability
|
||||
* @private
|
||||
*/
|
||||
_splitTechniques(sheetData) {
|
||||
@@ -73,12 +76,32 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
sheetData.data.techniques["mastery_ability"] = out["mastery_ability"].length === 0;
|
||||
|
||||
// Always display "school_ability", but display "mastery_ability" only if rank >= 5
|
||||
if (sheetData.data.identity.school_rank < 5 && out["mastery_ability"].length === 0) {
|
||||
if (sheetData.data.identity?.school_rank < 5 && out["mastery_ability"].length === 0) {
|
||||
delete out["mastery_ability"];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split Items by types for better readability
|
||||
* @private
|
||||
*/
|
||||
_splitItems(sheetData) {
|
||||
const out = {
|
||||
weapon: [],
|
||||
armor: [],
|
||||
item: [],
|
||||
};
|
||||
|
||||
sheetData.items.forEach((item) => {
|
||||
if (["item", "armor", "weapon"].includes(item.type)) {
|
||||
out[item.type].push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a light sheet if in "limited" state
|
||||
* @override
|
||||
@@ -311,13 +334,23 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
|
||||
}
|
||||
|
||||
switch (item.data.type) {
|
||||
case "armor": // no break
|
||||
case "weapon":
|
||||
if ($(event.currentTarget).data("item-eqquiped")) {
|
||||
item.data.data.equipped = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case "technique": {
|
||||
// If technique, select the current type
|
||||
if (item.data.type === "technique") {
|
||||
const techType = $(event.currentTarget).data("tech-type");
|
||||
if ([...CONFIG.l5r5e.techniques, ...CONFIG.l5r5e.techniques_school].includes(techType)) {
|
||||
item.data.data.technique_type = techType;
|
||||
item.data.img = `${CONFIG.l5r5e.paths.assets}/icons/techs/${techType}.svg`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
item.sheet.render(true);
|
||||
|
||||
@@ -23,7 +23,7 @@ export class RollnKeepDialog extends FormApplication {
|
||||
|
||||
/**
|
||||
* The current Roll
|
||||
* @param {Roll} roll
|
||||
* @param {RollL5r5e} roll
|
||||
*/
|
||||
roll = null;
|
||||
|
||||
|
||||
@@ -336,12 +336,18 @@ export class RollL5r5e extends Roll {
|
||||
roll.l5r5e = duplicate(data.l5r5e);
|
||||
|
||||
// get real Actor object
|
||||
if (data.l5r5e.actor && !(data.l5r5e.actor instanceof game.l5r5e.ActorL5r5e)) {
|
||||
if (data.l5r5e.actor) {
|
||||
if (data.l5r5e.actor instanceof game.l5r5e.ActorL5r5e) {
|
||||
// duplicate break the object, relink it
|
||||
roll.l5r5e.actor = data.l5r5e.actor;
|
||||
} else {
|
||||
// only id, get the object
|
||||
const actor = game.actors.get(data.l5r5e.actor.id);
|
||||
if (actor) {
|
||||
roll.l5r5e.actor = actor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return roll;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,10 @@
|
||||
<input name="data.money.zeni" type="number" value="{{actor.data.money.zeni}}" data-dtype="Number" min="0" placeholder="0"/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset class="items-wrapper">
|
||||
<legend>{{localize 'l5r5e.equipment' }}</legend>
|
||||
{{> 'systems/l5r5e/templates/items/item/items.html' }}
|
||||
</fieldset>
|
||||
</article>
|
||||
|
||||
{{!-- Experience Tab --}}
|
||||
|
||||
@@ -28,9 +28,15 @@
|
||||
{{> 'systems/l5r5e/templates/actors/npc/narrative.html' }}
|
||||
</article>
|
||||
<article>
|
||||
<fieldset class="items-wrapper">
|
||||
<legend>{{localize 'l5r5e.armors.equipped' }}</legend>
|
||||
{{> 'systems/l5r5e/templates/items/weapon/weapons.html' }}
|
||||
{{> 'systems/l5r5e/templates/items/armor/armors.html' }}
|
||||
</fieldset>
|
||||
<fieldset class="items-wrapper">
|
||||
<legend>{{localize 'l5r5e.equipment' }}</legend>
|
||||
{{> 'systems/l5r5e/templates/items/item/items.html' }}
|
||||
</fieldset>
|
||||
</article>
|
||||
<article>
|
||||
{{> 'systems/l5r5e/templates/actors/npc/techniques.html' }}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<legend class="section-header">
|
||||
{{localize 'l5r5e.armors.title'}}
|
||||
{{#if editable}}
|
||||
<a data-item-type="armor" class="armor-control item-add" title="{{ localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
<a data-item-type="armor" data-item-eqquiped="true" class="armor-control item-add" title="{{localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
{{/if}}
|
||||
</legend>
|
||||
<ul class="item-list">
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{{#each data.splitItemsList as |cat type|}}
|
||||
<fieldset class="items-content">
|
||||
<legend>
|
||||
{{ localize 'l5r5e.equipment' }}
|
||||
{{#if editable}}
|
||||
<a data-item-type="item" class="item-control item-add" title="{{ localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
{{localize (localize 'l5r5e.{type}s.title' type=type) }}
|
||||
{{#if ../editable}}
|
||||
<a data-item-type="{{type}}" class="item-control item-add" title="{{ localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
{{/if}}
|
||||
</legend>
|
||||
<ul class="item-list">
|
||||
{{#each actor.items as |item id|}}
|
||||
{{#ifCond '["item", "armor", "weapon"]' 'includes' item.type}}
|
||||
{{> 'systems/l5r5e/templates/items/item/item-entry.html' item=item id=id editable=../editable }}
|
||||
{{/ifCond}}
|
||||
{{#each cat as |item id|}}
|
||||
{{> 'systems/l5r5e/templates/items/item/item-entry.html' item=item id=id editable=../../editable }}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</fieldset>
|
||||
{{/each}}
|
||||
@@ -2,7 +2,7 @@
|
||||
<legend class="section-header">
|
||||
{{localize 'l5r5e.weapons.title'}}
|
||||
{{#if editable}}
|
||||
<a data-item-type="weapon" class="weapon-control item-add" title="{{ localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
<a data-item-type="weapon" data-item-eqquiped="true" class="weapon-control item-add" title="{{localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
|
||||
{{/if}}
|
||||
</legend>
|
||||
<ul class="item-list">
|
||||
|
||||
Reference in New Issue
Block a user