Jump to content

Looking for scripters!


Maxi

Recommended Posts

This makes me curious. Could you show us some of your work? smile.png

package scripts;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.Image;import java.awt.Rectangle;import java.awt.event.MouseEvent;import java.io.IOException;import java.net.URL;import javax.imageio.ImageIO;import org.Advertising other bots isn&#39;t allowed..api.General;import org.Advertising other bots isn&#39;t allowed..api.Timing;import org.Advertising other bots isn&#39;t allowed..api.input.Mouse;import org.Advertising other bots isn&#39;t allowed..api2007.ChooseOption;import org.Advertising other bots isn&#39;t allowed..api2007.GameTab;import org.Advertising other bots isn&#39;t allowed..api2007.GameTab.TABS;import org.Advertising other bots isn&#39;t allowed..api2007.Camera;import org.Advertising other bots isn&#39;t allowed..api2007.Inventory;import org.Advertising other bots isn&#39;t allowed..api2007.NPCs;import org.Advertising other bots isn&#39;t allowed..api2007.Objects;import org.Advertising other bots isn&#39;t allowed..api2007.Player;import org.Advertising other bots isn&#39;t allowed..api2007.Players;import org.Advertising other bots isn&#39;t allowed..api2007.Skills;import org.Advertising other bots isn&#39;t allowed..api2007.types.RSItem;import org.Advertising other bots isn&#39;t allowed..api2007.types.RSNPC;import org.Advertising other bots isn&#39;t allowed..api2007.types.RSPlayer;import org.Advertising other bots isn&#39;t allowed..api2007.types.RSTile;import org.Advertising other bots isn&#39;t allowed..script.Script;import org.Advertising other bots isn&#39;t allowed..script.ScriptManifest;import org.Advertising other bots isn&#39;t allowed..script.interfaces.Painting;@ScriptManifest(authors={"LCSPro"}, category="Combat", name="SuperYaks", description="Fights Yaks on the Island of Neitiznot", version=0.1D)public class SuperYaks extends Scriptimplements Painting{	long Start;	private double ratioPerHour = (3600000D) / (System.currentTimeMillis() - Start);	private final Font theFont = new Font("Trebuchet MS", Font.BOLD, 14);	private final Image thePaint = getImage("http://i.imgur.com/9Pttd3b.png");	Rectangle hide = new Rectangle(491, 505, 20, 20);	public boolean showPaint = true;	int[] foodsInt = { 1891, 1893, 1895, 379, 329, 333, 2309, 361, 373, 385, 351 };	int startExperience;	int currentExperience;	int experienceGained;	int yaksKilled;	int yaksPerHour;	int foodAte;	String Yaks = "Yak";	String Status;	public void run()	{		println("Welcome to SuperYaks");		println("Please post feedback, bugs & suggestions on Advertising other bots isn&#39;t allowed..org");		Mouse.setSpeed(400);		Start = System.currentTimeMillis();		startExperience = 				(Skills.getXP("HITPOINTS") + Skills.getXP("ATTACK") + 						Skills.getXP("STRENGTH") + Skills.getXP("DEFENCE") + 						Skills.getXP("RANGED"));		while (loop() > 0) {			loop();		}	}	public int loop()	{		RSNPC[] theYaks = NPCs.findNearest(new String[] {"Yak"});		RSNPC[] theStrangePlant = NPCs.findNearest(new String[] { "Strange Plant" });				/* Logout Support */		if(!hasFood() && !inCombat()) {						if(GameTab.getOpen() != GameTab.TABS.LOGOUT) {				while(GameTab.getOpen() != GameTab.TABS.LOGOUT) {					Status = ("Opening LOGOUT Tab");					GameTab.open(TABS.LOGOUT);					sleep(300,600);				}			}			if(GameTab.getOpen() == GameTab.TABS.LOGOUT) {				RSTile thePlayerPosition = new RSTile(Player.getPosition().getX(), 						Player.getPosition().getY());				while(Player.getPosition().equals(thePlayerPosition)) {					Status = ("Logging out");					Mouse.move(580 + General.random(0, 120), 365 + General.random(0, 20));					Mouse.click(1);				}			}			stopScript(); 			return 0;		}		/* Combat Support */		if(!inCombat() && hasFood()				&& Skills.getCurrentLevel("Hitpoints") > 30) {						if (theYaks.length > 0) {				for (RSNPC free : theYaks) {					if(!free.isInCombat()) {						if(!inCombat() && !free.isInCombat()) {							long timer = System.currentTimeMillis() + General.random(1000, 1200);							while(!ChooseOption.isOptionValid("Attack") && 									System.currentTimeMillis() < timer) {								Status = ("Finding Yak");								free.hover();							}							while(ChooseOption.isOptionValid("Attack") && !free.isInCombat()									&& !inCombat()) {								Status = ("Attacking Yak");								free.click("Attack");							}						}					}				}			}		}		/* inCombat Support */		while(inCombat()) {			Status = ("Fighting Yaks");			currentExperience = 					(Skills.getXP("HITPOINTS") + Skills.getXP("ATTACK") + 							Skills.getXP("STRENGTH") + Skills.getXP("DEFENCE") + 							Skills.getXP("RANGED"));			experienceGained = currentExperience - startExperience;			yaksPerHour = (int)(ratioPerHour * getYaksKilled());			getYaksKilled();						/* Food Support */			if(Skills.getCurrentLevel("Hitpoints") <= General.random(20, 30) && hasFood()) {				if(hasFood()) {					RSItem[] ourFood = Inventory.find(foodsInt); 					Status = ("Eating, we're at: " + getHpPercent() + "% HP");					println("Health Percent: " + getHpPercent());					if(Skills.getCurrentLevel("Hitpoints") <= 30) {						if(ourFood.length > 0) {							for(RSItem theFood : ourFood) {								while(!ChooseOption.isOptionValid("Eat")) {									Status = ("Hovering Food ID:" + theFood.getID());									theFood.hover();								}								if(ChooseOption.isOptionValid("Eat")) {									theFood.click("Eat");									foodAte ++;									sleep(300,600);								}							}						}					}				}			}		}		return 25;	}	private int getYaksKilled() {		return experienceGained / 266;	}	public int getHpPercent() {		return (int)(Skills.getCurrentLevel("Hitpoints") / Skills.getActualLevel("Hitpoints")) * 100;	}		public boolean hasArrows() {		RSItem[] ironKnives = Inventory.find(893);		if(ironKnives.length > 0) {			return true;		}		return false;	}	public boolean hasFood() {		RSItem[] foods = Inventory.find(foodsInt);		if (foods.length > 0) {			return true;		}		return false;	}	public boolean inCombat() {		long t = System.currentTimeMillis() + General.random(500,800);		while (System.currentTimeMillis() < t) {			if (Player.getRSPlayer().getAnimation() != -1) {				return true;			}		}		return false;	}	private Image getImage(String url)	{		try { return ImageIO.read(new URL(url)); } catch (IOException e) {} return null;	}	private final float expPerHour() {		return 1000.0F / ((float)((System.currentTimeMillis() - Start) / 60L / 60L) / (experienceGained));	}	public void mouseClicked(MouseEvent e) {		if (hide.contains(e.getPoint())) {			showPaint = !showPaint;		}	}	public void onPaint(Graphics Super) {		if(showPaint) {			Super.drawRect(491, 505, 20, 20);			Super.setColor(Color.CYAN);			Super.setFont(theFont);			Super.drawImage(thePaint, 5, 305, null);			Super.drawString(" " + Status, 78, 377);			Super.drawString(" " + (int)(experienceGained), 187, 399);			Super.drawString(" " + (int)(expPerHour()), 158, 419);			Super.drawString(" " + getYaksKilled(), 118, 442);			Super.drawString(" " + foodAte, 105, 463);			Super.drawString("Runtime: " + Timing.msToString(System.currentTimeMillis() - Start), 335, 365);		} else {			//nothing		}	}}
Link to comment
Share on other sites

It kinda sucks but..

package waterfiends;import org.p****bot.core.event.listeners.PaintListener;import org.p****bot.core.script.ActiveScript;import org.p****bot.core.script.job.Job;import org.p****bot.core.script.job.Task;import org.p****bot.core.script.job.state.Node;import org.p****bot.core.script.job.state.Tree;import org.p****bot.game.api.Manifest;import org.p****bot.game.api.methods.*;import org.p****bot.game.api.methods.input.Keyboard;import org.p****bot.game.api.methods.input.Mouse;import org.p****bot.game.api.methods.interactive.NPCs;import org.p****bot.game.api.methods.interactive.Players;import org.p****bot.game.api.methods.node.GroundItems;import org.p****bot.game.api.methods.tab.Inventory;import org.p****bot.game.api.methods.tab.Skills;import org.p****bot.game.api.methods.widget.Camera;import org.p****bot.game.api.methods.widget.WidgetCache;import org.p****bot.game.api.util.Filter;import org.p****bot.game.api.util.Random;import org.p****bot.game.api.util.Time;import org.p****bot.game.api.util.Timer;import org.p****bot.game.api.wrappers.Area;import org.p****bot.game.api.wrappers.Tile;import org.p****bot.game.api.wrappers.interactive.NPC;import org.p****bot.game.api.wrappers.node.GroundItem;import org.p****bot.game.api.wrappers.node.Item;import org.p****bot.game.api.wrappers.widget.WidgetChild;import org.p****bot.game.bot.Context;import org.p****bot.game.client.Client;import waterfiends.sk.action.ActionBar;import waterfiends.sk.action.Ability;import javax.imageio.ImageIO;import java.awt.*;import java.io.IOException;import java.net.URL;import java.text.DecimalFormat;import java.text.NumberFormat;import java.util.ArrayList;import java.util.Collections;import static org.p****bot.game.api.methods.tab.Skills.PRAYER;import static org.p****bot.game.api.methods.tab.Skills.RANGE;import static org.p****bot.game.api.methods.tab.Skills.WIDGET_SUMMONING;@Manifest(name = "WaterfiendsCamper", version = 0.1, authors = "Geashaw", description = "Camps waterfiends in the Ancient Caverns!")public class waterfiendscamper extends ActiveScript implements PaintListener {    private final java.util.List<Node> jobsCollection = Collections.synchronizedList(new ArrayList<Node>());    private Tree jobContainer = null;    public static final int[] FOOD_IDS = {333, 351, 329, 361, 379, 385, 365, 373, 7946, 385, 697, 391, 15266, 15272};    public static final int[] LOOT_IDS = {572, 12160, 12163, 385};    public static final int WATERFIEND_IDS = 5361;    public static final int CRIMSON_CHARM = 12160;    int startcrimsons, startexprange, startexphp, gainedexprange, gainedexphp, crimsons, kills;    private final static int[] RANGE_POTION = {23519, 23520, 23521, 23522, 23523, 23524};    long startTime;    //Area FIGHTING_AREA = new Area((new Tile(1734,5345, 0)), new Tile(1744, 5360, 0));    private NumberFormat k = new DecimalFormat("###,###,###");    private final ProgressTimer timer = new ProgressTimer();    public synchronized final void provide(final Node... jobs) {        for (final Node job : jobs) {            if (!jobsCollection.contains(job)) {                jobsCollection.add(job);            }        }        jobContainer = new Tree(jobsCollection.toArray(new Node[jobsCollection.size()]));    }    public synchronized final void revoke(final Node... jobs) {        for (final Node job : jobs) {            if (jobsCollection.contains(job)) {                jobsCollection.remove(job);            }        }        jobContainer = new Tree(jobsCollection.toArray(new Node[jobsCollection.size()]));    }    public final void submit(final Job... jobs) {        for (final Job job : jobs) {            getContainer().submit(job);        }    }    private Client client = Context.client();    @Override    public int loop() {        if (Game.getClientState() != Game.INDEX_MAP_LOADED) {            return 1000;        }        if (client != Context.client()) {            WidgetCache.purge();            Context.get().getEventManager().addListener(this);            client = Context.client();        }        if (jobContainer != null) {            final Node job = jobContainer.state();            if (job != null) {                jobContainer.set(job);                getContainer().submit(job);                job.join();            }        }        return Random.nextInt(10,25);    }    @Override    public void onStart() {        Mouse.setSpeed(Mouse.Speed.VERY_FAST);        startexprange = Skills.getExperience(RANGE);        startexphp = Skills.getExperience(Skills.CONSTITUTION);        startcrimsons = Inventory.getCount(true, CRIMSON_CHARM);        provide(new fighter(), new looter(), new abilityuser()/*new booster()*/, new healer());        startTime = System.currentTimeMillis();    }    public void onStop() {        // Add stuff here    }    private int getPerHour(final int value){        return (int) (value * 3600000D / (timer.getElapsed()));    }    private Image getImage(String url) {        try {            return ImageIO.read(new URL(url));        } catch(IOException e) {            return null;        }    }    public class ProgressTimer {        private long start;        public ProgressTimer() {this.start = System.currentTimeMillis();}        public void reset() {this.start = System.currentTimeMillis();}        public long getElapsed() {return (System.currentTimeMillis() - start);}        public String toElapsedString() {return Time.format(getElapsed());}    }    private String GetRuntime() {        try {            long millis = System.currentTimeMillis() - startTime;            long hours = millis / (1000 * 60 * 60);            millis -= hours * (1000 * 60 * 60);            long minutes = millis / (1000 * 60);            millis -= minutes * (1000 * 60);            long seconds = millis / 1000;            return ("" + (hours < 10 ? "0" : "") + hours + ":"                    + (minutes < 10 ? "0" : "") + minutes + ":"                    + (seconds < 10 ? "0" : "") + seconds + "");        } catch (Exception e) {            return "";        }    }    private final Image chatbox = getImage("http://puu.sh/1OVLt");    public void onRepaint(Graphics g1) {        Graphics2D g = (Graphics2D) g1;        g.drawImage(chatbox, 0, 388, null);        g.drawString("Runtime: " + timer.getElapsed(), 12, 410);        int gainedexphp = Skills.getExperience(Skills.CONSTITUTION) - (int) startexphp;        int gainedexprange = Skills.getExperience(RANGE) - startexprange;        //int kills = gainedexprange / 654;        int crimsons = Inventory.getCount(true, CRIMSON_CHARM) - startcrimsons;        g.setFont(new Font("Century Gothic", 0, 12));        g.setColor(Color.BLACK);        g.drawImage(chatbox, 0, 388, null);        g.drawString("Runtime: " + GetRuntime(), 12, 410);        g.drawString("Ranging: " + k.format(gainedexprange) + " (" + k.format(getPerHour(gainedexprange)) + ")", 12, 425);        g.drawString("Hitpoints: " + k.format(gainedexphp) + " (" + k.format(getPerHour(gainedexphp)) + ")", 12, 440);        g.drawString("Crimsons: " + k.format(crimsons) + " (" + k.format(getPerHour(crimsons)) + ")", 12, 455);        g.drawString("Time left: " + (Settings.get(1786)/128) + " minutes", 12, 485);        if((Settings.get(689) & 0x400) == 0x400){            g.setColor(Color.green);            g.drawString("Momentum on", 12, 470);        } else {            g.setColor(Color.red);            g.drawString("Momentum off", 12, 470);        }        GroundItem Loot = GroundItems.getNearest(LOOT_IDS);        if (Loot != null) {            g.setColor(Color.green);            for (Polygon y : Loot.getBounds()) {                g.drawPolygon(y);                g.drawString(Loot != null && Loot.validate() ? Loot.getGroundItem().getName() : "", (int)Loot.getCentralPoint().getX(), (int)Loot.getCentralPoint().getY());            }        }    }    public class fighter extends Node {        private Filter<NPC> filter = new Filter<NPC>() {            public boolean accept(NPC n) {                return n.getId() == WATERFIEND_IDS                && (n.getInteracting() == null                || (n.getInteracting() != null                && !n.getInteracting().validate()));            }        };        @Override        public boolean activate() {            return Players.getLocal().getHealthPercent() > 50 && !attacksCurrentTarget() && Players.getLocal().getInteracting() == null;        }        @Override        public void execute() {            WidgetChild actionBarWidget = Widgets.get(640, 6);            NPC target = NPCs.getNearest(new Filter<NPC>() {                public boolean accept(NPC npc){                    return npc.getInteracting() == null && npc.getId() == WATERFIEND_IDS;                }            });            if(target != null && target.validate()){                if(target.isOnScreen()){                    if((actionBarWidget != null && actionBarWidget.contains(target.getCentralPoint()) || !Calculations.isOnScreen(target.getCentralPoint()))){                        Camera.turnTo(target);                    }                    if(!Players.getLocal().isInCombat()){                        target.interact("Attack", target.getName());                        Task.sleep(2000);                    }                } else {                    if((actionBarWidget != null && actionBarWidget.contains(target.getCentralPoint()) || !Calculations.isOnScreen(target.getCentralPoint()))){                        Camera.turnTo(target);                        if((actionBarWidget != null && actionBarWidget.contains(target.getCentralPoint()) || !Calculations.isOnScreen(target.getCentralPoint()))){                            Walking.walk(target.getLocation());                        }                    }                    Walking.walk(target.getLocation());                }            }        }        private boolean attacksCurrentTarget() {            return Players.getLocal().getInteracting() != null                    && Players.getLocal().getInteracting().validate()                    && Players.getLocal().getInteracting().getInteracting() != null                    && Players.getLocal().getInteracting().getInteracting().equals(Players.getLocal());        }    }    public class healer extends Node{        @Override        public boolean activate() {            return Players.getLocal().getHealthPercent() < 50            && Inventory.getCount(FOOD_IDS) > 0;        }        @Override        public void execute() {            if(Inventory.getItem(FOOD_IDS).getWidgetChild() != null            && Inventory.getItem(FOOD_IDS).getWidgetChild().validate()){                Inventory.getItem(FOOD_IDS).getWidgetChild().interact("Eat");            }        }    }    public class looter extends Node{        @Override        public boolean activate() {            return GroundItems.getNearest(LOOT_IDS) != null;        }        @Override        public void execute() {            GroundItem loot = GroundItems.getNearest(LOOT_IDS);            WidgetChild actionBarWidget = Widgets.get(640, 6);            if(loot != null){                if(loot.getId() == 385){                    if(Inventory.getCount(385) < 4){                        if(loot.isOnScreen()){                            loot.interact("Take", loot.getGroundItem().getName());                            Task.sleep(1500);                        } else {                            Camera.turnTo(loot);                        }                    }                } else {                    if(loot.isOnScreen()){                        loot.interact("Take", loot.getGroundItem().getName());                        Task.sleep(1500);                    } else {                        if((actionBarWidget != null && actionBarWidget.contains(loot.getCentralPoint()) || !Calculations.isOnScreen(loot.getCentralPoint()))){                            Camera.turnTo(loot);                            //if((actionBarWidget != null && actionBarWidget.contains(loot.getCentralPoint()) || !Calculations.isOnScreen(loot.getCentralPoint()))){                                Walking.walk(loot.getLocation());                            //}                        }                    }                }            }        }    }    public class booster extends Node{        int rangelevel = Skills.getLevel(Skills.RANGE);        int defencelevel = Skills.getLevel(Skills.DEFENSE);        @Override        public boolean activate() {            return rangelevel < (Skills.getRealLevel(Skills.RANGE)) * 1.06;        }        @Override        public void execute() {            if(Inventory.getCount(RANGE_POTION) > 0){                final Item pot = Inventory.getItem(RANGE_POTION);                if(pot != null && pot.getWidgetChild().interact("Drink")){                    final Timer timer = new Timer(Random.nextInt(3500, 4500));                    while(timer.isRunning() && rangelevel < (Skills.getRealLevel(Skills.RANGE) *1.07)){                        Task.sleep(1000,2000);                    }                }            }        }    }    public class abilityuser extends Node {        @Override        public boolean activate() {            return Players.getLocal().getInteracting() != null && !Players.getLocal().isMoving();            // Check for waterfiend, whether it's interacting or not and validate the waterfiend.        }        @Override        public void execute() {            if((Settings.get(689) & 0x400) != 0x400){                prepareAbility();                for (int i = 0; i < 12; i++) {                    if (ActionBar.isReady(i) && ActionBar.getAbilityInSlot(i).available()){                        ActionBar.useSlot(i);                        Task.sleep(500);                        break;                    }                }            } else {                if (ActionBar.isReady(5) && ActionBar.getAbilityInSlot(5).available()){                    ActionBar.useSlot(5);                    Task.sleep(100,500);                }            }            if((ActionBar.getAdrenaline()/1000) == 100){            }        }        private void prepareAbility() {            if (Widgets.get(137, 56).isOnScreen() && !Widgets.get(137, 56).getText().equalsIgnoreCase("[Press Enter to Chat]")) {                Keyboard.sendKey('u001B');                Task.sleep(400);                Keyboard.sendKey('u001B');            }        }    }    public class familiar extends Node{        @Override        public boolean activate() {            return false;  //To change body of implemented methods use File | Settings | File Templates.        }        @Override        public void execute() {            /*if(Widgets.get(747, 7).getText().equals("0")) {                if(Inventory.getItem(sp1) != null) {                    Inventory.getItem(sp1).getWidgetChild().interact("Drink");                } else if(Inventory.getItem(sp2) != null) {                    Inventory.getItem(sp2).getWidgetChild().interact("Drink");                } else if(Inventory.getItem(sp3) != null) {                    Inventory.getItem(sp3).getWidgetChild().interact("Drink");                } else if(Inventory.getItem(sp4) != null) {                    Inventory.getItem(sp4).getWidgetChild().interact("Drink");                }            }            if(Inventory.getItem(arctic) != null) {                Widgets.get(747, 0).interact("Renew");            } else {                summoning = false;            }*/        }    }}
import java.awt.Color;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Point;import java.awt.Polygon;import java.awt.Rectangle;import java.text.DecimalFormat;import java.text.NumberFormat;import java.util.ArrayList;import javax.swing.JOptionPane;import bot.script.BotScript;import bot.script.enums.Skill;import bot.script.methods.Calculations;import bot.script.methods.Camera;import bot.script.methods.Game;import bot.script.methods.GroundItems;import bot.script.methods.Inventory;import bot.script.methods.Keyboard;import bot.script.methods.Mouse;import bot.script.methods.Npcs;import bot.script.methods.Objects;import bot.script.methods.Players;import bot.script.methods.Skills;import bot.script.methods.Walking;import bot.script.methods.Widgets;import bot.script.util.Random;import bot.script.wrappers.Component;import bot.script.wrappers.Entity;import bot.script.wrappers.GameObject;import bot.script.wrappers.GroundItem;import bot.script.wrappers.Item;import bot.script.wrappers.NPC;import bot.script.wrappers.Player;import bot.script.wrappers.Tile;import bot.script.wrappers.Widget;public class GeashawsChopAndFletch extends BotScript {	private NumberFormat k = new DecimalFormat("###,###,###");	private final ProgressTimer timer = new ProgressTimer();		Area treeArea = new Area(new Tile[] { new Tile(3168, 3238), new Tile(3195, 3238)});	Area spawnArea = new Area(new Tile[] { new Tile(3216, 3214), new Tile(3224, 3222)});		public final int TREES[] = {1276, 1278, 1282, 1286};	public final int LOG = 1512;	public final int KNIFE = 947;	public final int ARROW_SHAFT = 53;			public final int BRONZE_AXE = 1351;	public final int IRON_AXE = 1350;	public final int STEEL_AXE = 1353;	public final int BLACK_AXE = 1361;	public final int MITHRIL_AXE = 1355;	public final int ADAMANT_AXE = 1358;	public final int RUNE_AXE = 1359;		int KEEP[] = {1351, 1350, 1353, 1361, 1355, 1357, 1359, 53, 947, 1512};		int[] spirit2 = { 438, 439, 440, 441, 442, 443 };	int[] chicken2 = { 2463, 2464, 2465, 2466, 2467, 2468 };		NPC Chicken = Npcs.getNearest(chicken2);	NPC pirate = Npcs.getNearest(2539);	NPC plant = Npcs.getNearest(407);	NPC genie = Npcs.getNearest(409);	NPC OldMan = Npcs.getNearest(410);	NPC Guard = Npcs.getNearest(4375);	NPC Hyde = Npcs.getNearest(2540);	NPC Swarm = Npcs.getNearest(411);	NPC drunkenDwarf = Npcs.getNearest(956);	NPC Rick = Npcs.getNearest(2476);	NPC frog = Npcs.getNearest(2470);	GameObject frogobj = Objects.getNearest(5955);		public int START_SHAFTS, SHAFTS_MADE, PROFIT, START_EXP_WOODCUTTING, START_EXP_FLETCHING, WOODCUTTING_EXP_GAINED, FLETCHING_EXP_GAINED, START_LEVEL_WOODCUTTING, START_LEVEL_FLETCHING, WOODCUTTING_LEVELS_GAINED, FLETCHING_LEVELS_GAINED;	long START_TIME = 0;		private String info = "";		@Override	public boolean onStart() {		info = JOptionPane.showInputDialog(null, "Login information:","username:password");		START_TIME = System.currentTimeMillis();		START_EXP_WOODCUTTING = Skills.getXp(Skill.WOODCUTTING);				START_EXP_FLETCHING = Skills.getXp(Skill.FLETCHING);				START_LEVEL_WOODCUTTING = Skills.getLevel(Skill.WOODCUTTING);		START_LEVEL_FLETCHING = Skills.getLevel(Skill.FLETCHING);		START_SHAFTS = Inventory.getCount(ARROW_SHAFT, true);				log("Activating run");		if(!Walking.isRunOn()){			Walking.setRun(true);		}						/*Mouse.click(new Point(Random.nextInt(671,681), Random.nextInt(477,487)));	    sleep(100, 200);	    Mouse.click(new Point(Random.nextInt(640, 650), Random.nextInt(427,437)));	    sleep(100, 200);	    Mouse.click(new Point(Random.nextInt(635, 645), Random.nextInt(181, 191)));*/		    		log("Starting level woodcutting: " + START_LEVEL_WOODCUTTING + " and fletching: " + START_LEVEL_FLETCHING);				return true;	}		public void onFinish(){		log("Woodcutting exp: " + WOODCUTTING_EXP_GAINED + " [" + WOODCUTTING_LEVELS_GAINED + " level(s)]" + " and fletching exp : " + FLETCHING_EXP_GAINED + " [" + FLETCHING_LEVELS_GAINED + " level(s)]");	}		public class ProgressTimer {		private long start;        public ProgressTimer() {this.start = System.currentTimeMillis();}        public void reset() {this.start = System.currentTimeMillis();}        public long getElapsed() {return (System.currentTimeMillis() - start);}	}		public void chop(){				GameObject tree = Objects.getNearest(TREES);				Component contineu = Widgets.getComponent(165, 2);		if(contineu != null){			contineu.interact("Continue");		}				/*if(spirit2 != null){			log("Evil tree?");		}*/				if(Inventory.getCount(LOG, false) < 10){			if(tree != null){				if(tree.isVisible()){					if(Players.getLocal().getAnimation() == -1){						for(int i = 0; i < 5 && tree != null && Players.getLocal().getAnimation() == -1; i++){							tree.interact("Chop down");							sleep(800, 1500);						}					}				} else {					if(!tree.isVisible()){						Walking.walkTo(tree.getLocation());						sleep(1000, 1500);					}				}			} else {				while(tree == null){					sleep(100);				}			}			}	}		public void fletch(){				Item regular = Inventory.getItem(LOG);		Item knife = Inventory.getItem(KNIFE);		Component shaft = Widgets.getComponent(305, 9);						Component contineu = Widgets.getComponent(165, 2);		if(contineu != null){			contineu.interact("Continue");		}				if(shaft != null){						if(Players.getLocal().getAnimation() != 1248){				shaft.interact("Make 10");				sleep(5000);			} else {				sleep(100);			}		} else {			knife.interact("Use");			sleep(500);			regular.interact("Use");			sleep(1000);		}			}		public void checkGameState(){		if (Game.getGameState() == 10) {			log("Attempting to log in..");			Mouse.click(421, 290);			Keyboard.typeText(info.split(":")[0], true);			Keyboard.typeText(info.split(":")[1], true);			Mouse.click(314, 317);		}		if (Game.getGameState() == (20 | 25)) {			sleep(100);		}		if (Widgets.get(378).isValid(Widgets.get(378)) == true) {			Widgets.getComponent(378, 6).click();		}	}		public void activateRun(){							log("Reactivating run");		Mouse.click(new Point(Random.nextInt(671,681), Random.nextInt(477,487)));	    sleep(100, 200);	    Mouse.click(new Point(Random.nextInt(640, 650), Random.nextInt(427,437)));	    sleep(100, 200);	    Mouse.click(new Point(Random.nextInt(635, 645), Random.nextInt(181, 191)));			        timer.reset();	}		public void dropItems() {				Item[] i = Inventory.getItems();				for (int i2 = 0; i2 < i.length; i2++) {					if (i[i2].getId() != BRONZE_AXE && i[i2].getId() != IRON_AXE && i[i2].getId() != STEEL_AXE 			&& i[i2].getId() != BLACK_AXE && i[i2].getId() != MITHRIL_AXE && i[i2].getId() != ADAMANT_AXE 			&& i[i2].getId() != RUNE_AXE && i[i2].getId() != ARROW_SHAFT && i[i2].getId() != KNIFE && i[i2].getId() != LOG) {				i[i2].interact("Drop");			}		}	}		@Override	public int loop() {				try {				Tile me = Players.getLocal().getLocation();						checkGameState();				dropItems();						/*if (timer.getElapsed() >= 1200000) {				activateRun();			}*/						if(spawnArea.contains(me)){				log("You died brah!");			}									if(Inventory.getCount(LOG, false) < 10){								chop();			} else {								fletch();			}									} catch(Exception e){			log("Error... (" + e + ")");			stop();		}						return Random.nextInt(100, 250);	}		private String GetRuntime() {		try {			long millis = System.currentTimeMillis() - START_TIME;			long hours = millis / (1000 * 60 * 60);			millis -= hours * (1000 * 60 * 60);			long minutes = millis / (1000 * 60);			millis -= minutes * (1000 * 60);			long seconds = millis / 1000;			return ("" + (hours < 10 ? "0" : "") + hours + ":"					+ (minutes < 10 ? "0" : "") + minutes + ":"					+ (seconds < 10 ? "0" : "") + seconds + "");		} catch (Exception e) {			return "";		}	}	private int getPerHour(final int value) {		return (int) (value * 3600000D / (System.currentTimeMillis() - START_TIME));	}		@Override	public void paint(Graphics g1) {		Graphics2D g = (Graphics2D) g1;		WOODCUTTING_EXP_GAINED = Skills.getXp(Skill.WOODCUTTING) - START_EXP_WOODCUTTING;		WOODCUTTING_LEVELS_GAINED = Skills.getLevel(Skill.WOODCUTTING) - START_LEVEL_WOODCUTTING;		FLETCHING_EXP_GAINED = Skills.getXp(Skill.FLETCHING) - START_EXP_FLETCHING;		FLETCHING_LEVELS_GAINED = Skills.getLevel(Skill.FLETCHING) - START_LEVEL_FLETCHING;				SHAFTS_MADE = Inventory.getCount(ARROW_SHAFT, true) - START_SHAFTS;		PROFIT = SHAFTS_MADE * 3;							g.setColor(Color.YELLOW);		g.drawString("Runtime: " + GetRuntime(), 8, 300);		g.drawString("Woodcutting: " + k.format(WOODCUTTING_EXP_GAINED) + " (" + k.format(getPerHour(WOODCUTTING_EXP_GAINED)) + ") " + WOODCUTTING_LEVELS_GAINED + " levels", 8, 312);		g.drawString("Fletching: " + k.format(FLETCHING_EXP_GAINED) + " (" + k.format(getPerHour(FLETCHING_EXP_GAINED)) + ") " +  FLETCHING_LEVELS_GAINED + " levels", 8, 324);		g.drawString("Shafts made: " + k.format(SHAFTS_MADE) + " (" + k.format(getPerHour(SHAFTS_MADE)) + ") + " + k.format(PROFIT) + " gp (" + k.format(getPerHour(PROFIT)) + ")", 8, 336);	}		public class Area {		private final Polygon area;		private final int plane;		public Area(final Tile[] tiles) {			this(tiles, 0);		}		public Area(final Tile[] tiles, final int plane) {			area = tileArrayToPolygon(tiles);			this.plane = plane;		}		public Area(final Tile sw, final Tile ne) {			this(sw, ne, 0);		}		public Area(final Tile sw, final Tile ne, final int plane) {			this(new Tile[] { sw, new Tile(ne.getX() + 1, sw.getY()),					new Tile(ne.getX() + 1, ne.getY() + 1),					new Tile(sw.getX(), ne.getY() + 1) }, plane);		}		public Area(final int swX, final int swY, final int neX, final int neY) {			this(new Tile(swX, swY), new Tile(neX, neY), 0);		}		public boolean contains(final int x, final int y) {			return this.contains(new Tile(x, y));		}		public boolean contains(final int plane, final Tile... tiles) {			return this.plane == plane && this.contains(tiles);		}		public boolean contains(final Tile... tiles) {			final Tile[] areaTiles = getTileArray();			for (final Tile check : tiles) {				for (final Tile space : areaTiles) {					if (check.equals(space)) {						return true;					}				}			}			return false;		}		public Rectangle getBounds() {			return new Rectangle(area.getBounds().x + 1, area.getBounds().y + 1,					getWidth(), getHeight());		}		public Tile getCentralTile() {			if (area.npoints < 1) {				return null;			}			int totalX = 0, totalY = 0;			for (int i = 0; i < area.npoints; i++) {				totalX += area.xpoints[i];				totalY += area.ypoints[i];			}			return new Tile(Math.round(totalX / area.npoints), Math.round(totalY					/ area.npoints));		}		public Tile getNearestTile(final Tile base) {			Tile currTile = null;			for (final Tile tile : getTileArray()) {				if (currTile == null						|| Calculations.distanceBetween(base, tile) < Calculations								.distanceBetween(currTile, tile)) {					currTile = tile;				}			}			return currTile;		}		public int getPlane() {			return plane;		}		public Tile[] getTileArray() {			final ArrayList<Tile> list = new ArrayList<Tile>();			for (int x = getX(); x <= getX() + getWidth(); x++) {				for (int y = getY(); y <= getY() + getHeight(); y++) {					if (area.contains(x, y)) {						list.add(new Tile(x, y));					}				}			}			return list.toArray(new Tile[list.size()]);		}		public Tile[][] getTiles() {			final Tile[][] tiles = new Tile[getWidth()][getHeight()];			for (int i = 0; i < getWidth(); ++i) {				for (int j = 0; j < getHeight(); ++j) {					if (area.contains(getX() + i, getY() + j)) {						tiles[i][j] = new Tile(getX() + i, getY() + j);					}				}			}			return tiles;		}		public int getWidth() {			return area.getBounds().width;		}		public int getHeight() {			return area.getBounds().height;		}		public int getX() {			return area.getBounds().x;		}		public int getY() {			return area.getBounds().y;		}		public Tile[][] getAreaTiles() {			Tile[][] tileArray = new Tile[getWidth()][getHeight()];			int i = 0;			while (i < getHeight()) {				int j = 0;				while (j < getWidth()) {					if (this.area.contains(getX() + i, getY() + j)) {						tileArray[i][j] = new Tile(getX() + i, getY() + j);					}					j++;				}				i++;			}			return tileArray;		}		private Polygon tileArrayToPolygon(final Tile[] tiles) {			final Polygon poly = new Polygon();			for (final Tile t : tiles) {				poly.addPoint(t.getX(), t.getY());			}			return poly;		}	}		//start antirandoms		public static Point getRandomPointNear(Point p, int offset) {			int r = Random.nextInt(0, 4);			Point rP = null;			switch (r)			{			case 1:				rP = new Point(p.x + Random.nextInt(0, offset), p.y + Random.nextInt(0, offset));				break;			case 2:				rP = new Point(p.x - Random.nextInt(0, offset), p.y - Random.nextInt(0, offset));				break;			case 3:				rP = new Point(p.x - Random.nextInt(0, offset), p.y + Random.nextInt(0, offset));				break;			default:				rP = new Point(p.x + Random.nextInt(0, offset), p.y - Random.nextInt(0, offset));			}			return rP;		}		public void clickToContinue() {			Mouse.move(getRandomPointNear(new Point(305, 449), 7));			sleep(200, 400);			Mouse.click(true);		}		public void runFromCombat(){			if (Players.getLocal().inCombat()){				//runFrombank();				sleep(1000, 1500);			}		}		public boolean isRandomHere(int id){			try {				NPC rNpc = Npcs.getNearest(id);				Entity e = rNpc.getInteractingEntity();				if (rNpc != null){					if (e != null){						if ((e instanceof Player)){							Player p = (Player)e;							if (p != null){								if (Calculations.distanceBetween(rNpc.getLocation(), Players.getLocal().getLocation()) <= 2.0D)									return true;							}						}					}				}				return false;			} catch (Exception e) {			}			return false;		}		int[] randomEventNpcs = {4375, 2540, 410, 409, 956, 2539, 2538, 407, 411, 2470};		public int getRandomHere()		{			NPC rNpc = Npcs.getNearest(randomEventNpcs);			if (rNpc != null)			{				if (isRandomHere(rNpc.getId()))					return rNpc.getId();			}			return -1;		}		public void checkForRandoms() {			switch (getRandomHere())			{			case -1:				//randomStatus = "Safe";				break;			case 407:				//randomStatus = "Strange Plant";				NPC plant = Npcs.getNearest(407);				if (plant.isVisible())				{					Camera.turnToTile(plant.getLocation());					sleep(50, 100);					plant.interact("Pick"); } break;			case 410:				//randomStatus = "Old Man";				NPC oldman = Npcs.getNearest(410);				Camera.turnToTile(oldman.getLocation());				oldman.interact("Talk-to Mysterious Old Man");				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				break;			case 409:				//randomStatus = "Genie";				NPC genie = Npcs.getNearest(409);				if (genie.isVisible())				{					Camera.turnToTile(genie.getLocation());					sleep(50, 100);					//randomStatus = "Talking to Genie";					genie.interact("Talk-to Genie");					sleep(900, 1150);					clickToContinue();					sleep(2000, 2500);					Item lamp = Inventory.getItem(2529);					//randomStatus = "Using lamp on WC";					if (lamp != null)					{						lamp.interact("Rub");						sleep(1500, 2000);						Mouse.click(Widgets.getComponent(134, 20).getRandomPoint());						sleep(1500, 2000);						Mouse.click(Widgets.getComponent(134, 26).getRandomPoint());						sleep(500, 900);					}				}				break;			case 2539:				//randomStatus = "Pirate";				NPC pirate = Npcs.getNearest(2539);				Camera.turnToTile(pirate.getLocation());				pirate.interact("Talk-to Cap'n Hand");				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				break;			case 2538:				//randomStatus = "Giles";				break;			case 2540:				//randomStatus = "Dr Jekyll";				NPC hyde = Npcs.getNearest(2540);				Camera.turnToTile(hyde.getLocation());				hyde.interact("Talk-to Dr Jekyll");				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				break;			case 956:				//randomStatus = "Dwarf";				NPC dwarf = Npcs.getNearest(956);				Camera.turnToTile(dwarf.getLocation());				dwarf.interact("Talk-to Drunken Dwarf");				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				break;			case 2536:				//randomStatus = "Niles";				break;			case 2537:				//randomStatus = "Miles";				break;			case 4375:				//randomStatus = "Security Guard";				NPC guard = Npcs.getNearest(4375);				if (guard.isVisible())				{					Camera.turnToTile(guard.getLocation());					sleep(50, 100);					//status = "Talking to Guard";					guard.interact("Talk-to Security Guard");					sleep(900, 1150);					clickToContinue();					sleep(2000, 2500);					Item book = Inventory.getItem(2529);					if (book != null)					{						//randomStatus = "Dropping that shit";						book.interact("Drop");					}				}				break;			case 2476:				//randomStatus = "Rick Turpentine";				NPC rick = Npcs.getNearest(2476);				Camera.turnToTile(rick.getLocation());				rick.interact("Talk-to Rick Turpentine");				sleep(2000, 4000);				clickToContinue();				sleep(2000, 4000);				break;			case 3117:				//randomStatus = "Sandwich Bitch";				break;			case 2458:				//randomStatus = "Starting Freaky Forester";				sleep(1000, 1500);				solveFreakyForester();				break;			case 1056:				//randomStatus = "Starting Mime";				sleep(1000, 1500);				solveMime();				break;			case 494:				log("talking to banker");			}		}		public void solveMime()		{			int mime = 1056;			int mimeEmote = -1;			boolean yourTurn = false;			int turns = 0;			while (Npcs.getNearest(mime) != null)			{				while ((mimeEmote == -1) && (!yourTurn) && (turns < 5)) {					mimeEmote = Npcs.getNearest(mime).getAnimation();					sleep(1000);					if ((mimeEmote != -1) && (valid(Widgets.get(188)) == true)) {						yourTurn = true;					}				}				if (yourTurn == true)				{					int child = 0;					switch (mimeEmote) {					case 860:						child = 2;						break;					case 857:						child = 3;						break;					case 861:						child = 4;						break;					case 866:						child = 5;						break;					case 1130:						child = 6;						break;					case 1129:						child = 7;						break;					case 1128:						child = 8;						break;					case 1131:						child = 9;					}					int x = Widgets.get(188).getChild(child).getX();					int y = Widgets.get(188).getChild(child).getY();					Mouse.move(x + 50, y + 35);					sleep(50, 150);					Mouse.click(true);					mimeEmote = -1;					yourTurn = false;					turns++;					sleep(1000);				}			}		}		public void solveFreakyForester() {			int freakyForester = 2458;			int interactFF = 32769;			boolean completed = false;			int chickentokill = 0;			boolean gotMeat = false;			NPC lumberjack = Npcs.getNearest(freakyForester);			GroundItem pheasantMeat = GroundItems.getNearest(6179);			GameObject forestportal = Objects.getNearest(8972);			int meats = 6179;			if (lumberjack != null) {				if (chickentokill == 0) {					log("Starting forrester random");					Camera.turnToTile(lumberjack.getLocation());					sleep(500);					Npcs.getNearest(freakyForester).interact("Talk-To");					sleep(150, 250);					String chickentokilltext = "test";					if (Widgets.getComponent(242, 2) != null) {						chickentokilltext = Widgets.getComponent(242, 2).getText();					}					else if (Widgets.getComponent(243, 2) != null) {						chickentokilltext = Widgets.getComponent(243, 2).getText();					}					String one = "one";					String two = "two";					String three = "three";					String four = "four";					if (chickentokilltext.indexOf(one) != -1) {						chickentokill = 2459;						sleep(150, 250);					} else if (chickentokilltext.indexOf(two) != -1) {						chickentokill = 2460;						sleep(150, 250);					} else if (chickentokilltext.indexOf(three) != -1) {						chickentokill = 2461;						sleep(150, 250);					} else if (chickentokilltext.indexOf(four) != -1) {						chickentokill = 2462;						sleep(150, 250);					}					sleep(1000);					pheasantMeat = GroundItems.getNearest(meats);				}				else if ((!Inventory.contains(meats)) && (!gotMeat)) {					if (pheasantMeat == null) {						Npcs.getNearest(chickentokill).interact("Attack");						sleep(3000, 5000);						pheasantMeat = GroundItems.getNearest(meats);					} else if ((pheasantMeat != null) && (!Inventory.isFull())) {						pheasantMeat = GroundItems.getNearest(meats);						pheasantMeat.interact("Take");						gotMeat = true;						sleep(3000, 6000);					} else if ((pheasantMeat != null) && (Inventory.isFull())) {						if (Inventory.contains(59)) {							Inventory.getItem(59).interact("drop");							sleep(3000, 6000);							pheasantMeat.interact("Take");							gotMeat = true;							sleep(3000, 6000);						} else if ((Inventory.contains(1516)) && (!Inventory.contains(59))) {							Inventory.getItem(1516).interact("drop");							sleep(3000, 6000);							pheasantMeat.interact("Take");							gotMeat = true;							sleep(300, 600);						} else {							log("Inventory full cannot complete random");							return;						}					}				}				if (gotMeat == true) {					Camera.turnToTile(lumberjack.getLocation());					sleep(500);					Npcs.getNearest(freakyForester).interact("Talk-to");					sleep(4000);					completed = true;				}				if (completed == true) {					Walking.walkTo(forestportal.getLocation());					sleep(10000);					Camera.turnToTile(forestportal.getLocation());					sleep(500);					Objects.getNearest(8972).click();					sleep(10000);					if (valid(Widgets.get(566))) {						Widgets.getComponent(566, 18).click();					}					sleep(5000);					lumberjack = Npcs.getNearest(freakyForester);				}				sleep(2000);				return;			}		}		public boolean valid(Widget w)		{			for (Widget i : Widgets.getLoaded()) {				if (w.getIndex() == i.getIndex())					return true;			}			return false;		}}
Edited by Geashaw
Link to comment
Share on other sites

He is trying to supply users with the scripts for almost every need. He is probably examining the code and placing you in a group.

I find what you posted to be quite confusing, but I understand what you mean.

Once the OSBot team has an API for programmers to work with, we will be able to write scripts (or plug-ins if you like) to perform actions. At this moment there are no scripts flowing around (lacking the API) so what code are they examining exactly? wink.png

Applicants will get early access to the tools needed to start work on our scripts.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...