Advertisement
Guest User

Untitled

a guest
Aug 18th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.98 KB | None | 0 0
  1. package MuTanner;
  2.  
  3. import MuTanner.data.Hide;
  4. import org.rspeer.runetek.adapter.component.InterfaceComponent;
  5. import org.rspeer.runetek.adapter.scene.Player;
  6. import org.rspeer.runetek.api.commons.math.Random;
  7. import org.rspeer.runetek.api.component.Bank;
  8. import org.rspeer.runetek.api.component.Interfaces;
  9. import org.rspeer.runetek.api.component.tab.Inventory;
  10. import org.rspeer.runetek.api.movement.Movement;
  11. import org.rspeer.runetek.api.movement.position.Area;
  12. import org.rspeer.runetek.api.movement.position.Position;
  13. import org.rspeer.runetek.api.scene.Npcs;
  14. import org.rspeer.runetek.api.scene.Players;
  15. import org.rspeer.script.Script;
  16. import org.rspeer.script.ScriptCategory;
  17. import org.rspeer.script.ScriptMeta;
  18. import org.rspeer.ui.Log;
  19.  
  20. @ScriptMeta(name = "MuTanner", version = 0.1, desc = "Tans hide in Al Kharid", developer = "Muesli", category = ScriptCategory.CRAFTING)
  21.  
  22. public class MuTanner extends Script {
  23.     private static final String HIDE = "Blue dragonhide";
  24.     private static final String COINS = "Coins";
  25.     private static final Area BANK_AREA = Area.rectangular(new Position(3269, 3163), new Position(3271, 3170));
  26.     private static final Area TAN_AREA = Area.rectangular(new Position(3270, 3193), new Position(3277, 3189));
  27.  
  28.     public static Hide hide = Hide.GREEN;
  29.  
  30.     @Override
  31.     public void onStart(){
  32.         Log.info("***MuTanner starting***");
  33.         Log.info("We'll be tanning: " + hide.getName());
  34.     }
  35.  
  36.     @Override
  37.     public int loop(){
  38.         Player local = Players.getLocal();
  39.         int runEnergy = Movement.getRunEnergy();
  40.         if (!Inventory.contains(hide.getName()) || !Inventory.contains(COINS)){
  41.             if (!Bank.isOpen()){
  42.                 if(local.distance(BANK_AREA.getCenter()) > Random.nextInt(5)){
  43.                     if (!local.isMoving() && !local.isAnimating()) {
  44.                         Log.info("Walking to bank");
  45.                         Movement.walkToRandomized(BANK_AREA.getCenter());
  46.                         if (!Movement.isRunEnabled() && (runEnergy > Random.nextInt(25, 50))){
  47.                             Movement.toggleRun(true);
  48.                         }
  49.                     }
  50.                 } else {
  51.                     Log.info("Opening bank");
  52.                     Bank.open();
  53.                 }
  54.             } else {
  55.                 Bank.depositAllExcept(COINS);
  56.                 if (!Inventory.contains(COINS)) {
  57.                     if (Bank.contains(COINS)) {
  58.                         Bank.withdrawAll(COINS);
  59.                     } else {
  60.                         return -1;
  61.                     }
  62.                 }
  63.                 if (Bank.contains(hide.getName())) {
  64.                     Bank.withdrawAll(hide.getName());
  65.                 } else {
  66.                     onStop();
  67.                 }
  68.             }
  69.         } else if (!Interfaces.isOpen(324)){
  70.             if(local.distance(TAN_AREA.getCenter()) > 15){
  71.                 if (!local.isMoving() && !local.isAnimating() || Movement.getDestinationDistance() < Random.nextInt(7)) {
  72.                     Log.info("Walking to tan area");
  73.                     Movement.walkToRandomized(TAN_AREA.getCenter());
  74.                 }
  75.             } else {
  76.                 Log.info("Trading Ellis");
  77.                 Npcs.getNearest("Ellis").interact("Trade");
  78.             }
  79.         } else {
  80.             Log.info("Tanner interface is open, interacting...");
  81.             InterfaceComponent tanIComponent = Interfaces.getComponent(324, hide.getHideComponent());
  82.             if (tanIComponent != null) {
  83.                 Log.info("tan interface component is not null");
  84.                 tanIComponent.interact("Tan All");
  85.                 String[] craftActions = tanIComponent.getActions();
  86.                 for (String s: craftActions){
  87.                     Log.info(s);
  88.                 }
  89.             }
  90.         }
  91.         return Random.nextInt(500, 1500);
  92.     }
  93.  
  94.     @Override
  95.     public void onStop(){
  96.         Log.info("MuTanner stopping - RIP");
  97.     }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement