Changed miscellaneous to loot

This commit is contained in:
WBHarry 2025-07-27 14:41:25 +02:00
parent e168cdfd11
commit ac228dc6de
10 changed files with 20 additions and 21 deletions

View file

@ -80,8 +80,8 @@ Hooks.once('init', () => {
Items.registerSheet(SYSTEM.id, applications.sheets.items.Subclass, { types: ['subclass'], makeDefault: true }); Items.registerSheet(SYSTEM.id, applications.sheets.items.Subclass, { types: ['subclass'], makeDefault: true });
Items.registerSheet(SYSTEM.id, applications.sheets.items.Feature, { types: ['feature'], makeDefault: true }); Items.registerSheet(SYSTEM.id, applications.sheets.items.Feature, { types: ['feature'], makeDefault: true });
Items.registerSheet(SYSTEM.id, applications.sheets.items.DomainCard, { types: ['domainCard'], makeDefault: true }); Items.registerSheet(SYSTEM.id, applications.sheets.items.DomainCard, { types: ['domainCard'], makeDefault: true });
Items.registerSheet(SYSTEM.id, applications.sheets.items.Miscellaneous, { Items.registerSheet(SYSTEM.id, applications.sheets.items.Loot, {
types: ['miscellaneous'], types: ['loot'],
makeDefault: true makeDefault: true
}); });
Items.registerSheet(SYSTEM.id, applications.sheets.items.Consumable, { types: ['consumable'], makeDefault: true }); Items.registerSheet(SYSTEM.id, applications.sheets.items.Consumable, { types: ['consumable'], makeDefault: true });

View file

@ -55,7 +55,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
}, },
{ {
handler: CharacterSheet.#getItemContextOptions, handler: CharacterSheet.#getItemContextOptions,
selector: '[data-item-uuid][data-type="consumable"], [data-item-uuid][data-type="miscellaneous"]', selector: '[data-item-uuid][data-type="consumable"], [data-item-uuid][data-type="loot"]',
options: { options: {
parentClassHooks: false, parentClassHooks: false,
fixed: true fixed: true
@ -325,7 +325,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
} }
/** /**
* Get the set of ContextMenu options for Consumable and Miscellaneous. * Get the set of ContextMenu options for Consumable and Loot.
* @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance * @returns {import('@client/applications/ux/context-menu.mjs').ContextMenuEntry[]} - The Array of context options passed to the ContextMenu instance
* @this {CharacterSheet} * @this {CharacterSheet}
* @protected * @protected

View file

@ -6,6 +6,6 @@ export { default as Community } from './community.mjs';
export { default as Consumable } from './consumable.mjs'; export { default as Consumable } from './consumable.mjs';
export { default as DomainCard } from './domainCard.mjs'; export { default as DomainCard } from './domainCard.mjs';
export { default as Feature } from './feature.mjs'; export { default as Feature } from './feature.mjs';
export { default as Miscellaneous } from './miscellaneous.mjs'; export { default as Loot } from './loot.mjs';
export { default as Subclass } from './subclass.mjs'; export { default as Subclass } from './subclass.mjs';
export { default as Weapon } from './weapon.mjs'; export { default as Weapon } from './weapon.mjs';

View file

@ -132,14 +132,14 @@ export default class ClassSheet extends DHBaseItemSheet {
}); });
} }
} else if (target.classList.contains('choice-a-section')) { } else if (target.classList.contains('choice-a-section')) {
if (item.type === 'miscellaneous' || item.type === 'consumable') { if (item.type === 'loot' || item.type === 'consumable') {
const filteredChoiceA = this.document.system.inventory.choiceA; const filteredChoiceA = this.document.system.inventory.choiceA;
if (filteredChoiceA.length < 2) if (filteredChoiceA.length < 2)
await this.document.update({ await this.document.update({
'system.inventory.choiceA': [...filteredChoiceA.map(x => x.uuid), item.uuid] 'system.inventory.choiceA': [...filteredChoiceA.map(x => x.uuid), item.uuid]
}); });
} }
} else if (item.type === 'miscellaneous') { } else if (item.type === 'loot') {
if (target.classList.contains('take-section')) { if (target.classList.contains('take-section')) {
const filteredTake = this.document.system.inventory.take.filter(x => x); const filteredTake = this.document.system.inventory.take.filter(x => x);
if (filteredTake.length < 3) if (filteredTake.length < 3)

View file

@ -1,15 +1,15 @@
import DHBaseItemSheet from '../api/base-item.mjs'; import DHBaseItemSheet from '../api/base-item.mjs';
export default class MiscellaneousSheet extends DHBaseItemSheet { export default class LootSheet extends DHBaseItemSheet {
/**@inheritdoc */ /**@inheritdoc */
static DEFAULT_OPTIONS = { static DEFAULT_OPTIONS = {
classes: ['miscellaneous'], classes: ['loot'],
position: { width: 550 } position: { width: 550 }
}; };
/**@override */ /**@override */
static PARTS = { static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/items/miscellaneous/header.hbs' }, header: { template: 'systems/daggerheart/templates/sheets/items/loot/header.hbs' },
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' }, tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' }, description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
actions: { actions: {
@ -17,7 +17,7 @@ export default class MiscellaneousSheet extends DHBaseItemSheet {
scrollable: ['.actions'] scrollable: ['.actions']
}, },
settings: { settings: {
template: 'systems/daggerheart/templates/sheets/items/miscellaneous/settings.hbs', template: 'systems/daggerheart/templates/sheets/items/loot/settings.hbs',
scrollable: ['.settings'] scrollable: ['.settings']
}, },
effects: { effects: {

View file

@ -1301,9 +1301,9 @@ export const featureTypes = {
id: 'consumable', id: 'consumable',
label: 'TYPES.Item.consumable' label: 'TYPES.Item.consumable'
}, },
miscellaneous: { loot: {
id: 'miscellaneous', id: 'loot',
label: 'TYPES.Item.miscellaneous' label: 'TYPES.Item.loot'
}, },
beastform: { beastform: {
if: 'beastform', if: 'beastform',

View file

@ -6,7 +6,7 @@ import DHCommunity from './community.mjs';
import DHConsumable from './consumable.mjs'; import DHConsumable from './consumable.mjs';
import DHDomainCard from './domainCard.mjs'; import DHDomainCard from './domainCard.mjs';
import DHFeature from './feature.mjs'; import DHFeature from './feature.mjs';
import DHMiscellaneous from './miscellaneous.mjs'; import DHLoot from './loot.mjs';
import DHSubclass from './subclass.mjs'; import DHSubclass from './subclass.mjs';
import DHWeapon from './weapon.mjs'; import DHWeapon from './weapon.mjs';
import DHBeastform from './beastform.mjs'; import DHBeastform from './beastform.mjs';
@ -20,7 +20,7 @@ export {
DHConsumable, DHConsumable,
DHDomainCard, DHDomainCard,
DHFeature, DHFeature,
DHMiscellaneous, DHLoot,
DHSubclass, DHSubclass,
DHWeapon, DHWeapon,
DHBeastform DHBeastform
@ -35,7 +35,7 @@ export const config = {
consumable: DHConsumable, consumable: DHConsumable,
domainCard: DHDomainCard, domainCard: DHDomainCard,
feature: DHFeature, feature: DHFeature,
miscellaneous: DHMiscellaneous, loot: DHLoot,
subclass: DHSubclass, subclass: DHSubclass,
weapon: DHWeapon, weapon: DHWeapon,
beastform: DHBeastform beastform: DHBeastform

View file

@ -1,5 +1,4 @@
import BaseDataItem from './base.mjs'; import BaseDataItem from './base.mjs';
import { ActionField } from '../fields/actionField.mjs';
export default class DHLoot extends BaseDataItem { export default class DHLoot extends BaseDataItem {
/** @inheritDoc */ /** @inheritDoc */

View file

@ -61,9 +61,9 @@
canCreate=true canCreate=true
}} }}
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'
title='TYPES.Item.miscellaneous' title='TYPES.Item.loot'
type='miscellaneous' type='loot'
collection=document.itemTypes.miscellaneous collection=document.itemTypes.loot
isGlassy=true isGlassy=true
canCreate=true canCreate=true
}} }}