Skyblocker icon indicating copy to clipboard operation
Skyblocker copied to clipboard

Added Purse API and Purse Change Event

Open Westsi opened this issue 1 year ago • 6 comments

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.

Westsi avatar Aug 21 '24 11:08 Westsi

This seems a bit of a little random addition (apart from the regex fix)?

viciscat avatar Aug 21 '24 12:08 viciscat

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.

Westsi avatar Aug 21 '24 12:08 Westsi

Merge conflict looks fairly simple to fix to me.

Westsi avatar Sep 06 '24 19:09 Westsi

Done @kevinthegreat1

Westsi avatar Sep 14 '24 15:09 Westsi

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.

kevinthegreat1 avatar Sep 22 '24 00:09 kevinthegreat1

This api was a bit messy. I have rewritten it. Feel free to take a look but it should be good now.

kevinthegreat1 avatar Sep 22 '24 01:09 kevinthegreat1

[!Note] Squash

kevinthegreat1 avatar Nov 22 '24 21:11 kevinthegreat1