Skip to content

Instantly share code, notes, and snippets.

Created May 11, 2015
Embed
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
import org.tbot.graphics.SkillPaint;
import org.tbot.internal.AbstractScript;
import org.tbot.internal.Manifest;
import org.tbot.internal.event.listeners.PaintListener;
import org.tbot.methods.tabs.Inventory;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by FearMe on 5-1-2015.
*/
@Manifest(name = "bandits", authors = "fearme", version = 1.0)
public class Bandits extends AbstractScript implements PaintListener{
SkillPaint sp = new SkillPaint();
List<Node> nodes = new ArrayList<Node>();
@Override
public boolean onStart() {
nodes.add(new PrayerPots());
//nodes.add(new SuperPots());
return true;
}
@Override
public int loop() {
for(Node n : nodes) {
if (n.activate())
return n.doStuff();
}
return 100;
}
@Override
public void onRepaint(Graphics g) {
g.drawString("Prayer pot at: " + PrayerPots.potAt(), 10, 330);
sp.draw(g);
}
}
/**
* Created by FearMe on 5-1-2015.
*/
public abstract class Node {
public abstract boolean activate();
public abstract int doStuff();
}
/**
* Created by FearMe on 5-1-2015.
*/
public enum Potion {
STRENGTH(113, 115, 117, 119),
ATTACK(2428, 121, 123, 125),
RESTORE(2430, 127, 129, 131),
DEFENCE(2432, 133, 135, 137),
PRAYER(2434, 139, 141, 143),
FISHING(2438, 151, 153, 155),
RANGING(2444, 169, 171, 173),
ANTIFIRE(2452, 2454, 2456, 2458),
ENERGY(3008, 3010, 3012, 3014),
AGILITY(3032, 3034, 3036, 3038),
MAGIC(3040, 3042, 3044, 3046),
COMBAT(9739, 9741, 9743, 9745),
SUPER_ATTACK(2436, 145, 147, 149),
SUPER_STRENGTH(2440, 157, 159, 161),
SUPER_DEFENCE(2442, 163, 165, 167),
SUPER_ENERGY(3016, 3018, 3020, 3022),
SUPER_RESTORE(3024, 3026, 3028, 3030);
Potion(int full, int threeQuarters, int half, int quarter) {
this.quarter = quarter;
this.half = half;
this.threeQuarters = threeQuarters;
this.full = full;
}
public int quarter, half, threeQuarters, full;
}
import org.tbot.methods.Mouse;
import org.tbot.methods.Random;
import org.tbot.methods.Skills;
import org.tbot.methods.tabs.Inventory;
import org.tbot.wrappers.Item;
/**
* Created by FearMe on 5-1-2015.
*/
public class PrayerPots extends Node {
private long lastPrayer = 0;
public static int offset = Random.nextInt(15);
@Override
public boolean activate() {
return (Inventory.containsOneOf(Potion.PRAYER.full, Potion.PRAYER.threeQuarters,
Potion.PRAYER.half, Potion.PRAYER.quarter) &&
(lastPrayer + 5000) < System.currentTimeMillis()) &&
(Skills.getCurrentLevel(Skills.Skill.Prayer) <=
(Skills.getRealLevel(Skills.Skill.Prayer) -
getPrayerBoost() - offset));
}
@Override
public int doStuff() {
for(Item i : Inventory.getItems()) {
if (i.getName().contains("Prayer")) {
i.interact("Drink");
offset = Random.nextInt(15);
lastPrayer = System.currentTimeMillis();
break;
}
}
return 100;
}
private static int getPrayerBoost() {
return (int)Math.floor(7+(Skills.getRealLevel(Skills.Skill.Prayer)/4));
}
public static int potAt() {
return (Skills.getRealLevel(Skills.Skill.Prayer) - getPrayerBoost() - offset);
}
}
import org.tbot.internal.AbstractScript;
import org.tbot.methods.Skills;
import org.tbot.methods.Skills.Skill;
import org.tbot.methods.tabs.Inventory;
import org.tbot.wrappers.Item;
/**
* Created by FearMe on 5-1-2015.
*/
public class SuperPots extends Node {
private long lastPot = 0;
@Override
public boolean activate() {
return (inventoryContains(Potion.SUPER_ATTACK) && shouldDrink(Potion.SUPER_ATTACK)) || (inventoryContains(Potion.SUPER_STRENGTH) && shouldDrink(Potion.SUPER_STRENGTH))
return (Inventory.containsOneOf(Potion.SUPER_ATTACK.getFullId(), Potion.SUPER_ATTACK.getThreeQuartersId(),
Potion.SUPER_ATTACK.getHalfId(), Potion.SUPER_ATTACK.getQuarterId()) ||
Inventory.containsOneOf(Potion.SUPER_STRENGTH.getFullId(), Potion.SUPER_STRENGTH.getThreeQuartersId(),
Potion.SUPER_STRENGTH.getHalfId(), Potion.SUPER_STRENGTH.getQuarterId())) &&
((lastPot + 10000) < System.currentTimeMillis()) &&
(Skills.getCurrentLevel(Skill.Attack) <=
(Skills.getRealLevel(Skill.Attack) +
Math.floor(getSuperPotBoost(Skill.Attack)/2)));
}
@Override
public int doStuff() {
int oldAttack = Skills.getCurrentLevel(Skill.Attack);
int oldStrength = Skills.getCurrentLevel(Skill.Strength);
boolean attack = false;
boolean strength = false;
for(Item i : Inventory.getItems()) {
if (i.getName().contains("attack") && !attack) {
if(i.interact("Drink")) {
attack = true;
AbstractScript.sleep(3000);
}
} else if (i.getName().contains("strength") && !strength) {
if(i.interact("Drink")) {
strength = true;
AbstractScript.sleep(3000);
}
}
if(attack && strength) {
lastPot = System.currentTimeMillis();
break;
}
}
return 100;
}
private static int getSuperPotBoost(Skills.Skill skill) {
return (int)Math.floor(5+(Skills.getRealLevel(skill)*0.15));
}
private static boolean shouldDrink(Potion potion) {
switch(potion) {
case SUPER_ATTACK:
return (Skills.getCurrentLevel(Skill.Attack) <=
(Skills.getRealLevel(Skill.Attack) +
Math.floor(getSuperPotBoost(Skill.Attack)/2)));
case SUPER_STRENGTH:
return (Skills.getCurrentLevel(Skill.Strength) <=
(Skills.getRealLevel(Skill.Strength) +
Math.floor(getSuperPotBoost(Skill.Strength)/2)));
}
return false;
}
private static boolean inventoryContains(Potion p) {
return Inventory.containsOneOf(p.full, p.threeQuarters, p.half, p.quarter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment