Guest User

Untitled

a guest
Jul 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import org.powerbot.game.api.methods.Calculations;
  2. import org.powerbot.game.api.methods.input.Mouse;
  3. import org.powerbot.game.api.methods.interactive.Players;
  4. import org.powerbot.game.api.methods.widget.Camera;
  5. import org.powerbot.game.api.util.Random;
  6. import org.powerbot.game.api.wrappers.Tile;
  7.  
  8. public class Walking {
  9. public int angleTo(Tile tile) {
  10. final double ydif = tile.b - Players.getLocal().getPosition().b;
  11. final double xdif = tile.a - Players.getLocal().getPosition().a;
  12. return (int) (Math.atan2(ydif, xdif) * 180 / Math.PI);
  13. }
  14.  
  15. public float distanceTo(Tile tile) {
  16. return (float) Calculations.distance(Players.getLocal().getPosition(),
  17. tile);
  18. }
  19.  
  20. public boolean walkTileMM(Tile tile, int rnd) {
  21. float angle = angleTo(tile) - Camera.getAngleTo(0);
  22. float distance = distanceTo(tile);
  23. if (distance > 18) {
  24. distance = 18;
  25. }
  26. angle = (float) (angle * Math.PI / 180);
  27. int x = 627, y = 85;
  28. int dx = (int) (4 * (distance + Random.nextGaussian(0, rnd, 1)) * Math
  29. .cos(angle));
  30. int dy = (int) (4 * (distance + Random.nextGaussian(0, rnd, 1)) * Math
  31. .sin(angle));
  32. return Mouse.click(x + dx, y - dy, true);
  33. }
  34.  
  35. }
Add Comment
Please, Sign In to add comment