Advertisement
Guest User

F2P Progressive Lobsters 0.3

a guest
May 16th, 2018
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 10.84 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics2D;
  4. import java.awt.image.BufferedImage;
  5. import org.osbot.rs07.api.map.Area;
  6. import org.osbot.rs07.api.model.NPC;
  7. import org.osbot.rs07.api.model.RS2Object;
  8. import org.osbot.rs07.api.ui.Skill;
  9. import org.osbot.rs07.script.Script;
  10. import org.osbot.rs07.script.ScriptManifest;
  11. import org.osbot.rs07.utility.ConditionalSleep;
  12.  
  13. @ScriptManifest(author = "Castro_", info = "", logo = "https://i.imgur.com/hJ93X3w.png", name = ">C<Progressive Lobsters", version = 0.2)
  14. public class Main extends Script {
  15.  
  16.     public boolean gui_COMPLETE = false;
  17.  
  18.     public String status = "";
  19.  
  20.     Area LUMBRIDGE_SHRIMP_AREA = new Area(3232, 3142, 3247, 3156);
  21.  
  22.     Area LUMBRIDGE_POWERFISH_AREA = new Area(3238, 3238, 3244, 3255);
  23.  
  24.     Area PORT_SARIM_DEPOSIT_AREA = new Area(3041, 3232, 3047, 3237);
  25.     Area PORT_SARIM_CHARTER_AREA = new Area(3023, 3213, 3029, 3223);
  26.     Area KARAMJA_BOAT_INSIDE_AREA = new Area(2955, 3142, 2957, 3144).setPlane(1);
  27.     Area PORT_SARIM_BOAT_INSIDE_AREA = new Area(3031, 3215, 3033, 3219).setPlane(1);
  28.     Area KARAMJA_CHARTER_AREA = new Area(2949, 3146, 2957, 3150);
  29.     Area LOBSTER_AREA = new Area(2918, 3173, 2929, 3180);
  30.  
  31.     // paint:
  32.     private long startTime;
  33.  
  34.     BufferedImage paintBackground;
  35.  
  36.     public final String formatTime(final long ms) {
  37.         long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24;
  38.         s %= 60;
  39.         m %= 60;
  40.         h %= 24;
  41.  
  42.         return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s)
  43.                 : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s);
  44.     }
  45.  
  46.     public final String formatValue(final long l) {
  47.         return (l > 1_000_000) ? String.format("%.2fm", ((double) l / 1_000_000))
  48.                 : (l > 1000) ? String.format("%.1fk", ((double) l / 1000)) : l + "";
  49.     }
  50.  
  51.     public void onStart() {
  52.  
  53.         startTime = System.currentTimeMillis();
  54.         getExperienceTracker().start(Skill.FISHING);
  55.  
  56.     }
  57.  
  58.     @Override
  59.     public int onLoop() throws InterruptedException {
  60.  
  61.                 if (skills.getStatic(Skill.FISHING) < 20) {
  62.  
  63.                     if (LUMBRIDGE_SHRIMP_AREA.contains(myPlayer().getPosition())) {
  64.  
  65.                         FISH_SHRIMPS();
  66.  
  67.                         if (getInventory().isFull()) {
  68.  
  69.                             DROP_FISH();
  70.  
  71.                         }
  72.  
  73.                     } else {
  74.  
  75.                         if (!LUMBRIDGE_SHRIMP_AREA.contains(myPlayer().getPosition())) {
  76.  
  77.                             WALKING_TO_SHRIMPS();
  78.                         }
  79.                     }
  80.  
  81.                 } else {
  82.  
  83.                     if (skills.getStatic(Skill.FISHING) >= 20 && skills.getStatic(Skill.FISHING) < 40) {
  84.  
  85.                         if (skills.getStatic(Skill.FISHING) >= 20 && getInventory().contains("Small fishing net")) {
  86.  
  87.                             DROP_OLD_GEAR();
  88.  
  89.                         } else {
  90.  
  91.                             if (LUMBRIDGE_POWERFISH_AREA.contains(myPlayer().getPosition())) {
  92.  
  93.                                 FISH_TROUT();
  94.  
  95.                                 if (getInventory().isFull()) {
  96.  
  97.                                     DROP_FISH();
  98.  
  99.                                 }
  100.  
  101.                             } else {
  102.  
  103.                                 if (!LUMBRIDGE_POWERFISH_AREA.contains(myPlayer().getPosition())) {
  104.  
  105.                                     WALKING_TO_POWERFISH();
  106.  
  107.                                 }
  108.  
  109.                             }
  110.  
  111.                         }
  112.  
  113.                     } else {
  114.  
  115.                         if (skills.getStatic(Skill.FISHING) >= 40) {
  116.  
  117.                             if (skills.getStatic(Skill.FISHING) >= 40 && getInventory().contains("Fly fishing rod")
  118.                                     || getInventory().contains("Feather")) {
  119.  
  120.                                 DROP_OLD_GEAR();
  121.  
  122.                             } else {
  123.  
  124.                                 if (LOBSTER_AREA.contains(myPlayer().getPosition()) && !getInventory().isFull()) {
  125.  
  126.                                     FISH_LOBSTER();
  127.                                    
  128.                                    
  129.                                     if(!getInventory().onlyContains("Raw lobster", "Lobster pot", "Coins")) {
  130.                                        
  131.                                         DROP_MISC();
  132.                                        
  133.                                     }
  134.  
  135.                                 } else {
  136.  
  137.                                     if (getInventory().isFull() && !PORT_SARIM_DEPOSIT_AREA.contains(myPlayer().getPosition())) {
  138.  
  139.                                         WALKING_TO_DEPOSIT_BOX();
  140.  
  141.                                     } else {
  142.  
  143.                                         if (PORT_SARIM_DEPOSIT_AREA.contains(myPlayer().getPosition())
  144.                                                 && getInventory().contains("Raw lobster")) {
  145.  
  146.                                             DEPOSIT_FISH();
  147.  
  148.                                         } else {
  149.  
  150.                                             if (!LOBSTER_AREA.contains(myPlayer().getPosition())
  151.                                                     && getInventory().getAmount("Coins") >= 30
  152.                                                     && !getInventory().contains("Raw lobster")) {
  153.  
  154.                                                 WALKING_TO_LOBSTER_BOAT();
  155.  
  156.                                             } else {
  157.  
  158.                                                 if (!LOBSTER_AREA.contains(myPlayer().getPosition())
  159.                                                         && getInventory().getAmount("Coins") <= 29
  160.                                                         && !getInventory().contains("Raw lobster")) {
  161.  
  162.                                                     status = "Logging out as we do not have enough GP for boat fares...";
  163.                                                     log(status);
  164.                                                     logoutTab.logOut();
  165.  
  166.                                                     status = "Stopping script.";
  167.                                                     log(status);
  168.                                                     stop();
  169.  
  170.                                                 }
  171.  
  172.                                             }
  173.                                         }
  174.                                     }
  175.                                 }
  176.                             }
  177.                         }
  178.                     }
  179.                 }
  180.    
  181.         return 20;
  182.     }
  183.  
  184.     public void WALKING_TO_SHRIMPS() {
  185.  
  186.         status = "Walking to Lumbridge shrimp spot...";
  187.         log(status);
  188.  
  189.         getWalking().webWalk(LUMBRIDGE_SHRIMP_AREA.getRandomPosition());
  190.  
  191.     }
  192.  
  193.     public void WALKING_TO_POWERFISH() {
  194.  
  195.         status = "Walking to Lumbridge Trout and Salmon spot...";
  196.         log(status);
  197.  
  198.         getWalking().webWalk(LUMBRIDGE_POWERFISH_AREA.getRandomPosition());
  199.  
  200.     }
  201.  
  202.     public void WALKING_TO_LOBSTER_BOAT() {
  203.  
  204.         status = "Walking to Lobster spot...";
  205.         log(status);
  206.  
  207.         getWalking().webWalk(LOBSTER_AREA);
  208.  
  209.     }
  210.  
  211.     public void WALKING_TO_DEPOSIT_BOX() {
  212.  
  213.         status = "Walking to Deposit box...";
  214.         log(status);
  215.  
  216.         getWalking().webWalk(PORT_SARIM_DEPOSIT_AREA);
  217.  
  218.     }
  219.  
  220.     public void FISH_SHRIMPS() {
  221.  
  222.         NPC SHRIMP_SPOT = getNpcs().closest("Fishing spot");
  223.  
  224.         if (myPlayer().getAnimation() == -1 && !myPlayer().isMoving() && !getInventory().isFull()) {
  225.  
  226.             if (SHRIMP_SPOT != null) {
  227.  
  228.                 SHRIMP_SPOT.interact("Net");
  229.  
  230.             }
  231.  
  232.             try {
  233.                 sleep(random(1250, 1750));
  234.             } catch (InterruptedException e) {
  235.                 e.printStackTrace();
  236.             }
  237.  
  238.             status = "Fishing: Shrimps";
  239.             log(status);
  240.  
  241.             new ConditionalSleep(random(5000, 10000)) {
  242.                 @Override
  243.                 public boolean condition() {
  244.                     return myPlayer().getAnimation() == -1;
  245.                 }
  246.             }.sleep();
  247.  
  248.         } else {
  249.  
  250.             if (myPlayer().getAnimation() != -1) {
  251.  
  252.                 try {
  253.                     sleep(random(500, 5000));
  254.                 } catch (InterruptedException e) {
  255.                     e.printStackTrace();
  256.                 }
  257.  
  258.             }
  259.         }
  260.  
  261.     }
  262.  
  263.     public void FISH_TROUT() {
  264.  
  265.         NPC TROUT_SALMON_SPOT = getNpcs().closest("Rod Fishing spot");
  266.  
  267.         if (myPlayer().getAnimation() == -1 && !myPlayer().isMoving() && !getInventory().isFull()) {
  268.  
  269.             if (TROUT_SALMON_SPOT != null) {
  270.  
  271.                 TROUT_SALMON_SPOT.interact("Lure");
  272.  
  273.             }
  274.  
  275.             try {
  276.                 sleep(random(1250, 1750));
  277.             } catch (InterruptedException e) {
  278.                 e.printStackTrace();
  279.             }
  280.  
  281.             status = "Fishing: Trout and Salmon";
  282.             log(status);
  283.  
  284.             new ConditionalSleep(random(5000, 10000)) {
  285.                 @Override
  286.                 public boolean condition() {
  287.                     return myPlayer().getAnimation() == -1;
  288.                 }
  289.             }.sleep();
  290.  
  291.         } else {
  292.  
  293.             if (myPlayer().getAnimation() != -1) {
  294.  
  295.                 try {
  296.                     sleep(random(500, 5000));
  297.                 } catch (InterruptedException e) {
  298.                     e.printStackTrace();
  299.                 }
  300.  
  301.             }
  302.         }
  303.  
  304.     }
  305.  
  306.     public void FISH_LOBSTER() {
  307.  
  308.         NPC LOBSTER_SPOT = getNpcs().closest(1522);
  309.  
  310.         if (myPlayer().getAnimation() == -1 && !myPlayer().isMoving() && !getInventory().isFull()) {
  311.  
  312.             LOBSTER_SPOT.interact("Cage");
  313.  
  314.             try {
  315.                 sleep(random(1250, 1750));
  316.             } catch (InterruptedException e) {
  317.                 e.printStackTrace();
  318.             }
  319.  
  320.             status = "Fishing: Lobsters";
  321.             log(status);
  322.  
  323.             new ConditionalSleep(random(5000, 10000)) {
  324.                 @Override
  325.                 public boolean condition() {
  326.                     return myPlayer().getAnimation() == -1;
  327.                 }
  328.             }.sleep();
  329.  
  330.         } else {
  331.  
  332.             if (myPlayer().getAnimation() != -1) {
  333.  
  334.                 try {
  335.                     sleep(random(500, 5000));
  336.                 } catch (InterruptedException e) {
  337.                     e.printStackTrace();
  338.                 }
  339.  
  340.             }
  341.         }
  342.  
  343.     }
  344.  
  345.     public void DROP_FISH() {
  346.  
  347.         try {
  348.             sleep(random(250, 3000));
  349.         } catch (InterruptedException e1) {
  350.             e1.printStackTrace();
  351.         }
  352.  
  353.         status = "Dropping Fish";
  354.         log(status);
  355.  
  356.         getInventory().dropAll("Raw shrimps", "Raw anchovies", "Raw trout", "Raw salmon");
  357.  
  358.         try {
  359.             sleep(random(500, 1500));
  360.         } catch (InterruptedException e) {
  361.             e.printStackTrace();
  362.         }
  363.  
  364.     }
  365.    
  366. public void DROP_MISC() {
  367.        
  368.  
  369.         try {
  370.             sleep(random(250, 3000));
  371.         } catch (InterruptedException e1) {
  372.             e1.printStackTrace();
  373.         }
  374.  
  375.         status = "Dropping un-wanted items";
  376.         log(status);
  377.  
  378.         getInventory().dropAllExcept("Raw lobster", "Coins", "Lobster pot");
  379.  
  380.         try {
  381.             sleep(random(500, 1500));
  382.         } catch (InterruptedException e) {
  383.             e.printStackTrace();
  384.         }
  385.  
  386.        
  387.     }
  388.  
  389.     public void DEPOSIT_FISH() {
  390.  
  391.         RS2Object bank_box = getObjects().closest("Bank deposit box");
  392.  
  393.         if (bank_box != null) {
  394.  
  395.             bank_box.interact("Deposit");
  396.  
  397.             new ConditionalSleep(random(5000, 7000)) {
  398.                 @Override
  399.                 public boolean condition() {
  400.                     return depositBox.isOpen();
  401.                 }
  402.  
  403.             }.sleep();
  404.  
  405.             if (depositBox.isOpen()) {
  406.  
  407.                 depositBox.depositAll("Raw lobster");
  408.  
  409.                 new ConditionalSleep(random(5000, 7000)) {
  410.                     @Override
  411.                     public boolean condition() {
  412.                         return !getInventory().contains("Raw lobster");
  413.                     }
  414.  
  415.                 }.sleep();
  416.  
  417.             }
  418.  
  419.         }
  420.  
  421.     }
  422.  
  423.     public void DROP_OLD_GEAR() {
  424.  
  425.         if (skills.getStatic(Skill.FISHING) >= 20 && getInventory().contains("Small fishing net")) {
  426.  
  427.             status = "Dropping un-needed Small fishing net now we are 20 fishing...";
  428.             log(status);
  429.  
  430.             getInventory().drop("Small fishing net");
  431.  
  432.             if (getInventory().contains("Raw shrimps") || getInventory().contains("Raw anchovies")) {
  433.  
  434.                 status = "Dropping any Raw shrimps and Raw anchovies we have in inventory...";
  435.                 log(status);
  436.  
  437.                 getInventory().dropAll("Raw shrimps", "Raw anchovies");
  438.  
  439.                 try {
  440.                     sleep(random(500, 2000));
  441.                 } catch (InterruptedException e) {
  442.                     e.printStackTrace();
  443.                 }
  444.             }
  445.  
  446.         } else {
  447.  
  448.             if (skills.getStatic(Skill.FISHING) >= 40 && getInventory().contains("Fly fishing rod")
  449.                     || getInventory().contains("Feather")) {
  450.  
  451.                 status = "Dropping un-needed Fly fishing rod and Feathers now we are 40 fishing...";
  452.                 log(status);
  453.  
  454.                 getInventory().drop("Fly fishing rod");
  455.                 getInventory().drop("Feather");
  456.  
  457.                 if (getInventory().contains("Raw trout") || getInventory().contains("Raw salmon")) {
  458.  
  459.                     status = "Dropping any Raw trout and Raw salmon we have in inventory...";
  460.                     log(status);
  461.  
  462.                     getInventory().dropAll("Raw trout", "Raw salmon");
  463.  
  464.                     try {
  465.                         sleep(random(500, 2000));
  466.                     } catch (InterruptedException e) {
  467.                         e.printStackTrace();
  468.                     }
  469.                 }
  470.             }
  471.         }
  472.  
  473.     }
  474.  
  475.     @Override
  476.     public void onPaint(final Graphics2D g) {
  477.  
  478.         final long runTime = System.currentTimeMillis() - startTime;
  479.  
  480.         g.setColor(Color.WHITE);
  481.         Font font = new Font("Verdana", Font.BOLD, 16);
  482.         g.setFont(font);
  483.         g.drawString(">C<Progressive Lobsters", 29, 292);
  484.         Font font2 = new Font("Verdana", Font.BOLD, 10);
  485.         g.setFont(font2);
  486.         g.drawString("Runtime: " + formatTime(runTime), 29, 312);
  487.         g.drawString("Fishing XP gained: "+ formatValue(getExperienceTracker().getGainedXP(Skill.FISHING)), 29, 332);
  488.  
  489.     }
  490.  
  491. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement