Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

isVisible

Featured Replies

I thought some people might make use of this for either custom interaction or checking if entity is visible. Don't mind the ghetto fire entity check. 

import org.osbot.rs07.api.Client;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Model;
import org.osbot.rs07.api.util.GraphicUtilities;

import java.awt.*;

public class Calculations {
    public static Polygon getModelPolygon(Entity entity, Client client, Model model, int gridX, int gridY) {
        if (model == null) {
            return new Polygon();
        }
        if (entity.getName().equalsIgnoreCase("Fire")) {
            return entity.getPosition().getPolygon(client.getBot());
        } else {
            short[][] screenCoordinates = GraphicUtilities.getScreenCoordinates(client.getBot(), gridX, gridY, client.accessor.getPlane(), model);
            Polygon temp = new Polygon();
            for (int triangleId = 0; triangleId < model.getTriangleCount(); triangleId++)
                try {
                    int triangleA = model.getVertexXIndices()[triangleId];
                    int triangleB = model.getVertexYIndices()[triangleId];
                    int triangleC = model.getVertexZIndices()[triangleId];
                    short[] pointA = screenCoordinates[triangleA];
                    short[] pointB = screenCoordinates[triangleB];
                    short[] pointC = screenCoordinates[triangleC];
                    Polygon aw = entity.getPosition().getPolygon(client.getBot());
                    if (pointA != null && pointB != null && pointC != null) {
                        if (pointA[0] <= -1 || pointA[1] <= -1 || pointB[0] <= -1 || pointB[1] <= -1 || pointC[0] <= -1 || pointC[1] <= -1)
                            continue;
                        for (int xpoints : aw.xpoints) {
                            for (int ypoints : aw.ypoints) {
                                if (pointA[1] <= ypoints && pointA[0] <= xpoints) {
                                    temp.addPoint(pointA[0], pointA[1]);
                                }
                                if (pointB[1] <= ypoints && pointB[0] <= xpoints) {
                                    temp.addPoint(pointB[0], pointB[1]);
                                }
                                if (pointC[1] <= ypoints && pointC[0] <= xpoints) {
                                    temp.addPoint(pointC[0], pointC[1]);
                                }
                            }
                        }
                    }
                } catch (ArrayIndexOutOfBoundsException var13) {
                }
            return temp;
        }
    }
}

    public boolean isVisible(Script s, Entity entity) {
        Polygon polygon = Calculations.getModelPolygon(entity, s.client, entity.getModel(), entity.getGridX(), entity.getGridY());
        if (polygon != null) {
            Rectangle rectangle = new Rectangle(4, 4, 512, 334);
            return rectangle.intersects(polygon.getBounds());
        }
        return false;
    }

    public Rectangle visibleRectangle(Polygon polygon) {
        if (polygon != null) {
            Rectangle rectangle = new Rectangle(4, 4, 512, 334);
            return rectangle.intersection(polygon.getBounds());
        }
        return null;
    }

You could do without the null checks as well.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.