- import java.awt.*;
- import java.util.*;
- import java.util.List;
- import java.util.logging.Level;
- import javax.accessibility.*;
- import javax.swing.*;
- import org.rsbot.bot.Bot;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.util.ScreenshotUtil;
- @ScriptManifest(authors = "Charlie", category = "Fishing", name = "CFisher", version = 1.0, description =
- "<html><head>" +
- "</head><body>" +
- "<center><strong><h2>CFisher - a Revolution in Fly Fishing</h2></strong></center>" +
- "<br /><strong>Location?</strong>" +
- "<center><select name='LOC'>" +
- "<option>Barbarian Village" +
- "<option>Shilo Village</select></center>" +
- "</body></html>")
- public class CFisher extends Script implements PaintListener, ServerMessageListener {
- private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- // Int's and Stuff
- public int ID1 = 309;
- public int ID2 = 314;
- public int startXp;
- public int fishCaught;
- public int exp;
- public int Animation = 867;
- private int RunningEnergy = random(15, 30);
- private String status = "";
- public long startTime = System.currentTimeMillis();
- private long waitTimer;
- public boolean onStart(Map<String, String> args) {
- return true;
- }
- public int loop() {
- try {
- setCameraAltitude(true);
- if (isInventoryFull()) {
- dropAllExcept(ID1, ID2);
- wait(random(30,40));
- }
- if (!isInventoryFull()) {
- if(isIdle())
- Fish();
- wait(random(800,1000));
- }
- } catch (Exception e) {
- }
- return random(600, 800);
- }
- public int Fish(){
- RSNPC spot = getNearestNPCByID(328);
- RSTile mloc = spot.getLocation();
- if (distanceTo(mloc) > 4) {
- walkTileMM(mloc);
- wait(random(800,1000));
- }
- if (spot != null && tileOnScreen(spot.getLocation())) {
- atNPC(spot, "Lure");
- wait(random(800,1000));
- } else {
- turnToTile(spot.getLocation());
- }
- return random(800,1000);
- }
- public void onRepaint(Graphics g) {
- long millis = System.currentTimeMillis() - startTime;
- long FishPerHour = 0;
- long expPerHour = 0;
- int startlvl = 0;
- if(startlvl == 0){
- startlvl = skills.getCurrentSkillLevel(STAT_FISHING);
- }
- int xpToLvl = skills.getXPToNextLevel(STAT_FISHING);
- if ( startXp == 0) {
- startXp = skills.getCurrentSkillExp(STAT_FISHING);
- }
- exp = skills.getCurrentSkillExp(STAT_FISHING) - startXp;
- if (fishCaught > 0)
- FishPerHour = fishCaught * 3600 / (millis / 1000);
- if(exp > 0)
- expPerHour = exp * 3600 / (millis / 1000);
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- //Time Ran
- g.setColor( new Color(70, 234, 40, 150));
- g.fillRect(226, 322, 110, 16);
- g.setColor(new Color(0, 0, 0));
- g.drawRect(226, 322, 110, 16);
- g.setColor( new Color(70, 234, 40, 200));
- g.drawRect(227, 323, 108, 14);
- g.setColor(new Color(255, 255, 255));
- g.setFont(new Font("Comic Sans", Font.BOLD, 12));
- g.setColor(Color.black);
- g.drawString(
- hours
- +"h "
- +minutes
- +"min "
- +seconds
- +"sec ", 234,334);
- g.setColor( new Color(70, 234, 40, 100));
- g.setColor( new Color(70, 234, 40, 150));
- g.fillRect(0, 0, 0, 0);
- g.setColor(new Color(0, 0, 0));
- g.drawRect(337, 175, 182, 147);
- g.setColor(new Color(255, 255, 255));
- g.setColor(Color.blue);
- g.setFont(new Font("Times New Roman", Font.BOLD, 12));
- g.drawString("Fish Caught: " + Integer.toString(fishCaught) + "", 360,217);
- g.drawString("Exp Gained: " + exp, 360, 237);
- g.drawString("Fish Per Hr: " +FishPerHour, 360, 257);
- g.drawString("Experience Per Hr: " + expPerHour, 360, 277);
- g.drawString("Exp until: " + xpToLvl + " Xp", 360, 297);
- g.setColor(new Color(255, 255, 255));
- g.setColor(Color.black);
- g.drawString("CFisher - Revolved", 360, 197);
- g.setColor(Color.white);
- final int percent = skills.getPercentToNextLevel
- (Constants.STAT_FISHING);
- }
- //Server Message
- @Override
- public void serverMessageRecieved(final ServerMessageEvent m) {
- final String message = m.getMessage();
- if (message.contains("You catch a")) {
- fishCaught++;
- }
- }
- public void onFinish() {
- ScreenshotUtil.takeScreenshot(true);
- }
- }
