Hello everyone,
I'm releasing this script it made me bank but I don't use it anymore so I don't know how much money does it generate now, features:-
-GE
Buys Bows and collect
Sells Steel Arrows and collect
Change un-noted bows to noted
-Brain's Shop
Buys Steel Arrows until 1950
Sells bows only if the quantity in the shop is acceptable
Hops world (F2p)
-Friends Chat (Not completed)
Know the bot location
Send trade signal
-Update
Create file With all numbers (Bows sold, Arrows Bought)
Send Email (Via external jar)
Source
package Main;
import org.osbot.rs07.api.GrandExchange;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;
import java.awt.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@ScriptManifest(name = "Shopper", author = "Kadiem", version = 1.0, info = "", logo = "")
public class Main extends Script {
long Timer;
Area shopArea = new Area(2953, 3205, 2960, 3202);
Area grandexchangeArea = Banks.GRAND_EXCHANGE;
Area tradingArea = Banks.VARROCK_WEST;
static String Status = "Normal";
boolean GotTradeOffer;
Timer logTimer;
Timer updateTimer;
int numberofWSB;
int numberofWLB;
int numberofMSB;
int numberofMLB;
int numberofSA;
int coinsinbank;
@Override
public void onStart() throws InterruptedException {
logTimer = new Timer(0);
updateTimer = new Timer(0);
Timer = System.currentTimeMillis();
try {
File file = new File(getDirectoryData()+"info.txt");
if(!file.exists()) {
file.createNewFile();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public int onLoop() throws InterruptedException {
if(logTimer.Passed(1)){
log("Current money stock " + (int) inventory.getAmount("Coins"));
log("Current money stock in bank " + coinsinbank);
logTimer.reset();
}
if(updateTimer.Passed(30)){
Update();
updateTimer.reset();
sleep(random(2000,3000));
}
if(Status == "Normal") {
if (!GotTradeOffer) {
if (tabs.open(Tab.INVENTORY) && !trade.isFirstInterfaceOpen()) {
if (inventory.contains("Willow longbow") && inventory.contains("Willow shortbow") && inventory.contains("Maple shortbow") && inventory.contains("Maple longbow")) {
GoToShop();
}
if (!inventory.contains("Willow longbow") || !inventory.contains("Willow shortbow") || !inventory.contains("Maple shortbow") || !inventory.contains("Maple longbow")) {
GoToGe();
}
}
} else if (GotTradeOffer) {
Trade();
}
}else if (Status == "Muling"){
WalktoTrade();
}
return 100;
}
private void WalktoTrade() {
if(!tradingArea.contains(myPlayer())){
walking.webWalk(tradingArea);
}
}
public void Update(){
try {
File file = new File(getDirectoryData()+"info.txt");
if(!file.exists()) {
file.createNewFile();
}
PrintWriter pw = new PrintWriter(new FileWriter(file, true));
long timeRan = System.currentTimeMillis() - this.Timer;
pw.println(myPlayer().getName());
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
pw.println(dateFormat.format(date));
pw.println("Time running ["+formatTime(timeRan)+"]");
pw.println("Current money stock " +"["+(int) inventory.getAmount("Coins")/1000+"K"+"]");
pw.println("Number of steel arrows bought " +"["+ numberofSA+"]");
pw.println("Number of willow shortbows bought " +"["+ numberofWSB+"]");
pw.println("Number of willow longbows bought " +"["+ numberofWLB+"]");
pw.println("Number of maple shortbows bought " +"["+ numberofMSB+"]");
pw.println("Number of maple longbows bought " +"["+ numberofMLB+"]");
pw.println("-------------------------------------------------------------------------");
pw.close();
log("Update!");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public final String formatTime(long ms) {
long s = ms / 1000;
long m = s / 60;
long h = m / 60;
return String.format("%02d:%02d:%02d", h %= 24, m %= 60, s %= 60);
}
private void Trade() throws InterruptedException {
Player muleTrade = (Player)this.players.closest(new String[]{"Yourname"});
if(grandExchange.isOpen()){
grandExchange.close();
}
if(store.isOpen()){
store.close();
}
if(!trade.isFirstInterfaceOpen()) {
if(muleTrade != null) {
muleTrade.interact(new String[]{"Trade with"});
new ConditionalSleep(5000) {
public boolean condition() throws InterruptedException {
return getTrade().isCurrentlyTrading();
}
}.sleep();
}else{
return;
}
}
if(trade.isFirstInterfaceOpen()){
trade.offer("Coins",GetQuantity());
getTrade().acceptTrade();
new ConditionalSleep(5000){
public boolean condition() throws InterruptedException {
return getTrade().isSecondInterfaceOpen();
}
}.sleep();
}
if(trade.isSecondInterfaceOpen()){
getTrade().acceptTrade();
new ConditionalSleep(5000){
public boolean condition() throws InterruptedException {
return !getTrade().isSecondInterfaceOpen();
}
}.sleep();
GotTradeOffer = false;
if (inventory.contains("Willow longbow") && inventory.contains("Willow shortbow") && inventory.contains("Maple shortbow") && inventory.contains("Maple longbow")) {
GoToShop();
}
if (!inventory.contains("Willow longbow") || !inventory.contains("Willow shortbow") || !inventory.contains("Maple shortbow") || !inventory.contains("Maple longbow")) {
GoToGe();
}
}
}
private int GetQuantity() {
int x = (int) (inventory.getAmount("Coins") - 100000);
return x;
}
public boolean invcheck(String name){
if(inventory.contains(name) && inventory.getAmount(name) == 100){
return true;
}
return false;
}
private void GoToGe() throws InterruptedException {
NPC grandexchangeclerk = npcs.closest("Grand Exchange Clerk");
if (!grandexchangeArea.contains(myPlayer())) {
walking.webWalk(grandexchangeArea);
}
if (grandexchangeArea.contains(myPlayer())) {
if (inventory.contains(849) || inventory.contains(847) || inventory.contains(851) || inventory.contains(853)) {
changetonoted();
} else {
if (!grandExchange.isOpen()) {
if (grandexchangeclerk != null) {
grandexchangeclerk.interact("Exchange");
new ConditionalSleep(Script.random(5000, 8000)) {
public boolean condition()
throws InterruptedException {
return grandExchange.isOpen();
}
}.sleep();
}
}
if (grandExchange.isOpen()) {
BUY(847, "willow longbow", 150, 100, "Steel arrow", 32);
BUY(849, "willow shortbow", 100, 100, "Steel arrow", 32);
BUY(851, "Maple longbow", 336, 100, "Steel arrow", 32);
BUY(853, "Maple shortbow", 208, 100, "Steel arrow", 32);
}
}
if(inventory.getAmount("Coins") >= 100000){
despositcoins();
}
}
}
private void despositcoins() throws InterruptedException {
if(!bank.isOpen()){
bank.open();
}
if (bank.isOpen()) {
coinsinbank = (int) bank.getAmount("Coins");
bank.deposit("Coins",GetQuantity());
bank.close();
}
}
public GrandExchange.Box getbox(){
if(grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.EMPTY){
return GrandExchange.Box.BOX_1;
}
if(grandExchange.getStatus(GrandExchange.Box.BOX_2) == GrandExchange.Status.EMPTY){
return GrandExchange.Box.BOX_2;
}
if(grandExchange.getStatus(GrandExchange.Box.BOX_3) == GrandExchange.Status.EMPTY){
return GrandExchange.Box.BOX_3;
}
return null;
}
public void BuyMethod(String name,int price,int Quantity) throws InterruptedException {
grandExchange.buyItems(getbox());
sleep(random(1000,1500));
keyboard.typeString(name);
keyboard.typeString("",true);
}
private void changetonoted() throws InterruptedException {
if(!bank.isOpen()){
bank.open();
}
if (bank.isOpen()) {
bank.depositAllExcept("Coins");
sleep(random(1000, 1500));
getWidgets().getWidgetContainingText("Note").interact("Note");
sleep(random(1000, 1500));
if (bank.contains("Maple shortbow")) {
bank.withdrawAll("Maple shortbow");
}
if (bank.contains("Maple longbow")) {
bank.withdrawAll("Maple longbow");
}
if (bank.contains("Willow shortbow")) {
bank.withdrawAll("Willow shortbow");
}
if (bank.contains("Willow longbow")) {
bank.withdrawAll("Willow longbow");
}
}
}
public void BUY(int id,String name,int Price,int Quantity,String Sellingname,int Sellingprice) throws InterruptedException {
if(inventory.contains(Sellingname)){
grandExchange.sellItem(886,Sellingprice, (int) inventory.getAmount(886));
new ConditionalSleep(Script.random(5000, 8000)) {
public boolean condition()
throws InterruptedException {
return grandExchange.isOpen();
}
}.sleep();
sleep(random(1000, 1100));
}
if (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_SALE || grandExchange.getStatus(GrandExchange.Box.BOX_2) == GrandExchange.Status.FINISHED_SALE || grandExchange.getStatus(GrandExchange.Box.BOX_3) == GrandExchange.Status.FINISHED_SALE) {
grandExchange.collect();
}
if (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_BUY || grandExchange.getStatus(GrandExchange.Box.BOX_2) == GrandExchange.Status.FINISHED_BUY || grandExchange.getStatus(GrandExchange.Box.BOX_3) == GrandExchange.Status.FINISHED_BUY) {
grandExchange.collect();
} else if (!inventory.contains(name) && grandExchange.getItemId(GrandExchange.Box.BOX_1) != id && grandExchange.getItemId(GrandExchange.Box.BOX_2) != id && grandExchange.getItemId(GrandExchange.Box.BOX_3) != id || inventory.contains(name) && inventory.getAmount(name) < Quantity && grandExchange.getItemId(GrandExchange.Box.BOX_1) != id && grandExchange.getItemId(GrandExchange.Box.BOX_2) != id && grandExchange.getItemId(GrandExchange.Box.BOX_3) != id) {
grandExchange.buyItem(id, name, Price, GetQuantity(name,Quantity));
new ConditionalSleep(Script.random(5000, 8000)) {
public boolean condition()
throws InterruptedException {
return grandExchange.isOpen();
}
}.sleep();
sleep(random(1000, 1100));
}
}
private int GetQuantity(String name,int InitialQuantity) {
if(!inventory.contains(name)){
return InitialQuantity;
}
if(inventory.contains(name) && inventory.getAmount(name) < 100){
int x = (int) (100 - inventory.getAmount(name));
return x;
}
return 0;
}
private void GoToShop() throws InterruptedException {
NPC Brian = npcs.closest("Brian");
if(!shopArea.contains(myPlayer())){
walking.webWalk(shopArea);
}
if(shopArea.contains(myPlayer())){
if(!store.isOpen()){
if(Brian !=null) {
Brian.interact("Trade");
new ConditionalSleep(Script.random(5000, 8000))
{
public boolean condition()
throws InterruptedException
{
return grandExchange.isOpen();
}
}.sleep();
}
}
if(store.isOpen()){
shop();
HopWorlds();
}
}
}
private void shop() throws InterruptedException {
while(store.getAmount("Steel arrow") >= 1460) {
store.buy("Steel arrow", 10);
numberofSA = numberofSA + 10;
sleep(random(800,1100));
}
if (store.getAmount("Oak longbow") <= 5) {
store.sell("Oak longbow", 5);
sleep(random(800,1100));
}
if (store.getAmount("Willow shortbow") <= 4) {
store.sell("Willow shortbow", 5);
numberofWSB = numberofWSB + 5;
sleep(random(800,1100));
}
if (store.getAmount("Willow longbow") <= 4) {
store.sell("Willow longbow", 5);
numberofWLB = numberofWLB + 5;
sleep(random(800,1100));
}
if (store.getAmount("Maple shortbow") <= 3) {
store.sell("Maple shortbow", 5);
numberofMSB = numberofMSB + 5;
sleep(random(800,1100));
}
if (store.getAmount("Maple longbow") <= 3) {
store.sell("Maple longbow", 5);
numberofMLB = numberofMLB + 5;
sleep(random(800,1100));
}
}
private void HopWorlds() throws InterruptedException {
store.close();
new ConditionalSleep(Script.random(5000, 8000))
{
public boolean condition()
throws InterruptedException
{
return !store.isOpen();
}
}.sleep();
worlds.hop(WorldNumber());
tabs.open(Tab.INVENTORY);
sleep(random(2000,3000));
tabs.open(Tab.INVENTORY);
new ConditionalSleep(Script.random(5000, 8000))
{
public boolean condition()
throws InterruptedException
{
return tabs.open(Tab.INVENTORY);
}
}.sleep();
sleep(random(3000,4000));
}
private int WorldNumber(){
if(worlds.getCurrentWorld() == 301){
return 8;
}
if(worlds.getCurrentWorld() == 308){
return 16;
}
if(worlds.getCurrentWorld() == 316){
return 26;
}
if(worlds.getCurrentWorld() == 326){
return 35;
}
if(worlds.getCurrentWorld() == 335){
return 82;
}
if(worlds.getCurrentWorld() == 382){
return 83;
}
if(worlds.getCurrentWorld() == 383){
return 84;
}
if(worlds.getCurrentWorld() == 384){
return 93;
}
if(worlds.getCurrentWorld() == 393){
return 94;
}
return 1;
}
public void SendReply(String message) throws InterruptedException {
if(grandExchange.isOpen()){
grandExchange.close();
}
tabs.open(Tab.FRIENDS);
new ConditionalSleep(Script.random(5000, 8000))
{
public boolean condition()
throws InterruptedException
{
return Tab.FRIENDS.isOpen(bot);
}
}.sleep();
sleep(random(1500,2000));
getWidgets().getWidgetContainingText("Yourname").interact("Message");
new ConditionalSleep(Script.random(5000, 8000))
{
public boolean condition()
throws InterruptedException
{
return dialogues.inDialogue();
}
}.sleep();
sleep(random(1500,2000));
keyboard.typeString(message,true);
}
public String getlocation(){
if(shopArea.contains(myPlayer())){
return "At the shop";
}
if(grandexchangeArea.contains(myPlayer())){
return "At ge";
}
return null;
}
public void onMessage(Message c) throws InterruptedException {
if (c.getMessage().contains("Yourname wishes to trade with you.")){
this.log("Yourname wishes to trade with you.");
GotTradeOffer = true;
}
if (c.getMessage().contains("Where are u?.")){
this.log("Message recived.");
SendReply(getlocation());
}
if (c.getMessage().contains("Ok im here.")){
this.log("Message recived.");
Trade();
}
if (c.getMessage().contains("Ok come here.")){
SendReply("Comming...");
this.log("Message recived.");
Status = "Muling";
}
if (c.getMessage().contains("Ok done.")){
SendReply("Ok back to normal");
this.log("Message recived.");
Status = "Normal";
}
}
@Override
public void onPaint(Graphics2D g) {
//This is where you will put your code for paint(s)
}
}
Email jar source:
package Email;
import java.awt.EventQueue;
import java.io.File;
import java.util.Properties;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.swing.JFrame;
public class SendMailTLS {
public static void main(String[] args) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Frame1 frame = new Frame1();
frame.setVisible(true);
}
});
try {
while (true) {
SendEmail();
Thread.sleep(Minutes(40));
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static int Minutes(int Minutes){
return Minutes*60000;
}
public static void SendEmail(){
final String username = "Yourname@email.com";
final String password = "Email Password";
Properties props = new Properties();
props.put("mail.smtp.auth", true);
props.put("mail.smtp.starttls.enable", true);
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("Yourname@email.com"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("Emailtorecieve@email.com"));
message.setSubject("Account Updates");
message.setText("Account Updates");
MimeBodyPart messageBodyPart = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
String currentUsersHomeDir = System.getProperty("user.home");
String otherFolder = currentUsersHomeDir + "\\OSBot\\Data\\info.txt";
messageBodyPart = new MimeBodyPart();
String file = otherFolder;
String fileName = "info.txt";
DataSource source = new FileDataSource(file);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(fileName);
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
System.out.println("Sending");
Transport.send(message);
System.out.println("Done");
} catch (MessagingException e) {
e.printStackTrace();
}
}
}
Hope you enjoy it and please let me know your opinions in the poll
Thanks.