Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.52 KB | None | 0 0
  1. public final int RAW_SALMON = 331;
  2.     public final int RAW_TROUT = 335;
  3.     public final int COOKED_TROUT = 333;
  4.     public final int COOKED_SALMON = 329;
  5.     public final int BURNT_FISH = 343;
  6.     public final int FIRE = 26185;
  7.  
  8.  
  9.     public void gatherSalmon(){
  10.         // navigate to fishing spot
  11.  
  12.         // gather fish
  13.  
  14.         // while inv is not full (should only work near the barb fishing area)
  15.         while(!ctx.inventory.isFull()){
  16.             System.out.println("Querying ground items...");
  17.             GroundItem groundItems = null;
  18.             if(!groundItems.valid()){
  19.                 groundItems = ctx.groundItems.select().nearest().poll();
  20.             }
  21.             int queriedGroundItems = groundItems.id();
  22.             switch (queriedGroundItems){
  23.                 case RAW_SALMON:
  24.                     groundItems.interact("Take", "Raw salmon");
  25.                     break;
  26.                 case RAW_TROUT:
  27.                     groundItems.interact("Take", "Raw trout");
  28.                     break;
  29.                 case COOKED_SALMON:
  30.                     groundItems.interact("Take", "Salmon");
  31.                     break;
  32.                 case COOKED_TROUT:
  33.                     groundItems.interact("Take", "Trout");
  34.                     break;
  35.             }
  36.         }
  37.  
  38.         // check for any raw food in the inv
  39.         while(ctx.inventory.select().id(RAW_TROUT, RAW_SALMON, BURNT_FISH).poll().valid()){
  40.             System.out.println("Player inv contains raw salmon | raw trout...");
  41.             Condition.sleep(3500);
  42.             // player not animating
  43.             if(ctx.players.local().animation() == -1 && ctx.players.local().inMotion()) {
  44.                 // using the food and clicking the fire
  45.                 System.out.println("Player not animating ... attempting to cooking food..");
  46.                 ctx.inventory.select().id(RAW_TROUT, RAW_SALMON).poll().interact("Use");
  47.                 ctx.objects.select().id(FIRE).nearest().poll().interact("Use", "Fire");
  48.                 ctx.widgets.component(270,14).click();
  49.             } else {
  50.                 System.out.println("Player is animating and cooking");
  51.             }
  52.             // dropping burnt fish if any
  53.             if(ctx.players.local().animation() == -1 && ctx.inventory.select().id(BURNT_FISH).poll().valid()){
  54.                 System.out.println("Found burnt fish in the inv... dropping burnt fish... ");
  55.                 ctx.inventory.select().id(BURNT_FISH).poll().interact("Drop", "Burnt fish");
  56.             }
  57.         }
  58.  
  59.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement