Advertisement
Codydude56

Al-Kharid Net Fisher

Jan 27th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.59 KB | None | 0 0
  1. import bot.script.BotScript;
  2. import bot.script.Manifest;
  3. import bot.script.methods.Skills;
  4.  
  5. import bot.script.enums.Skill;
  6.  
  7. import bot.script.enums.Tab;
  8. import bot.script.methods.Bank;
  9. import bot.script.methods.Game;
  10. import bot.script.methods.Inventory;
  11. import bot.script.methods.Players;
  12. import bot.script.methods.Walking;
  13. import bot.script.wrappers.NPC;
  14. import bot.script.wrappers.Tile;
  15. import bot.script.methods.Npcs;
  16.  
  17. import java.awt.*;
  18.  
  19. @Manifest(author = "Coordinates", name = "Al-Kharid Net Fishing", description = "Net fishes in Al-Kharid", version = 1.00)
  20. public class AlkharidNet extends BotScript {
  21.  
  22.     //XP and Levels
  23.     int xpStart = 0;
  24.     int lvlStart;
  25.     int xpGained;
  26.     int lvlCurrent;
  27.     int fish = 0;
  28.     //Stall and Tea
  29.     int SHRIMP = 318;
  30.     int ANCH = 322;
  31.     int NET_SPOT = 316;
  32.     //Tiles
  33.     Tile BANK_BOOTH = new Tile(3269, 3164);
  34.     Tile FISHING_SPOT = new Tile(3267, 3149);
  35.     //Etc.
  36.     long runtime;
  37.     long startTime = 0;
  38.  
  39.     @Override
  40.     public boolean onStart() {
  41.         xpStart = Skills.getXp(Skill.FISHING);
  42.         lvlStart = Skills.getLevel(Skill.FISHING);
  43.         startTime = System.currentTimeMillis();
  44.         if (!Inventory.contains(304)) {
  45.             log("You must start with a fishing net in your inventory!");
  46.             return false;
  47.         }
  48.         return true;
  49.     }
  50.     @Override
  51.     public int loop() {
  52.         if (Game.getEnergy() >= 45 && !Walking.isRunOn()) {
  53.             if (Game.getTab() == Tab.CONTROLS) {
  54.                 Walking.setRun(true);
  55.             } else {
  56.                 Game.openTab(Tab.CONTROLS);
  57.             }
  58.         }
  59.         if (Inventory.isFull()) {
  60.             if (BANK_BOOTH.distance() < 3) {
  61.                 bank();
  62.             } else {
  63.                 if (!Players.getLocal().isMoving()) {
  64.                     Walking.walkTo(Walking.getClosestTileOnMap(BANK_BOOTH));
  65.                     sleep(750);
  66.                 }
  67.                 if (Players.getLocal().isMoving() && Walking.readyForNextFlag(BANK_BOOTH)) {
  68.                     Walking.walkTo(Walking.getClosestTileOnMap(BANK_BOOTH));
  69.                     sleep(750);
  70.                 }
  71.             }
  72.         }
  73.         if (!Inventory.isFull()) {
  74.             if (Players.getLocal().getAnimation() == 621) {
  75.                 return 1;
  76.             }
  77.             if (FISHING_SPOT.distance() < 3) {
  78.                 fish();
  79.             } else {
  80.                 if (!Players.getLocal().isMoving()) {
  81.                     Walking.walkTo(Walking.getClosestTileOnMap(FISHING_SPOT));
  82.                     sleep(750);
  83.                 }
  84.                 if (Players.getLocal().isMoving() && Walking.readyForNextFlag(FISHING_SPOT)) {
  85.                     Walking.walkTo(Walking.getClosestTileOnMap(FISHING_SPOT));
  86.                     sleep(750);
  87.                 }
  88.             }
  89.         }
  90.         if (BANK_BOOTH.distance() < 3 && Inventory.contains(SHRIMP) || BANK_BOOTH.distance() < 3 && Inventory.contains(ANCH)) {
  91.             if (!Bank.isOpen()) {
  92.                 Bank.open();
  93.                 sleep(2000);
  94.             } else {
  95.                 Bank.deposit(SHRIMP, Inventory.getCount(SHRIMP, false));
  96.                 Bank.deposit(ANCH, Inventory.getCount(ANCH, false));
  97.             }
  98.         }
  99.         return 1;
  100.     }
  101.  
  102.     @Override
  103.     public void onFinish() {
  104.     }
  105.  
  106.     private final Color color1 = new Color(0, 0, 255, 151);
  107.     private final Color color2 = new Color(0, 0, 0);
  108.     private final Color color3 = new Color(1, 1, 1);
  109.     private final BasicStroke stroke1 = new BasicStroke(1);
  110.     private final Font font1 = new Font("Arial", 0, 13);
  111.    
  112.     @Override
  113.     public void paint(Graphics g1) {
  114.         runtime = System.currentTimeMillis() - startTime;
  115.         xpGained = (Skills.getXp(Skill.FISHING) - xpStart);
  116.         lvlCurrent = (Skills.getLevel(Skill.FISHING));
  117.         int lvlGain = (lvlCurrent - lvlStart);
  118.         int xpHour = (int) ((double) xpGained / runtime * 3600000);
  119.         int catchesHour = (int) ((double) fish / runtime * 3600000);
  120.        
  121.         Graphics2D g = (Graphics2D)g1;
  122.         g.setColor(color1);
  123.         g.fillRect(237, 258, 271, 69);
  124.         g.setColor(color2);
  125.         g.setStroke(stroke1);
  126.         g.drawRect(237, 258, 271, 69);
  127.         g.setFont(font1);
  128.         g.setColor(color3);
  129.         g.drawString("Al-Kharid Net by Coordinates", 241, 271);
  130.         g.setColor(color2);
  131.         g.drawLine(237, 273, 508, 273);
  132.         g.setColor(color3);
  133.         g.drawString("Catches: " + fish, 241, 291);
  134.         g.drawString("XP Gained: " + xpGained, 241, 308);
  135.         g.drawString("Current Level: " + lvlCurrent + "(+" + lvlGain + ")", 241, 323);
  136.         g.drawString("XP/Hour: " + xpHour, 374, 308);
  137.         g.drawString("Catches/HR: " + catchesHour, 374, 291);
  138.         g.drawString("Run time:" + timeToString((int) runtime), 374, 323);
  139.         g.drawString("Version 1.00", 435, 271);
  140.     }
  141.  
  142.     public void bank() {
  143.         if (!Bank.isOpen()) {
  144.             Bank.open();
  145.             sleep(2000);
  146.         } else {
  147.             fish += Inventory.getCount(SHRIMP, false);
  148.             fish += Inventory.getCount(ANCH, false);
  149.             Bank.deposit(SHRIMP, Inventory.getCount(SHRIMP, false));
  150.             Bank.deposit(ANCH, Inventory.getCount(ANCH, false));
  151.         }
  152.     }
  153.  
  154.     public void fish() {
  155.         NPC FISH_SPOT = Npcs.getNearest(NET_SPOT);
  156.         if (FISH_SPOT == null) {
  157.             return;
  158.         }
  159.         if (Players.getLocal().getAnimation() == -1) {
  160.             FISH_SPOT.interact("Net");
  161.             sleep(2000);
  162.         } else {
  163.             sleep(500);
  164.         }
  165.     }
  166. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement