diff --git a/modules/actor/merchant-sheet.js b/modules/actor/merchant-sheet.js index 2425a6a4..4842c45b 100644 --- a/modules/actor/merchant-sheet.js +++ b/modules/actor/merchant-sheet.js @@ -257,12 +257,18 @@ export default class MerchantSheetDSA5 extends ActorSheetdsa5NPC { if (!itemLibrary.equipmentBuild) { await itemLibrary.buildEquipmentIndex() } + let items = [] for (let cat of categories) { items.push(...await itemLibrary.getRandomItems(cat, numbers[cat])) } + var seen = {} items = items.filter(function(x) { + const domain = getProperty(x, "data.data.effect.attributes") || "" + const price = Number(getProperty(x, "data.data.price.value")) || 0 + if (domain != "" || price > 10000) return false + let seeName = `${x.type}_${x.name}` return (seen.hasOwnProperty(seeName) ? false : (seen[seeName] = true)) && actor.data.items.filter(function(y) { return y.type == x.type && y.name == x.name @@ -275,7 +281,7 @@ export default class MerchantSheetDSA5 extends ActorSheetdsa5NPC { async removeAllGoods(actor, ev) { let text = $(ev.currentTarget).text() $(ev.currentTarget).html(' ') - let ids = actor.items.filter(x => ["poison", "consumable", "equipment","plant", "ammunition"].includes(x.type)).map(x => x.id) + let ids = actor.items.filter(x => ["poison", "consumable", "equipment", "plant", "ammunition"].includes(x.type)).map(x => x.id) ids.push(...actor.items.filter(x => ["armor", "meleeweapon", "rangeweapon"].includes(x.type) && !x.data.data.worn.value).map(x => x.id)) await actor.deleteEmbeddedDocuments("Item", ids); $(ev.currentTarget).text(text) diff --git a/modules/system/itemlibrary.js b/modules/system/itemlibrary.js index 20580702..a7bee05d 100644 --- a/modules/system/itemlibrary.js +++ b/modules/system/itemlibrary.js @@ -297,6 +297,7 @@ export default class DSA5ItemLibrary extends Application { async getRandomItems(category, limit) { let filteredItems = [] let index = this.equipmentIndex + filteredItems.push(...(await index.search(category, { field: ["itemType"] }))) return await Promise.all(this.shuffle(filteredItems.filter(x => x.hasPermission)).slice(0, limit).map(x => x.getItem())) } diff --git a/modules/system/migrator.js b/modules/system/migrator.js index 14c83989..6c8268e2 100644 --- a/modules/system/migrator.js +++ b/modules/system/migrator.js @@ -32,7 +32,7 @@ export default function migrateWorld() { Hooks.once("ready", async function() { if (!game.user.isGM) return - await ChatMessage.create(DSA5_Utility.chatDataSetup("

TDE for Foundry 9 is still in beta test. Please report bugs in Github.

", "roll")) + //await ChatMessage.create(DSA5_Utility.chatDataSetup("

TDE for Foundry 9 is still in beta test. Please report bugs in Github.

", "roll")) await setupDefaulTokenConfig() const currentVersion = await game.settings.get("dsa5", "migrationVersion")