Added Purse API and Purse Change Event
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 to 372647.
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 it 372768121.
To fix this, I added a regex before the existing regex that matches the (+nnn) section and removes it.
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.
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.
This api was a bit messy. I have rewritten it. Feel free to take a look but it should be good now.
[!Note] Squash