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

Discount overview on Arx purchase page and price calculation change #2

Closed
wants to merge 7 commits into from

Conversation

DaftMav
Copy link

@DaftMav DaftMav commented Nov 7, 2024

Multiple changes as mentioned in (#1):

  • New feature: Adds discount % and Arx/pricing values for each package on the Arx purchase page
  • Changes how prices are calculated, using the lowest Arx package possible needed to buy an item
  • Replaces window load event with DOMready()
  • Simplified handling of decimals using toFixed(2)
  • Updated readme to reflect changes made, added new screenshots, and details on new settings

Calculated discount % and example arx:price values are added on each
Arx package on the Arx purchase page.
The window load event is only fired when the entire page has been
loaded, including all resourses like scripts, stylesheets and images.
This is unreliable especially with ad- and privacy blockers preventing
certain files to load. Replaced it with a DOMready() function that
triggers earlier and always.

The decimals handling of prices has been simplified using toFixed(2).

Note on Number.EPSILON; It doesn't prevent floating-point errors in
the way it's used here. In rare occasions it could prevent incorrectly
rounding down instead of up but the 0.01 difference doesn't matter
here and we're also not doing direct equality comparisons.
Prices for each item are now calculated using the lowest Arx package
possible to buy that specific item. It does not make sense if an item
costs 12500 to use the 8400 package and calculate leftovers with the
5000 package. This would be more expensive than simply buying the
larger 16800 package.

Also a few fixes I missed and all my tabs were messed up...
- Changes the way prices are calculated
- Adds discount-% overview on Arx purchase page
- Readme changed to reflect changes made with new screenshots
Updated the readme to reflect the changes of how the script works and calculates prices.

- New shop screenshots added
- Details for all settings added
Initially this was intended to just be an update for the original version but it seems the original author is not doing anything with the push request.
Metadata header was changed to make this a separate standalone version so userscript managers won't look at the original URL for updates.
@DaftMav DaftMav closed this Feb 26, 2025
@ShadowLp174
Copy link
Owner

Oh shoot I completely forgot about this. Sorry about that. Maybe it is better in it's own userscript, you seem to care for it more than I do :)

@DaftMav
Copy link
Author

DaftMav commented Feb 26, 2025

No problem, I just changed the metadata URL in my version because if I linked my version to people the script would still point to your version and perhaps look here for updates. I didn't realize doing that would also update this pull request which was not intended, so I figured I'd just close this.
If you still want to merge it's fine with me but I also wouldn't mind keeping it separated and maintaining mine in case it breaks when the store website is changed.

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

Successfully merging this pull request may close these issues.

Calculating item cost from two Arx packages is more expensive than getting the larger Arx package
2 participants