Mine sisusse
Otsi siit
  • Rohkem valikuid...
Otsi tulemusi mis sisaldab...
Otsi tulemusi...
Jälgi teemat sisse logides  

Abi Scripti tegemisega .

Soovitatud postitused

import java.awt.Color;

import java.awt.Graphics;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.MalformedURLException;

import java.net.URL;

import java.net.URLConnection;

import java.util.Map;

 

import com.speljohan.rsbot.bot.Bot;

import com.speljohan.rsbot.event.listeners.PaintListener;

import com.speljohan.rsbot.script.Script;

import com.speljohan.rsbot.script.wrappers.RSObject;

import com.speljohan.rsbot.script.wrappers.RSTile;

import com.speljohan.rsbot.script.wrappers.RSTilePath;

/*

* Directions:

* 1. Save as EastVarrockMinerAndBankerByXalo.java in your Scripts folder

* 2. Click 'Compile' in your root RSBot folder

* 3. Select Your Ore Type and other preferences

* 4. Start at Lumbridge, the East Varrock mine, or the East Varrock Bank

* 5. Report bugs on the topic page on RSBot forums or RuneAttack.com forums

*

* APPROVED SUPPORT SITES:

* Mutant-Xalo Pro Script - http://mxproscript.net

* Rune Attack - http://runeattack.com

* RSBot - http://rsbot.org

*/

public class EastVarrockMinerAndBankerByXalo extends Script implements PaintListener{

 

private int[] ironOre = { 11954, 11955, 11956 };

private int[] pickAxe = { 1265, 1267, 1269, 1273, 1271, 1275, 11969, 1823, 1825, 1827, 1829 };

private int bankBooth = 11402;

private int lumbyBush = 36782;

private int currentState = 0;

private int totalOres = 0;

final int[] smokingRock = { 11193, 11433, 11434, 11435, 11436 };

private static long START_TIME = System.currentTimeMillis();

private String ONLINE_VERSION;

private int STARTING_MINING_XP;

 

private int paintY = 230;

 

RSTile[] pathToMineFromBank = { new RSTile(3254, 3420), new RSTile(3254, 3422), new RSTile(3261, 3428),

new RSTile(3275, 3428), new RSTile(3281, 3416), new RSTile(3290, 3407),

new RSTile(3291, 3392), new RSTile(3292, 3382), new RSTile(3286, 3372),

new RSTile(3284, 3368), new RSTile(3287, 3370)};

RSTilePath pathToBankFromMine = new RSTilePath(

reversePath(pathToMineFromBank), this);

RSTile[] pathToMineFromLumby = { new RSTile(3232, 3219),

new RSTile(3237, 3225),

new RSTile(3248, 3225),

new RSTile(3254, 3226),

new RSTile(3260, 3238),

new RSTile(3251, 3252),

new RSTile(3247, 3267),

new RSTile(3242, 3272),

new RSTile(3239, 3281),

new RSTile(3239, 3292),

new RSTile(3238, 3308),

new RSTile(3247, 3321),

new RSTile(3247, 3325),

new RSTile(3262, 3326),

new RSTile(3276, 3335),

new RSTile(3281, 3350),

new RSTile(3285, 3366)};

 

/* RSBot ID */

public EastVarrockMinerAndBankerByXalo() {

setParameter("author", "Xalo");

setParameter("version", getVersion());

setParameter("name", "East Varrock Miner And Banker By Xalo");

setParameter("category", "Mining");

setParameter("description", "Start in East Varrock Bank, East Varrock Mine, or Lumbridge.");

}

 

public double getVersion(){

return 1.3;

}

 

/* Run */

public boolean onStart(Map args) {

log("Let's Mine!");

try {

URL scriptCheck = new URL("http://www.runeattack.com/scripts/EastVarrockMinerAndBankerByXaloVersion.txt");

URLConnection connectToRuneAttack = scriptCheck.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(connectToRuneAttack.getInputStream()));

 

String inputLine;

 

while ((inputLine = in.readLine()) != null) {

ONLINE_VERSION = inputLine;

}

in.close();

} catch (MalformedURLException me) {

System.out.println("MalformedURLException: " + me);

} catch (IOException ioe) {

System.out.println("IOException: " + ioe);

}

 

STARTING_MINING_XP = skills.getCurrentSkillExp(STAT_MINING);

return true;

}

 

public void onFinish(){

Bot.getEventManager().removeListener(PaintListener.class, this);

return;

}

 

/*

* Cases:

* 0 - Mining

* 1 - Full Inventory, Walk to Bank

* 2 - At Bank, Deposit Ores

* 3 - Deposited Ores, Walk to Mine from Bank

* 4 - At Mine, begin mining (state = 0)

* 5 - We're in Lumby, Walk to Mine from Lumby

*/

public int loop() {

 

try {

switch (currentState) {

case 0:

if(getEnergy() >= (40 + random(0, 10))) { setRun(true); }

if(atLumby()){ currentState = 4; }

if(!(isInventoryFull()) && atBank()){ currentState = 3; }

if (isInventoryFull()) { currentState++; }

else { mine(); }

break;

case 1:

if(atBank()){

wait(random(500, 1000));

currentState++;

}

if(walkToBankFromMine()) { return random(500, 1000); };

break;

case 2:

depositOres();

totalOres = totalOres + 28;

currentState++;

break;

case 3:

if(walkToMineFromBank()) { return random(500, 1000); };

if(atMine()){ currentState = 0; }

break;

case 4:

if(walkToMineFromLumby()) { return random(500, 1000); };

if(atMine()){ currentState = 0; }

break;

}

 

} catch (final Exception e) {

e.printStackTrace();

}

return random(500, 1000);

}

 

/* Mining Functions */

private void mine(){

if ((!getMyPlayer().isMoving()) && getMyPlayer().getAnimation() == -1){

RSObject obj = findObject(ironOre);

if(obj !=null) {

//log("Found Ore");

RSTile oreLocation = obj.getLocation();

//log("Ore Location = " + oreLocation);

if(distanceTo(oreLocation)

// log("Mining Ore");

atObject(obj,"Mine");

wait(random(25,100));

}

if((distanceTo(oreLocation) > 5) && (distanceTo(oreLocation)

// log("Moving to Ore");

turnToTile(oreLocation);

}else{

// log("No Iron Ore Within Range");

}

}else{

//log("Waiting for Respawn");

wait(random(10,30));

}

}

}

 

/* Transportation Functions */

//Thanks PwnZ for a working walking method

private boolean walkToBankFromMine(){

log("Walking to Bank From Mine");

try {

return pathToBankFromMine.walkToEnd();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return false;

}

 

private boolean walkToMineFromBank(){

log("Walking to Mine From Bank");

RSTile[] randomizedPath = randomizePath(pathToMineFromBank, 2, 2);

RSTilePath path = new RSTilePath(randomizedPath, this);

try {

return path.walkToEnd();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return false;

}

 

private boolean walkToMineFromLumby(){

log("Walking to Mine From Lumby");

RSTile[] randomizedPath = randomizePath(pathToMineFromLumby, 2, 2);

RSTilePath path = new RSTilePath(randomizedPath, this);

try {

return path.walkToEnd();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return false;

}

private boolean atBank(){

RSObject bank = findObject(bankBooth); // search for bank.

if(bank == null) return false; // did not find the bank.

log("We're at the bank");

return atObject(bank, "Use-quickly");

}

 

private boolean atMine(){

RSObject ore = findObject(ironOre); // search for ore.

if(ore == null) return false; // did not find the ore.

if(distanceTo(ore) > 8){ return false; }; //ore too far away

log("We're at the mine");

return true;

}

 

private boolean atLumby(){

RSObject bush = findObject(lumbyBush); // search for ore.

if(bush == null) return false; // did not find the ore.

if(distanceTo(bush) > 10){ return false; }; //ore too far away

log("We're at Lumby");

return true;

}

private void depositOres(){

log("Depositing Ores");

wait(random(100,300));

bank.depositAllExcept(pickAxe);

wait(random(10,30));

bank.close();

wait(random(10,30));

}

 

/* Paint Functions */

@Override

public void onRepaint(final Graphics g) {

if (isLoggedIn()) {

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;

 

g.setColor(new Color(0, 0, 0, 90));

g.fill3DRect(5, paintY, 180, 105, true);

g.setColor(Color.GREEN);

g.drawString("Xalo's Varrock Miner & Banker", 10, paintY + 20);

if(Double.toString(getVersion()).equals(ONLINE_VERSION)){

g.drawString("Script is up-to-date (v." + ONLINE_VERSION + ")", 10, paintY + 35);

} else {

g.setColor(Color.RED);

g.drawString("An update is available (v." + ONLINE_VERSION + ")", 10, paintY + 35);

}

g.setColor(Color.GREEN);

g.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, 10, paintY + 50);

g.drawString("Mining XP Gained : " + (skills.getCurrentSkillExp(STAT_MINING) - STARTING_MINING_XP) , 10, paintY + 65);

g.drawString("Ores : " + totalOres, 10, paintY + 80);

g.drawString("Xalo - http://runeattack.com", 10, paintY + 95);

 

Kudias ma ssellisest jutust saaksin scripti valmis teha .

Mis ma tegema peaksin .

Et paljun aidake sellega .

 

Üht asja tean .

Ma pean selle code notediga salvestama .

Aga kudias ma saan .java värgi teha ?

Jaga seda postitust


Postituse link
Share on other sites

Kommentaari lisamiseks loo konto või logi sisse

Kommenteerimiseks peate olema liige

Loo konto

Liituge meie kommuuni uue kontoga. See on lihtne!

Loo uus konto

Logi sisse

On juba konto? Logi sisse siit.

Logi sisse nüüd
Jälgi teemat sisse logides  

×
×
  • Loo uus...

Oluline informatsioon

Selle veebisaidi paremaks muutmiseks oleme teie seadmesse paigutanud küpsised . Võite kohandada oma küpsiste seadeid , vastasel juhul eeldame, et te olete küpsiste kasutamisega nõus kui jätkate veebisaidil sirvimist.. Palun lugege läbi Kasutustingimused ja Privaatsuspoliitika.