Skip to content

Commit

Permalink
feat(actor ninja sheet): added new row on inventory for device items
Browse files Browse the repository at this point in the history
  • Loading branch information
SouOWendel committed Oct 16, 2024
1 parent d14a66a commit 2c95141
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
8 changes: 6 additions & 2 deletions module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,16 @@ export class ShinobiActorSheet extends ActorSheet {
const aptidoes = [];
const poderes = [];
const tecnicas = [];
const dispositivos = [];

for (let i of context.items) {
i.img = i.img || Item.DEFAULT_ICON;
if (i.type === 'armas') { armas.push(i); }
else if (i.type === 'armaduras') { armaduras.push(i); }
else if (i.type === 'gerais') { gerais.push(i); }
else if (i.type === 'aptidoes') { aptidoes.push(i); }
else if (i.type === 'gerais') {
if (i.system.tipo.includes("dispositivo")) dispositivos.push(i);
else gerais.push(i);
} else if (i.type === 'aptidoes') { aptidoes.push(i); }
else if (i.type === 'poderes') { poderes.push(i); }
else if (i.type === 'tecnicas') { tecnicas.push(i); }
}
Expand All @@ -145,6 +148,7 @@ export class ShinobiActorSheet extends ActorSheet {
context.aptidoes = aptidoes;
context.poderes = poderes;
context.tecnicas = tecnicas;
context.dispositivos = dispositivos;
}

/** @inheritDoc */
Expand Down
56 changes: 54 additions & 2 deletions templates/actor/parts/actor-inventario.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<div class='item-name'>{{localize 'Itens Gerais'}}</div>
<div class='item-small item-prop'>Tipo</div>
<div class='item-medium item-prop'>Preço</div>
<div class='item-small item-prop'>Compart.</div>
<div class='item-small item-prop'>Usos</div>
<div class='item-small item-prop'>Quantidade</div>
<div class='item-controls'>
<a class='item-control item-create' title='{{localize "DOCUMENT.Create" type='gerais'}}' data-type='gerais'>
Expand Down Expand Up @@ -155,4 +155,56 @@
</div>
</li>
{{/each}}
</ol>
</ol>

{{#if dispositivos}}
<ol class='items-list'>
<li class='item flexrow items-header'>
<div class='item-name'>{{localize 'Dispositivos'}}</div>
<div class='item-small item-prop'>Categoria</div>
<div class='item-medium item-prop'>Preço</div>
<div class='item-small item-prop'>Usos</div>
<div class='item-small item-prop'>Quantidade</div>
<div class='item-controls'>
<a class='item-control item-create' title='{{localize "DOCUMENT.Create" type='Dispositivo'}}' data-type='gerais'>
<i class='fas fa-plus'></i>
</a>
</div>
</li>
{{#each dispositivos as |item id|}}
<li class='item flexrow' data-item-id='{{item._id}}'>
<div class='item-name'>
<div class='item-image flex-group-center'>
<a class='rollable' data-roll-type='item'>
<img src='{{item.img}}' title='{{item.name}}' width='24' height='24'/>
</a>
</div>
<h4>{{item.name}}</h4>
</div>
<div class='item-small item-prop'>
{{ifThen item.system.tipo (localize (concat "shinobiNoSho.ITEMS.geral.tipoAbv." item.system.tipo)) ""}}
</div>
<div class='item-medium item-prop'>
{{ifThen item.system.preco item.system.preco ""}} Ryos
</div>
<div class='item-small item-prop'>
{{ifThen item.system.usos.value item.system.usos.value ""}} /
{{ifThen item.system.usos.max item.system.usos.max ""}}
</div>
<div class='item-small item-prop'>
{{ifThen item.system.quantidade item.system.quantidade ""}}
</div>
<div class='item-controls'>
<a class='item-control item-edit'
title='{{localize "DOCUMENT.Update" type='Dispositivo'}}'>
<i class='fas fa-edit'></i>
</a>
<a class='item-control item-delete'
title='{{localize "DOCUMENT.Delete" type='Dispositivo'}}'>
<i class='fas fa-trash'></i>
</a>
</div>
</li>
{{/each}}
</ol>
{{/if}}

0 comments on commit 2c95141

Please sign in to comment.