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

Discounts not calculating properly (100% discount, "You do not have enough tokens") #840

Open
NobleKangaroo opened this issue May 7, 2024 · 4 comments

Comments

@NobleKangaroo
Copy link

Please make sure to leave out any sensitive information!

Describe the bug
Discounts are not currently checking if the player's balance is above the discounted price, but instead the pre-discount price. For instance if I have a balance of 100,000 tokens and a store item costs 200,000 pre-discount, a 100% discount should allow me to purchase the item. However, the store says that I do not have enough tokens.

To Reproduce
Steps to reproduce the behavior:

  1. Create store item with price, for instance 200k
  2. Create role giving 100% discount, assign to player
  3. Go in-game with that player and try to purchase the item
  4. See error

Expected behavior
Allowed to purchase the item

Screenshots
image

Additional context
N/A

@mvaessen mvaessen added this to Open in GSA Development May 7, 2024
@mvaessen
Copy link
Contributor

mvaessen commented May 7, 2024

Hi, thanks for the report.

I checked the code, and it does check the discounted price. I would suggest creating a simpler test case where it checks for a 50% discount, or something like that, on a 10 token item. You can then begin with a balance of 0 and slowly add tokens until it's purchased. This should give an indication whether it's an actual bug with the discount price, or something else.

@NobleKangaroo
Copy link
Author

NobleKangaroo commented May 7, 2024

Hello @mvaessen - I can confirm that a 50% discount role works as intended. My test case was a shop item for 150,000 tokens and a discounted rate of 50% and a player with a balance around 100,000. This did in fact work, resulting in the player with a remaining balance around 25,000 as intended.

That said it appears that the issue is not with the before/after balance comparison (as the player had enough tokens to buy the discounted price but not the full price, yet the discount worked) but possibly with a zero-cost shop pack. I have a use case where a player might be offered a 100% discount, and this is something that should be working as a 100% discount role is something that the website allows us to do.

I'm able to perform more testing if you need, let me know.

Thanks!

@mvaessen
Copy link
Contributor

mvaessen commented May 7, 2024

hi, thanks for the extra info, that is very helpful.

I'm currently not able to fix this, but I will check it out later when the current work-in-progress is released later this month.

@NobleKangaroo
Copy link
Author

I changed the price of the shop item to 50 tokens and reduced the player's tokens to 5 tokens and the issue remains.
image

Of note is that the player is a member of two roles - one that provides a 50% discount and one that provides a 100% discount. I thought perhaps there were an issue with multiple roles but after removing them from all additional roles, that doesn't appear to be the case. The player is a member of just one role now (100% discount), has 5 tokens, and cannot purchase a shop item that costs 50 tokens.

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

No branches or pull requests

2 participants