-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Added Purse API and Purse Change Event #950
Conversation
This seems a bit of a little random addition (apart from the regex fix)? |
Yeah, I was working on a slayer profit calculator and saw that there was no way of tracking purse changes like this. I thought that it was best to make it a more abstract thing so that it could be used in other similar calculators (ghost profit, bountiful reforge in farming etc). I maybe should have explained that more. |
Merge conflict looks fairly simple to fix to me. |
src/main/java/de/hysky/skyblocker/utils/purse/PurseChangeCause.java
Outdated
Show resolved
Hide resolved
Done @kevinthegreat1 |
This pr needed to be rebased. I have done that for you. I apologize for the very rapidly changing main branch, but that's bound to happen to an interdependent project like this, so it would be nice if you could deal with these situations. |
7b4ad9d
to
07c683a
Compare
This api was a bit messy. I have rewritten it. Feel free to take a look but it should be good now. |
src/main/java/de/hysky/skyblocker/utils/purse/PurseChangeCause.java
Outdated
Show resolved
Hide resolved
…pcoming feature I am making
Co-authored-by: Kevin <[email protected]>
….java Co-authored-by: Kevin <[email protected]>
…pcoming feature I am making
d4fafb7
to
56b1f6e
Compare
Note Squash |
I added a way to create callbacks for when the player's purse changes and fixed the Utils.getPurse function so that it would not break in the case below. This so that the Purse API can be used to track scavenger coins, useful in profit calculators for slayers and ghosts for instance.
The case that broke the getPurse function:
Purse: 372,647
works fine, as the prior regex changed that to372647
.However, when the purse is being updated with mob kill coins, the line becomes
Purse: 372,768 (+121)
, where the prior regex just removed all non digits, making it372768121
.To fix this, I added a regex before the existing regex that matches the
(+nnn)
section and removes it.