Better Merchant - reonZ/pf2e-toolbelt GitHub Wiki

This tool add new functionalities the the system merchant actor

[!IMPORTANT] This tool requires a GM to be online to function.

Sell Items Button

This feature will open a new window containing all the valid items of the currently selected token (or the assigned actor) that the merchant could be interested in buying. For an item to show on the list, it must:

  • Be identified
  • Have a quantity of 1 or more
  • Not belong the the Coins stack group
  • Match a Buy Filter from the merchant

Price displayed in the list are already using the matching filter ratio, you can hover over it to see the original price of the items.

[!NOTE] Prices are colored based on an assumed ratio of 1 for treasures and 0.5 for the other items.

Buy Item Button

A new Buy Item button is added to each merchant item to directly engage in a buy trade without having to drag & drop the item onto another actor's token/sheet.

Create Scrolls

This feature lets you use the compendium browser to filter spells you would like to turn into scrolls and add to the merchant. Once the filters setup, click on the new Add To Merchant button found in the header and a new window with all the filtered spells will show up where you can select which ones you want to be made into scrolls and at which heightened level.

From Browser

This feature lets you use the compendium browser to filter the items you would like to add to the merchant. Once the filters setup, click on the new Add To Merchant button found in the header and a new window with all the filtered items will show up where you can select up to 100 of to instantly add to the merchant.

Setup Filters

A menu where you can setup filters for items/services and their associated price ratio.

Item filters are created using the the system compendium browser and clicking on the new Create Filter button found in the application header. Service filters on the other hand are represented by a minimum level value and an eventual single tag string.

Enabled filters are checked from top to bottom until one matches the item/service. Its price ratio is then used for the transaction.

If the end of the list is reached without any matching filter, then the merchant will reject the transaction which means that you can have merchant unwilling to buy/sell some type or even all items/services if you wish.

The Sell Filters column represents the items the merchant is willing to sell to the players.

The Buy Filters columns represents the items the merchant is willing to buy from the players. If any Treasure item reaches the Default filter, it will automatically be bought for its full price instead of using the filter price ratio.

The Service Filters columns represents the services the merchant is willing to provide to he players.

[!NOTE] The price of items/services in the merchant's inventory will be colored in green/red if it is cheaper or more expensive respectively due to a filter affecting them.

Infinite Stocks

When enabled, the merchant will have virtually an infinite stock of each item in its inventory. The Total Bulk, Total Wealth and items Quantity values in the sheet will be replaced by the symbol.

Services

The GM can create simple services that the merchant will provide to the players. A service is the combination of a name and description.

A service can also have a custom image, a price, a quantity, a macro to be executed as well as tags and a level used by the service filters.

[!NOTE] A quantity of -1 (default) means the merchant will offer the service without limit

The GM has the possibility of offering the service to the players, this will not reduce its quantity value nor request any exchange of currency.

[!NOTE] A disabled service while not displayed to the players can still be offered to them by the GM.

Service Macro

Services can have a macro that will be executed whenever it is purchased or offered for free by the GM.

The service buyer is forwarded to the macro as the actor parameter as well as an extra service parameter containing the following:

{
  /** if it was offered for free by the GM */
  forceFree: boolean;
  level: number;
  name: string;
  /** price before filter ratio was applied */
  originalPrice: CoinsPF2e;
  quantity: number;
  /** the merchant */
  seller: LootPF2e;
  serviceRatio: number | null;
  /** price after filter ratio was applied */
  usedPrice: CoinsPF2e | null;
}

Settings

Enabled 🌎

Add custom functionalities to the default system merchant.

API

game.toolbelt?.api.betterMerchant = {
    /**
     * run the merchant buy filters against the list of items provided
     * returns a new list containing the items the merchant is willing to buy and at which price
     */
    testItemsForMerchant(merchant: ActorPF2e, items: ItemPF2e[]): TestItemData[],
}
type TestItemData = {
    buyPrice: CoinsPF2e,
    item: PhysicalItemPF2e,
};