Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.util.ArrayList;
- import org.tribot.bot.Methods;
- import org.tribot.bot.TRiBot;
- import org.tribot.input.Mouse;
- import org.tribot.loader.Client;
- import org.tribot.methods.*;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.wrappers.RSArea;
- import org.tribot.wrappers.RSInterface;
- import org.tribot.wrappers.RSInventItem;
- import org.tribot.wrappers.RSModel;
- import org.tribot.wrappers.RSObject;
- import org.tribot.wrappers.RSTile;
- @ScriptManifest(authors = { "J_Pizzle" }, category = "Runecrafting", name = "Earth Rune Crafter", version = 0.1, description = "<html>"
- + "<h1><center>Earth Rune Crafter</center></h1>Crafts earth runes.</html>")
- public class EarthRuneCrafter extends Script {
- int Crafted;
- int runeEss = 1436;
- int earthTally = 1440;
- int[] tallyArray = {1440};
- int alterID = 2481;
- int ruinsID = 2455;
- int portalID = 2468;
- RSTile releaseTile = tile(3302, 3477);
- RSTile endTile = tile(2657, 4830);
- RSTile alterLoc = tile(2658, 4838);
- RSTile[] toAlter = {tile(3254, 3420), tile(3258, 3429), tile(3268, 3429),
- tile(3278, 3435), tile(3286, 3448), tile(3291, 3460), tile(3304, 3474)};
- RSTile[] toBank = walking.invertPath(toAlter);
- public EarthRuneCrafter(Client bot) {
- super(bot);
- }
- public boolean waitForTile(RSTile theTile, int timeout){
- long t = timing.currentTimeM();
- while (timing.timeFromMark(t) < timeout){
- if (character.getPos().equals(theTile))
- return true;
- }
- return false;
- }
- public boolean waitForStop(int timeout){
- long t = timing.currentTimeM();
- while (timing.timeFromMark(t) < timeout){
- RSTile currTile = character.getPos();
- sleep(10 + random(100, 250));
- if (currTile.equals(currTile))
- return true;
- }
- return false;
- }
- public boolean enterPortal(){
- RSObject portal = objects.findNearestObject(portalID, 1000);
- if (portal != null){
- RSTile loc = portal.getPos();
- sleep(500 + random(0, 250));
- if (calculations.isTileOnScreen(loc, 0)){
- Point portalCoords = calculations.tileToScreen(loc, 0);
- clickMouse(portalCoords, 5, 5, 1);
- return waitForTile(releaseTile, 1000);
- } else {
- walking.walkPathUntilFlag(walking.randomizePath(
- walking.generateStraightPath(loc), 2, 2));
- waitForStop(1000);
- sleep(100 + random(123, 345));
- enterPortal();
- }
- }
- return false;
- }
- public boolean Bank(){
- if (banking.openBankNPC()){
- banking.depositByInvExcept(tallyArray);
- banking.withdrawItem(runeEss, 27);
- banking.closeBank();
- if (inventory.countItemsByID(runeEss) > 0)
- return true; else
- return false;
- }
- return false;
- }
- public int amountCrafted(){
- RSInventItem runes = inventory.getItemByID(557);
- return runes.getStackSize();
- }
- public boolean craftRunes(){
- if (inventory.countItemsByID(runeEss) > 0){
- RSObject alter= objects.findNearestObject(alterID, 100);
- RSTile alterLoc = alter.getPos();
- if (calculations.isTileOnScreen(alterLoc, 0)){
- Point alterCoords = calculations.tileToScreen(alterLoc, 0);
- clickMouse(alterCoords, 5, 5, 1);
- long t = timing.currentTimeM();
- while (timing.timeFromMark(t) < 10000 && inventory.countItemsByID(runeEss) > 0)
- sleep(10);
- } else {
- walking.walkPathUntilFlag(walking.randomizePath(
- walking.generateStraightPath(alterLoc), 2, 2));
- craftRunes();
- }
- if (inventory.countItemsByID(runeEss) == 0){
- Crafted += amountCrafted();
- return true;
- }
- }
- return false;
- }
- public boolean enterAlter(){
- if (inventory.countItemsByID(earthTally) ==0)
- return false;
- RSInventItem item = inventory.getItemByID(earthTally);
- if (item == null)
- return false;
- Point coords = item.getRandomPoint();
- clickMouse(coords, 1, 1, 1);
- RSObject alter = objects.findNearestObject(ruinsID, 1000);
- if (alter != null){
- RSTile alterTile = alter.getPos();
- Point alterCoords = calculations.tileToScreen(alterTile, 0);
- clickMouse(alterCoords, 5, 5, 1);
- return waitForTile(endTile, 1000000);
- }
- return false;
- }
- @Override
- public void onBreakEnd() {
- // TODO Auto-generated method stub
- }
- @Override
- public void onBreakStart() {
- // TODO Auto-generated method stub
- }
- @Override
- public void onEnd() {
- // TODO Auto-generated method stub
- }
- @Override
- public void onPaint(Graphics g) {
- g.setColor(Color.red);
- g.drawString("GE Chop'N Bank", 10, 320);
- g.drawString("Trees Cut: " + Crafted, 10, 335);
- }
- @Override
- public void onPause() {
- // TODO Auto-generated method stub
- }
- @Override
- public void onResume() {
- // TODO Auto-generated method stub
- }
- @Override
- public void run() {
- while (true){
- if (Bank()){
- walking.walkPath(walking.randomizePath(toAlter, 1, 1));
- if (enterAlter()){
- if (craftRunes()){
- if (enterPortal())
- walking.walkPath(walking.randomizePath(toBank, 1, 1));
- }
- }
- }
- }
- }
- //}
- public RSTile tile(int x, int y){
- return new RSTile(x, y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement