Add the Weapon item details (closes #132)
This commit is contained in:
parent
60797ab1e2
commit
337370bbfe
6 changed files with 153 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// Data Models
|
||||
import { DescribedItemData } from "./models/Item/DescribedItemData.mjs";
|
||||
import { CommonItemData } from "./models/Item/CommonItemData.mjs";
|
||||
import { WeaponItemData } from "./models/Item/Weapon.mjs";
|
||||
import { AspectItemData } from "./models/Item/Aspect.mjs";
|
||||
import { SpellItemData } from "./models/Item/Spell.mjs";
|
||||
import { PlayerData } from "./models/Actor/Player.mjs";
|
||||
|
|
@ -46,6 +47,7 @@ Hooks.once(`init`, async () => {
|
|||
CONFIG.Item.dataModels.untyped = DescribedItemData;
|
||||
CONFIG.Item.dataModels.material = CommonItemData;
|
||||
CONFIG.Item.dataModels.foil = DescribedItemData;
|
||||
CONFIG.Item.dataModels.weapon = WeaponItemData;
|
||||
CONFIG.Item.dataModels.aspect = AspectItemData;
|
||||
CONFIG.Item.dataModels.spell = SpellItemData;
|
||||
CONFIG.Item.dataModels.pet = PetItemData;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ export const partials = [
|
|||
`actors/char-sheet/v2/partials/inventory/items/material.v2.pc.hbs`,
|
||||
`actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs`,
|
||||
`actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs`,
|
||||
`actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs`,
|
||||
];
|
||||
|
||||
export const preAliasedPartials = {
|
||||
|
|
|
|||
24
module/models/Item/Weapon.mjs
Normal file
24
module/models/Item/Weapon.mjs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { DescribedItemData } from "./DescribedItemData.mjs";
|
||||
import DOTDUNGEON from "../../config.mjs";
|
||||
|
||||
export class WeaponItemData extends DescribedItemData {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return mergeObject(super.defineSchema(), {
|
||||
damage: new fields.StringField({
|
||||
initial: null,
|
||||
nullable: true,
|
||||
blank: true,
|
||||
options: DOTDUNGEON.damageTypes,
|
||||
}),
|
||||
ranged: new fields.BooleanField({ initial: false, }),
|
||||
scoped: new fields.BooleanField({ initial: false, }),
|
||||
ammo: new fields.StringField({
|
||||
initial: null,
|
||||
nullable: true,
|
||||
blank: true,
|
||||
options: DOTDUNGEON.ammoTypes,
|
||||
}),
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
@ -118,7 +118,7 @@ export class PlayerSheetv2 extends GenericActorSheet {
|
|||
return stats;
|
||||
};
|
||||
|
||||
_itemTypesHidden = new Set([`weapon`, `armour`, `equipment`, `foil`, `structure`, `service`]);
|
||||
_itemTypesHidden = new Set([`pet`, `armour`, `equipment`, `foil`, `structure`, `service`]);
|
||||
toggleItemFilter(filterName) {
|
||||
if (this._itemTypesHidden.has(filterName)) {
|
||||
this._itemTypesHidden.delete(filterName);
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.untyped, .aspect {
|
||||
.untyped, .aspect, .weapon {
|
||||
@include material.elevate(1);
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
|
|
@ -291,4 +291,10 @@
|
|||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.weapon {
|
||||
&__description {
|
||||
grid-row: span 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
<section class="weapon">
|
||||
<div
|
||||
class="weapon__header"
|
||||
data-collapse-id="{{item.uuid}}"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="equal-padding reduced-padding"
|
||||
data-collapse-id="{{item.uuid}}"
|
||||
tabindex="0"
|
||||
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
|
||||
>
|
||||
<div aria-hidden="true" class="icon icon--12">
|
||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
||||
{{{ icons.caret-down }}}
|
||||
{{else}}
|
||||
{{{ icons.caret-right }}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</button>
|
||||
<h3 class="weapon__name">
|
||||
{{item.name}}
|
||||
</h3>
|
||||
<div class="weapon__quantity--display">
|
||||
(x {{item.system.quantity}})
|
||||
</div>
|
||||
</div>
|
||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
||||
<hr>
|
||||
<div class="weapon__content">
|
||||
<div class="weapon__field editable">
|
||||
<label for="{{meta.idp}}-{{item.uuid}}-quantity">
|
||||
Quantity
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
id="{{meta.idp}}-{{item.uuid}}-quantity"
|
||||
value="{{item.system.quantity}}"
|
||||
data-embedded-id="{{item.uuid}}"
|
||||
data-embedded-update="system.quantity"
|
||||
data-embedded-update-on="blur"
|
||||
>
|
||||
</div>
|
||||
<div class="weapon__field">
|
||||
<span>Type:</span>
|
||||
<span>
|
||||
{{ifThen item.system.ranged "Ranged" "Melee"}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="weapon__field">
|
||||
<span>Damage:</span>
|
||||
<span>
|
||||
{{dd-empty-state item.system.damage}}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="{{dd-i18n 'dotdungeon.common.send-to-chat'}}"
|
||||
data-tooltip="{{dd-i18n 'dotdungeon.common.send-to-chat'}}"
|
||||
data-tooltip-direction="RIGHT"
|
||||
class="weapon__button--send-to-chat"
|
||||
>
|
||||
<div aria-hidden="true" class="icon icon--20">
|
||||
{{{ icons.chat-bubble }}}
|
||||
</div>
|
||||
</button>
|
||||
<div class="weapon__field">
|
||||
<span>Tier:</span>
|
||||
<span>{{dd-i18n (concat "dotdungeon.rarity." item.system.tier)}}</span>
|
||||
</div>
|
||||
<div class="weapon__field">
|
||||
{{ifThen item.system.scoped "Scoped" "No Scope"}}
|
||||
</div>
|
||||
<div class="weapon__field">
|
||||
<span>Ammo:</span>
|
||||
<span>
|
||||
{{dd-empty-state item.system.ammo}}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="{{dd-i18n 'dotdungeon.common.edit'}}"
|
||||
data-tooltip="{{dd-i18n 'dotdungeon.common.edit'}}"
|
||||
data-tooltip-direction="RIGHT"
|
||||
class="weapon__button--edit"
|
||||
data-embedded-edit="{{item.uuid}}"
|
||||
>
|
||||
<div aria-hidden="true" class="icon icon--20">
|
||||
{{{ icons.edit }}}
|
||||
</div>
|
||||
</button>
|
||||
<p class="weapon__description">
|
||||
{{#if item.system.description}}
|
||||
{{item.system.description}}
|
||||
{{else}}
|
||||
<span class="placeholder">
|
||||
This item hasn't been described yet...
|
||||
</span>
|
||||
{{/if}}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="{{dd-i18n 'dotdungeon.common.delete'}}"
|
||||
data-tooltip="{{dd-i18n 'dotdungeon.common.delete'}}"
|
||||
data-tooltip-direction="RIGHT"
|
||||
class="weapon__button--delete"
|
||||
data-embedded-delete
|
||||
data-embedded-id="{{item.uuid}}"
|
||||
>
|
||||
<div aria-hidden="true" class="icon icon--20">
|
||||
{{{ icons.garbage-bin }}}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
</section>
|
||||
Loading…
Add table
Add a link
Reference in a new issue