JohnRThomas / Exia-Mining-All-In-One

A mining script for Runemate
7 stars 7 forks source link

[BUG]Mining Guild Banking #7

Closed JohnRThomas closed 8 years ago

JohnRThomas commented 8 years ago

Mining guild banking issue. Not walking to the bank and not clicking the bank the right way. It just keeps clicking bank and the response is "you can't reach that"

Kneckter commented 8 years ago

Problem lies in public boolean inBank(). The OR clause notes the distance from the banker can be less than 5 blocks away if the player is outside the bank. If the OR clause is true, the bot clicks and walks into the wall. Sometimes the bot is slow at clicking and the character walks to the right point. This usually happens when walking.

Changing the If statement to the below will stop the bot from trying to click through the wall.

if(bank.contains(Players.getLocal()) || (bankers.size() > 0 && bankers.first().isVisible() && bankers.first().distanceTo(Players.getLocal()) < 2))

JohnRThomas commented 8 years ago

Yeah, I tried to fix this before. I have that value at 5 deliberately to allow the script to click bankers before it enters the bank.

The Falador bank is a special exception that breaks this because of the bug in actual RS that gives the message "Can't reach that." even thought the bankers are in fact reachable.

You are correct though, the inBank method should e updated, but instead of updating the in Location.java, I'm going to make a custom one in MiningGuild.java to override the default functionality. This way, the other locations that do not have this issue will still allow early clicking of the bankers since that is a pretty human like way of playing.

Kneckter commented 8 years ago

Right now the OSRS Rimmington code uses the Faldor bank and will have this issue too until deposit boxes is added. I added a fix to my Locations.java file. I tested it and it works. It isn't the same as what you planned but it could be a temp fix.

JohnRThomas commented 8 years ago

Your change would work, but one thing to keep in mind is that super classes should never references their sub classes. Ideally you want the class heirachy to only go one way. Take a look at my modifications to Location.java and the two affected locations with respect to this commit: 2c62d808362f035a5770f1a5d229f35950657367

Also, would it be better to bank in Draynor for Rimmington?

Kneckter commented 8 years ago

Nice change. I see the difference in how it works. Glad you are still working on the code haha.

For the banks, the Falador one is about 18 blocks closer but we can change it to Draynor if you want. The coordinates are in the Lumbridge West file.

JohnRThomas commented 8 years ago

If it's closer, let's keep it how it is.

Good work!