[PR][Feature] 798 - Attribution (#986)

* Added attribution for items, adversary and environment

* Added Attribution to all adversaries

* Added attribution to environments

* Added attribution for class and subclass

* Added Attribution to Ancestry/Community

* Added Attribution for Beastforms

* Added Attribution to DomainCards

* Added Attribution for wepaons

* Attribution for Armor/Loot/Consumables

* Added a setting to hide attribution
This commit is contained in:
WBHarry 2025-08-18 03:44:59 +02:00 committed by GitHub
parent 495575fba4
commit 8c84edddad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
982 changed files with 9082 additions and 3996 deletions

View file

@ -26,7 +26,8 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
hasResource: false,
isQuantifiable: false,
isInventoryItem: false,
hasActions: false
hasActions: false,
hasAttribution: true
};
}
@ -37,7 +38,13 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
/** @inheritDoc */
static defineSchema() {
const schema = {};
const schema = {
attribution: new fields.SchemaField({
source: new fields.StringField(),
page: new fields.NumberField(),
artist: new fields.StringField()
})
};
if (this.metadata.hasDescription) schema.description = new fields.HTMLField({ required: true, nullable: true });
@ -110,6 +117,13 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
return [];
}
get attributionLabel() {
if (!this.attribution) return;
const { source, page } = this.attribution;
return [source, page ? `pg ${page}.` : null].filter(x => x).join('. ');
}
/**
* Obtain a data object used to evaluate any dice rolls associated with this Item Type
* @param {object} [options] - Options which modify the getRollData method.