Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Stashed money overflow #9

Open
monbon234 opened this issue Jun 16, 2024 · 6 comments
Open

[BUG] Stashed money overflow #9

monbon234 opened this issue Jun 16, 2024 · 6 comments

Comments

@monbon234
Copy link

If too much money is stashed, upon respawn the stashed value will become extremely small (3 gold in my experience (I stashed all my money twice whilst at the max value so thats how high it was, probably important info to include))

@monbon234 monbon234 changed the title Stashed money overflow [BUG] Stashed money overflow Jul 3, 2024
@codefaux
Copy link
Owner

codefaux commented Jul 4, 2024

I'll look into this. I have a few ideas, but the upcoming release will still suffer the same failure. I have an idea how to work around it. I'll leave this open until I resolve it. Overflows, especially with money, might be a recurring theme..

@monbon234
Copy link
Author

would it be possible to change all deposit options to only allow up to 99% of the max gold value to be stashed, preventing overflows?

@codefaux
Copy link
Owner

codefaux commented Jul 6, 2024

The resulting value would still increase, which would overflow. An overflow is any time you're trying to store a number bigger than the maximum a number can be in a given space. I have an idea how to work around it, though.

@monbon234
Copy link
Author

I meant a way for the actual options to change their deposit values
eg if overflow was 1000
when the player clicks stash, calculate the safe amount left to stash (lets say 10 less than overflow)
then check to see if the value the player is attempting to stash is greater than that amount (in this case (1000-10)-stashedvalue)
and if the value is greater than that amount, just overwrite the amount being stashed to the safe amount
this way any attempt to stash more than is able to be stored, it would just end up adding 0 to the stashedvalue

@codefaux
Copy link
Owner

codefaux commented Jul 8, 2024

My intent is to deny transactions which would pass a certain limit. To avoid making it too easy to overflow the player, I've set limited the amount Persistence can give the player, and the amount it can put into a stash, separately.

The max amount a player can get from Persistence (stash, etc) is limited to well below the overflow amount, so that a player must work to overflow their money (infinite money)

The max amount a player can put into stash is limited to considerably higher, but still a wide margin away from the overflow limit, so if you have an excessively large stash amount when switching, it will not allow deposits until you withdraw enough.

If you need to fix your stash money due to the overflow, I can help you with that process.

@codefaux
Copy link
Owner

I've pushed v3 into the wild. Stash and player money should not overflow. Already-overflowed stashes will not resolve. Player or stash balance above transaction limits will deny deposit but allow withdraw, so players with "too much money" will see disabled buttons until they spend some. Closing this issue.

Reopen if the problem crops back up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants