Begin making the pre-embed quantity change logic based on source IDs and not name

This commit is contained in:
Oliver-Akins 2024-03-21 21:24:26 -06:00
parent 6a355e63c0
commit bad95f8c18
3 changed files with 44 additions and 14 deletions

View file

@ -45,20 +45,20 @@ export class Player extends DotDungeonActor {
* TODO: Find item based of the source's ID, not name
* @param {DotDungeonItem} item
*/
async 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;
};
};
// async 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;
// };
// };
getRollData() {
const data = {