Advertisement
Floplie

seagullBuddy "Floplie"

Jan 12th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. package scripts;
  2.  
  3. import javax.imageio.ImageIO;
  4.  
  5. import org.tribot.api.General;
  6.  
  7. import java.awt.*;
  8.  
  9. import javax.imageio.ImageIO;
  10.  
  11. import java.io.IOException;
  12. import java.net.URL;
  13. import java.text.DecimalFormat;
  14.  
  15. import org.tribot.api.input.Mouse;
  16. import org.tribot.api2007.Banking;
  17. import org.tribot.api2007.Camera;
  18. import org.tribot.api2007.GroundItems;
  19. import org.tribot.api2007.Inventory;
  20. import org.tribot.api2007.NPCs;
  21. import org.tribot.api2007.Objects;
  22. import org.tribot.api2007.PathFinding;
  23. import org.tribot.api2007.Player;
  24. import org.tribot.api2007.Skills;
  25. import org.tribot.api2007.Walking;
  26. import org.tribot.api2007.Skills.SKILLS;
  27. import org.tribot.api2007.types.RSGroundItem;
  28. import org.tribot.api2007.types.RSNPC;
  29. import org.tribot.api2007.types.RSObject;
  30. import org.tribot.api2007.types.RSTile;
  31. import org.tribot.script.Script;
  32. import org.tribot.script.ScriptManifest;
  33. import org.tribot.script.interfaces.Painting;
  34.  
  35. @ScriptManifest(authors = { "Floplie" }, category = "Combat", name = "seagullBuddy", version = 1, description = "Thank you for using my seagullBuddy script, love from Floplie.")
  36.  
  37.  
  38. public class SeagullBuddy extends Script implements Painting {
  39. private int[] SID = {1339, 1338};
  40. private int FEATHER_ID = 314;
  41. private long startTime = System.currentTimeMillis();
  42. private final Color color1 = new Color(255, 255, 255);
  43.  
  44. private final Font font1 = new Font("Arial", 0, 24);
  45.  
  46. private final Image img1 = getImage("http://i.imgur.com/89X4zR4.png");
  47.  
  48. private boolean isRunning = false;
  49. @Override
  50. public void run() {
  51. if(!isRunning){
  52. isRunning = true;
  53. }
  54. while(isRunning){
  55. if(feathersValid()&&!Player.getRSPlayer().isInCombat()){
  56. pickupFeathers();
  57. }
  58.  
  59.  
  60.  
  61. if(!feathersValid()&&!Player.getRSPlayer().isInCombat()){
  62. fightSeagulls();
  63. }
  64. }
  65. }
  66.  
  67. private void fightSeagulls() {
  68. RSNPC[] seagull = NPCs.findNearest(SID);
  69. if(seagull.length>0&&!seagull[0].isInCombat()){
  70. seagull[0].click();
  71. General.sleep(2000, 3000);
  72. }
  73.  
  74. }
  75. private void pickupFeathers() {
  76. RSGroundItem[] feather = GroundItems.findNearest(FEATHER_ID);
  77. if(feather.length>0){
  78. feather[0].click("Take)");
  79. General.sleep(1000, 2000);
  80. }
  81.  
  82. }
  83. private boolean feathersValid() {
  84. RSGroundItem[] feather = GroundItems.findNearest(FEATHER_ID);
  85.  
  86. if(feather!=null&&feather.length>0){
  87. if(feather[0]!=null)
  88. return true;
  89. }else{
  90. return false;
  91. }
  92. return false;
  93. }
  94.  
  95.  
  96. @Override
  97. public void onPaint(Graphics g) {
  98. g.drawImage(img1, 3, 340, null);
  99. g.setFont(font1);
  100. g.setColor(color1);
  101. g.drawString(" " + runTime(startTime), 329, 419);
  102.  
  103. }
  104.  
  105. public String runTime(long i) {
  106. DecimalFormat nf = new DecimalFormat("00");
  107. long millis = System.currentTimeMillis() - i;
  108. long hours = millis / (1000 * 60 * 60);
  109. millis -= hours * (1000 * 60 * 60);
  110. long minutes = millis / (1000 * 60);
  111. millis -= minutes * (1000 * 60);
  112. long seconds = millis / 1000;
  113. return nf.format(hours) + ":" + nf.format(minutes) + ":"
  114. + nf.format(seconds);
  115. }
  116.  
  117. private Image getImage(String url) {
  118. try {
  119. return ImageIO.read(new URL(url));
  120. } catch (IOException e) {
  121. return null;
  122. }
  123. }
  124.  
  125.  
  126.  
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement