Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Projection extends org.tribot.api2007.Projection {
- public static int[] SINE;
- public static final Point NULL_PT;
- public static int[] COSINE;
- static {
- int n;
- NULL_PT = new Point(-1, -1);
- SINE = new int[2048];
- COSINE = new int[2048];
- int n2 = n = 0;
- while (n2 < SINE.length) {
- int n3 = n;
- Projection.SINE[n3] = (int)(65536.0 * Math.sin((double)n3 * 0.0030679615));
- int n4 = n++;
- Projection.COSINE[n4] = (int)(65536.0 * Math.cos((double)n4 * 0.0030679615));
- n2 = n;
- }
- }
- public static Point tileToMinimap(Positionable position) {
- if (position == null) {
- return null;
- }
- RSTile a2;
- final RSPlayer rsPlayer;
- if ((rsPlayer = Player.getRSPlayer()) == null) {
- return Projection.NULL_PT;
- }
- a2 = rsPlayer.getAnimablePosition();
- RSTile a3;
- if ((a3 = position.getPosition()) == null) {
- return Projection.NULL_PT;
- }
- a3 = a3.toLocalTile();
- final RSTile rsTile = a3;
- final int a4 = rsTile.getX() * 4 + 2 - a2.getX() / 32;
- final int a5 = rsTile.getY() * 4 + 2 - a2.getY() / 32;
- final int a6 = Game.getMinimapRotation() & 0x7FF;
- final int n = a4;
- final int n2 = n * n;
- final int n3 = a5;
- if (n2 + n3 * n3 > 6000) {
- return Projection.NULL_PT;
- }
- final int a7 = Projection.SINE[a6];
- final int a8 = Projection.COSINE[a6];
- final int a9 = a5 * a7 + a4 * a8 >> 16;
- final int a10 = a5 * a8 - a4 * a7 >> 16;
- final Point a11;
- if ((a11 = GM()) == null) {
- return Projection.NULL_PT;
- }
- final int n4 = a9 + ((a11.x > 0) ? a11.x : 643);
- int y;
- int n5;
- if (a11.y > 0) {
- y = a11.y;
- n5 = a10;
- }
- else {
- y = 83;
- n5 = a10;
- }
- return new Point(n4, y - n5);
- }
- public static boolean isInMinimap(final Point p) {
- final Point a2;
- if ((a2 = GM()) == Projection.NULL_PT) {
- return false;
- }
- if (General.isClientResizable()) {
- Rectangle a3 = null;
- final RSInterface a4;
- if ((a4 = (RSInterface)Interfaces.get(160, 41)) != null) {
- a3 = a4.getAbsoluteBounds();
- }
- return (a3 == null || !a3.contains(p)) && p.distance(a2) < 73.0;
- }
- return org.tribot.api2007.Projection.isInMinimap(p);
- }
- private static Point GM() {
- int n = 0;
- int n2 = 0;
- if (!General.isClientResizable()) {
- RSInterfaceChild rSInterfaceChild = Interfaces.get((int)548, (int)8);
- if (rSInterfaceChild == null) return NULL_PT;
- Rectangle rectangle = rSInterfaceChild.getAbsoluteBounds();
- if (rectangle == null) return NULL_PT;
- Rectangle rectangle2 = rectangle;
- n = rectangle2.x + (rectangle2.width % 2 == 1 ? rectangle.width + 1 : rectangle.width) / 2;
- Rectangle rectangle3 = rectangle;
- n2 = rectangle3.y + (rectangle3.height % 2 == 1 ? rectangle.height + 1 : rectangle.height) / 2;
- return new Point(n, n2);
- } else {
- RSInterfaceChild rSInterfaceChild = Interfaces.get((int)161, (int)25);
- if ((!Interfaces.isInterfaceSubstantiated(rSInterfaceChild)) && (!Interfaces.isInterfaceSubstantiated((rSInterfaceChild = Interfaces.get((int)164, (int)25)))))
- return NULL_PT;
- Rectangle rectangle = rSInterfaceChild.getAbsoluteBounds();
- if (rectangle == null) return NULL_PT;
- Rectangle rectangle4 = rectangle;
- n = rectangle4.x + (rectangle4.width % 2 == 1 ? rectangle.width + 1 : rectangle.width) / 2;
- Rectangle rectangle5 = rectangle;
- n2 = rectangle5.y + (rectangle5.height % 2 == 1 ? rectangle.height + 1 : rectangle.height) / 2;
- }
- return new Point(n, n2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement