daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Dec 15th, 2018 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. strictfp pastebin
  2.  
  3. Paste #34106, submitted October 5, 2012, 12:11 am
  4. Paste Again
  5.  
  6. Share on facebook Share on tumblr Share on twitter Share on print More Sharing Services
  7. 0
  8. ?
  9. 1
  10. 2
  11. 3
  12. 4
  13. 5
  14. 6
  15. 7
  16. 8
  17. 9
  18. 10
  19. 11
  20. 12
  21. 13
  22. 14
  23. 15
  24. 16
  25. 17
  26. 18
  27. 19
  28. 20
  29. 21
  30. 22
  31. 23
  32. 24
  33. 25
  34. 26
  35. 27
  36. 28
  37. 29
  38. 30
  39. 31
  40. 32
  41. 33
  42. 34
  43. 35
  44. 36
  45. 37
  46. 38
  47. 39
  48. 40
  49. 41
  50. 42
  51. 43
  52. 44
  53. 45
  54. 46
  55. 47
  56. 48
  57. 49
  58. 50
  59. 51
  60. 52
  61. 53
  62. 54
  63. 55
  64. 56
  65. 57
  66. 58
  67. 59
  68. 60
  69. 61
  70. 62
  71. 63
  72. 64
  73. 65
  74. 66
  75. 67
  76. 68
  77. 69
  78. 70
  79. 71
  80. 72
  81. 73
  82. 74
  83. 75
  84. 76
  85. 77
  86. 78
  87. 79
  88. 80
  89. 81
  90. 82
  91. 83
  92. 84
  93. 85
  94. 86
  95. 87
  96. 88
  97. 89
  98. 90
  99. 91
  100. 92
  101. 93
  102. 94
  103. 95
  104. 96
  105. 97
  106. 98
  107. 99
  108. 100
  109. 101
  110. import java.awt.Point;
  111. import java.awt.Polygon;
  112. import java.awt.Rectangle;
  113. import java.util.Random;
  114.  
  115. import org.dynamac.bot.api.methods.Calculations;
  116. import org.dynamac.bot.api.methods.Client;
  117. import org.dynamac.bot.api.methods.Mouse;
  118. import org.dynamac.bot.api.wrappers.Character;
  119.  
  120. public class Tile {
  121.     private static Character c = new Character(null);
  122.     private int localX;
  123.     private int localY;
  124.     private int x;
  125.     private int y;
  126.     private int plane;
  127.     public Tile(int x, int y, int plane){
  128.         this.plane=plane;
  129.         if(x<=104 || y<=104){
  130.             this.localX=x;
  131.             this.localY=y;
  132.             this.x=x+Client.getBaseX();
  133.             this.y=y+Client.getBaseY();
  134.         }
  135.         else{
  136.             this.x=x;
  137.             this.y=y;
  138.             this.localX=x-Client.getBaseX();
  139.             this.localY=y-Client.getBaseY();
  140.         }
  141.     }
  142.     public int getLocalX(){
  143.         return localX;
  144.     }
  145.     public int getLocalY(){
  146.         return localY;
  147.     }
  148.     public int getPlane(){
  149.         return plane;
  150.     }
  151.     public Polygon getPolygon(){
  152.         return Calculations.getTilePolygon(x, y);
  153.     }
  154.     public Point getScreenLocation(){
  155.         return Calculations.locationToScreen(x, y);
  156.     }
  157.     public Point getTileOnMap(){
  158.         return Calculations.worldToMap(getLocalX(), getLocalY());
  159.     }
  160.     public Rectangle getBounds(){
  161.         return new Rectangle(getX(),getY(),32,32);
  162.          
  163.     }
  164.     public Tile getNext(final Tile... tiles) {
  165.         for (int i = tiles.length - 1; i > 0; i -= 1) {
  166.             if (tiles[i].isOnMap()) {
  167.                 return tiles[i];
  168.             }
  169.         }
  170.         return null;
  171.     }
  172.     public Tile getLastTile(final Tile... tiles) {
  173.         return tiles[tiles.length - 1];
  174.     }
  175.     public boolean clickTile(){
  176.             Polygon p = Calculations.getTilePolygon(getLocalX(), getLocalX());
  177.             Rectangle r = p.getBounds();
  178.             Point pt = new Point(new Random().nextInt(r.width)+r.x, new Random().nextInt(r.height)+r.y);
  179.             if(pt.x>0 && pt.x<515 && pt.y>54 && pt.y<388){
  180.                 Mouse.clickMouse(pt, 1);
  181.                 return true;
  182.             }
  183.          
  184.         return false;
  185.     }
  186.     public boolean clickMap(){
  187.         if(isOnMap()){
  188.             Mouse.clickMouse(getTileOnMap());
  189.             return true;
  190.         }
  191.         return false;
  192.     }
  193.     public Tile getClosestTile(final Tile tile) {
  194.         final Tile player = new Tile(c.getLocationX(),c.getLocationY(), getPlane());
  195.         final Tile close = new Tile((player.getX() + tile.getLocalX()) / 2,(player.getY() + tile.getLocalY()) / 2, getPlane());
  196.         if (!close.isOnMap()) {
  197.             return getClosestTile(close);
  198.         }
  199.         return close;
  200.     }
  201.     public boolean isOnMap(){
  202.         return getTileOnMap().x != -1 && getTileOnMap().y != -1;
  203.     }
  204.     public int getX(){
  205.         return x;
  206.     }
  207.     public int getY(){
  208.         return y;
  209.     }
  210. }
  211. Share on facebook Share on tumblr Share on twitter Share on print More Sharing Services
  212. 0
  213. Contents of pastes reflect the opinions of the poster. If you don't like it, it's not our problem. We may remove pastes without notice, for any or no reason. Does anyone read this? I don't think so.
  214. When you're using strictfp paste, don't do anything stupid, don't offend anyone, don't violate copyright, don't do anything illegal, and don't break anything. If you do, it's on you.
  215.  
  216. © strictfp.com | All rights reserved | Valid HTML5 and CSS Level 3 | Contact Us | Page generated in 0.0581 seconds
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top