• Log in or sign up for an account here: https://www.sythe.org/login

~Need Coal Miner~

~Need Coal Miner~
~Need Coal Miner~
//
// ProMiner by Aelin[Aelin]
//
// Revision 0.01
// Beta release
//
import java.awt.*;
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.*;

public class ProMiner extends Script implements PaintListener {
int[][] rocks = new int[][] {
// Remington - Clay
new int[] { 9711, 9713 },

// Remington - Copper
new int[] { 9708, 9709, 9710 },

// Remington - Tin
new int[] { 9714, 9716 },

// Remington - Iron
new int[] { 9717, 9718, 9719 },

// Remington - Gold
new int[] { 9720, 9722 },

// Varrock East - Copper
new int[] { 11960, 11961, 11962 },

// Varrock East - Tin
new int[] { 11957, 11958, 11959 },

// Varrock East - Iron
new int[] { 11954, 11955, 11956 },

// Varrock West - Clay
new int[] { 15503, 15504, 15505 },

// Varrock West - Tin
new int[] { 11957, 11958, 11959 },

// Varock West - Iron
new int[] { 11954, 11955 },

// Varrock West - Silver
new int[] { 11949, 11950 },

// Al Kharid - Copper
new int[] { 11936, 11937, 11938 },

// Al Kharid - Iron
new int[] { 37307, 37309 },

// Al Kharid - Silver
new int[] { 37304, 37305 },

// Al Kharid - Coal
new int[] { 11930, 11932 },

// Al Kharid - Gold
new int[] { 37310, 37313 },

// Al Kharid - Mithril
new int[] { 11942, 11944 },

// Al Kharid - Adamanite
new int[] { 11939, 11941 },

// Mining Guild - Coal
// new int[ ] { 31061, 31059, 31068, 31069, 31070 }
};
int[] gear = new int[] { 1265, // Bronze Pickaxe
1267, // Iron pickaxe.
1269, // Steel Pickaxe
1273, // Mithril Pickaxe
1271, // Adamanite Pickaxe.
1275 // Rune pickaxe
};

final int[] smokingRocks = { 11433, 11434, 11435, 11436 };
RSTile[] toBank;
RSTile[] toMine;
int bankBooth;
int checkTime;
long startTime;
long lastCheck;
int fails;
final int MAX_FAILS = 25;
int mode;
boolean powerMode = false;
int randomRun = random(40, 75);
final int S_WALKTO_MINE = 1000;
final int S_WALKTO_BANK = 1500;
final int S_MINE = 2000;
final int S_USE_BANK = 2500;
final int S_DROP = 3000;
int state = S_MINE;
int rockCount;
int oldRockCount;
int xpPerRock;
long avoidedCombat;
long avoidedSmokingRocks;
int startLevel;
int startExp;
int oldExp;
int countToNext;
int oldLevels;
long lastAvgCheck;
int avgPerHour;
int gems;

public String getAuthor() {
return "Aelin";
}

public String getName() {
return "ProMiner";
}

public double getVersion() {
return 0.01;
}

public String getScriptCategory() {
return "Aelin/Pro Series/Mining";
}

public String getScriptDescription() {
String html = "";

html += "<html>";
html += "<body>";
html += "<font size=\"2\">";
html += "<b>" + getName() + " v" + getVersion() + "</b><br>";
html += "Author: " + getAuthor() + "<br><br>";
html += "<b>Remmington:</b> 0 - Clay, 1 - Copper, 2 - Tin, 3 - Iron, 4 - Gold<br>";
html += "<b>Varrock East:</b> 5 - Copper, 6 - Tin, 7 - Iron<br>";
html += "<b>Varrock West:</b> 8 - Clay, 9 - Tin, 10 - Iron, 11 - Silver<br>";
html += "<b>Al Kharid:</b> 12 - Copper, 13 - Iron, 14 - Silver, 15 - Gold, 16 - Mithril<br>";
// html += "<b>Faladore:</b> <br>";
html += "<b>Mining Guild:</b> 12 - Coal<br>";
html += "Mode: <input type=\"text\" name=\"mode\"><br>";
html += "<input type=\"radio\" name=\"power\" value=\"true\">Power-Mining Mode<br>";
html += "</font>";
html += "</body>";
html += "</html>";

return html;
}

public boolean onStart(Map<String, String> args) {
Bot.getEventManager().addListener(PaintListener.class, this);

try {
mode = Integer.parseInt(args.get("mode"));

if (args.get("power").equals("true")) {
powerMode = true;
log("Power-mining mode activated.");
}
} catch (Exception e) {

}

if (mode >= 0 && mode <= 4) {
log("Settings paths for remington.");
toBank = new RSTile[] { new RSTile(2977, 3239),
new RSTile(2976, 3252), new RSTile(2974, 3266),
new RSTile(2981, 3275), new RSTile(2994, 3282),
new RSTile(3005, 3291), new RSTile(3004, 3304),
new RSTile(3007, 3318), new RSTile(3007, 3334),
new RSTile(3007, 3350), new RSTile(3013, 3356) };
toMine = reversePath(toBank);
bankBooth = 11758;
}

if (mode >= 5 && mode <= 7) {
log("Setting paths for Varrock East.");
toBank = new RSTile[] { new RSTile(3285, 3365),
new RSTile(3294, 3377), new RSTile(3292, 3392),
new RSTile(3290, 3408), new RSTile(3285, 3423),
new RSTile(3273, 3428), new RSTile(3258, 3429),
new RSTile(3254, 3420) };
toMine = reversePath(toBank);
bankBooth = 11402;
}

if (mode >= 8 && mode <= 11) {
log("Setting paths for Varrock West.");
toBank = new RSTile[] { new RSTile(3180, 3370),
new RSTile(3178, 3380), new RSTile(3173, 3394),
new RSTile(3171, 3410), new RSTile(3171, 3425),
new RSTile(3186, 3429), new RSTile(3186, 3439) };
toMine = reversePath(toBank);
bankBooth = 11402;
}

if (mode >= 12 && mode <= 16) {
log("Setting paths for Al Kharid.");
toBank = new RSTile[] { new RSTile(3300, 3305),
new RSTile(3299, 3291), new RSTile(3294, 3277),
new RSTile(3292, 3263), new RSTile(3291, 3248),
new RSTile(3288, 3231), new RSTile(3280, 3217),
new RSTile(3285, 3201), new RSTile(3281, 3187),
new RSTile(3277, 3172), new RSTile(3269, 3167) };
toMine = reversePath(toBank);
bankBooth = 35647;
}

if (mode >= 17 && mode <= 17) {
log("Setting paths for the Mining Guild.");
toBank = new RSTile[] { new RSTile(3047, 9738),
new RSTile(3038, 9737), new RSTile(3021, 9739),
new RSTile(3021, 3339), new RSTile(3032, 3342),
new RSTile(3032, 3357), new RSTile(3020, 3361),
new RSTile(3012, 3356) };
toMine = reversePath(toBank);
bankBooth = 11758;
}

return true;
}

public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
}

public int loop() {
// Does the play have enough energy to run and is the player allready
// running?
if (getEnergy() >= randomRun && !isRunning()) {
// All conditions met, set run mode.
log("Setting run.");
setRun(true);

randomRun = random(40, 75);
log("Running next time when energy reaches " + randomRun + ".");
return random(500, 750);
}

// Perform script actions based on state.
switch (state) {
case S_WALKTO_MINE:
if (walkPath(toMine)) {
log("Arriving at mine, mining.");
state = S_MINE;
return random(500, 750);
} else {
antiBan();
return random(250, 500);
}

case S_WALKTO_BANK:
if (walkPath(toBank)) {
log("Arriving at bank, banking.");
state = S_USE_BANK;
return random(500, 750);
} else {
antiBan();
return random(250, 500);
}

case S_MINE:
RSObject rock = findObject(rocks[mode]);
RSObject sr = findObject(smokingRocks);

if (isInventoryFull()) {
if (powerMode) {
log("Inventory is full, dropping.");
state = S_DROP;
return random(500, 750);
} else {
log("Inventory is full, banking.");
state = S_WALKTO_BANK;
return random(500, 750);
}
}

if (getMyPlayer().isInCombat()) {
log("Currently in combat, running away.");
avoidedCombat++;
state = S_WALKTO_BANK;
return random(500, 750);
}

if (getMyPlayer().isMoving()
|| getMyPlayer().getAnimation() != -1) {
if (sr != null && distanceTo(sr.getLocation()) <= 1) {
log("Avoided smoking rocks.");
avoidedSmokingRocks++;
} else {
return antiBan();
}
}

if (rock != null) {
if (tileOnScreen(rock.getLocation())) {
fails = 0;
atObject(rock, "Mine");
return random(750, 1000);
} else {
walkTileRand(rock.getLocation());
return random(500, 750);
}
} else {
fails++;
log("Failed to find a rock, trying " + (MAX_FAILS - fails)
+ " times.");
return random(750, 1500);
}

case S_USE_BANK:
RSObject booth = findObject(bankBooth);

if (getMyPlayer().isMoving()) {
return antiBan();
}

if (booth != null) {
if (tileOnScreen(booth.getLocation())) {
if (!atObject(booth, "Use-quickly")) {
log("Failed to access bank, trying "
+ (MAX_FAILS - fails) + " more times.");
return random(750, 1500);
}

bank.depositAllExcept(gear);

if (isInventoryFull()) {
log("Something when wrong, inventory is still full, retrying "
+ (MAX_FAILS - fails) + " more times.");
return random(500, 750);
} else {
log("Made deposit, heading back to the mine.");
state = S_WALKTO_MINE;
return random(500, 750);
}
} else {
walkTileRand(booth.getLocation());
return random(500, 750);
}
} else {
fails++;
log("Failed to find a bank booth, trying "
+ (MAX_FAILS - fails) + " more times.");
return random(750, 1500);
}

case S_DROP:
log("Dropping all items except gear.");
dropAllExcept(gear);
state = S_MINE;
return random(500, 750);

}

return random(500, 750);
}

public void onRepaint(Graphics g) {
// local objects:
int index = STAT_MINING;
int exp = 0;
int levels;
long hours = 0, minutes = 0, seconds = 0;
long time;

// Has start time been previously set?
if (startTime == 0) {
startTime = System.currentTimeMillis();
}

// Calculate hours, minutes and seconds.
time = System.currentTimeMillis() - startTime;
seconds = time / 1000;
if (seconds >= 60) {
minutes = seconds / 60;
seconds -= minutes * 60;
}
if (minutes >= 60) {
hours = minutes / 60;
minutes -= hours * 60;
}

// Has variables been previously defined?
if (startLevel == 0 || startExp == 0) {
// No, so define them now.
startLevel = skills.getCurrentSkillLevel(index);
startExp = skills.getCurrentSkillExp(index);
oldExp = 0;
}

// Calculate catches based on experience changes.
exp = skills.getCurrentSkillExp(index) - startExp;
if (exp > oldExp) {
xpPerRock = exp - oldExp;
oldExp = exp;
rockCount++;
countToNext = skills.getXPToNextLevel(STAT_MINING) / xpPerRock + 1;
}

// Calculate levels gained.
levels = skills.getCurrentSkillLevel(index) - startLevel;
if (levels > oldLevels) {
oldLevels = levels;
}

//
if (System.currentTimeMillis() - lastAvgCheck >= 60000) {
lastAvgCheck = System.currentTimeMillis();
avgPerHour = (rockCount - oldRockCount) * 60;
oldRockCount = rockCount;
}

// Draw information.
g.setColor(Color.WHITE);
g.drawString(getName() + " v" + getVersion(), 9, 171);
g.drawString("XP Gained: " + exp, 9, 187);
g.drawString("Levels Gained: " + levels, 9, 203);
g.drawString("Percent to next level: "
+ skills.getPercentToNextLevel(index), 9, 219);
g.drawString("Rocks: " + rockCount, 9, 235);
g.drawString("Rocks to next level: " + countToNext, 9, 251);
g.drawString("Times avoided combat: " + avoidedCombat, 9, 267);
g.drawString("Smoking Rocks Avoided: " + avoidedSmokingRocks, 9, 283);
g.drawString("Time running: " + hours + "." + minutes + "." + seconds,
9, 299);
g.drawString("Average per hour: " + avgPerHour, 9, 315);
// g.drawString("Gems: " + gems, 9, 331); Added later.
}

private int antiBan() {
int gamble = random(1, 12);

switch (gamble) {
case 1:
return random(500, 750);

case 2:
int x = random(0, 750);
int y = random(0, 500);
moveMouse(0, 0, x, y);
return random(500, 750);

case 3:
openTab(TAB_INVENTORY);
return random(500, 750);

case 4:
if (getMyPlayer().isMoving()) {
return random(750, 1000);
}

if (System.currentTimeMillis() - lastCheck >= checkTime) {
lastCheck = System.currentTimeMillis();
checkTime = random(60000, 180000);

if (getCurrentTab() != TAB_STATS) {
openTab(TAB_STATS);
}
moveMouse(660, 227, 50, 28);
return random(5000, 8000);
}

case 5:
if (random(1, 8) == 2) {
int angle = getCameraAngle() + random(-90, 90);
if (angle < 0) {
angle = 0;
}
if (angle > 359) {
angle = 0;
}

setCameraRotation(angle);
}

return random(500, 750);
}

return random(500, 750);
}

private boolean walkPath(RSTile[] path) {
if (distanceTo(path[path.length - 1]) <= 2) {
return true;
} else {
if (!getMyPlayer().isMoving()) {
walkPathMM(randomizePath(path, 2, 2), 20);
}
}

return false;
}

private void walkTileRand(RSTile tile) {
// Local objects:
RSTile temp = new RSTile(tile.getX() + random(-2, 2), tile.getY()
+ random(-2, 2));

walkTileMM(temp);
}
}

There's an all in one miner that has Guild miner in it
 
Runescape Gamblingrunescape gambling
Back
Top