paradoxed

Untitled

Mar 2nd, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. public class Methods extends Main{
  2. private static Main ctx;
  3. public static boolean canDropOre() {
  4. return powermine && ctx.getInventory().contains(miningOre);
  5. }
  6. public static boolean canDropGems() {
  7. return dropgems && ctx.getInventory().contains(GEMS);
  8. }
  9. public static boolean atBank() {
  10. NPC banker = ctx.getNpcs().closest("Banker");
  11. return banker.isOnScreen() && banker.exists();
  12. }
  13. public static boolean isBusy() {
  14. return ctx.getPlayers().localPlayer().isMoving() || ctx.getPlayers().localPlayer().getAnimation() != -1;
  15. }
  16. public static boolean atMine() {
  17. for (int i = 0; i < oreObjectIds.length; i++) {
  18. GameObject rocks = ctx.getGameObjects().closest("Rocks");
  19. if (rocks.getID() == oreObjectIds[i]) {
  20. if (rocks.isOnScreen()) {
  21. return true;
  22. }
  23. }
  24. }
  25. return false;
  26. }
  27. public static int getHourly(final int amount, final long elapsed) {
  28. return (int) (amount * 3600000.0D / elapsed);
  29. }
  30. public static String formatNumber(int i) {
  31. return NumberFormat.getIntegerInstance().format(i);
  32. }
  33. public static String Status = "Loading...";
  34. public static String Version = "0.0.1";
  35. public static double miningExpStart, miningStartLevel, miningTnl, miningCurrLevel, miningExpGained, miningCurrExp;
  36. public static String miningMethod;
  37. public static String miningOre;
  38. public static double minerProgBar;
  39. public static final String[] GEMS = {"Uncut sapphire", "Uncut emerald", "Uncut ruby", "Uncut diamond"};
  40. public static int[] oreObjectIds;
  41. public static boolean powermine;
  42. public static boolean dropgems;
  43. public static boolean minebank;
  44. public static String bot;
  45.  
  46. public int getPrice(String name) throws IOException {
  47. if (name.contains("arrow"))
  48. name = name + "s";
  49. if (name.equals("Herb"))
  50. name = "Unidentified herb";
  51. if (name.length() <= 3)
  52. return 0;
  53.  
  54. URL url = new URL(
  55. "http://forums.zybez.net/runescape-2007-prices/api/item/"
  56. + name.replace("+", "%2B").replace(' ', '+')
  57. .replace("'", "%27"));
  58. URLConnection con = url.openConnection();
  59. con.addRequestProperty("User-Agent", "Mozilla/5.0");
  60. BufferedReader in = new BufferedReader(new InputStreamReader(
  61. con.getInputStream()));
  62. String line = "";
  63. String inputLine;
  64.  
  65. while ((inputLine = in.readLine()) != null)
  66. line += inputLine;
  67.  
  68. in.close();
  69. if (!line.contains("average\":"))
  70. return 0;
  71.  
  72. System.out.println(line);
  73. line = line.substring(line.indexOf("average\":")
  74. + "average\":".length());
  75. line = line.substring(0, line.indexOf(","));
  76. return (int) Math.round(Double.parseDouble(line));
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment