Skip to content

Better Merchant

Idle edited this page Dec 20, 2024 · 14 revisions

Adds new functionalities the the system's merchant. The feature prevents golds from sells from being added to the merchant's inventory. It also color code the price of the items based on their ratio.

From Browser

Opens a modified version of the system compendium browser and let you filter and select items to add directly to the merchant.

Item Filters

A menu where you can setup different ratio values associated with filters. When adding a new filter (clicking on the + buttons), a modified version of the system compendium browser will open and let you create it.

In the Sell Filters column, you decide which items can be sold by the merchant and at which price, the Gold Purse field is just there to keep track of the amount of gold each filter made from selling items. The Default Sell purse is always credited the golds from a sell, event from another filter.

In the Buy Filters columns, you decide which items can be bought by the merchant and at which price, it works differently than the sell column.

  • The gold purse is the amount of gold a filter can spend to buy items (at that filter's ratio); The merchant has an infinite amount of gold to spend if a gold purse field is left empty.
  • The Use Default Purse option forces the filter to also use the Default Buy purse on top of its own, which means that if the filter purse has enough gold to spend (or infinite) but the Default Buy purse doesn't, the filter will not be able to be used to buy items.
  • When an item is bought, the appropriate purses will be drained from their gold count.

Note

Filters are checked from top to bottom, if a filter has enough gold to buy the items at its own ratio (taking into account the gold availability of Default Buy if necessary), then the feature will stop the checks and use that filter, if the search reaches the end of the list and no filter could satisfy the transaction (not even the Default Buy), then the trade will be rejected by the merchant.

Infinite Stocks

The merchant will have an infinite stock of each item in its inventory (technically 9999 or each)

The quantity cell of each item, the total wealth and the total bulk of the sheet will be replaced by .

Important

Due to a "limitation/bug" of the system, opening an item sheet and closing it saves its data even if nothing has changed. While the module doesn't permanently modify an item's quantity, opening the item sheet of a temporarily modified item in the merchant's inventory and closing it will sadly make that change permanent.

Services

The GM can add simple services offered by the merchant to Character/NPC/Party actors. A service is the combination of a name, price and description that can be seen and "purchased" by players in the merchant sheet.

The GM can pick an image representing the service and set its level. A quantity can also be set to limit the amount of time the service can be used by players, a negative number represents an infinite amount of uses.

The GM has the possibility of offering the service for free (if it has a cost) and skipping the quantity part by clicking on the Free Service hand icon.

Note

Players will only see services that are enabled and have a quantity other than 0.

Service Macro

Services can have a macro to be executed whenever it is payed for or offered for free by the GM, the macro will have the following parameters forwarded to its scope:

{
    actor: ActorPF2e;
    service: {
        seller: LootPF2e;
        name: string;
        level: number;
        quantity: number;
        forceFree: boolean;
        serviceRatio: number;
        usedPrice: CoinsPF2e | null;
        originalPrice: CoinsPF2e;
    }
}

Settings

Enabled 🌎 🔃

Enables the feature in your world.

Services Above Items 🌎 ✅

Should services be displayed above the items list in the sheet.

API

/*
 * retrieves the api object for this feature
 */
game.modules.get("pf2e-toolbelt")?.api.betterMerchant;
/*
 * checks if an item matches the partial equipment browser filter provided
 */
compareItemWithFilter: (item: PhysicalItemPF2e, filter: Partial<EquipmentFilters>) => boolean;
/*
 * runs the filters checks for the provided item
 */
testItem: (actor: LootPF2e, item: PhysicalItemPF2e, type: "buy" | "sell", quantity?: number) => {
    price: CoinsPF2e;
    filter: ExtractedFilter;
} | undefined
Clone this wiki locally