Jump to content

Shaft

Members
  • Posts

    12
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Shaft's Achievements

Newbie

Newbie (1/10)

14

Reputation

  1. Here are two snippets of code that allow you to get the drop table of any npc on the osrs wiki(as far as i know that's all the npcs) for this to work you need to add jsoup code to your project (you can find it here: https://github.com/jhy/jsoup). The only real use for this is the gui of fighter scripts. The item name and icon will always have the same index in the arrays used. Example usage: package Test; import Utils.WikiParser; import Utils.DropTable; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; public class test { public static void main(String[] args){ DropTable testTable = WikiParser.getMonsterDroptable("Chicken"); //if you look at chicken on wiki you will see the first item is bones System.out.println(testTable.getItemNames()[0]); // therefore bones have the index 0 ImageIO.write(imageToBufferedImage(testTable.getItemImages[0]), "png" , new File("Bones.png")); /will save Bones.png } private static BufferedImage imageToBufferedImage(Image im) { BufferedImage bi = new BufferedImage (im.getWidth(null),im.getHeight(null),BufferedImage.TYPE_INT_ARGB); Graphics bg = bi.getGraphics(); bg.drawImage(im, 0, 0, null); bg.dispose(); return bi; } } Source: WikiParser.java package Utils; import java.awt.Image; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import Utils.JSoup.Jsoup; import Utils.JSoup.nodes.Document; import Utils.JSoup.select.Elements; public class WikiParser { public static DropTable getMonsterDroptable(String monsterName){ try { Document doc = Jsoup.connect("http://oldschoolrunescape.wikia.com/wiki/" + monsterName.replaceAll(" ", "_")).get(); Elements tables = doc.getElementsByClass("wikitable sortable dropstable"); System.out.println("tables: " + tables.size()); Elements rows = tables.select("tr"); System.out.println("rows: " + rows.size()); Image[] images = new Image[rows.size() - tables.size()]; String[] names = new String[rows.size() - tables.size()]; int skipped = 0; for(int i = 1; i < rows.size(); i++){ Elements collumns = rows.get(i).select("td"); if(collumns.size() == 5){ images[i - (1 + skipped)] = getImage(collumns.get(0).getElementsByTag("img").get(0).attr("data-src")); names[i - (1 + skipped)] = collumns.get(1).text(); }else{ skipped++; } } return new DropTable(names, images); } catch (IOException e) { e.printStackTrace(); } return null; } private static Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch (IOException e) { return null; } } } DropTable.java package Utils; import java.awt.Image; public class DropTable { String[] itemNames; Image[] itemImages; public DropTable(String[] itemNames, Image[] itemImages){ this.itemNames = itemNames; this.itemImages = itemImages; } public Image[] getItemImages(){ return itemImages; } public String[] getitemNames(){ return itemNames; } public void addItem(String itemName, Image itemImage){ String[] tempStrings = new String[itemNames.length + 1]; Image[] tempImages = new Image[itemImages.length + 1]; for(int i = 0; i < itemNames.length; i++){ tempStrings[i] = itemNames[i]; tempImages[i] = itemImages[i]; } tempStrings[itemNames.length] = itemName; tempImages[itemImages.length] = itemImage; itemNames = tempStrings; itemImages = tempImages; } }
  2. 3 classes u can use to add a trail and a crusor Classes: Usage: global vars: private MouseTrail trail = new MouseTrail(0, 255, 255, 2000, this); private MouseCursor cursor = new MouseCursor(52, 4, Color.white, this); onPaint: public void onPaint(Graphics2D g){ trail.paint(g); cursor.paint(g); } Credit: swizzbeat -> cursor DarkMagican -> trail Original posts:
  3. Zammy wines I found this script i wrote quite some time ago and decided to add paint an release it here. Keep in mind the price checker isn't always right because it uses the osrs's api not osbuddy's api. I've thrown in the source even tho it's not the cleanest code ever and shouldn't be used as an example for your scripts. What does it do: -Grabs wines of zamorak -Banks How to use: -Start anywhere with law, water and air runes or staves. Source: Download: https://mega.nz/#!JpwVBCZR!KOHqeJ3pkVHSmKZe-kEg4U2YaPidSyqobQJqNvgcXHw
  4. Shaft

    C# Hw

    Considering you're a scripter you and u stating the equation in the question you really should have known how to do it... Also your welcome.
  5. Shaft

    C# Hw

    int numberIn = Convert.ToInt32(Console.ReadLine()); int result = 1; for(int i = numberIn; i > 0; i--;){ result = result * i; } Console.WriteLine(numberIn + "!=" + result); That should work i think.
  6. Shaft

    TinderBoxes

    Fck forgot to change the title, rip
  7. Shaft

    TinderBoxes

    TinderBoxes I've decided to port this script to osbot and publish it, since the method has crashed because of a video made by thirdagefilms. Keep in mind the price checker isn't always right because it uses the osrs's api not osbuddy's api. The numbers in the upper left corner are debug numbers. What does it do: -Searches the bookshelf in Wise old man's house for tinderboxes -Banks How to use: -talk to the wise old man before running. Screen shot: Source: Download: https://mega.nz/#!Bph1kTwD!qzJrtVYj45TDHUwri84YxGCuRwgPMQHB7P8khrb60LM
  8. Shaft

    PotatoPicker

    I had 1 in my inv before Thanks
  9. Shaft

    PotatoPicker

    Thanks, of course it has barrows boss support...
  10. PotatoPicker What does it do: -Picks potatoes in draynor -Banks Screen shot: Source: Download: https://mega.nz/#!E5hGUTgR!zuMbibdUnECd7bncfE-6tWpsrlqxn7E6awJ0KVKbuDE
×
×
  • Create New...