whelan / fvtt-merchant-sheet-npc

FVTT - Merchant Sheet NPC 5E
MIT License
12 stars 13 forks source link

[WFRP4e] Pay command is not localized #122

Closed pallando closed 2 years ago

pallando commented 2 years ago

Describe the bug When using this module with WFRP in French, the pay command is not recognized, thus no money is taken from the buyer.

To Reproduce Steps to reproduce the behavior:

  1. Install French WFRP module
  2. As a player, click on "Buy item" on a merchant NPC
  3. See error ("Invalid syntax")

Expected behavior Clicking the "pay" button should remove the specified amount of money from the player.

Screenshots image

Additional context It looks like this module uses hard coded values for coins ("gc", "ss", "bp") whereas the WFRP module uses the localized names for coins when parsing the command.

pallando commented 2 years ago

Replacing line 63 from Wfrp4eCurrencyCalculator.ts by something like this may work:

        let gc = game.i18n.localize("MARKET.Abbrev.GC").toLowerCase();
        let ss = game.i18n.localize("MARKET.Abbrev.SS").toLowerCase();
        let bp = game.i18n.localize("MARKET.Abbrev.BP").toLowerCase();
        let money = game.wfrp4e.market.payCommand(priceAmount.gc + gc + priceAmount.ss + ss + priceAmount.bp + bp, buyer, { 'suppressMessage': true });

At least, it does when I try it locally (by editing 'bundle.js'), but I have not tried in English.