All pastes #613748 Raw Edit

Anonymous

public javascript v1 · immutable
·published 2007-07-11 04:36 UTC
rendered paste body
import java.awt.*;import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.*;import java.awt.Color;import java.awt.Graphics;import impsoft.nexus.bots.color.scriptable.*;import impsoft.nexus.bots.color.ColorBot;import impsoft.nexus.bots.color.scriptable.interfaces.AutoPaint;import impsoft.nexus.bots.color.scriptable.objects.EdgeRGBCluster;import impsoft.nexus.bots.color.structures.RGB;import impsoft.nexus.bots.reflection.objects.AryanPath;import impsoft.nexus.bots.reflection.structures.AryanTile;import impsoft.nexus.bots.color.util.Timer;//by bbSoftpublic class bbZammyWines extends ColorScript implements AutoPaint{ //http://www.bbsoft-scripts.com public static String[] commands = new String[] { "Zammy wine" }; public static String author = "bbSoft"; public static String description = "gets wine dead walk everything should be flawless..."; public static double version = 1.0; //paths and other tiles: AryanTile[] path = new AryanTile[] { new AryanTile(3222,3219),new AryanTile(3234,3219),new AryanTile(3230,3232), new AryanTile(3220,3242),new AryanTile(3215,3254),new AryanTile(3149,3261), new AryanTile(3138,3265),new AryanTile(3107,3264),new AryanTile(3103,3272), new AryanTile(3094,3274),new AryanTile(3069,3278),new AryanTile(3007,3279), new AryanTile(3006,3325),new AryanTile(2998,3327),new AryanTile(2981,3321), new AryanTile(2953,3320),new AryanTile(2946,3336),new AryanTile(2950,3364), new AryanTile(2948,3377),new AryanTile(2944,3377),new AryanTile(2944,3371)}; AryanTile[] path2; //NOW GATHERED FROM AUTH SERVER  AryanTile deathTile = new AryanTile(3222, 3217); AryanTile rangeTile = new AryanTile(2930,3518); //collors RGB[] WC = new RGB[] {new RGB(155,145,144) }; EdgeRGBCluster WineCol = new EdgeRGBCluster(WC, this); //int's	 int GetCount=0; int DeadCount=0; int XpCount=0; int Ammountofrunes; int RunesUsed=0; int Lawrunesthere; //Strings String forumUsername = ""; String forumPassword = ""; //booleans boolean authed = false; boolean argError = false; //timers Timer startTime = new Timer(0L); // rects Rectangle TeleGrabs = new Rectangle(691, 279, 8, 6); AryanPath DeadFallyW = new AryanPath(path, this); AryanPath ToWines; //Calls path2 in the authup() function ;)//script start public bbZammyWines(ColorBot b, String cmd, String args[]) {  super(b);    if (args.length < 3) {	 log("Usage: forumUsername,forumPassword,AmountOfRunes");	 argError = true;	} else {	 forumUsername = args[0];	 forumPassword = args[1];	 Ammountofrunes = strToInt(args[2]);	}	if (!argError) {	 try {	  if (authUP()) {		 log("Authed Accepted! Loading bbZammyWines...");		 authed = true;		} else {		 log("Auth Denied! - Please buy an auth at http://www.bbSoft-scripts.com");		}	 } catch (Exception e) {	  authed = false;	 }	 log("Starting script...");	} } public void script()throws InterruptedException {  if(!authed)   return;  if(argError)   return;  if (!latestVersion())   return;     while(true) {	 while(Alive() == true) {	  if(RunesUsed >= Ammountofrunes){	   shutDown();	  }	  if(RunesUsed==0){	   WhereAreWe();	  }	  BackToBank();	  Bankshizz();	  theTabs.Options.setRun(true);	  GetBackWalk();	  GetWines();	  GetWineslast();	  theTabs.Options.setRun(false);    if(rangeTile.distanceTo(getLocation()) > 5 && rangeTile.distanceTo(getLocation()) < 25){     GetBackWalk();    }   }  } } public void ClickAndGet()throws InterruptedException {  if(WineCol != null) {	 while (!theTopText.getTopText().contains("kine")) {	  theTabs.Magic.setSelected();	  mouseClickLeft(TeleGrabs);  	sleep(50);	 }	 while (theTopText.getTopText().contains("kine")) {  	WineCol.doTopTextAndMenu("-> Wine"," Cast");	  sleep(50);	 }  } } public void GetWines()throws InterruptedException {  int howmany = theTabs.Inventory.getCount();	WieldStaff();	while(howmany <= 25 &&RunesUsed<=Ammountofrunes) {	 if(rangeTile.distanceTo(getLocation()) > 5&&rangeTile.distanceTo(getLocation()) < 25){	  GetBackWalk();	 }	 ClickAndGet();	 sleep(random(2000,3000)); 	 howmany = theTabs.Inventory.getCount();	 log("you have"+ howmany+"items");	 Randomshit();	 sleep(random(14000,15500));  	 RunesUsed=RunesUsed+1;	} }	 public void GetWineslast()throws InterruptedException {	ClickAndGet();	sleep(random(20000,22000)); 	RunesUsed++; } public boolean Alive()throws InterruptedException {  if(getLocation().distanceTo(deathTile) > 25) {	 return true;	}else{	 log("OMGOZORZ WE ARE DEAD!! deadwalk pl0x??");	 DeadCount++;	 DeadWalk();	 return false;	} } public void GetBackWalk()throws InterruptedException {  theTabs.Options.setRun(true);	log("walking back");	ToWines.walkToEnd(); } public void BackToBank()throws InterruptedException {	  ToWines.walkToStart();  log("walking to bank"); }	 public void Bankshizz()throws InterruptedException {  log("Deposit all exept for possible unwielded staff...");  this.theBank.doDepositAllBut(new String[]{ "of ai" });  log("Withdraw 27 laws");  while(theTabs.Inventory.getCount() !=1) {   this.theBank.doWithDrawX("Law", 27);   sleep(random(1000,1500));  } } public void WieldStaff()throws InterruptedException {  if(theTabs.Inventory.getCount() > 0) {   theTabs.Inventory.doAction("eld S", "eld", 28, true);  } } public void Randomshit() throws InterruptedException {  int RandomShit = random(1, 500);  if (RandomShit >= 1 && RandomShit <= 5) {   theCompass.setNorth();   sleep(random(1500, 2500));  }  if (RandomShit > 5 && RandomShit <= 10) {   theCompass.setWest();   sleep(random(1500, 2500));  }  if (RandomShit > 10 && RandomShit <= 15) {   theCompass.setSouth();   sleep(random(1500, 2500));  }  if (RandomShit > 15 && RandomShit <= 20) {   theCompass.setEast();   sleep(random(1500, 2500));  }  if (RandomShit > 20 && RandomShit <= 25) {   theTabs.Controls.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 25 && RandomShit <= 30) {   theTabs.Equipment.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 30 && RandomShit <= 35) {   theTabs.Friends.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 40 && RandomShit <= 45) {   theTabs.Logout.setSelected ();   sleep(random(1500, 2500));  }  if (RandomShit > 45 && RandomShit <= 50) {   theTabs.Magic.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 50 && RandomShit <= 55) {   theTabs.Options.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 55 && RandomShit <= 60) {   theTabs.Prayer.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 60 && RandomShit <= 65) {   theTabs.Quest.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 65 && RandomShit <= 70) {   theTabs.Statistics.setSelected();   sleep(random(1500, 2500));  }  if (RandomShit > 70 && RandomShit <= 500) {   sleep(random(3000, 4500));  } }  public void  WhereAreWe()throws InterruptedException { if(getLocation().distanceTo(deathTile) > 25) { log("just walking to the bank :)"); DeadFallyW.walkToEnd(); } if(getLocation().distanceTo(rangeTile) > 25) {  BackToBank();  } } public void DeadWalk()throws InterruptedException {  WieldStaff();	DeadFallyW.walkToEnd();	RunesUsed=RunesUsed+27; }	 public void paint(Graphics g) {  g.setColor(Color.PINK);  g.drawString("Welcome to bbSoft's Zammy wine collecter v" + version, 20, 40);  g.setColor(Color.RED);  g.drawString("We have gathered approximately: " + RunesUsed + " zammy wines", 20, 60);  double litlesom=Ammountofrunes-RunesUsed;  g.drawString("We still have to do: " + litlesom + " zammy wines", 20, 80);  g.drawString("Time running: " + startTime.timePassed()/1000/60+" Min", 20, 100);  if(DeadCount<1) {   g.setColor(Color.GREEN);  }  if(DeadCount>5&&DeadCount<10) {   g.setColor(Color.YELLOW);  }  if(DeadCount>10) {   g.setColor(Color.BLACK);  }  g.drawString("Dead count: " + DeadCount, 20, 120);  double som=RunesUsed*43;  g.setColor(Color.RED);  g.drawString("We gained (if we have not died): " + som+ " XP", 20, 140); }  private String readPage(URL url) {  try {	 URLConnection uc = url.openConnection();	 uc.connect();	 InputStreamReader in = new InputStreamReader(uc.getInputStream());	 BufferedReader data = new BufferedReader(in); 	 String line;	 String buffer = "";	 while ((line = data.readLine()) != null) {	  buffer += line;	 }	 return buffer;  } catch (Exception e) {	 e.printStackTrace();	 return null;	} } public int strToInt(String omg) {  return Integer.parseInt(omg); } public boolean latestVersion() throws InterruptedException {  String page1 = "";	try {	 page1 = readPage(new URL("http://bbsoft-scripts.com/ipb/index.php?act=bbzammywinesauth&version=1"));	} catch (Exception e) {	 return false;  }	double newVer = Double.parseDouble(page1);	if (newVer == version) {	 log("You have the latest version of bbZammyWines!");	 return true;	}	log("There is a new version (v" + newVer + ") of bbZammyWines, please download it at http://www.bbSoft-scripts.com");		return false;	} public boolean authUP() throws InterruptedException {  String page = "";  InetAddress address;	try { // This is a check for the host redirection trick.	 address = InetAddress.getByName("bbsoft-scripts.com");	 if (!address.getHostAddress().equals("77.232.72.88"))	  return false;	} catch (UnknownHostException e) {	 return false;	}	try {	 String tempUser = forumUsername.replaceAll(" ", "%20");	 String tempPass = forumPassword.replaceAll(" ", "%20");   page = readPage(new URL("http://bbsoft-scripts.com/ipb/index.php?act=bbzammywinesauth&name=" + tempUser + "&pass=" + tempPass));	} catch (Exception e) {	 return false;	}	if (page.equals("null") || page.equals(""))	 return false;	if (!address.getHostAddress().equals("77.232.72.88")) // Double check 	 return false;	   String[] sectA = page.split("&");	try {	 path2 = new AryanTile[sectA.length];	 for(int i = 0; i < sectA.length; i++) {	  String[] temp = sectA[i].split(":");    path2[i] = new AryanTile(strToInt(temp[0]), strToInt(temp[1]));	 }  } catch (Exception e) {   log("OMG: " + e);   return false;  }			// INITIALIZE THE PATH	ToWines = new AryanPath(path2, this);	  return true; }}