Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Image;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.util.GlobalConfiguration;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import java.awt.event.KeyEvent;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.methods.Game.CHAT_MODE;
- import java.awt.image.BufferedImage;
- import java.awt.image.RenderedImage;
- import java.io.*;
- import java.net.URL;
- import javax.imageio.ImageIO;
- @ScriptManifest(authors = { "TehNubZ" }, name = "TehPapaya Spawner", description = "Catherby Papaya Fruit Spawner and Noter.")
- public class TehPapaya extends Script implements PaintListener, MessageListener
- {
- AntiBan ab = new AntiBan();
- public static final Summoning.Familiar FRUIT_BAT = null;
- int fruitBatPouch = 12033;
- int fruitFallScroll = 12423;
- int obelisk = 29943;
- int leprechaun = 3021;
- int notedPapaya = 5973;
- int papaya = 5972;
- int orange = 2108;
- int pineapple = 2114;
- int lemon = 2102;
- int banana = 1963;
- int lime = 2120;
- int papayaOnStart = 0;
- int papayaCount = 0;
- int newpapaya = 0;
- int spawnCount = 0;
- int count = 0;
- int randomCounter = 0;
- int mySummoningPoints;
- private RSTile obeliskTile = new RSTile(2853, 3439);
- private RSTile spawningTile = new RSTile(2855, 3431);
- public long timeRunning = 0, hours = 0, minutes = 0, seconds = 0,
- startTime = System.currentTimeMillis();
- public boolean onStart()
- {
- log("Welcome to TehPapaya.");
- log("Make millions a day just by spawning fruit!");
- log("Note. Make sure your character is in near the leprichaun in Catherby before starting.");
- mouse.setSpeed(random(7, 10));
- walking.walkTileMM(spawningTile, 1, 4);
- startTime = System.currentTimeMillis();
- sleep(1000, 1300);
- return true;
- }
- @Override
- public int loop()
- {
- // log("Prologue: entering looping");
- if (!isInSpawningArea())
- {
- log("Please move your character near the leprechaun in Catherby and restart script.");
- stopScript(true);
- }
- SpawnFruit();
- sleep(400, 500);
- summonFamiliar();
- sleep(400, 500);
- renewPoints();
- sleep(400, 500);
- renewFamiliar();
- sleep(400, 500);
- // log("Epilogue: leaving looping");
- return random(100, 400);
- }
- public void SpawnFruit()
- {
- /* log("Prologue: Entering SpawnFruit");
- log("Creature has "+summoning.getTimeLeft());
- log("Creature has "+ summoning.getFamiliar().getRequiredSpecialPoints()+ " special points left");
- log("You have "+ summoning.getSummoningPoints() + " Summoning points left");*/
- if (isInSpawningArea() && !needSummoningPoints() && summoning.isFamiliarSummoned() && !needNoting() && hasScrolls())
- {
- if (getMyPlayer() != null && getMyPlayer().isMoving())
- {
- sleep(1000, 2000);
- }
- if(!isInActualSpawningLocation())
- {
- antiban();
- sleep(500, 600);
- walking.walkTileMM(spawningTile);
- randomCounter++;
- }
- for (int i = 0; i < random(3, 5); i++)
- {
- sleep(300, 600);
- summoning.doAction("Cast");
- sleep(2400, 2700);
- }
- RSGroundItem groundItem = null;
- papayaCount = inventory.getCount(papaya);
- while (groundItems != null && (groundItem = groundItems.getNearest(papaya)) != null && groundItem.isOnScreen())
- {
- if (inventory.isFull())
- {
- antiban();
- break;
- }
- groundItem = groundItems.getNearest(papaya);
- if(groundItems != null)
- {
- groundItem.doAction("Take");
- while(getMyPlayer().isMoving())
- {
- sleep(300, 500);
- }
- papayaCount = inventory.getCount(papaya) + inventory.getCount(true, notedPapaya);
- }
- sleep(800, 1000);
- }
- sleep(400, 500);
- RSItem invoItem;
- while((invoItem= inventory.getItem(orange)) != null)
- {
- invoItem.doAction("Drop");
- sleep(300, 500);
- }
- while((invoItem= inventory.getItem(pineapple)) != null)
- {
- invoItem.doAction("Drop");
- sleep(300, 500);
- }
- while((invoItem= inventory.getItem(lime)) != null)
- {
- invoItem.doAction("Drop");
- sleep(300, 500);
- }
- while((invoItem= inventory.getItem(lemon)) != null)
- {
- invoItem.doAction("Drop");
- sleep(300, 500);
- }
- while((invoItem= inventory.getItem(banana)) != null)
- {
- invoItem.doAction("Drop");
- sleep(300, 500);
- }
- if (!inventory.isFull())
- {
- antiban();
- sleep(3000, 5000);
- antiban();
- sleep(6000, 8000);
- }
- else
- {
- antiban();
- sleep(6000, 8000);
- }
- }
- if (isInSpawningArea() && !needSummoningPoints() && needNoting() && hasScrolls())
- {
- walking.walkTileMM(getLocation(leprechaun));
- if (getMyPlayer().isMoving())
- {
- sleep(1000, 2000);
- }
- else
- {
- if (npcs.getNearest(leprechaun).isOnScreen())
- {
- inventory.getItem(papaya).doAction("Use");
- sleep(300, 500);
- npcs.getNearest(leprechaun).doAction("Use");
- sleep(1000, 2000);
- walking.walkTileMM(spawningTile, 1, 4);
- }
- else
- {
- walking.walkTileMM(getLocation(leprechaun));
- }
- }
- }
- // log("Epilogue: leaving SpawnFruit");
- }
- public void summonFamiliar()
- {
- // log("Prologue: entering summonFamiliar");
- if (isInSpawningArea() && !summoning.isFamiliarSummoned() && !needSummoningPoints() && !needNoting() && hasScrolls())
- {
- inventory.getItem(fruitBatPouch).doAction("Summon");
- sleep(2000, 2500);
- }
- // log("Epilogue: leaving summonFamiliar");
- }
- public void renewPoints()
- {
- // log("Prologue: Entering renewPoints");
- if (isInSpawningArea() && needSummoningPoints() && !needNoting() && hasScrolls())
- {
- walking.walkTileMM(obeliskTile);
- sleep(2000,3000);
- objects.getNearest(obelisk).doClick();
- sleep(1500,2000);
- walking.walkTileMM(spawningTile, 1, 4);
- sleep(3000,3500);
- }
- // log("Epilogue: Leaving renewPoints");
- }
- public void renewFamiliar()
- {
- if (isInSpawningArea() && !needSummoningPoints() && !needNoting() && hasScrolls() && needRenewFamiliar())
- {
- summoning.doAction("Renew");
- sleep(1000, 1500);
- }
- }
- public void antiban()
- {
- int rand = random(1, 25);
- switch (rand)
- {
- case 1:
- ab.checkXP(Skills.ATTACK);
- sleep (500, 300);
- ab.moveCameraRandomly();
- break;
- case 2:
- ab.checkXP(Skills.FARMING);
- sleep (500, 300);
- ab.moveCameraRandomly();
- break;
- case 4:
- ab.moveCameraRandomly();
- sleep (500, 300);
- break;
- case 8:
- ab.moveCameraRandomly();
- sleep (500, 300);
- ab.checkXP(Skills.SUMMONING);
- break;
- case 16:
- ab.moveCameraRandomly();
- sleep (500, 300);
- ab.checkXP(Skills.CONSTITUTION);
- break;
- default:
- mouse.setSpeed(random(6, 10));
- mouse.move(random(1, 600), random(1, 400));
- sleep (500, 300);
- break;
- }
- }
- public boolean isInSpawningArea()
- {
- /* log("Player location is "+ getMyPlayer().getLocation());
- log("SpawningTiles are "+ spawningTiles.toString());
- log("Spawning tiles length: "+ spawningTiles.length);
- log("Spawning tiles length [0]: "+ spawningTiles[0].length); */
- RSTile myPlayerLocation = getMyPlayer().getLocation();
- if (myPlayerLocation.getX() < 2867 && myPlayerLocation.getX() > 2844 && myPlayerLocation.getY() < 3442 && myPlayerLocation.getY() > 2430)
- {
- return true;
- }
- return false;
- }
- public boolean isInActualSpawningLocation()
- {
- RSTile myPlayerLocation = getMyPlayer().getLocation();
- if (myPlayerLocation.getX() < 2858 && myPlayerLocation.getX() > 2852 && myPlayerLocation.getY() < 3433 && myPlayerLocation.getY() > 3430)
- {
- return true;
- }
- return false;
- }
- public boolean needSummoningPoints()
- {
- if(summoning.getSummoningPoints() < 10)
- {
- return true;
- }
- return false;
- }
- public boolean needNoting()
- {
- if (inventory.isFull())
- {
- return true;
- }
- return false;
- }
- public boolean hasScrolls()
- {
- if (inventory.contains(fruitFallScroll))
- {
- return true;
- }
- return false;
- }
- public boolean hasPouches()
- {
- if (inventory.contains(fruitBatPouch))
- {
- return true;
- }
- return false;
- }
- public boolean needRenewFamiliar()
- {
- if (summoning.isFamiliarSummoned())
- {
- if (summoning.getTimeLeft() <= 1)
- {
- return true;
- }
- }
- return false;
- }
- public RSTile getLocation(int Npc)
- {
- RSTile NpcLocation = new RSTile(npcs.getNearest(Npc).getLocation().getX(), npcs.getNearest(Npc).getLocation().getY());
- return NpcLocation;
- }
- public void onRepaint(Graphics g)
- {
- if (game.isLoggedIn())
- {
- g.drawImage(getImage("TehPapayacopy.png"), 159, 349, null);
- timeRunning = System.currentTimeMillis() - startTime;
- seconds = timeRunning / 1000;
- if (seconds >= 60) {
- minutes = seconds / 60;
- seconds -= minutes * 60;
- }
- if (minutes >= 60) {
- hours = minutes / 60;
- minutes -= hours * 60;
- }
- g.setColor(Color.black);
- g.clearRect(226, 440, 231, 30);
- g.setColor(Color.orange);
- g.drawString("Papayas Collected: "+ papayaCount +" $"+ (papayaCount*1950), 228, 452);
- g.drawString("Time Run: "+hours+":"+minutes+":"+seconds, 228, 467);
- g.setColor(Color.black);
- g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY()));
- g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800);
- g.setColor(Color.green);
- g.drawLine(0, (int) (mouse.getLocation().getY()) + 1, 800, (int) (mouse.getLocation().getY()) + 1);
- g.drawLine((int) (mouse.getLocation().getX()) + 1, 0, (int) (mouse.getLocation().getX()) + 1, 800);
- }
- }
- public static Image getImage(String fileName) {
- try {
- File f = new File(
- GlobalConfiguration.Paths.getScriptsDirectory() + "/"
- + fileName);
- if (f.exists()) {
- return ImageIO.read(f.toURI().toURL());
- }
- BufferedImage img = ImageIO.read(new URL(
- "http://i598.photobucket.com/albums/tt68/WarriorX/" + fileName));
- if (img != null) {
- ImageIO.write((RenderedImage) img, "PNG", f);
- return img;
- }
- } catch (IOException e) {
- }
- return null;
- }
- @Override
- public void messageReceived(MessageEvent e) {
- }
- public class AntiBan {
- private int [] Locations = {1 , 2, 3}; //set locations here
- private int WHITE = 35;
- private int GREEN = 37;
- private int AMBER = 39;
- private int RED = 41;
- private int NONE = 53;
- private void checkXP(int Skill) {
- if(game.getCurrentTab() != Game.TAB_STATS){
- game.openTab(game.TAB_STATS);
- skills.doHover(Skill);
- } else {
- skills.doHover(Skill);
- }
- }
- private void moveMouseOffScreen(int Time){
- mouse.moveOffScreen();
- sleep(Time);
- }
- private void setRunning(int Energy){
- if(!walking.isRunEnabled() && walking.getEnergy() >= Energy){
- walking.setRun(true);
- moveMouseRandomly(Locations);
- }
- }
- private void moveMouseRandomly(int[] location){
- switch(location.length){
- case 0: // chatBox
- mouse.move(random(4, 327), random(528, 483));
- break;
- case 2: // Screen
- mouse.move(random(3, 0), random(525, 352));
- break;
- case 3: //Minimap
- mouse.move(random(521, 0), random(760, 170));
- break;
- case 4: //inventory
- mouse.move(random(527, 200), random(744, 464));
- }
- }
- private void moveCameraToLeft(int minTime, int maxTime){
- keyboard.pressKey((char)KeyEvent.VK_LEFT);
- sleep(random(minTime, maxTime));
- keyboard.releaseKey((char)KeyEvent.VK_LEFT);
- }
- private void moveCameraToRight(int minTime, int maxTime){
- keyboard.pressKey((char)KeyEvent.VK_RIGHT);
- sleep(random(minTime, maxTime));
- keyboard.releaseKey((char)KeyEvent.VK_RIGHT);
- }
- private void moveCameraRandomly() {
- switch(random(0,3)) {
- case 0:
- moveCameraToLeft(750, 1000);
- camera.setPitch(random(30, 120));
- sleep(50, 100);
- break;
- case 1:
- moveCameraToRight(1000, 2500);
- camera.setPitch(random(30, 120));
- sleep(50, 100);
- break;
- }
- }
- private void addNote(String Text){
- RSInterface Notes = interfaces.get(34);
- if(game.getCurrentTab() != game.TAB_NOTES){
- game.openTab(game.TAB_NOTES);
- return;
- } else {
- mouse.click(Notes.getComponent(3).getLocation(), true);
- sleep(600, 800);
- keyboard.sendText(Text, true);
- }
- }
- private void deleteNote(String Text){
- RSInterface Notes = interfaces.get(34);
- if(game.getCurrentTab() != game.TAB_NOTES){
- game.openTab(game.TAB_NOTES);
- return;
- } else {
- for(int i = 0; i <= 30; i++){
- log(i);
- try {
- if(Notes.getComponent(9).getComponent(i).getText().equals(Text)){
- mouse.click(Notes.getComponent(9).getComponent(i).getLocation(), true);
- mouse.click(Notes.getComponent(8).getLocation(), true);
- } else {
- i++;
- }
- } catch(Exception e){}
- }
- }
- }
- private void setNoteColor(String Text, int Color){
- RSInterface Notes = interfaces.get(34);
- if(game.getCurrentTab() != game.TAB_NOTES){
- game.openTab(game.TAB_NOTES);
- return;
- } else {
- for(int i = 0; i <= 30; i++){
- try {
- if(Notes.getComponent(9).getComponent(i).getText().equals(Text)){
- mouse.click(Notes.getComponent(9).getComponent(i).getLocation(), false);
- Notes.getComponent(9).doAction("Colour");
- sleep(200, 500);
- mouse.click(Notes.getComponent(Color).getLocation(), true);
- } else {
- i++;
- }
- } catch(Exception e){}
- }
- }
- }
- private void setMode(int chooseOption, CHAT_MODE setMode){
- switch(chooseOption){
- case 1: // setPublicMode
- game.setPublicChat(setMode);
- break;
- case 2:// setTradeMode
- game.setTradeMode(setMode);
- break;
- case 3:// setPrivateMode
- game.setPrivateChat(setMode);
- break;
- case 4: //setClanMode
- game.setClanMode(setMode);
- case 5:// setAssistMode
- game.setAssistMode(setMode);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement