Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.wrappers.*;
- import com.kbot2.scriptable.methods.wrappers.Obj;
- import com.kbot2.scriptable.methods.wrappers.Tile;
- import com.kbot2.scriptable.methods.wrappers.Interface;
- import com.kbot2.scriptable.methods.data.Data;
- import com.kbot2.scriptable.methods.data.Skills;
- import com.kbot2.scriptable.methods.data.GroundItems;
- import com.kbot2.scriptable.methods.data.Camera;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- import java.*;
- import java.io.*;
- import java.net.URL;
- import java.net.URLConnection;
- import java.awt.*;
- import java.awt.event.KeyEvent;
- import javax.swing.*;
- import java.util.*;
- import java.text.DecimalFormat;
- public class ACOrangeSalamander extends Script implements PaintListener, ServerMessageListener {
- int TREE = 19652;
- int ROPE = 954;
- int NET = 303;
- int CAUGHT_SALLY = 19654;
- int O_SALAMANDER = 10146;
- int Caught = 0;
- int origHUNT = 0;
- int status = 0;
- long startTime;
- String Status;
- public boolean active() {
- return true;
- }
- public boolean onStart() {
- Status = "Starting Up";
- startTime = System.currentTimeMillis();
- origHUNT = skills.getExperience(Skills.SKILL_HUNTER);
- return true;
- }
- public String getName() {
- return "A_C's Orange Salamander Catcher";
- }
- public String getAuthor() {
- return "A_C/Assassins Cried";
- }
- public String getDescription() {
- return "Catches Orange Salamanders";
- }
- public int loop() {
- setMouseSpeed(random(0,2));
- if(walking.getEnergy() > 50)
- walking.setRunning(true);
- camera.setCompass('n');
- camera.setAltitude(true);
- if(getMyPlayer().getAnimation() != -1) {
- return (random(100,200));
- }
- if(!getMyPlayer().isMoving() && getMyPlayer().getAnimation() == -1) {
- Status = "Waiting.....";
- }
- switch (status) {
- case 0:
- GroundItem FISHING_NET = groundItems.getClosestItem(15, NET);
- if(FISHING_NET ==null) {
- status = 1;
- } else if(FISHING_NET !=null) {
- Status = "Picking Up Trap";
- if (distanceTo(FISHING_NET.getLocation()) > 3)
- walking.walkToMM(FISHING_NET.getLocation());
- if (getMyPlayer().isMoving()) return 100;
- FISHING_NET.doAction("Take");
- status = 0;
- }
- break;
- case 1:
- GroundItem ROPES = groundItems.getClosestItem(15, ROPE);
- if(ROPES ==null) {
- status = 2;
- } else if(ROPES !=null) {
- Status = "Picking Up Trap";
- if (distanceTo(ROPES.getLocation()) > 3)
- walking.walkToMM(ROPES.getLocation());
- if (getMyPlayer().isMoving()) return 100;
- ROPES.doAction("Take");
- status = 1;
- }
- break;
- case 2:
- GroundItem FISHING_NET2 = groundItems.getClosestItem(15, NET);
- if(FISHING_NET2 !=null) {
- status = 0;
- } else {
- Obj CAUGHT = getClosestObject(5, CAUGHT_SALLY);
- if (CAUGHT == null) {
- status = 3;
- } else if (CAUGHT != null) {
- Status = "Collecting Salamander";
- if (distanceTo(CAUGHT.getLocation()) > 3)
- walking.walkToMM(CAUGHT.getLocation());
- if (getMyPlayer().isMoving()) return 100;
- CAUGHT.doAction("Check");
- sleep (random(750,1000));
- status = 2;
- }
- }
- break;
- case 3:
- GroundItem FISHING_NET3 = groundItems.getClosestItem(15, NET);
- if(FISHING_NET3 !=null) {
- status = 0;
- } else {
- Obj Y_TREE = getClosestObject(5, TREE);
- if (Y_TREE == null) {
- status = 4;
- } else if (Y_TREE != null) {
- Status = "Setting Up Trap";
- if (getMyPlayer().isMoving()) return 100;
- Y_TREE.doAction("Set-trap");
- status = 3;
- }
- }
- break;
- case 4:
- if (getMyPlayer().isMoving()) return 100;
- if (inventory.contains(O_SALAMANDER)) {
- inventory.atItem("Release", O_SALAMANDER);
- status = 4;
- } else {
- status = 0;
- }
- break;
- }
- return random(100, 300);
- }
- public void onServerMessage(String m) {
- if(m.contains("caught"))
- Caught++;
- }
- public void onRepaint(Graphics w) {
- long runTime = System.currentTimeMillis() - startTime;
- int secs = ((int) ((runTime / 1000) % 60));
- int mins = ((int) (((runTime / 1000) / 60) % 60));
- int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
- w.setColor(Color.green);
- w.drawString("A_C's Orange Salamander Catcher", 34, 43);
- w.drawString("Status: " + Status, 34, 61);
- w.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":"
- + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "")
- + secs, 34, 79);
- w.drawString("Experience gained: " + (skills.getExperience(Skills.SKILL_HUNTER) - origHUNT), 34, 115);
- w.drawString("Exp to next level: " + (skills.getExperienceToNextLevel(Skills.SKILL_HUNTER)), 34, 133);
- w.drawString("To next level: " + (skills.getExperienceToNextLevel(Skills.SKILL_HUNTER)) / 224 + " Salamanders", 34, 151);
- w.drawString((skills.getPercentageToNextLevel(Skills.SKILL_HUNTER)) + "% to next level" , 34, 169);
- w.drawString("Current Level: " +(skills.getLevel(Skills.SKILL_HUNTER)) , 34, 187);
- w.drawString("No. of Catches: " + Caught , 34, 205);
- }
- }
Add Comment
Please, Sign In to add comment