fantasycalendar / FoundryVTT-ItemPiles

Other
33 stars 54 forks source link

[BUG] - [CSB] - Player browser freezes when purchase more than can afford. #577

Closed Mechanized82 closed 3 months ago

Mechanized82 commented 4 months ago

Are you on the latest version of Item Piles? Yes

Have you tried to reset Item Piles' system settings? No

Describe the bug Player browser (me with browser open to test) freezes and needs refreshed to function

To Reproduce

  1. Set up a merchant pile,
  2. Give an item with a quantity
  3. Player inputs a higher max than allowable based on how much currency they have.

Setup:

Active modules:

image

Additional context It will even freeze sometimes if you input the allowed max (I think because there are some decimals on the calculations that exceed the actual amount of coin on the character, not sure though, just a hunch)

Edit: I've also noticed that setting the merchant buy price mod to 50% is changing a 5cp item to 2cp (truncating) but choosing to buy 2 costs 5cp. However, the max quantity says 8 when the character has 16cp. In reality 8 x 2.5cp items would cost 20 so it is calculating that oddly as well. The max quantity should be 6.

Haxxer commented 4 months ago

CSB is not a supported system - please provide your item piles configuration.

Mechanized82 commented 4 months ago

image

Is this what you mean? If not then talk to me like I'm 10 because I understand nothing regarding the technical side of this stuff lol.

I also just started using Item Piles today. Everything else seems to work so thus far. As long as I don't fiddle with the buy modifier and create decimal points I've had no issues.

Haxxer commented 4 months ago

Since you have put copper as your primary currency, the exchange rate for the other currencies count as that. As you have currently put it, one copper is worth 100 gold pieces. You want 0.01, as one copper piece is worth 1/100th of a gold piece.

Mechanized82 commented 4 months ago

I tried that and it won't pick up that I have silver/gold to spend in the merchant. (example: on the character sheet i have 10cp, 5sp, 1gp, and it is only allowing me to buy 2 of a 5cp item.)

Then I tried to change the exchange to 100cp, 10sp, 1gp, just to get rid of decimals, and it picked up that I had other coins but it seemed to reverse the exchange rate, wanting to give me change in gold and silver for spending a few copper.

Is the exchange rate reversed for me for some reason since copper is my primary? I had the rates set up in that manner because it is the only way it was calculating cp/sp/gp correctly. There are really no issues that I've caught with my exchange set up in that manner, and its the only way that it is working.

The main issue is that it isn't converting cp decimals generated by the buy price mod % to an accurate max qty. My guess is that it is calculating max qty off of the truncated price column, where it says 2CP. When really, the price mod is set to 50%... on a 5cp item... giving that item a true cost of 2.5cp. The browser freezes attempting to go over the true cost of 2.5cp (inputting 6 is fine (2.5cp*6 = 15cp) but as soon as any larger number is input everything freezes.

image

This image shows how the max may look correct at first glance...

image

But as you see, adding a qty of 2 = 5cp. The cost is actually 2.5cp, the decimal is hidden. with 16cp the max qty should say 6, not 8.

This only seems to be happening when decimals are involved. As when I tried your suggestion of changing my exchange numbers around entering a larger Qty just set the number to whatever the max was.

Anyway, all the word vomit was just as much info as I could give you on the situation. Is there a reason my exchange rate is reversed? If I could fix that I could avoid this bug. Otherwise I have to use the exchange rate as I have it set...

Haxxer commented 4 months ago

Could you show me a screenshot of your new currency settings?

Mechanized82 commented 4 months ago

I had to revert back to the original ones I posted as they are the only ones that work. (100gp, 10sp, 1cp, CP primary)

image

Proof they do function properly.

Would you like me to screen shot what happens with your currency suggestions?

Haxxer commented 4 months ago

I think I was mistaken with my suggestion - if gold coins are your primary currency, I would recommend putting them as follows:

I don't know why it would freeze for you, have you tried in other browsers? What about other systems, like DND5e?

Mechanized82 commented 4 months ago

That setup works properly, except that I was really hoping to keep copper as my primary. I've built a setting agnostic system and surprisingly enough, medieval item costs in copper are pretty similar to modern day dollar costs for similar items lol... so the entire guide is listed in copper/dollar amount.

I had a friend verify the same freezing issue on google chrome as was with me on Firefox. Never tried a different system, I don't play any others besides this one.

Is it possible to fix that max Qty miscalc and giving it a try? Looks like its calculating the truncated number instead of the actual number. Or would that mess something else up?

Haxxer commented 4 months ago

Having this conversation over github like a delayed support chat isn't conducive to me being able to assist you - could you contact me on Discord? My username is Wasp.

Mechanized82 commented 4 months ago

Thank you, that should be easier. It doesn't look like you're accepting msgs or requests though. My username is mechanized82

Haxxer commented 3 months ago

Fixed in 3.0.6