Don't like ads? PRO users don't see any ads ;-)
Guest

Need help - ExoMemphiz

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 5.74 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6.  
  7. import org.powerbot.concurrent.Task;
  8. import org.powerbot.concurrent.strategy.Condition;
  9. import org.powerbot.concurrent.strategy.Strategy;
  10. import org.powerbot.game.api.ActiveScript;
  11. import org.powerbot.game.api.Manifest;
  12. import org.powerbot.game.api.methods.Widgets;
  13. import org.powerbot.game.api.methods.interactive.Players;
  14. import org.powerbot.game.api.methods.node.SceneEntities;
  15. import org.powerbot.game.api.methods.tab.Inventory;
  16. import org.powerbot.game.api.methods.tab.Skills;
  17. import org.powerbot.game.api.util.Random;
  18. import org.powerbot.game.api.util.Time;
  19. import org.powerbot.game.api.wrappers.node.SceneObject;
  20. import org.powerbot.game.api.wrappers.widget.Widget;
  21. import org.powerbot.game.bot.event.listener.PaintListener;
  22.  
  23. @Manifest(authors = {"ExoMemphiz"}, name = "ExoArtisan", version = 1.0, description = "Does the Artisan Workshop Minigame!")
  24. public class ExoArtisan extends ActiveScript implements PaintListener {
  25.  
  26. public int ironingotID = 20632;
  27. public int anvilID = 4046;
  28. public int furnaceID = 29395;
  29. public int chuteID = 29396;
  30. public int bootID = 20577;
  31. public int status = 0;
  32. public int i;
  33. public int t;
  34. public int x;
  35. public int y;
  36. public int xchange;
  37. public int a;
  38. public int b;
  39. public int xpgained = 0;
  40. public int startxp = 0;
  41. public int lvlsgained = 0;
  42. public int startlvl = 0;
  43. public int c;
  44. public int e = 0;
  45. public String item = "Boots";
  46.  
  47. @Override
  48.  
  49. protected void setup() {
  50.         changenumbers();
  51.                 startxp = Skills.getExperience(Skills.SMITHING);
  52.                 startlvl = Skills.getExperience(Skills.SMITHING);
  53.                
  54.                
  55.                
  56.                 final withdraw withdraw = new withdraw();
  57.                 final makeboots makeboots = new makeboots();
  58.                 final deposit deposit = new deposit();
  59.                
  60.                 final Strategy Withdraw = new Strategy(withdraw, withdraw);
  61.                 final Strategy Makeboots = new Strategy(makeboots, makeboots);
  62.                 final Strategy Deposit = new Strategy(deposit, deposit);
  63.        
  64.                 provide(Withdraw);
  65.                 provide(Makeboots);
  66.                 provide(Deposit);
  67.                
  68. }
  69.        
  70.  
  71.  
  72. public boolean contains(final int itemID) {
  73.     return Inventory.getItem(itemID) != null;
  74.    }
  75.  
  76.  
  77.  
  78. public class withdraw extends Strategy implements Task, Condition
  79. {
  80.        
  81.         @Override
  82.         public boolean validate() {
  83.                
  84.                 if ((contains(ironingotID)) == false && (contains(bootID)) == false); {
  85.                        
  86.                         return true;
  87.                 }
  88.         }
  89.        
  90.         public void run() {
  91.         if(SceneEntities.getNearest(furnaceID).isOnScreen()){
  92.                 final SceneObject furnace = SceneEntities.getNearest(furnaceID);
  93.                 final  Widget ppp = Widgets.get(1072);
  94.                         furnace.interact("Withdraw-ingots");
  95.                         Time.sleep(Random.nextInt(500, 600));
  96.                         Widgets.get(1072, 21).click(true);
  97.                         Time.sleep(Random.nextInt(1000, 1200));
  98.                         if (ppp != null)
  99.                         {
  100.                         Widgets.get(1072, 119).click(true);
  101.                         Time.sleep(Random.nextInt(350, 600));
  102.         }
  103.         }
  104. }
  105. }
  106.  
  107.  
  108.  
  109. public void changenumbers() {
  110.        
  111.         a = Skills.getExperience(Skills.SMITHING);
  112.         b = Skills.getLevel(Skills.SMITHING);
  113.                 xpgained = a - startxp;
  114.                 lvlsgained = b - startlvl;
  115.         c = Skills.getExperienceToLevel(Skills.SMITHING, +1);
  116.         e = b + 1;
  117. }
  118.  
  119.  
  120.  
  121. public void onRepaint(Graphics g1) {
  122.         Graphics2D g = (Graphics2D)g1;
  123.         g.setColor(new Color(0, 255, 255, 42));
  124.         g.fillRect(544,209,193,254);
  125.         g.drawRect(544,209,193,254);
  126.         g.setColor(new Color(0, 255, 204, 110));
  127.         g.fillRect(9, 343, 485, 113);
  128.         g.setColor(new Color(0, 0, 0));
  129.         g.setStroke(new BasicStroke(1));
  130.         g.drawRect(9, 343, 485, 113);
  131.         g.setColor(new Color(255, 0, 0));
  132.         g.fillRect(122, 351, 338, 18);
  133.         g.setColor(new Color(0, 204, 0));
  134.         g.fillRect(122, 351, xchange, 18);
  135.         g.setColor(new Color(0, 0, 0));
  136.         g.setFont(new Font("Arial", 0, 13));
  137.         g.setFont(new Font("Arial", 1, 13));
  138.         g.drawString("Lvls gained:" + lvlsgained, 552, 245);
  139.         g.drawString("Exp gained:" + xpgained, 552, 300);
  140.         g.drawString("Exp Remaining" + c, 552, 345);
  141.         g.drawString("Current Lvl:" + b, 240, 386);
  142.         g.drawString("Target Lvl:" + e, 240, 406);
  143.     }
  144.  
  145.    
  146.    
  147. public class makeboots extends Strategy implements Task, Condition
  148. {      
  149.  
  150.         @Override
  151.         public boolean validate() {
  152.                
  153.                 if ((contains(ironingotID)==true));{
  154.                         return true;    }
  155.                         }
  156.        
  157.         public void run() {
  158.        
  159.         {
  160.        
  161.         if(SceneEntities.getNearest(anvilID).isOnScreen()){
  162.                 final SceneObject anvil = SceneEntities.getNearest(anvilID);
  163.                         anvil.interact("Smith");
  164.                         Time.sleep(Random.nextInt(500, 600));
  165.                        
  166.                         if (Widgets.get(1073, 11).getText().contains("Helm")) {
  167.                                
  168.                         Widgets.get(905, 14).click(true);
  169.                        
  170.                         item = "Helm";
  171.                        
  172.                         }
  173.                        
  174.                         else if (Widgets.get(1073, 11).getText().contains("Chestplate")) {
  175.                                
  176.                                 Widgets.get(905, 15).click(true);
  177.                                
  178.                                 item = "Chestplate";
  179.                                
  180.                                 }
  181.                        
  182.                         else if (Widgets.get(1073, 11).getText().contains("Boots")) {
  183.                                
  184.                                 Widgets.get(905, 16).click(true);
  185.                                
  186.                                 item = "Boots";
  187.                                
  188.                                 }
  189.                        
  190.                         else if (Widgets.get(1073, 11).getText().contains("Gauntlets")) {
  191.                        
  192.                                 Widgets.get(905, 17).click(true);
  193.                                
  194.                                 item = "Gauntlets";
  195.                                
  196.                         }
  197.                                
  198.                                 while ((Inventory.getCount(bootID) < 28) && (Widgets.get(1073, 11).getText().contains(item))) {
  199.                                         Time.sleep(200, 300); }
  200.                         }
  201.         }
  202.        
  203. }
  204. }
  205.  
  206.  
  207.  
  208. public class deposit extends Strategy implements Task, Condition
  209. {      
  210.        
  211.         @Override
  212.         public boolean validate() {
  213.                
  214.                 if ((Inventory.getCount(bootID))==28 && Players.getLocal().getAnimation()==-1); {}
  215.                         return true;
  216.                 }
  217.        
  218.         public void run() {
  219.        
  220.         if(SceneEntities.getNearest(chuteID).isOnScreen()){
  221.                 final SceneObject chute = SceneEntities.getNearest(chuteID);
  222.                         chute.interact("Deposit-armour");
  223.                         Time.sleep(Random.nextInt(1200, 1500));
  224.         }
  225. }
  226. }
  227. }