Finish the Inventory item improvements

This commit is contained in:
Oliver-Akins 2024-02-06 19:29:05 -07:00
parent 83039c6144
commit 2f8ec1b79c
9 changed files with 107 additions and 13 deletions

View file

@ -46,6 +46,14 @@ async function createCustomItem(defaults, opts = {}) {
};
};
/** @this {Actor} */
async function createCustomUntyped() {
await createCustomItem.bind(this)([{
type: `untyped`,
name: game.i18n.format(`dotdungeon.defaults.untyped.name`),
}]);
};
/** @this {Actor} */
async function createCustomAspect() {
await createCustomItem.bind(this)([{
@ -105,12 +113,33 @@ async function preAspectEmbed(item) {
};
};
/**
* @param {ItemHandler} item
* @this {Actor}
*/
async function preUntypedEmbed(item) {
let inventoryItem = this.itemTypes.untyped.find(i => i.name === item.name);
if (inventoryItem) {
inventoryItem.update({"system.quantity": inventoryItem.system.quantity + 1});
ui.notifications.info(
game.i18n.format(
`dotdungeon.notification.info.increased-item-quantity`,
{ name: inventoryItem.name }
),
{ console: false }
);
return false;
};
};
export default {
atAspectLimit,
createCustomItem,
createCustomUntyped,
createCustomAspect,
createCustomSpell,
createCustomPet,
genericEmbeddedDelete,
preAspectEmbed,
preUntypedEmbed,
};