[Feature] Add Default Icons for Document Subtypes (#584)

Fixes #458

Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
joaquinpereyra98 2025-08-04 22:38:56 -03:00 committed by GitHub
parent 481652bf3f
commit 0feec77512
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 206 additions and 13 deletions

View file

@ -74,8 +74,8 @@ export default class DHItem extends foundry.documents.Item {
isInventoryItem === true
? 'Inventory Items' //TODO localize
: isInventoryItem === false
? 'Character Items' //TODO localize
: 'Other'; //TODO localize
? 'Character Items' //TODO localize
: 'Other'; //TODO localize
return { value: type, label, group };
}
@ -118,6 +118,19 @@ export default class DHItem extends foundry.documents.Item {
return labels;
}
/* -------------------------------------------- */
/**@inheritdoc */
static getDefaultArtwork(itemData) {
const { type } = itemData;
const Model = CONFIG.Item.dataModels[type];
const img = Model.DEFAULT_ICON ?? this.DEFAULT_ICON;
return { img };
}
/* -------------------------------------------- */
async use(event) {
const actions = new Set(this.system.actionsList);
if (actions?.size) {
@ -139,10 +152,10 @@ export default class DHItem extends foundry.documents.Item {
this.type === 'ancestry'
? game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.ancestryTitle')
: this.type === 'community'
? game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.communityTitle')
: this.type === 'feature'
? game.i18n.localize('TYPES.Item.feature')
: game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.subclassFeatureTitle'),
? game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.communityTitle')
: this.type === 'feature'
? game.i18n.localize('TYPES.Item.feature')
: game.i18n.localize('DAGGERHEART.UI.Chat.foundationCard.subclassFeatureTitle'),
origin: origin,
img: this.img,
item: {