Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. public class Projection extends org.tribot.api2007.Projection {
  2.  
  3. public static int[] SINE;
  4. public static final Point NULL_PT;
  5. public static int[] COSINE;
  6.  
  7. static {
  8. int n;
  9. NULL_PT = new Point(-1, -1);
  10. SINE = new int[2048];
  11. COSINE = new int[2048];
  12. int n2 = n = 0;
  13. while (n2 < SINE.length) {
  14. int n3 = n;
  15. Projection.SINE[n3] = (int)(65536.0 * Math.sin((double)n3 * 0.0030679615));
  16. int n4 = n++;
  17. Projection.COSINE[n4] = (int)(65536.0 * Math.cos((double)n4 * 0.0030679615));
  18. n2 = n;
  19. }
  20. }
  21.  
  22. public static Point tileToMinimap(Positionable position) {
  23. if (position == null) {
  24. return null;
  25. }
  26. RSTile a2;
  27. final RSPlayer rsPlayer;
  28. if ((rsPlayer = Player.getRSPlayer()) == null) {
  29. return Projection.NULL_PT;
  30. }
  31. a2 = rsPlayer.getAnimablePosition();
  32. RSTile a3;
  33. if ((a3 = position.getPosition()) == null) {
  34. return Projection.NULL_PT;
  35. }
  36. a3 = a3.toLocalTile();
  37. final RSTile rsTile = a3;
  38. final int a4 = rsTile.getX() * 4 + 2 - a2.getX() / 32;
  39. final int a5 = rsTile.getY() * 4 + 2 - a2.getY() / 32;
  40. final int a6 = Game.getMinimapRotation() & 0x7FF;
  41. final int n = a4;
  42. final int n2 = n * n;
  43. final int n3 = a5;
  44. if (n2 + n3 * n3 > 6000) {
  45. return Projection.NULL_PT;
  46. }
  47. final int a7 = Projection.SINE[a6];
  48. final int a8 = Projection.COSINE[a6];
  49. final int a9 = a5 * a7 + a4 * a8 >> 16;
  50. final int a10 = a5 * a8 - a4 * a7 >> 16;
  51. final Point a11;
  52. if ((a11 = GM()) == null) {
  53. return Projection.NULL_PT;
  54. }
  55. final int n4 = a9 + ((a11.x > 0) ? a11.x : 643);
  56. int y;
  57. int n5;
  58. if (a11.y > 0) {
  59. y = a11.y;
  60. n5 = a10;
  61. }
  62. else {
  63. y = 83;
  64. n5 = a10;
  65. }
  66. return new Point(n4, y - n5);
  67. }
  68.  
  69. public static boolean isInMinimap(final Point p) {
  70. final Point a2;
  71. if ((a2 = GM()) == Projection.NULL_PT) {
  72. return false;
  73. }
  74. if (General.isClientResizable()) {
  75. Rectangle a3 = null;
  76. final RSInterface a4;
  77. if ((a4 = (RSInterface)Interfaces.get(160, 41)) != null) {
  78. a3 = a4.getAbsoluteBounds();
  79. }
  80. return (a3 == null || !a3.contains(p)) && p.distance(a2) < 73.0;
  81. }
  82. return org.tribot.api2007.Projection.isInMinimap(p);
  83. }
  84.  
  85. private static Point GM() {
  86. int n = 0;
  87. int n2 = 0;
  88. if (!General.isClientResizable()) {
  89. RSInterfaceChild rSInterfaceChild = Interfaces.get((int)548, (int)8);
  90. if (rSInterfaceChild == null) return NULL_PT;
  91. Rectangle rectangle = rSInterfaceChild.getAbsoluteBounds();
  92. if (rectangle == null) return NULL_PT;
  93. Rectangle rectangle2 = rectangle;
  94. n = rectangle2.x + (rectangle2.width % 2 == 1 ? rectangle.width + 1 : rectangle.width) / 2;
  95. Rectangle rectangle3 = rectangle;
  96. n2 = rectangle3.y + (rectangle3.height % 2 == 1 ? rectangle.height + 1 : rectangle.height) / 2;
  97. return new Point(n, n2);
  98. } else {
  99. RSInterfaceChild rSInterfaceChild = Interfaces.get((int)161, (int)25);
  100. if ((!Interfaces.isInterfaceSubstantiated(rSInterfaceChild)) && (!Interfaces.isInterfaceSubstantiated((rSInterfaceChild = Interfaces.get((int)164, (int)25)))))
  101. return NULL_PT;
  102. Rectangle rectangle = rSInterfaceChild.getAbsoluteBounds();
  103. if (rectangle == null) return NULL_PT;
  104. Rectangle rectangle4 = rectangle;
  105. n = rectangle4.x + (rectangle4.width % 2 == 1 ? rectangle.width + 1 : rectangle.width) / 2;
  106. Rectangle rectangle5 = rectangle;
  107. n2 = rectangle5.y + (rectangle5.height % 2 == 1 ? rectangle.height + 1 : rectangle.height) / 2;
  108. }
  109. return new Point(n, n2);
  110. }
  111.  
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement