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.

Get and save sprite snippet

Featured Replies

public class FetchSprites {

    private static String path = "";

    public static File getSprite(String item) {
        item = Character.toUpperCase(item.charAt(0)) + item.toLowerCase().substring(1);
        if (!Files.exists(Paths.get(path + item + ".png"))) {
            fetchSprite(item);
        }
        return new File(path + item + ".png");
    }


    private static void fetchSprite(String item) {
        item = Character.toUpperCase(item.charAt(0)) + item.toLowerCase().substring(1);
        String itemNoSpaces = item.replace(" ","_");
        try {
            final URL url = new URL("http://oldschoolrunescape.wikia.com/wiki/" + itemNoSpaces.toLowerCase());
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                if (line.contains("/" + itemNoSpaces + ".png")) {
                    int start = line.indexOf("<a href=") + 9;
                    int name = line.indexOf(itemNoSpaces + ".png",start);
                    int end = name + item.length() + 4;
                    URL imageUrl = new URL(line.substring(start,end));
                    BufferedImage image = ImageIO.read(imageUrl);
                    ImageIO.write(image,"png",new File(path + item + ".png"));
                    break;
                }
            }
            bufferedReader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

This will check if the sprite is already cached, if not, it will cache the sprite and return the file(path).

Improvements are welcome.

 

Edited by The Undefeated

If you'd like to simplify this, I host the item images in 32x32 pngs.

http://basketti.club/441.png

above url is for noted iron ore:

441.png

otherwise great solution :)

  • Author
16 minutes ago, Lemons said:

If you'd like to simplify this, I host the item images in 32x32 pngs.

 


http://basketti.club/441.png

 

above url is for noted iron ore:

441.png

otherwise great solution :)

Oh that looks nice. What about untradeables?

 

2 minutes ago, The Undefeated said:

Oh that looks nice. What about untradeables?

 

Should have all the items, though this is from an older revision (forget which, I got the dump from rune-server) so newer items might be missing.

  • Author
11 hours ago, Lemons said:

Should have all the items, though this is from an older revision (forget which, I got the dump from rune-server) so newer items might be missing.

Hmm, I'll stick to Wiki just to be sure.

Definitely going to use your your images if that’s okay, I’ve been trying to print screen and copy paste into mspaint, and tediously zoom in and try to cut it out lol!

  • Author
48 minutes ago, sonda said:

Definitely going to use your your images if that’s okay, I’ve been trying to print screen and copy paste into mspaint, and tediously zoom in and try to cut it out lol!

Of course you can them, the pictures are loaded from oldschool wiki.

Create an account or sign in to comment

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.