jopeek / fvtt-loot-sheet-npc-5e

FVTT - Loot Sheet NPC 5E
MIT License
44 stars 85 forks source link

When I buy from a merchant I get platinum. #339

Closed Altrix1 closed 2 years ago

Altrix1 commented 2 years ago

When I buy from a merchant I get platinum. Zrzut ekranu 2022-05-14 131307 Zrzut ekranu 2022-05-14 131351

Cmslt95 commented 2 years ago

Jeah same problem here

TheFinalPerry commented 2 years ago

I am getting the same issue. It always seems to multiple the platinum in a weird way. For instance if they have 500 gp and purchase a 50gp item they are given 4995pp always. If they have 500gp and purchase an item for 5 gp they always get 4999.5. It is consistent.

I am able to replicate in a world with only this module enabled. Tested in a different world with only this module enabled and I could not replicate. Same settings on the module.

Module version - 3.5.10 Operating system - Win10 Browser version - Chrome Version 101.0.4951.67, Microsoft Edge Version 101.0.1210.53, Brave Version 1.39.111, Firefox 100.0.2 Foundry version - 9.269 Errors in console - no errors

DanielBoettner commented 2 years ago

I Will take a look into currency conversion again.

Ameranth commented 2 years ago

I believe this issue is due to _getFundsAsPlatinum, starting at line 464 in TradeHelper.js:

        fundsAsPlatinum += funds.gp / rates.pp;
        fundsAsPlatinum += (funds.ep / rates.gp) / rates.pp;
        fundsAsPlatinum += (funds.sp / rates.gp) / rates.pp;
        fundsAsPlatinum += (funds.cp / rates.gp) / rates.pp;

This code is dividing gp funds by the pp rate, which is defined as 0.1, thus it is multiplying gp by 10 to convert to pp, rather than diving by 10.

DanielBoettner commented 2 years ago

@Ameranth thanks alot

Will try to get it into the next release (which I finish currently)

Ameranth commented 2 years ago

Awesome, thank you very much for your work!