Skip to content

Commit

Permalink
fix item build
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielBoettner committed Jan 2, 2022
1 parent 71059ea commit a033a4d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/loot/loot-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export class LootCreator {
/** Try first to load item from compendium */
if (item.collection) {
existingItem = await getItemFromCompendium(item);
itemData = duplicate(existingItem.data);
itemData.type = BRTCONFIG.ITEM_LOOT_TYPE;
}

/** Try first to load item from item list */
Expand All @@ -135,6 +137,7 @@ export class LootCreator {
existingItem = game.items.getName(item.text);
if (existingItem) {
itemData = duplicate(existingItem.data);
itemData.type = BRTCONFIG.ITEM_LOOT_TYPE;
}
}

Expand All @@ -155,10 +158,10 @@ export class LootCreator {
const createNewItem = !itemData || convert;

if (createNewItem) {
const name = convert?.text || item.text,
type = BRTCONFIG.ITEM_LOOT_TYPE,
img = convert?.img || item.img,
price = convert?.price || item.price || 0;
const name = convert ? convert?.text : item.text,
type = BRTCONFIG.ITEM_LOOT_TYPE,
img = convert ? convert?.img : item.img,
price = convert ? convert?.price : item.price || 0;

itemData = { name: name, type, img: img, data: { price: price }}; // "icons/svg/mystery-man.svg"
}
Expand Down

0 comments on commit a033a4d

Please sign in to comment.