IronPowerminer
Mines Iron ore and drops it on the ground.
Changelog
V1.2 - Added Smoking rock random support and picking up pickheads
V1.1 - Added more ID's and improved the speed
V1.0 - Release
Script:
import java.awt.*
import org.osbot.script.Script
import org.osbot.script.ScriptManifest
import org.osbot.script.mouse.*
import org.osbot.script.rs2.*
import org.osbot.script.rs2.map.Position
import org.osbot.script.rs2.model.GroundItem
import org.osbot.script.rs2.model.Item
import org.osbot.script.rs2.model.PrimaryObject
import org.osbot.script.rs2.model.RS2Object
import org.osbot.script.rs2.ui.*
@ScriptManifest(name = "IronPowerminer", author="Xerion", version = 1.3D, info = "IronPowerminer")
class IronPowerminer extends Script {
enum State {
START, IDLE, MINING, DROP, BANK, BANKING
}
private final Color color1 = new Color(0.1f, 0.1f, 0.1f, 0.7f);
private final Color color2 = new Color(255, 0, 0);
private final Font font1 = new Font("Calisto MT", 0, 16);
private final Font font2 = new Font("Calisto MT", 0, 11);
int[] pickhandle = [480,482,484,486,488,490];
int[] iron = [ 11955, 11956, 11954,2092,2093,5773,5774,5775,6943,6944,9717,9718,9719,14856,14857,14858,14913,14914,19000,19001,19002,21281,21282,21283,29222,29223,29221,32441,32442,32443,32451,32452,37307,37308,37309];
int[] items = [480,482,484,486,488,490,1265 , 1267, 1269, 1271,1273,1275,1617,1619,1621,1623]
def timeout = null;
def starttime = null;
def Newantiban = null;
def MinedOre = 0;
boolean Antibans = true
State state = State.START;
PrimaryObject currentRock = null;
@Override
void onStart() {
starttime = System.currentTimeMillis();
Newantiban = System.currentTimeMillis() + random(10000, 20000);
def th = Thread.start {
antiban()
}
if (client.getInventory().isFull()){
state = State.DROP;
}
else { state = State.IDLE; }
}
@Override
int onLoop() {
if (!randoms()){
switch(state) {
case State.IDLE:
return mine();
case State.MINING:
return check();
case State.DROP:
return drop();
}
}
return 1000 + gRandom(400, 800);
}
int mine() {
currentRock = closestObject(iron);
if (currentRock != null) {
if (selectEntityOption(currentRock,false,"Mine")) {
timeout = Calendar.instance.timeInMillis / 1000
state = State.MINING;
}
}
return 100;
}
int check(){
if (!currentRock.exists() || timeout + 15 < Calendar.instance.timeInMillis / 1000){
if (!client.getInventory().isFull()){
state = State.IDLE;
return 500 + random(100, 1000)
}
else {
if (currentTab() != Tab.INVENTORY){
openTab(Tab.INVENTORY);
}
else{state = State.DROP;
return 500 + random(100, 1000)}
}
}
return 100
}
boolean randoms(){
//Losing Pickhandle
if (closestGroundItem(pickhandle) != null){
selectEntityOption(closestGroundItem(pickhandle),"Take")
return true
}
return false
}
int drop(){
if (client.getInventory().contains(440)){
selectInventoryOption(client.getInventory().getSlotForId(440),"drop");
return random(200,450)
} else {
state = State.IDLE;
}
return 1000 + random(500,800)
}
void onMessage(String message){
if ("You manage to mine some iron." == message){
MinedOre++
}
else if (message == "This rock contains iron." || message == "There is no ore currently available in this rock."){
state = State.IDLE;
}
}
@Override
void onExit(){
Antibans = false
}
@Override
void onPaint(Graphics g) {
g.setColor(color1);
g.fillRect(1, 51, 209, 94);
g.setFont(font1);
g.setColor(color2);
g.drawString("IronPowerminer", 7, 76);
g.setFont(font2);
g.drawString("Time: " + format(System.currentTimeMillis() - starttime), 7, 130);
g.drawString("Ore: Iron(${MinedOre})", 7, 100);
g.drawString("State: ${state}", 7, 115);
}
String format(final long time) {
final StringBuilder t = new StringBuilder();
final long total_secs = time / 1000;
final long total_mins = total_secs / 60;
final long total_hrs = total_mins / 60;
final int secs = (int) total_secs % 60;
final int mins = (int) total_mins % 60;
final int hrs = (int) total_hrs % 24;
if (hrs < 10) {
t.append("0");
}
t.append(hrs);
t.append(":");
if (mins < 10) {
t.append("0");
}
t.append(mins);
t.append(":");
if (secs < 10) {
t.append("0");
}
if (secs < 0){
t.append("0")
}
else{
t.append(secs);
}
return t.toString();
}
void antiban(){
while(Antibans){
if (state == State.MINING && Newantiban < System.currentTimeMillis()){
int Anti = random(0 , 3)
switch(Anti){
case 0:
log("Antiban: Move mouse")
moveMouseOutsideScreen()
Newantiban = System.currentTimeMillis() + random(40000, 120000)
break;
case 1:
log("Antiban: Move camera")
client.moveCameraToEntity(currentRock)
Newantiban = System.currentTimeMillis() + random(40000, 120000)
break;
case 2:
log("Antiban: Open Skills tab")
if (currentTab() != Tab.SKILLS){
openTab(Tab.SKILLS);
}
Newantiban = System.currentTimeMillis() + random(40000, 120000)
break;
case 3:
log("Antiban: Open Friends tab")
if (currentTab() != Tab.FRIENDS){
openTab(Tab.FRIENDS);
}
Newantiban = System.currentTimeMillis() + random(40000, 120000)
break;
}
}
Thread.sleep(1000)
}
}
}