- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.util.Timer;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.*;
- import java.awt.*;
- @ScriptManifest(authors = "Alfansor", name = "Alfies FishnDrop", version = 0.6, description = "Just go to the trout/salmon spot near barbarian village and run the script.")
- public class AlfFishnDrop extends Script implements PaintListener,
- ServerMessageListener {
- int[] Inventory = { 309, 314 };
- int[] spotID = { 328 };
- int fishCount = 0;
- Thread abThread;
- // Paint stuff
- long startTime = 0;
- int startXp = 0;
- int startLvl = 0;
- int expGained = 0;
- int lvlsGained = 0;
- private final RenderingHints antialiasing = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- private final Color color1 = new Color(255, 255, 255, 134);
- private final Color color2 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 1, 15);
- private final Font font2 = new Font("Arial", 0, 10);
- public void onRepaint(Graphics g1) {
- if (game.isLoggedIn()) {
- Graphics2D g = (Graphics2D) g1;
- g.setRenderingHints(antialiasing);
- if (startTime == 0) {
- startTime = System.currentTimeMillis();
- }
- if (startXp == 0) {
- startXp = skills.getCurrentExp(Skills.FISHING);
- startLvl = skills.getRealLevel(Skills.FISHING);
- }
- expGained = skills.getCurrentExp(Skills.FISHING) - startXp;
- lvlsGained = (skills.getRealLevel(Skills.FISHING) - startLvl);
- g.setColor(color1);
- g.fillRect(2, 253, 202, 86);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(2, 253, 202, 86);
- g.setFont(font1);
- g.drawString("Alf Fish 'n' Drop", 15, 272);
- g.setFont(font2);
- g.drawString("Time Running: "
- + Timer.format(System.currentTimeMillis() - startTime), 15,
- 287);
- g.drawString("Fish Caught: " + fishCount, 16, 300); // Writes the
- g.drawString("Levels Gained: " + lvlsGained, 16, 313); // the + is
- g.drawString("Exp Gained: " + expGained, 16, 327);
- }
- }
- @Override
- public void serverMessageRecieved(ServerMessageEvent e) {
- String msg = e.getMessage();
- if (msg.contains("You catch")) {
- fishCount++;
- }
- }
- // paint stuff END
- public boolean onStart() {
- log("Welcome to Alfies FishnDrop!");
- abThread = new Thread(new antiBan());
- abThread.start();
- return true;
- }
- private void Lure() {
- try {
- RSNPC lureSpot = npcs.getNearest(spotID);
- if (calc.tileOnScreen(lureSpot.getLocation())
- && getMyPlayer().getAnimation() == -1) {
- lureSpot.doAction("Lure");
- }
- if (!calc.tileOnScreen(lureSpot.getLocation())) {
- if (calc.distanceTo(lureSpot) <= 7) {
- camera.turnToTile(lureSpot.getLocation());
- } else {
- if (!getMyPlayer().isMoving()) {
- walking.walkTileMM(lureSpot.getLocation());
- }
- }
- }
- } catch (Exception e) {
- }
- }
- private void dropFish() {
- inventory.dropAllExcept(Inventory);
- }
- public void onFinish() {
- abThread = null;
- log("Thanks for using Alfies FishnDrop.");
- }
- public int loop() {
- if (inventory.isFull()) {
- dropFish();
- } else if (!inventory.isFull()) {
- Lure();
- }
- return (random(600, 1250));
- }
- class antiBan extends Thread {
- public void run() {
- while (abThread != null) {
- try {
- int state = random(0, 8);
- switch (state) {
- case 1:
- int currTab = game.getCurrentTab();
- game.openTab(random(0, 5));
- Thread.sleep(random(1000, 4000));
- game.openTab(currTab);
- break;
- case 2:
- camera.setAngle(random(0, 360));
- break;
- case 3:
- camera.setPitch(random(0, 100));
- break;
- case 4:
- mouse.moveSlightly();
- Thread.sleep(random(850, 1150));
- mouse.moveSlightly();
- break;
- }
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- log.severe("Antiban has encountered an error. Error:" + e);
- }
- }
- }
- }
- }