Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import javax.imageio.ImageIO;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.JButton;
- import javax.swing.JCheckBox;
- import javax.swing.JComboBox;
- import javax.swing.JFileChooser;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import javax.swing.JTabbedPane;
- import javax.swing.JTextField;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.util.Filter;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSComponent;
- @ScriptManifest(name = "konzy's Master Stealer", authors = "konzy", keywords = "Thieving",
- version = 0.51, description = "Master Farmer Thieving by konzy")
- public class konzyMasterStealer extends Script implements PaintListener, ServerMessageListener , MouseListener
- {
- final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- static final RSArea MARKET_AREA = new RSArea(new RSTile(3069, 3245), new RSTile(3086, 3258));
- static final RSArea BANK_AREA = new RSArea(new RSTile(3092,3240),new RSTile(3097,3246));
- static final RSArea WALK_AREA = new RSArea(new RSTile(3088,3247),new RSTile(3097,3250));
- static final RSTile MARKET_TO_BANK[] = {new RSTile(3084,3249), new RSTile(3089,3249), new RSTile(3092,3248), new RSTile(3093,3245)};
- static final RSTile MARKET_TILE = new RSTile(3080,3250);
- static final RSTile BANK_TILE = new RSTile(3093,3244);
- static final RSTile EXIT_TILE = new RSTile(3092,3249);
- static final RSTile CENTRAL_TILE = new RSTile(3085,3249);
- static final RSTile PATH_TO_BANK[] = {CENTRAL_TILE , BANK_TILE};
- static final RSTile PATH_FROM_BANK[] = {EXIT_TILE , CENTRAL_TILE};
- static final int[] KEEP_ID = {
- 5100, 5295, 5296, 5298, 5299, 5300, 5301, 5302, 5303, 5304,
- 5320, 5321, 5323};
- static final String KEEP_NAME[] = {
- "impwurt", "anarr", "oadflax", "vantoe", "wuarm",
- "napdragon", "adantine", "antadyme", "warf", "orstol",
- "weetcorn", "atermelon", "trawberry"};
- static final int[] DONT_DROP_ID = {
- 617, 1733, 1734, 10115, 10075, 10076
- };
- static final int[] DROP_ID = {
- 5319, 5307, 5305, 5322, 5099, 5310, 5308, 5102, 5294, 5309,
- 5101, 5096, 5324, 5306, 5291, 5103, 5292, 5097, 5281, 5098,
- 5105, 5106, 5280, 5297, 5311, 5104, 5293, 5318, 5282, 1993,
- 1937};
- static final int KEEP_ID_COUNT = 13;
- static final int DROP_ID_COUNT = 31;
- static final int DONT_DROP_ID_COUNT = 6;
- static final int FARMER_ID = 2234;
- static final int BOOTH_ID = 2213;
- static final int STUNNED_ID = 424;
- //private boolean guiWait = true, guiExit;
- private boolean dropSeeds = false;
- private boolean failedPick = false;
- private int profit = 0;
- private int withdrawFood = 5;
- private int foodPrice = 0;
- private int HP;
- private int startLvl;
- private int gainedLvls;
- private int startXP = 0;
- private int succeedPickpockets = 0;
- private int failPickpockets = 0;
- private int foodEaten = 0;
- private long startTime;
- private String status = "";
- private boolean showPaint;
- private int completeIDs[][] = new int[3][KEEP_ID_COUNT];
- private int totalComplete = 0;
- private RSItem carriedFood;
- private RSNPC masterFarmer;
- private boolean justAttacked = false;
- public boolean onStart() {
- if(!game.isLoggedIn()) {
- log("Start logged in.");
- return false;
- }
- /*
- startScript = false;
- konzyMasterStealerGUI gui = new konzyMasterStealerGUI();
- while(!startScript) {
- if(!gui.isVisible())
- return false;
- sleep(100);
- }
- */
- carriedFood = getFood();
- if (carriedFood != null){
- try {
- status = "Getting Prices";
- foodPrice = grandExchange.getMarketPrice(carriedFood.getID());
- } catch (Exception e) {}
- }else {
- log("Please start with food in your inventory.");
- return false;
- }
- log("The Item ID of your food is " + carriedFood.getID());
- startTime = (int)System.currentTimeMillis();
- startXP = skills.getCurrentExp(Skills.THIEVING);
- startLvl = skills.getCurrentLevel(Skills.THIEVING);
- showPaint = true;
- return true;
- }
- private RSItem getFood(){
- for(RSItem i : inventory.getItems()) {
- if(i == null || i.getID() == -1)
- continue;
- if (i.getComponent().getActions() == null || i.getComponent().getActions()[0] == null)
- continue;
- if (i.getComponent().getActions()[0].contains("Eat")){
- return i;
- }
- }
- return null;
- }
- private void hoverFarmer(){
- if(npcs.getNearest("Master Farmer").isValid()){
- if(npcs.getNearest("Master Farmer").isOnScreen()){
- Point farmerScreenLoc = npcs.getNearest("Master Farmer").getScreenLocation();
- int x = mouse.getLocation().x;
- int y = mouse.getLocation().y;
- int x2 = farmerScreenLoc.x;
- int y2 = farmerScreenLoc.y;
- int xdiff;
- int ydiff;
- if(x > x2)
- xdiff = x - x2;
- else
- xdiff = x2 - x;
- if(y > y2)
- ydiff = y - y2;
- else
- ydiff = y2 - y;
- if(ydiff > 75 || xdiff > 75)
- try{
- mouse.move(farmerScreenLoc);
- }catch (Exception e){}
- }
- }
- }
- private int getCurrentLifepoint() {
- if (interfaces.get(748).getComponent(8).getText() != null && interfaces.get(748).getComponent(8).isValid()) {
- HP = Integer.parseInt(interfaces.get(748).getComponent(8).getText());
- }
- return HP;
- }
- public boolean isHealthLow() {
- int CurrHP = getCurrentLifepoint() / 10;
- int RealHP = skills.getRealLevel(Skills.CONSTITUTION);
- if (CurrHP <= random(RealHP / 2, RealHP / 1.5)) {
- status = "Eating Food";
- return true;
- }
- if (getMyPlayer().getHPPercent() <= 10) {
- log.warning("HP less than 10% Logging out.");
- game.logout(true);
- stopScript(true);
- }
- return false;
- }
- private final Filter<RSNPC> npcFilter = new Filter<RSNPC>() {
- public boolean accept(RSNPC t) {
- if(t.getName().equals("Master Farmer"))
- return false;
- return (t.isValid() && t.isInCombat() && t.isInteractingWithLocalPlayer() && t.getHPPercent() != 0);
- }
- };
- public boolean gettingAttacked(){
- RSNPC mGuard[] = npcs.getAll(npcFilter);
- if (mGuard != null && getMyPlayer().isInCombat())
- return true;
- return false;
- }
- private boolean eatFood() {
- for(int i = 0; i < 3; i++) {
- if(!inventory.contains(carriedFood.getID())){
- log("cant find food");
- break;
- }
- if(carriedFood.doAction("Eat")) {
- profit -= foodPrice;
- return true;
- }
- }
- return false;
- }
- public boolean openBank() {
- status = "Opening Bank";
- if(!bank.isOpen()){
- if (objects.getNearest(BOOTH_ID).isOnScreen()) {
- final RSObject bankBooth = objects.getNearest(BOOTH_ID);
- if (bankBooth != null) {
- bankBooth.doAction("Use-Quickly");
- }
- }
- return false;
- }
- return true;
- }
- public int loop(){
- antiBan(false);
- if(isHealthLow()){
- carriedFood = getFood();
- eatFood();
- return random(25, 50);
- }
- if (justAttacked && !BANK_AREA.contains(getMyPlayer().getLocation())){
- status = "RUN AWAY!!!";
- walking.setRun(true);
- walking.walkPathMM(PATH_TO_BANK , 1 , 1);
- antiBan(true);
- return random(3000, 5000);
- }else
- justAttacked = false;
- if(!inventory.contains(carriedFood.getID()) || inventory.isFull()){
- if(!BANK_AREA.contains(getMyPlayer().getLocation())){
- status = "Walking To Bank";
- walking.walkPathMM(PATH_TO_BANK , 1 , 1);
- }
- else if(!bank.isOpen())
- openBank();
- else if(inventory.getCount() >= 1){
- status = "Depositing";
- bank.depositAll();
- } else if (bank.getCount(carriedFood.getID()) == 0 && game.isLoggedIn()) {
- log("Out of food! logging out...");
- sleep(random(4000, 5000));
- bank.close();
- game.logout(true);
- stopScript(true);
- }else if (withdrawFood > inventory.getCount(carriedFood.getID()) ){
- try{
- if (withdrawFood - inventory.getCount(carriedFood.getID()) >= 10)
- bank.getItem(carriedFood.getID()).doAction("Withdraw-10");
- else
- bank.getItem(carriedFood.getID()).doAction("Withdraw-5");
- }catch (Exception e){}
- if(bank.close()){
- antiBan(true);
- return random(100, 250);
- }
- }
- return random(1500, 2000);
- }
- if (BANK_AREA.contains(getMyPlayer().getLocation())){
- status = "Walking Back To Market";
- walking.walkPathMM(PATH_FROM_BANK);
- return random(1000 , 1500);
- }
- if (!MARKET_AREA.contains(getMyPlayer().getLocation())){
- walking.walkTileMM(CENTRAL_TILE , 2 , 2);
- return random(1000 , 1500);
- }else if (failedPick){
- status = "failed";
- if(isHealthLow()){
- carriedFood = getFood();
- eatFood();
- antiBan(true);
- }
- if (inventory.containsOneOf(DROP_ID) && dropSeeds) {
- status = "Dropping Seeds";
- int dontDrop[] = {};
- int i;
- for (i = 0; i < KEEP_ID_COUNT ; i++)
- dontDrop[i] = KEEP_ID[i];
- while ((i - KEEP_ID_COUNT) < DONT_DROP_ID_COUNT){
- dontDrop[i] = DONT_DROP_ID[i - KEEP_ID_COUNT];
- i++;
- }
- dontDrop[i + 1] = carriedFood.getID();
- try {
- inventory.dropAllExcept(dontDrop);
- } catch (Exception e) {return 0;}
- }
- antiBan(true);
- hoverFarmer();
- failedPick = false;
- }else if(getMyPlayer().isInCombat()){
- status = "Still Stunned";
- return random(100 , 250);
- }
- else if(npcs.getNearest("Master Farmer").isValid()){
- try {
- masterFarmer = npcs.getNearest("Master Farmer");
- if(masterFarmer.isOnScreen()){
- status = "Pickpocketing!";
- masterFarmer.doAction("Pickpocket");
- antiBan(false);
- return random(250 , 400);
- } else {
- status = "Walking to Farmer";
- walking.walkTo((walking.randomizeTile(masterFarmer.getLocation(),1, 1)));
- }
- } catch (Exception e) {return 0;}
- antiBan(true);
- return random(200, 500);
- }
- return 0;
- }
- private void antiBan(boolean overRide){
- int randomNo = random(1, 20);
- int r = random(1, 12);
- if (randomNo == 3 || overRide) {
- if (r == 2) {
- status = "AB Open Random Tab";
- game.openTab(random(1, 14));
- }
- if (r == 3) {
- status = "AB Move Mouse Slightly";
- mouse.moveSlightly();
- }
- if (r == 4) {
- status = "AB Move Mouse";
- mouse.moveRandomly(70, 380);
- }
- if (r == 5) {
- status = "AB Move Off Screen";
- mouse.moveOffScreen();
- }
- if (r == 6) {
- status = "AB Rotate to Master Farmer";
- if(npcs.getNearest("Master Farmer") != null)
- camera.turnToCharacter(npcs.getNearest("Master Farmer"));
- }
- if (r == 7) {
- status = "AB Rotate Camera";
- camera.setAngle(random(5, 120));
- }
- if (r == 8) {
- status = "AB Rotate Camera";
- camera.setAngle(random(80, 230));
- }
- if (r == 9) {
- status = "AB Rotate Camera";
- camera.setAngle(random(150, 180));
- }
- if (r == 10) {
- status = "AB Rotate Camera";
- camera.setAngle(random(250, 360));
- }
- if (r == 11) {
- status = "AB Open Skill Tab";
- if (game.getCurrentTab() != 4) {
- game.openTab(4);
- } else return;
- }
- if (r == 12) {
- status = "AB Look AT Thieving Skill";
- if (game.getCurrentTab() != 1) {
- game.openTab(1);
- sleep(random(500, 700));
- mouse.move(random(620 , 665), random(295, 315));
- sleep(random(1000, 1500));
- }
- }
- }
- }
- int getItemID (String item){
- int i;
- for(i = 0 ; i < KEEP_ID_COUNT ; i++){
- if(item.contains(KEEP_NAME[i])){
- return KEEP_ID[i];
- }
- }
- return 0;
- }
- int itemPrice (int id){
- int p;
- for (int i = 0; i < totalComplete ; i ++ ){
- if (completeIDs[0][i] == id)
- return completeIDs[1][i];
- }
- try {
- status = "Getting Prices";
- p = grandExchange.getMarketPrice(id);
- } catch (Exception e) {return 0;}
- completeIDs[0][totalComplete] = id;
- completeIDs[1][totalComplete] = p;
- totalComplete++;
- return p;
- }
- public void serverMessageRecieved(ServerMessageEvent e) {
- String svrmsg = e.getMessage();
- if (svrmsg.contains("combat")) {
- justAttacked = true;
- }
- if (svrmsg.contains("stunned")){
- failedPick = true;
- failPickpockets++;
- }
- if (svrmsg.contains("restores"))
- foodEaten++;
- if (svrmsg.contains("advanced")) {
- sleep(random(1500, 2500));
- if (interfaces.canContinue()) {
- interfaces.clickContinue();
- }
- gainedLvls++;
- sleep(random(50,100));
- }
- if (svrmsg.contains("You steal")){
- succeedPickpockets++;
- if (svrmsg.contains("seed")) {
- int seedCount = 1;
- String splitString[] = svrmsg.split(" " , 10);
- String seedName = "";
- if (!splitString[2].contains("a") && !splitString[2].contains("an"))
- seedCount = Integer.parseInt(splitString[2].trim());
- seedName = splitString[3];
- int seedID = getItemID(seedName);
- if (seedID != 0){
- if (foodPrice == 0){
- try {
- status = "Getting Prices";
- foodPrice = grandExchange.getMarketPrice(carriedFood.getID());
- } catch (Exception e1) {}
- }
- profit += (itemPrice(seedID) * seedCount);
- }
- }
- }
- }
- //private class konzyMasterStealerGUI extends JFrame {}
- //START: Paint generated using Enfilade's Easel
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(0, 204, 0);
- private final Color color3 = new Color(255, 255, 255);
- private final Font font1 = new Font("Razer Regular", 0, 13);
- public void onRepaint(Graphics g1) {
- if(!showPaint){
- Graphics2D g = (Graphics2D)g1;
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Click Chat To See Paint", 160, 335);
- return;
- }
- int runTime = (int) (System.currentTimeMillis() - startTime);
- int hours = (int) runTime / (60 * 1000 * 60);
- int minutes = (int) (runTime - (hours * 60 * 1000 * 60)) / (60 * 1000);
- int seconds = (int) (runTime - (hours * 60 * 1000 * 60) - (minutes * 60 * 1000)) / 1000;
- int currentXP = skills.getCurrentExp(Skills.THIEVING);
- int currentLVL = skills.getCurrentLevel(Skills.THIEVING);
- int gainedXP = currentXP - startXP;
- int gainedLVL = currentLVL - startLvl;
- int xpPerHour = (int) ((3600000.0 / (double) runTime) * gainedXP);
- int succeedPickpocketsHour = (int) ((3600000.0 / (double) runTime) * succeedPickpockets);
- int profitPerHour = (int) ((3600000.0 / (double) runTime) * profit);
- String dispProfit = "" + profit;
- String dispProfitPerHour = "" + profitPerHour;
- if(profit < 0){
- dispProfit = "(" + (-profit) + ")";
- dispProfitPerHour = "(" + (-profitPerHour) + ")";
- }
- String normMinutes;
- String normSeconds;
- if (minutes < 10)
- normMinutes = "0" + minutes;
- else normMinutes = "" + minutes;
- if (seconds < 10)
- normSeconds = "0" + seconds;
- else normSeconds = "" + seconds;
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(8, 344, 502, 128);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("konzy's Master Stealer V " + properties.version(), 10, 355);
- g.drawString("XP Gained: " + gainedXP, 10, 370);
- g.drawString("XP/hr: " + xpPerHour, 10, 385);
- g.drawString("Current Level: " + currentLVL, 10, 400);
- g.drawString("% Level Up: " + (100 - skills.getPercentToNextLevel(Skills.THIEVING)) + "%", 10, 415);
- g.drawString("Levels Gained: " + gainedLVL, 10, 430);
- g.drawString("Run Time: " + hours + ":" + normMinutes + ":" + normSeconds, 10, 445);
- g.drawString("Number of Picks: " + succeedPickpockets, 250, 355);
- g.drawString("Picks per Hour: " + succeedPickpocketsHour, 250, 370);
- g.drawString("Picks Failed: " + failPickpockets, 250, 385);
- g.drawString("Profit: " + dispProfit, 250, 400);
- g.drawString("Profit Per Hour: " + dispProfitPerHour, 250, 415);
- g.drawString("Status: " + status, 250, 430);
- g.drawString("By konzy", 250, 445);
- g.setColor(color3);
- g.drawString("Click Paint To See Chat", 160, 335);
- }
- //END: Paint generated using Enfilade's Easel
- @Override
- public void mouseClicked(MouseEvent e) {
- RSComponent inter = interfaces.get(137).getComponent(0);
- if(inter.getArea().contains(e.getPoint())) {
- showPaint = !showPaint;
- }
- }
- @Override
- public void mousePressed(MouseEvent e) { }
- @Override
- public void mouseReleased(MouseEvent e) { }
- @Override
- public void mouseEntered(MouseEvent e) { }
- @Override
- public void mouseExited(MouseEvent e) { }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement