import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.*;
import org.rsbot.script.*;
import org.rsbot.script.wrappers.*;
import org.rsbot.bot.Bot;
import org.rsbot.bot.input.Mouse;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.event.events.ServerMessageEvent;
@ScriptManifest(authors = "Rapid", category = "AlexMaley", name = "Tuna Potato Maker", version = 0.1, description = "Makes tuna potatoes.")
public class TunaPotatoMaker extends Script implements PaintListener,
ServerMessageListener {
public int mouseX;
public int mouseY;
public long seconds2;
public long ProfitPerHour;
public long startTime =
System.currentTimeMillis
();
public int TotalProfit;
public int CornBowlMade;
public int TunaBowlMade;
public int PotatoButterMade;
public int TunaPotatoMade;
public int Counter;
public int BankBoothID = 14367;
public int KnifeID = 946;
//Primary ingredients
public int ButterID = 6697;
public int PotatoID = 6701;
public int CornID = 5988;
public int BowlID = 1923;
public int TunaID = 361;
//Secondary Ingredients
public int ButterPotatoID = 6703;
public int CornBowlID = 7088;
public int TunaBowlID = 7068;
//Final product
public int TunaPotatoID = 7060;
private int antiBan() {
int random = random(1, 4);
switch (random) {
case 1:
if (random(1, 4) == 2) {
moveMouseRandomly(300);
return random(100, 500);
}
case 2:
if (random(1, 10) == 5) {
if (getCurrentTab() != TAB_INVENTORY) {
openTab(TAB_INVENTORY);
return random(100, 500);
} else {
return random(100, 500);
}
}
case 3:
if (random(1, 200) == 100) {
if (getMyPlayer().isMoving()) {
return random(100, 500);
}
if (getCurrentTab() != TAB_STATS) {
openTab(TAB_STATS);
}
moveMouse(686, 306, 20, 10);
wait(random(1500, 3000));
if (getCurrentTab() != TAB_INVENTORY) {
openTab(TAB_INVENTORY);
}
return random(100, 500);
}
case 4:
if (random(1, 150) == 75) {
openTab(random(0, 8));
wait(random(1500, 2500));
return random(100, 500);
}
}
return 50;
}
public void doBank(){
RSObject BankBooth = getNearestObjectByID(BankBoothID);
atObject(BankBooth, "Use-quickly");
}
public boolean doButter(){
try{
doBank();
wait(random(500,600));
while (!bank.isOpen()){
doBank();
wait(random(200,300));
}
wait(random(1000,1250));
while (!isLoggedIn()){
wait(random(100,200));
}
Counter = bank.getCount(ButterID);
if (Counter < 13){
log("No butter in bank, stopping script.");
stopScript();
}
bank.depositAllExcept(KnifeID);
wait(random(200,300));
bank.withdraw(ButterID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(ButterID);
while (Counter == 0){
bank.depositAllExcept(KnifeID);
wait(random(1000,1250));
bank.withdraw(ButterID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(ButterID);
}
bank.withdraw(PotatoID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(PotatoID);
while (Counter == 0){
bank.depositAllExcept(KnifeID, ButterID);
wait(random(200, 300));
bank.withdraw(PotatoID, 13);
wait(random(1000, 1250));
Counter = getInventoryCount(PotatoID);
}
while (bank.isOpen()){
bank.close();
wait(random(1000,1250));
}
atInventoryItem(ButterID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(ButterID, "Use");
wait(random(200, 300));
}
atInventoryItem(PotatoID, "Use");
wait(random(1000,1200));
while (!RSInterface.getInterface(513).isValid()){
wait(random(200,300));
atInventoryItem(ButterID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(ButterID, "Use");
wait(random(200, 300));
}
atInventoryItem(PotatoID, "Use");
wait(random(1000,1250));
}
if (RSInterface.getInterface(513).isValid()){
clickMouse(260, 415, 10, 10, false);
if (getMenuActions().contains("Make All")){
atMenu("Make All");
}
}
for (int i = 0; i <= 13; i++) {
if (RSInterface.getInterface(
Constants.INTERFACE_LEVELUP)
.isValid()) {
clickContinue();
}
antiBan();
wait(1250);
}
}catch(Exception e){
}
return true;
}
public boolean doCorn(){
try{
doBank();
wait(random(500,800));
while (!bank.isOpen()){
doBank();
wait(random(500,800));
}
bank.depositAllExcept(KnifeID);
wait(random(250,300));
bank.withdraw(CornID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(CornID);
while (Counter != 13){
bank.depositAllExcept(KnifeID);
wait(random(1000,1250));
bank.withdraw(CornID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(CornID);
}
bank.withdraw(BowlID,13);
wait(random(1000,1250));
Counter = getInventoryCount(BowlID);
while (Counter != 13){
Counter = getInventoryCount(BowlID);
while (Counter > 13){
bank.depositAllExcept(KnifeID, CornID);
wait(random(300,400));
bank.withdraw(CornID, 13);
wait(random(1000,1250));
Counter = getInventoryCount();
}
bank.depositAllExcept(KnifeID, CornID);
wait(random(300,400));
bank.withdraw(BowlID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(BowlID);
}
while (bank.isOpen()){
bank.close();
wait(random(1000,1250));
}
atInventoryItem(BowlID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(BowlID, "Use");
wait(random(200,300));
}
atInventoryItem(CornID, "Use");
wait(random(1000,1250));
while (!RSInterface.getInterface(513).isValid()){
atInventoryItem(BowlID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(BowlID, "Use");
wait(random(200,300));
}
atInventoryItem(CornID, "Use");
wait(random(500,600));
}
if (RSInterface.getInterface(513).isValid()){
clickMouse(260, 415, 10, 10, false);
if (getMenuActions().contains("Make All")){
atMenu("Make All");
}
}
for (int i = 0; i <= 13; i++) {
if (RSInterface.getInterface(
Constants.INTERFACE_LEVELUP)
.isValid()) {
clickContinue();
}
antiBan();
wait(1250);
}
}catch(Exception e){
}
return true;
}
public boolean doTuna(){
try{
doBank();
wait(random(500,600));
while (!bank.isOpen()){
doBank();
wait(random(500,600));
}
bank.depositAllExcept(KnifeID, CornBowlID);
wait(random(300,400));
bank.withdraw(TunaID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(TunaID);
while (Counter != 13){
bank.depositAllExcept(KnifeID, CornBowlID);
wait(random(1000,1250));
bank.withdraw(TunaID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(TunaID);
}
Counter = getInventoryCount(CornBowlID);
while (Counter != 13){
bank.depositAllExcept(KnifeID, TunaID);
wait(random(1000,1250));
bank.withdraw(CornBowlID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(CornBowlID);
}
while (bank.isOpen()){
bank.close();
wait(random(1000,1250));
}
atInventoryItem(TunaID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(TunaID, "Use");
wait(random(200,300));
}
atInventoryItem(CornBowlID, "Use");
wait(random(1000,1250));
while (!RSInterface.getInterface(513).isValid()){
atInventoryItem(TunaID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(TunaID, "Use");
wait(random(200,300));
}
atInventoryItem(CornBowlID, "Use");
wait(random(1000,1250));
}
if (RSInterface.getInterface(513).isValid()){
clickMouse(260, 415, 10, 10, false);
if (getMenuActions().contains("Make All")){
atMenu("Make All");
}
}
for (int i = 0; i <= 13; i++) {
if (RSInterface.getInterface(
Constants.INTERFACE_LEVELUP)
.isValid()) {
clickContinue();
}
antiBan();
wait(1250);
}
}catch(Exception e){
}
return true;
}
public boolean doFinal(){
try{
doBank();
wait(random(500,600));
while (!bank.isOpen()){
doBank();
wait(random(500,600));
}
bank.depositAllExcept(KnifeID, TunaBowlID);
wait(random(200,300));
bank.withdraw(ButterPotatoID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(ButterPotatoID);
while (Counter != 13){
bank.depositAllExcept(TunaBowlID, KnifeID);
wait(random(1000,1250));
bank.withdraw(ButterPotatoID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(ButterPotatoID);
}
Counter = getInventoryCount(TunaBowlID);
while (Counter != 13){
bank.depositAllExcept(ButterPotatoID, KnifeID);
wait(random(1000,1250));
bank.withdraw(TunaBowlID, 13);
wait(random(1000,1250));
Counter = getInventoryCount(TunaBowlID);
}
while (bank.isOpen()){
bank.close();
wait(random(1000,1250));
}
wait(random(300,400));
atInventoryItem(ButterPotatoID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(ButterPotatoID, "Use");
wait(random(200,300));
}
atInventoryItem(TunaBowlID, "Use");
wait(random(1000,1250));
while (!RSInterface.getInterface(513).isValid()){
wait(random(200,300));
atInventoryItem(ButterPotatoID, "Use");
wait(random(200,300));
while (!isItemSelected()){
atInventoryItem(ButterPotatoID, "Use");
wait(random(200,300));
}
atInventoryItem(TunaBowlID, "Use");
wait(random(1000,1250));
}
if (RSInterface.getInterface(513).isValid()){
clickMouse(260, 415, 10, 10, false);
if (getMenuActions().contains("Make All")){
wait(random(200,300));
atMenu("Make All");
}
}
for (int i = 0; i <= 13; i++) {
if (RSInterface.getInterface(
Constants.INTERFACE_LEVELUP)
.isValid()) {
clickContinue();
}
antiBan();
wait(1250);
}
wait(random(100,200));
}catch(Exception e){
}
return true;
}
@Override
public int loop() {
if (isLoggedIn()){
if (doButter()){
if (doCorn()){
if (doTuna()){
if (doFinal()){
}
}
}
}
}else{
wait(random(5000,6000));
}
return(random(500,1000));
}
@Override
public void onRepaint(Graphics g) {
if (isLoggedIn()){
long millis =
System.currentTimeMillis
() - startTime;
final long hours = millis / (1000 * 60 * 60);
millis -= hours * 1000 * 60 * 60;
final long minutes = millis / (1000 * 60);
millis -= minutes * 1000 * 60;
final long seconds = millis / 1000;
TotalProfit = (TunaPotatoMade * 78) + (PotatoButterMade * 83) + (CornBowlMade * 295) + (TunaBowlMade * 284);
final int profitPerHour =
(int
) (3600000D /
(System.currentTimeMillis
() - startTime
)*
(TotalProfit
));
Mouse m = Bot.getClient().getMouse();
g.setColor(new Color(255, 255, 0));
g.drawRect(4, 307, 50 ,20 );
g.fillRect(4, 307, 50, 20);
g.setColor(Color.white);
g.drawString("Hide",9, 317 );
if(m.x >= 4 && m.x < 4 + 50 && m.y >= 307 && m.y < 307 + 20){
g.setColor(new Color(255, 255, 0));
g.drawRect(0, 0, 226 , 163);
g.fillRect(0, 0, 226, 163);
g.setColor(Color.white);
g.drawString("Butter with Potato's made : " + PotatoButterMade, 9, 23 );
g.drawString("Sweet corn bowls made : " + CornBowlMade, 9,43);
g.drawString("Tuna bowls made : " + TunaBowlMade, 9, 63);
g.drawString("Tuna potato's made : " + TunaPotatoMade, 9, 83);
g.drawString("Total Profit made : " + TotalProfit + "!", 9, 103);
g.drawString("Profit P/Hour : " + profitPerHour + "!", 9, 123);
g.drawString("Duration : " + hours + ":" + minutes + ":" + seconds, 9, 143);
}
}
}
@Override
public void serverMessageRecieved(ServerMessageEvent e) {
String serverString = e.getMessage();
if (serverString.contains("You put the cooked sweetcorn into the bowl.")){
CornBowlMade++;
}
if (serverString.contains("You mix the ingredients to make the topping.")){
TunaBowlMade++;
}
if (serverString.contains("You add the butter to the potato.")){
PotatoButterMade++;
}
if (serverString.contains("You add the topping to the potato.")){
TunaPotatoMade++;
}
}
}