Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Pestcontroller;
- import java.awt.*;
- import org.tbot.graphics.MouseTrail;
- import org.tbot.internal.AbstractScript;
- import org.tbot.internal.Manifest;
- import org.tbot.internal.ScriptCategory;
- import org.tbot.internal.event.listeners.PaintListener;
- import org.tbot.internal.handlers.LogHandler;
- import org.tbot.methods.Camera;
- import org.tbot.methods.GameObjects;
- import org.tbot.methods.GroundItems;
- import org.tbot.methods.NPCChat;
- import org.tbot.methods.Npcs;
- import org.tbot.methods.Players;
- import org.tbot.methods.Random;
- import org.tbot.methods.Time;
- import org.tbot.methods.Widgets;
- import org.tbot.methods.walking.Path;
- import org.tbot.methods.walking.Walking;
- import org.tbot.util.Condition;
- import org.tbot.wrappers.GameObject;
- import org.tbot.wrappers.NPC;
- import org.tbot.wrappers.GroundItem;
- import org.tbot.wrappers.Area;
- import org.tbot.wrappers.Player;
- import org.tbot.wrappers.Tile;
- @Manifest(name = "Free medium boat Pestcontrol", authors = "Trester/Rivaldo", description = "Plays the pest control minigame on the medium boat", version = 1.0, category = ScriptCategory.MINIGAMES)
- public class Pestcontrol extends AbstractScript implements PaintListener{
- Timer t = new Timer();
- String Status = " ";
- int[] npcIds = {1727, 1690, 1716, 1705, 1689, 1691, 1706, 1715, 1726, 1736, 1749, 1735, 1709, 1752, 1710, 1711, 1750};
- Area BOAT_AREA = new Area(2638, 2647,2641,2642);
- Tile LANDING_AREA = new Tile(2644, 2644);
- static final Area ISLAND_AREA = new Area(11093, 2215, 11116, 2230);
- private final MouseTrail mt = new MouseTrail();
- public Image cursor;
- int gamesPlayed;
- boolean fighting = false;
- String pointies;
- public boolean onStart() {
- LogHandler.log("I punched a racoon today.");
- return true;
- }
- public int loop() {
- NPC noob = Npcs.getNearest("Shifter");
- GameObject gangplank = GameObjects.getNearest("Gangplank");
- Player p = Players.getLocal();
- GameObject nullThing = GameObjects.getNearest(14282);
- if (noob != null) {
- if (noob.isOnScreen()) {
- if (p.getAnimation() == -1 && noob.distance() < 7) {
- Status = "Fighting";
- fighting = true;
- Time.sleep(27,140);
- noob.interact("Attack");
- Time.sleep(1300, 2700);
- Time.sleepUntil(new Condition() {
- public boolean check() {
- return Players.getLocal().getAnimation() == -1;
- }
- }, Random.nextInt(1800, 2400));
- }
- }else if(noob.distance() <= 7){
- Camera.turnTo(noob);
- }else{
- Path path = Walking.findLocalPath(noob.getLocation());
- if(path !=null) {
- if(path.traverse()) {
- Time.sleep(Random.nextInt(421, 1582));
- }
- }
- }
- }
- if(noob == null || noob.distance() > 7){
- fighting = false;
- }
- if (LANDING_AREA != null && p.getLocation().equals(LANDING_AREA)) {
- if (gangplank != null && p.getAnimation() == -1) {
- fighting = false;
- gangplank.interact("Cross");
- Status = "Clicking the gangplank";
- Time.sleep(300, 1700);
- }
- }
- if(gangplank != null && !p.getLocation().equals(LANDING_AREA) && !this.BOAT_AREA.contains(p)){
- fighting = false;
- Path path4 = Walking.findLocalPath(LANDING_AREA);
- if(path4 !=null) {
- if(path4.traverse()) {
- LogHandler.log("Antifail activated.");
- Time.sleep(Random.nextInt(421, 1582));
- }
- }
- }
- if(nullThing != null && fighting == false){
- Path path1 = Walking.findLocalPath(nullThing.getLocation());
- Status = "walking Middle";
- if(path1 !=null && nullThing.distance() > 7) {
- if(path1.traverse()) {
- Time.sleep(Random.nextInt(421, 1582));
- }
- }
- }
- if(noob != null && noob.getLocation().equals(Players.getLocal().getLocation())){
- Status = "Fighting";
- fighting = true;
- noob.interact("Attack");
- Time.sleep(1300, 2700);
- Time.sleepUntil(new Condition() {
- public boolean check() {
- return Players.getLocal().getAnimation() == -1;
- }
- }, Random.nextInt(1800, 2400));
- }
- if (BOAT_AREA != null && this.BOAT_AREA.contains(p)) {
- Status = "In boat";
- fighting = false;
- if(Widgets.getWidget(407, 14) != null && Widgets.getWidget(407, 14).isValid() && Widgets.getWidget(407, 14).isVisible()){
- pointies = Widgets.getWidget(407, 14).getText().split(": ")[1].toString();
- }
- if (Random.nextInt(5423) == 7)
- Status = "Random camera movement while waiting";
- Camera.setAngle(Random.nextInt(32, 360));
- Time.sleep(300, 1700);
- Camera.setPitch(Random.nextInt(32, 98));
- Time.sleep(300, 1700);
- }
- return Random.nextInt(121 , 423);
- }
- public void onRepaint(Graphics g) {
- Graphics2D gr = (Graphics2D) g;
- gr.setColor(Color.WHITE);
- gr.setFont(new Font("Arial", 1, 11));
- gr.drawString("Time Running: " + t.getFormattedTime(), 275, 315);
- g.drawString("UltraStakur simonzz :D ", 275, 330);
- g.drawString("Current Points: " + pointies , 275, 345);
- g.drawString("Status: " + Status, 275, 360);
- mt.draw(gr);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement