import { itemDefinition } from "../definitions/items.js"; /** Whether this stack may be listed as a marketplace sell order. */ export function canSellOnMarketplace (stack) { const def = itemDefinition(stack?.itemId); if (!def || !stack) { return false; } return def.marketplaceSellable !== false; } /** @throws {Error & { userFacing?: boolean }} */ export function assertMarketplaceSellable (stack) { if (canSellOnMarketplace(stack)) { return; } const def = itemDefinition(stack?.itemId); const error = new Error( def?.marketplaceSellBlockedReason ?? "That item cannot be sold on the marketplace." ); error.userFacing = true; throw error; }