FIX: imports

FIX: items sheet new paths
FIX: ItemDataModelMetadata type jsdoc
This commit is contained in:
Joaquin Pereyra 2025-06-03 19:26:41 -03:00
parent 08a21dcb2f
commit 80cedbe4d2
5 changed files with 29 additions and 40 deletions

View file

@ -1,7 +1,7 @@
import DhpDualityRoll from '../data/dualityRoll.mjs';
import { DualityRollColor } from '../data/settings/Appearance.mjs';
import DHDualityRoll from "../data/chat-message/dualityRoll.mjs";
export default class DhpChatMessage extends ChatMessage {
export default class DhpChatMessage extends foundry.documents.ChatMessage {
async renderHTML() {
/* We can change to fully implementing the renderHTML function if needed, instead of augmenting it. */
const html = await super.renderHTML();
@ -13,8 +13,8 @@ export default class DhpChatMessage extends ChatMessage {
) {
html.classList.add('duality');
const dualityResult = this.system.dualityResult;
if (dualityResult === DhpDualityRoll.dualityResult.hope) html.classList.add('hope');
else if (dualityResult === DhpDualityRoll.dualityResult.fear) html.classList.add('fear');
if (dualityResult === DHDualityRoll.dualityResult.hope) html.classList.add('hope');
else if (dualityResult === DHDualityRoll.dualityResult.fear) html.classList.add('fear');
else html.classList.add('critical');
}

View file

@ -199,42 +199,32 @@ export default class ClassSheet extends DaggerheartSheet(ItemSheetV2) {
if (item.type === 'subclass') {
await this.document.update({
'system.subclasses': [
...this.document.system.subclasses,
{ img: item.img, name: item.name, uuid: item.uuid }
...this.document.system.subclasses, item.uuid
]
});
} else if (item.type === 'feature') {
await this.document.update({
'system.features': [
...this.document.system.features,
{ img: item.img, name: item.name, uuid: item.uuid }
...this.document.system.features, item.uuid
]
});
} else if (item.type === 'weapon') {
if (event.currentTarget.classList.contains('primary-weapon-section')) {
if (!this.document.system.characterGuide.suggestedPrimaryWeapon && !item.system.secondary)
await this.document.update({
'system.characterGuide.suggestedPrimaryWeapon': {
img: item.img,
name: item.name,
uuid: item.uuid
}
'system.characterGuide.suggestedPrimaryWeapon': item.uuid
});
} else if (event.currentTarget.classList.contains('secondary-weapon-section')) {
if (!this.document.system.characterGuide.suggestedSecondaryWeapon && item.system.secondary)
await this.document.update({
'system.characterGuide.suggestedSecondaryWeapon': {
img: item.img,
name: item.name,
uuid: item.uuid
}
'system.characterGuide.suggestedSecondaryWeapon': item.uuid
});
}
} else if (item.type === 'armor') {
if (event.currentTarget.classList.contains('armor-section')) {
if (!this.document.system.characterGuide.suggestedArmor)
await this.document.update({
'system.characterGuide.suggestedArmor': { img: item.img, name: item.name, uuid: item.uuid }
'system.characterGuide.suggestedArmor': item.uuid
});
}
} else if (event.currentTarget.classList.contains('choice-a-section')) {
@ -242,8 +232,7 @@ export default class ClassSheet extends DaggerheartSheet(ItemSheetV2) {
if (this.document.system.inventory.choiceA.length < 2)
await this.document.update({
'system.inventory.choiceA': [
...this.document.system.inventory.choiceA,
{ img: item.img, name: item.name, uuid: item.uuid }
...this.document.system.inventory.choiceA, item.uuid
]
});
}
@ -252,16 +241,14 @@ export default class ClassSheet extends DaggerheartSheet(ItemSheetV2) {
if (this.document.system.inventory.take.length < 3)
await this.document.update({
'system.inventory.take': [
...this.document.system.inventory.take,
{ img: item.img, name: item.name, uuid: item.uuid }
...this.document.system.inventory.take, item.uuid
]
});
} else if (event.currentTarget.classList.contains('choice-b-section')) {
if (this.document.system.inventory.choiceB.length < 2)
await this.document.update({
'system.inventory.choiceB': [
...this.document.system.inventory.choiceB,
{ img: item.img, name: item.name, uuid: item.uuid }
...this.document.system.inventory.choiceB, item.uuid
]
});
}

View file

@ -1,4 +1,4 @@
import { DualityRollColor } from './settings/Appearance.mjs';
import { DualityRollColor } from "../settings/Appearance.mjs";
const fields = foundry.data.fields;
const diceField = () =>

View file

@ -1,7 +1,9 @@
/**
* Describes metadata about the item data model type
* @typedef {Object} ItemDataModelMetadata
* @property {String} type - System type that this type data model represents
* @property {Boolean} hasDescription
* @property {string} type - The system type that this data model represents (e.g., "weapon", "armor", "consumable")
* @property {boolean} hasDescription - Indicates whether items of this type have description field
* @property {boolean} isQuantifiable - Indicates whether items of this type have quantity field
*/
const fields = foundry.data.fields;

View file

@ -38,10 +38,10 @@
<fieldset class="one-column drop-section primary-weapon-section">
<legend>{{localize "DAGGERHEART.Sheets.Class.Guide.SuggestedPrimaryWeaponTitle"}}</legend>
<div class="drop-section-body list-items">
{{#if source.system.characterGuide.suggestedPrimaryWeapon}}
<div class="suggested-item item-line" data-action="viewItem" data-item="{{source.system.characterGuide.suggestedPrimaryWeapon.uuid}}">
<img class="image" src="{{source.system.characterGuide.suggestedPrimaryWeapon.img}}" />
<span>{{source.system.characterGuide.suggestedPrimaryWeapon.name}}</span>
{{#if document.system.characterGuide.suggestedPrimaryWeapon}}
<div class="suggested-item item-line" data-action="viewItem" data-item="{{document.system.characterGuide.suggestedPrimaryWeapon.uuid}}">
<img class="image" src="{{document.system.characterGuide.suggestedPrimaryWeapon.img}}" />
<span>{{document.system.characterGuide.suggestedPrimaryWeapon.name}}</span>
<div class="controls">
<i data-action="removePrimaryWeapon" class="fa-solid fa-trash icon-button"></i>
</div>
@ -53,10 +53,10 @@
<fieldset class="one-column drop-section secondary-weapon-section">
<legend>{{localize "DAGGERHEART.Sheets.Class.Guide.SuggestedSecondaryWeaponTitle"}}</legend>
<div class="drop-section-body list-items">
{{#if source.system.characterGuide.suggestedSecondaryWeapon}}
<div class="suggested-item item-line" data-action="viewItem" data-item="{{source.system.characterGuide.suggestedSecondaryWeapon.uuid}}">
<img class="image" src="{{source.system.characterGuide.suggestedSecondaryWeapon.img}}" />
<span>{{source.system.characterGuide.suggestedSecondaryWeapon.name}}</span>
{{#if document.system.characterGuide.suggestedSecondaryWeapon}}
<div class="suggested-item item-line" data-action="viewItem" data-item="{{system.system.characterGuide.suggestedSecondaryWeapon.uuid}}">
<img class="image" src="{{document.system.characterGuide.suggestedSecondaryWeapon.img}}" />
<span>{{document.system.characterGuide.suggestedSecondaryWeapon.name}}</span>
<div class="controls">
<i data-action="removeSecondaryWeapon" class="fa-solid fa-trash icon-button"></i>
</div>
@ -68,10 +68,10 @@
<fieldset class="one-column drop-section armor-section">
<legend>{{localize "DAGGERHEART.Sheets.Class.Guide.SuggestedArmorTitle"}}</legend>
<div class="drop-section-body list-items">
{{#if source.system.characterGuide.suggestedArmor}}
<div class="suggested-item item-line" data-action="viewItem" data-item="{{source.system.characterGuide.suggestedArmor.uuid}}">
<img class="image" src="{{source.system.characterGuide.suggestedArmor.img}}" />
<span>{{source.system.characterGuide.suggestedArmor.name}}</span>
{{#if document.system.characterGuide.suggestedArmor}}
<div class="suggested-item item-line" data-action="viewItem" data-item="{{document.system.characterGuide.suggestedArmor.uuid}}">
<img class="image" src="{{document.system.characterGuide.suggestedArmor.img}}" />
<span>{{document.system.characterGuide.suggestedArmor.name}}</span>
<div class="controls">
<i data-action="removeArmor" class="fa-solid fa-trash icon-button"></i>
</div>