Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import javax.imageio.ImageIO;
- import org.tribot.api.General;
- import java.awt.*;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.URL;
- import java.text.DecimalFormat;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.GroundItems;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.NPCs;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.PathFinding;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.api2007.types.RSGroundItem;
- import org.tribot.api2007.types.RSNPC;
- import org.tribot.api2007.types.RSObject;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Painting;
- @ScriptManifest(authors = { "Floplie" }, category = "Combat", name = "seagullBuddy", version = 1, description = "Thank you for using my seagullBuddy script, love from Floplie.")
- public class SeagullBuddy extends Script implements Painting {
- private int[] SID = {1339, 1338};
- private int FEATHER_ID = 314;
- private long startTime = System.currentTimeMillis();
- private final Color color1 = new Color(255, 255, 255);
- private final Font font1 = new Font("Arial", 0, 24);
- private final Image img1 = getImage("http://i.imgur.com/89X4zR4.png");
- private boolean isRunning = false;
- @Override
- public void run() {
- if(!isRunning){
- isRunning = true;
- }
- while(isRunning){
- if(feathersValid()&&!Player.getRSPlayer().isInCombat()){
- pickupFeathers();
- }
- if(!feathersValid()&&!Player.getRSPlayer().isInCombat()){
- fightSeagulls();
- }
- }
- }
- private void fightSeagulls() {
- RSNPC[] seagull = NPCs.findNearest(SID);
- if(seagull.length>0&&!seagull[0].isInCombat()){
- seagull[0].click();
- General.sleep(2000, 3000);
- }
- }
- private void pickupFeathers() {
- RSGroundItem[] feather = GroundItems.findNearest(FEATHER_ID);
- if(feather.length>0){
- feather[0].click("Take)");
- General.sleep(1000, 2000);
- }
- }
- private boolean feathersValid() {
- RSGroundItem[] feather = GroundItems.findNearest(FEATHER_ID);
- if(feather!=null&&feather.length>0){
- if(feather[0]!=null)
- return true;
- }else{
- return false;
- }
- return false;
- }
- @Override
- public void onPaint(Graphics g) {
- g.drawImage(img1, 3, 340, null);
- g.setFont(font1);
- g.setColor(color1);
- g.drawString(" " + runTime(startTime), 329, 419);
- }
- public String runTime(long i) {
- DecimalFormat nf = new DecimalFormat("00");
- long millis = System.currentTimeMillis() - i;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- return nf.format(hours) + ":" + nf.format(minutes) + ":"
- + nf.format(seconds);
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch (IOException e) {
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement