mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[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:
parent
481652bf3f
commit
0feec77512
34 changed files with 206 additions and 13 deletions
|
|
@ -105,6 +105,13 @@ export default class DhpAdversary extends BaseDataActor {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/actors/dragon-head.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get attackBonus() {
|
||||
return this.attack.roll.bonus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,16 @@ export default class BaseDataActor extends foundry.abstract.TypeDataModel {
|
|||
return schema;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* The default icon used for newly created Actors documents
|
||||
* @type {string}
|
||||
*/
|
||||
static DEFAULT_ICON = null;
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Obtain a data object used to evaluate any dice rolls associated with this Item Type
|
||||
* @param {object} [options] - Options which modify the getRollData method.
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ import { ActionField } from '../fields/actionField.mjs';
|
|||
import DHCharacterSettings from '../../applications/sheets-configs/character-settings.mjs';
|
||||
|
||||
export default class DhCharacter extends BaseDataActor {
|
||||
/**@override */
|
||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.ACTORS.Character'];
|
||||
|
||||
/**@inheritdoc */
|
||||
static get metadata() {
|
||||
return foundry.utils.mergeObject(super.metadata, {
|
||||
label: 'TYPES.Actor.character',
|
||||
|
|
@ -18,6 +20,7 @@ export default class DhCharacter extends BaseDataActor {
|
|||
});
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
|
|
@ -303,6 +306,8 @@ export default class DhCharacter extends BaseDataActor {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get tier() {
|
||||
const currentLevel = this.levelData.level.current;
|
||||
return currentLevel === 1
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { resourceField, bonusField } from '../fields/actorField.mjs';
|
|||
export default class DhCompanion extends BaseDataActor {
|
||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.ACTORS.Companion'];
|
||||
|
||||
/**@inheritdoc */
|
||||
static get metadata() {
|
||||
return foundry.utils.mergeObject(super.metadata, {
|
||||
label: 'TYPES.Actor.companion',
|
||||
|
|
@ -18,6 +19,7 @@ export default class DhCompanion extends BaseDataActor {
|
|||
});
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
||||
|
|
@ -87,6 +89,13 @@ export default class DhCompanion extends BaseDataActor {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/actors/capybara.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get proficiency() {
|
||||
return this.partner?.system?.proficiency ?? 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayFie
|
|||
import DHEnvironmentSettings from '../../applications/sheets-configs/environment-settings.mjs';
|
||||
|
||||
export default class DhEnvironment extends BaseDataActor {
|
||||
/**@override */
|
||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.ACTORS.Environment'];
|
||||
|
||||
/**@inheritdoc */
|
||||
static get metadata() {
|
||||
return foundry.utils.mergeObject(super.metadata, {
|
||||
label: 'TYPES.Actor.environment',
|
||||
|
|
@ -14,6 +16,7 @@ export default class DhEnvironment extends BaseDataActor {
|
|||
});
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
|
|
@ -37,6 +40,13 @@ export default class DhEnvironment extends BaseDataActor {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/actors/forest.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get features() {
|
||||
return this.parent.items.filter(x => x.type === 'feature');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,26 @@ export default class DHAncestry extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/family-tree.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Gets the primary feature.
|
||||
* @type {foundry.documents.Item|null} Returns the item of the first feature with type "primary" or null if none is found.
|
||||
*/
|
||||
get primaryFeature() {
|
||||
return this.features.find(x => x.type === CONFIG.DH.ITEM.featureSubTypes.primary)?.item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the secondary feature.
|
||||
* @type {foundry.documents.Item|null} Returns the item of the first feature with type "secondary" or null if none is found.
|
||||
*/
|
||||
get secondaryFeature() {
|
||||
return this.features.find(x => x.type === CONFIG.DH.ITEM.featureSubTypes.secondary)?.item;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,20 @@ export default class DHArmor extends AttachableItem {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/chest-armor.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get customActions() {
|
||||
return this.actions.filter(
|
||||
action => !this.armorFeatures.some(feature => feature.actionIds.includes(action.id))
|
||||
);
|
||||
}
|
||||
|
||||
/**@inheritdoc */
|
||||
async _preUpdate(changes, options, user) {
|
||||
const allowed = await super._preUpdate(changes, options, user);
|
||||
if (allowed === false) return false;
|
||||
|
|
@ -68,7 +76,7 @@ export default class DHArmor extends AttachableItem {
|
|||
return acc;
|
||||
}, {});
|
||||
|
||||
for (var feature of added) {
|
||||
for (const feature of added) {
|
||||
const featureData = armorFeatures[feature.value];
|
||||
if (featureData.effects?.length > 0) {
|
||||
const embeddedItems = await this.parent.createEmbeddedDocuments(
|
||||
|
|
|
|||
|
|
@ -79,6 +79,16 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
return schema;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* The default icon used for newly created Item documents
|
||||
* @type {string}
|
||||
*/
|
||||
static DEFAULT_ICON = null;
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Convenient access to the item's actor, if it exists.
|
||||
* @returns {foundry.documents.Actor | null}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,13 @@ export default class DHBeastform extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/wolf-head.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
async _preCreate() {
|
||||
if (!this.actor) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,13 @@ export default class DHClass extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/laurel-crown.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get hopeFeatures() {
|
||||
return this.features.filter(x => x.type === CONFIG.DH.ITEM.featureSubTypes.hope).map(x => x.item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,15 @@ export default class DHCommunity extends BaseDataItem {
|
|||
|
||||
/** @inheritDoc */
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
|
||||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/village.svg';
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,4 +22,10 @@ export default class DHConsumable extends BaseDataItem {
|
|||
consumeOnUse: new fields.BooleanField({ initial: false })
|
||||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/round-potion.svg';
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ export default class DHDomainCard extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/card-play.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
async _preCreate(data, options, user) {
|
||||
const allowed = await super._preCreate(data, options, user);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,13 @@ export default class DHFeature extends BaseDataItem {
|
|||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/stars-stack.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @inheritDoc */
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
|
|
|
|||
|
|
@ -19,4 +19,11 @@ export default class DHLoot extends BaseDataItem {
|
|||
...super.defineSchema()
|
||||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/open-treasure-chest.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,13 @@ export default class DHSubclass extends BaseDataItem {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/laurels.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get foundationFeatures() {
|
||||
return this.features.filter(x => x.type === CONFIG.DH.ITEM.featureSubTypes.foundation).map(x => x.item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,13 @@ export default class DHWeapon extends AttachableItem {
|
|||
};
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@override */
|
||||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/items/battered-axe.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
get actionsList() {
|
||||
return [this.attack, ...this.actions];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue