paradoxed

Untitled

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