Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.powerbot.game.api.methods.Calculations;
- import org.powerbot.game.api.methods.input.Mouse;
- import org.powerbot.game.api.methods.interactive.Players;
- import org.powerbot.game.api.methods.widget.Camera;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.wrappers.Tile;
- public class Walking {
- public int angleTo(Tile tile) {
- final double ydif = tile.b - Players.getLocal().getPosition().b;
- final double xdif = tile.a - Players.getLocal().getPosition().a;
- return (int) (Math.atan2(ydif, xdif) * 180 / Math.PI);
- }
- public float distanceTo(Tile tile) {
- return (float) Calculations.distance(Players.getLocal().getPosition(),
- tile);
- }
- public boolean walkTileMM(Tile tile, int rnd) {
- float angle = angleTo(tile) - Camera.getAngleTo(0);
- float distance = distanceTo(tile);
- if (distance > 18) {
- distance = 18;
- }
- angle = (float) (angle * Math.PI / 180);
- int x = 627, y = 85;
- int dx = (int) (4 * (distance + Random.nextGaussian(0, rnd, 1)) * Math
- .cos(angle));
- int dy = (int) (4 * (distance + Random.nextGaussian(0, rnd, 1)) * Math
- .sin(angle));
- return Mouse.click(x + dx, y - dy, true);
- }
- }
Add Comment
Please, Sign In to add comment