Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Fixes in 1.02:
- //Double teleport 99% Eradicated even with massive lag
- //Path around the "Curve" tightened and shortened
- //Path at "ramp" sometimes high road.
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.text.NumberFormat;
- import java.util.Map;
- import org.rsbot.bot.Bot;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Calculations;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.Skills;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.wrappers.RSInterface;
- import org.rsbot.script.wrappers.RSInterfaceChild;
- import org.rsbot.script.wrappers.RSInterfaceComponent;
- import java.awt.Rectangle;
- @ScriptManifest(authors = { "Garrett" }, category = "Runecraft", name = "Garrett's Astral Runecrafter", version = 1.02, description =
- "<html><head>" +
- "</head><body>" +
- "<center><strong><h2>Garrett's Astral Runecrafter</h2></strong><br /><br />" +
- "NOTE: Wearing a ring of life & turning off auto retaliate would be a good idea<br />" +
- "Start the script anywhere along the runecrafting process<br />" +
- "If you want to use teleport, have an earth staff equipped and laws in inventory</center><br />" +
- "Food ID: <input name='FOODID' type='text' size='5' value='7946' /><br />" +
- "Eat Food (Random): <input name='HEALTH1' type='text' size='3' value='70' /> to <input name='HEALTH2' type='text' size='3' value='90' /> HP %<br />" +
- "<input name='USEPOTS' type='checkbox' value='1'>Use energy potions?" +
- "</body></html>")
- public class GarrettsAstralRunecrafter extends Script implements PaintListener, ServerMessageListener {
- final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- private long scriptStartTIME = 0;
- int runEnergy = random(40, 95);
- int randomDrink = 100;
- int healthPercent = 0;
- int drinkVars[] = new int[2];
- int randomHealth[] = new int[2];
- int failCount = 0;
- int fatalCount = 0;
- int startLVL = 0;
- int startXP = 0;
- boolean setAltitude = false;
- //delete from here if needed
- int smPouch = 5509;
- int medPouch = 5510;
- int medPouchd = 5511;
- int largePouch = 5512;
- int largePouchd = 5513;
- int giantPouch = 5514;
- int giantPouchd = 5515;
- int airRune = 556;
- int cosmicRune = 564;
- public boolean checkPouch = true;
- public boolean fullPouch = true;
- public int pouchCheck = 0;
- public int numPouches = 0;
- public boolean decayedPouch = false;
- public boolean giantFull=false;
- public int pouchesFixxed = 0;
- public boolean craftUp=false;
- public boolean emptyInv=false;
- public boolean smFull=false;
- public boolean medFull=false;
- public boolean largeFull=false;
- public int moneyBanked=0;
- public int moneyUsed=0;
- public int profitMade=0;
- public int essPrice=129;
- public int astralPrice=214;
- public int lawPrice=334;
- public boolean craftSinceProfit=false;
- public int tCashUsed = 0;
- boolean useFood = true;
- boolean usePots = true;
- final int pureEssence = 7936;
- final int astralRune = 9075;
- final int lawRune = 563;
- final int energyPots[] = {3014, 3012, 3010, 3008, 3022, 3020, 3018, 3016};
- int foodID = 0;
- public RSTile PathToBank[] = { new RSTile(2113,3916), new RSTile(2106,3915), new RSTile(2100,3918)};
- final RSTile bankBooth = new RSTile(2099, 3920);
- final RSTile bankTile = new RSTile(2101, 3919);
- final RSTile altar = new RSTile(2158, 3864);
- final RSTile[] path = {new RSTile(2099, 3919), new RSTile(2104, 3915), new RSTile(2112, 3915), new RSTile(2113, 3901),
- new RSTile(2113, 3897), new RSTile(2115,3885), new RSTile(2123, 3879), new RSTile(2128, 3874),
- new RSTile(2134, 3864), new RSTile(2142, 3860), new RSTile(2147, 3863),
- new RSTile(2153, 3864), new RSTile(2156, 3864)};
- private enum State { walkToAltar, walkToBank, craftRunes, teleport, drinkPotion, eatFood, bank, checkPouches, emptyPouch, repairPouches, error };
- private State getState() {
- if (fatalCount > 20)
- return State.error;
- if (usePots)
- if (getEnergy() < randomDrink)
- if (inventoryContainsOneOf(energyPots))
- return State.drinkPotion;
- if (tileOnMap(bankTile)) {
- if (useFood)
- if (getHPpercent() < healthPercent)
- if (inventoryContains(foodID))
- return State.eatFood;
- if (usePots)
- if (!inventoryContainsOneOf(energyPots) && !isInventoryFull())
- return State.bank;
- if (decayedPouch)
- return State.repairPouches;
- if (checkPouch)
- return State.checkPouches;
- if (!inventoryContains(pureEssence))
- return State.bank;
- if (!isInventoryFull())
- return State.bank;
- }
- if (tileOnMap(altar)){
- if (inventoryContains(pureEssence)){
- craftSinceProfit=true;
- return State.craftRunes;
- }
- if(craftUp){
- craftUp=false;
- return State.craftRunes;
- }
- if (fullPouch)
- return State.emptyPouch;
- }
- if (inventoryContains(pureEssence))
- return State.walkToAltar;
- else {
- if (inventoryContains(lawRune) && distanceTo(bankTile) > 30)
- return State.teleport;
- else
- return State.walkToBank;
- }
- }
- public boolean onStart( Map<String,String> args ) {
- setCompass('w');
- scriptStartTIME = System.currentTimeMillis();
- usePots = args.get("USEPOTS") != null ? true : false;
- randomHealth[0] = Integer.parseInt(args.get("HEALTH1"));
- randomHealth[1] = Integer.parseInt(args.get("HEALTH2"));
- drinkVars[0] = 40;
- drinkVars[1] = 70;
- randomDrink = random(drinkVars[0], drinkVars[1]);
- healthPercent = random(randomHealth[0], randomHealth[1]);
- foodID = Integer.parseInt(args.get("FOODID"));
- return true;
- }
- public int loop() {
- if (!isLoggedIn())
- return 1;
- if(!setAltitude) {
- setCameraAltitude(true);
- wait(random(250, 500));
- setAltitude = true;
- return 1;
- }
- startRunning(runEnergy);
- switch (getState()) {
- case walkToAltar:
- walkPath(path);
- return 1;
- case walkToBank:
- walkPath(reversePath(path));
- return 1;
- case craftRunes:
- int invCount = getInventoryCount(astralRune);
- if (onTile(altar, "Craft", random(-0.25, 1.25), random(-0.25, 1.25), 0)) {
- fatalCount = 0;
- wait(random(200, 400));
- failCount = 0;
- while (invCount == getInventoryCount(astralRune) && failCount < 40) {
- wait(random(50, 100));
- failCount++;
- }
- }
- return 1;
- case teleport:
- log("Initiating teleport");
- if (getCurrentTab() != TAB_MAGIC) {
- openTab(TAB_MAGIC);
- failCount = 0;
- while (getCurrentTab() != TAB_MAGIC && failCount < 10) {
- wait(random(50, 100));
- failCount++;
- }
- }
- RSTile location = getMyPlayer().getLocation();
- RSTile location2 = location;
- wait(random(100,250));
- while(location == location2){
- log("While loop started loc=loc");
- if (atInterface(430, 42)) {
- wait(random(500, 750));
- failCount = 0;
- while (location == getMyPlayer().getLocation() && failCount < 40) {
- wait(random(100, 150));
- failCount++;
- }
- while (getMyPlayer().getAnimation() != -1) {
- wait(random(50, 100));
- }
- wait(random(800, 1200));
- moneyUsed= moneyUsed+lawPrice;
- } else {
- onTile(altar, "Pray", random(-0.25, 1.25), random(-0.25, 1.25), 0);
- wait(random(800, 1200));
- }
- location2 = getMyPlayer().getLocation();
- log("while loop ended");
- }
- log("successfully registered tele");
- return 1;
- case drinkPotion:
- if (bank.isOpen()) {
- if (bank.close()) {
- wait(random(100, 200));
- failCount = 0;
- while (bank.isOpen() && failCount < 20) {
- wait(random(50, 100));
- failCount++;
- }
- }
- return 1;
- }
- for (int i = 0; i < energyPots.length; i++) {
- try {
- if (atInventoryItem(energyPots[i], "Drink")) {
- wait(random(100, 200));
- failCount = 0;
- while (inventoryContains(energyPots[i]) && failCount < 20) {
- wait(random(50, 100));
- failCount++;
- }
- randomDrink = random(drinkVars[0], drinkVars[1]);
- break;
- }
- } catch(Exception e) { }
- }
- return 1;
- case eatFood:
- if (inventoryContains(foodID)) {
- if (bank.isOpen()) {
- if (bank.close()) {
- wait(random(100, 200));
- failCount = 0;
- while (bank.isOpen() && failCount < 20) {
- wait(random(50, 100));
- failCount++;
- }
- }
- return 1;
- }
- if (atInventoryItem(foodID, "Eat")) {
- wait(random(100, 200));
- failCount = 0;
- while (inventoryContains(foodID) && failCount < 30) {
- wait(random(50, 100));
- failCount++;
- }
- healthPercent = random(randomHealth[0], randomHealth[1]);
- }
- }
- return 1;
- case repairPouches:
- if(bank.isOpen()&&inventoryContains(airRune)&&inventoryContains(cosmicRune)&&inventoryContains(astralRune)){
- if (bank.close()) {
- wait(random(100, 200));
- failCount = 0;
- while (bank.isOpen() && failCount < 20) {
- wait(random(50, 100));
- failCount++;
- }
- return 1;
- }
- }
- if(inventoryContains(airRune)&&inventoryContains(cosmicRune)&&inventoryContains(astralRune)){
- if (getCurrentTab() != TAB_MAGIC) {
- openTab(TAB_MAGIC);
- failCount = 0;
- while (getCurrentTab() != TAB_MAGIC && failCount < 10) {
- wait(random(50, 100));
- failCount++;
- }
- }
- atInterface(430, 26);
- wait(random(1500, 1750));
- final RSInterfaceChild scrollBar = RSInterface.getChildInterface(88, 20);
- if (!scrollBar.isValid())
- return 1;
- Rectangle pos = scrollBar.getArea();
- if (pos.x == -1 || pos.y == -1 || pos.width == -1 || pos.height == -1) {
- return 1;
- }
- moveMouse((int) random(458, 465), (int) random(257, 296));
- clickMouse(true);
- wait(random(500, 750));
- clickMouse(true);
- final RSInterfaceChild darkMage = RSInterface.getChildInterface(88, 22);
- if (!darkMage.isValid())
- return 1;
- atComponent(darkMage,4,"Speak-to");
- //I know this looks a bit overkill but it seems to work out right... dont fix it if it ain't broke right?!?
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- moveMouse((int) random(162, 352), (int) random(416, 423));
- clickMouse(true);
- moveMouse((int) random(162, 352), (int) random(416, 423));
- wait(random(500, 750));
- moveMouse((int) random(162, 352), (int) random(416, 423));
- clickMouse(true);
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- clickContinue();
- wait(random(500,1000));
- }
- if(!inventoryContains(airRune)||!inventoryContains(cosmicRune)||!inventoryContains(astralRune)){
- if (getMyPlayer().isMoving())
- return 1;
- if (distanceTo(bankTile) > 10)
- walkTileMM(bankTile);
- if (!bank.isOpen()) {
- if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
- wait(random(1500, 2000));
- failCount = 0;
- while (!bank.isOpen() && failCount < 30) {
- wait(random(600, 800));
- if (getMyPlayer().isMoving())
- failCount = 0;
- failCount++;
- }
- }
- }
- if (atInventoryItem(pureEssence, "Deposit-All")) {
- wait(random(600, 800));
- failCount = 0;
- while (inventoryContains(pureEssence) && failCount < 30) {
- wait(random(600, 800));
- failCount++;
- }
- } else fatalCount++;
- if (bank.atItem(airRune, "Withdraw-10")) {
- wait(random(600, 800));
- failCount = 0;
- while (!inventoryContains(airRune) && failCount < 30) {
- wait(random(600, 800));
- failCount++;
- }
- } else fatalCount++;
- if (bank.atItem(cosmicRune, "Withdraw-10")) {
- wait(random(600, 800));
- failCount = 0;
- while (!inventoryContains(cosmicRune) && failCount < 30) {
- wait(random(600, 800));
- failCount++;
- }
- } else fatalCount++;
- if (bank.atItem(astralRune, "Withdraw-10")) {
- wait(random(600, 800));
- failCount = 0;
- while (!inventoryContains(astralRune) && failCount < 30) {
- wait(random(600, 800));
- failCount++;
- }
- } else fatalCount++;
- return 1;
- }
- if(!inventoryContains(medPouchd)&&!inventoryContains(largePouchd)&&!inventoryContains(giantPouchd)){
- if (getMyPlayer().isMoving())
- return 1;
- if (distanceTo(bankTile) > 10)
- walkTileMM(bankTile);
- if (!bank.isOpen()) {
- if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
- wait(random(100, 200));
- failCount = 0;
- while (!bank.isOpen() && failCount < 30) {
- wait(random(50, 100));
- if (getMyPlayer().isMoving())
- failCount = 0;
- failCount++;
- }
- }
- }
- bank.depositAllExcept(energyPots[0], energyPots[1], energyPots[2], energyPots[3], energyPots[4], energyPots[5], energyPots[6], energyPots[7], lawRune, pureEssence, smPouch, medPouch, largePouch, giantPouch);
- decayedPouch=false;
- checkPouch=true;
- pouchesFixxed++;
- giantFull=false;
- largeFull=false;
- medFull=false;
- smFull=false;
- return 1;
- }
- case emptyPouch:
- wait(random(500,1000));
- if (getMyPlayer().isMoving())
- return 1;
- if(inventoryContains(giantPouch)&&!isInventoryFull()&&giantFull){
- atInventoryItem(giantPouch,"Empty");
- giantFull=false;
- wait(random(200,500));
- craftUp=true;
- return 1;
- }
- if(inventoryContains(smPouch)&&!isInventoryFull())
- atInventoryItem(smPouch,"Empty");
- wait(random(100,200));
- if(inventoryContains(medPouch)&&!isInventoryFull())
- atInventoryItem(medPouch,"Empty");
- wait(random(100,200));
- if(inventoryContains(largePouch)&&!isInventoryFull())
- atInventoryItem(largePouch,"Empty");
- wait(random(100,200));
- if(!isInventoryFull()){
- checkPouch=true;
- fullPouch=false;
- smFull=false;
- medFull=false;
- largeFull=false;
- return 1;
- }
- return 1;
- case checkPouches:
- emptyInv=false;
- if(inventoryContains(medPouchd)||inventoryContains(largePouchd)||inventoryContains(giantPouchd)){
- decayedPouch=true;
- return 1;
- }
- if(bank.isOpen()&&inventoryContains(pureEssence))
- if (bank.close()) {
- wait(random(100, 200));
- failCount = 0;
- while (bank.isOpen() && failCount < 20) {
- wait(random(50, 100));
- failCount++;
- }
- return 1;
- }
- if(!inventoryContains(pureEssence)){
- if (getMyPlayer().isMoving())
- return 1;
- if (distanceTo(bankTile) > 10)
- walkTileMM(bankTile);
- if (!bank.isOpen()) {
- if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
- wait(random(100, 200));
- failCount = 0;
- while (!bank.isOpen() && failCount < 30) {
- wait(random(50, 100));
- if (getMyPlayer().isMoving())
- failCount = 0;
- failCount++;
- }
- }
- }
- if(!isInventoryFull()&&!inventoryContains(astralRune)){
- if (bank.atItem(pureEssence, "Withdraw-All")) {
- wait(random(200, 400));
- failCount = 0;
- while (!inventoryContains(pureEssence) && failCount < 30) {
- wait(random(50, 100));
- failCount++;
- }
- } else fatalCount++;
- } else {
- if(craftSinceProfit){
- moneyBanked=moneyBanked+(getInventoryCount(astralRune)*astralPrice);
- craftSinceProfit=false;
- }
- bank.depositAllExcept(energyPots[0], energyPots[1], energyPots[2], energyPots[3], energyPots[4], energyPots[5], energyPots[6], energyPots[7], lawRune, pureEssence, smPouch, medPouch, largePouch, giantPouch);
- }
- return 1;
- }
- numPouches=0;
- pouchCheck=0;
- wait(random(200,400));
- if(inventoryContains(smPouch)&&!smFull){
- numPouches++;
- while(numPouches>pouchCheck&&!emptyInv){
- atInventoryItem(smPouch, "Fill");
- wait(random(1000,2000));
- }
- if(numPouches<=pouchCheck&&!emptyInv){
- smFull=true;
- }
- }
- wait(random(200,400));
- if(inventoryContains(medPouch)&&!medFull){
- numPouches++;
- while(numPouches>pouchCheck&&!emptyInv){
- atInventoryItem(medPouch, "Fill");
- wait(random(1000,2000));
- }
- if(numPouches<=pouchCheck&&!emptyInv){
- medFull=true;
- }
- }
- wait(random(200,400));
- if(inventoryContains(largePouch)&&!largeFull){
- numPouches++;
- while(numPouches>pouchCheck&&!emptyInv){
- atInventoryItem(largePouch, "Fill");
- wait(random(1000,2000));
- }
- if(numPouches<=pouchCheck&&!emptyInv){
- largeFull=true;
- }
- }
- pouchCheck=0;
- if(inventoryContains(giantPouch)&&!giantFull){
- atInventoryItem(giantPouch, "Fill");
- wait(random(1000,2000));
- if(pouchCheck>=1)
- giantFull=true;
- return 1;
- }
- wait(random(300,600));
- if(pouchCheck==numPouches&&!emptyInv){
- checkPouch=false;
- fullPouch=true;
- return 1;
- }
- if(numPouches<=0&&!emptyInv){
- checkPouch=false;
- fullPouch=false;
- return 1;
- }
- return 1;
- case bank:
- if (getMyPlayer().isMoving())
- return 1;
- if (distanceTo(bankTile) > 10)
- walkPathMM(PathToBank);
- if (!bank.isOpen()) {
- if (onTile(bankBooth, "Use-Quickly", 0.5, 0.5, 0)) {
- wait(random(100, 200));
- failCount = 0;
- while (!bank.isOpen() && failCount < 30) {
- wait(random(50, 100));
- if (getMyPlayer().isMoving())
- failCount = 0;
- failCount++;
- }
- }
- return 1;
- }
- if (inventoryContains(astralRune)) {
- if(inventoryContains(lawRune) || inventoryContains(pureEssence))
- bank.depositAllExcept(energyPots[0], energyPots[1], energyPots[2], energyPots[3], energyPots[4], energyPots[5], energyPots[6], energyPots[7], lawRune, pureEssence, smPouch, medPouch, largePouch, giantPouch);
- else
- bank.depositAll();
- }
- if (getEnergy() < randomDrink) {
- if (!inventoryContainsOneOf(energyPots) && !isInventoryFull()) {
- int usePotion = 0;
- for (int i = 0; i < energyPots.length; i++) {
- try {
- if (bank.getItemByID((energyPots[i])).isValid()) {
- usePotion = energyPots[i];
- break;
- }
- } catch(Exception e) { }
- }
- if (bank.atItem(usePotion, "Withdraw-1")) {
- failCount = 0;
- while (!inventoryContains(usePotion) && failCount < 30) {
- wait(random(50, 100));
- failCount++;
- }
- }
- }
- }
- if (getHPpercent() <= healthPercent) {
- if (!inventoryContains(foodID) && !isInventoryFull()) {
- if (bank.atItem(foodID, "Withdraw-1")) {
- failCount = 0;
- while (!inventoryContains(foodID) && failCount < 30) {
- wait(random(50, 100));
- failCount++;
- }
- } else fatalCount++;
- }
- return 1;
- }
- if (!inventoryContains(pureEssence) || !isInventoryFull()) {
- if (bank.atItem(pureEssence, "Withdraw-All")) {
- wait(random(200, 400));
- failCount = 0;
- while (!inventoryContains(pureEssence) && failCount < 30) {
- wait(random(50, 100));
- failCount++;
- }
- } else fatalCount++;
- }
- return 1;
- case error:
- return -1;
- }
- return 1;
- }
- public void serverMessageRecieved(final ServerMessageEvent arg0) {
- final String serverString = arg0.getMessage();
- if (serverString.toLowerCase().contains("full")) {
- pouchCheck++;
- }
- if (serverString.toLowerCase().contains("fill")) {
- pouchCheck++;
- }
- if (serverString.toLowerCase().contains("left")) {
- pouchCheck++;
- }
- if (serverString.toLowerCase().contains("decayed")) {
- decayedPouch=true;
- }
- if (serverString.toLowerCase().contains("have any more")) {
- emptyInv=true;
- }
- }
- private boolean onTile(final RSTile tile, final String action, final double dx, final double dy, final int height) {
- if (!tile.isValid())
- return false;
- Point checkScreen = null;
- try {
- checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
- if (!pointOnScreen(checkScreen)) {
- if (getMyPlayer().isMoving())
- return false;
- if (walkTileMM(tile))
- wait(random(750, 1000));
- return false;
- }
- } catch(Exception e) { }
- try {
- boolean stop = false;
- for (int i = 0; i <= 50; i++) {
- checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
- if (!pointOnScreen(checkScreen))
- return false;
- moveMouse(checkScreen);
- final Object[] menuItems = getMenuItems().toArray();
- for (int a = 0; a < menuItems.length; a++) {
- if (menuItems[a].toString().toLowerCase().contains(action.toLowerCase())) {
- stop = true;
- break;
- }
- }
- if (stop)
- break;
- }
- } catch(Exception e) { }
- try {
- return atMenu(action);
- } catch(Exception e) { }
- return false;
- }
- private double getHPpercent() {
- final int health = Integer.parseInt(getInterface(748, 8).getText().trim());
- final int totalHealth = skills.getRealSkillLevel(STAT_HITPOINTS) * 10;
- return (int) (((double) health / (double) totalHealth) * 100.0);
- }
- private void startRunning(final int energy) {
- if (getEnergy() >= energy && !isRunning()) {
- runEnergy = random(40, 95);
- setRun(true);
- wait(random(500, 750));
- }
- }
- private boolean walkPath(RSTile[] path) {
- if(!getMyPlayer().isMoving() || distanceTo(getDestination()) <= 5)
- return walkPathMM(path, 17);
- return false;
- }
- public void onFinish() {
- Bot.getEventManager().removeListener( PaintListener.class, this );
- }
- public void onRepaint(Graphics g) {
- if (!isLoggedIn())
- return;
- if (startLVL == 0) {
- startXP = skills.getCurrentSkillExp(Skills.getStatIndex("runecrafting"));
- startLVL = skills.getCurrentSkillLevel(Skills.getStatIndex("runecrafting"));
- }
- if(getCurrentTab() != TAB_INVENTORY)
- return;
- long seconds = 0;
- long minutes = 0;
- long hours = 0;
- final NumberFormat nf = NumberFormat.getInstance();
- nf.setMinimumIntegerDigits(2);
- final long runTime = System.currentTimeMillis() - scriptStartTIME;
- seconds = runTime / 1000;
- if ( seconds >= 60 ) {
- minutes = seconds / 60;
- seconds -= (minutes * 60);
- }
- if ( minutes >= 60 ) {
- hours = minutes / 60;
- minutes -= (hours * 60);
- }
- final int currentXP = skills.getCurrentSkillExp(Skills.getStatIndex("runecrafting"));
- final int currentLVL = skills.getCurrentSkillLevel(Skills.getStatIndex("runecrafting"));
- final int XPgained = currentXP - startXP;
- final int LVLgained = currentLVL - startLVL;
- final int xpTilNext = skills.getXPToNextLevel(Skills.getStatIndex("runecrafting"));
- final int percentTilNext = skills.getPercentToNextLevel(Skills.getStatIndex("runecrafting"));
- final int fillBar = (int) (1.65 * (double) percentTilNext);
- final int essUsed = (int) ((double) XPgained / 8.7);
- profitMade = moneyBanked - (moneyUsed + (essUsed * essPrice));
- tCashUsed = moneyUsed + (essUsed * essPrice);
- int essPerHour = 0;
- int XPperHour = 0;
- if ((runTime / 1000) > 0) {
- essPerHour = (int) ((3600000.0 / (double) runTime) * essUsed);
- XPperHour = (int) ((3600000.0 / (double) runTime) * XPgained);
- }
- final int[] coords = new int[] {225, 240, 255, 270, 285, 300, 315, 330, 345, 360, 375, 390, 405, 420, 435, 450, 465, 480, 495, 510};
- g.setColor(new Color(0, 0, 0, 175));
- g.fillRoundRect(555, 210, 175, 250, 10, 10);
- g.setColor(Color.WHITE);
- g.drawString(properties.name(), 561, coords[0]);
- g.drawString("Version: " + properties.version(), 561, coords[1]);
- g.drawString("Run Time: " + hours + ":" + nf.format(minutes) + ":" + nf.format(seconds), 561, coords[2]);
- g.drawString("Essence Used: " + essUsed, 561, coords[4]);
- g.drawString("EssUsed/Hour: " + essPerHour, 561, coords[5]);
- g.drawString("Lvls Gained: " + LVLgained, 561, coords[6]);
- g.drawString("XP Gained: " + XPgained, 561, coords[7]);
- g.drawString("XP/Hour: " + XPperHour, 561, coords[8]);
- g.drawString("XP To Next Level: " + xpTilNext, 561, coords[9]);
- g.setColor(new Color(255, 0, 0, 175));
- g.fillRect(560, coords[10] - 11, 165, 13);
- g.setColor(new Color(0, 255, 0, 200));
- g.fillRect(560, coords[10] - 11, fillBar, 13);
- g.setColor(Color.WHITE);
- g.drawString(percentTilNext + "%", 561, coords[10]);
- g.drawString("Pouches Fixed "+pouchesFixxed+ " times.", 561, coords[11]);
- g.drawString("Cash banked: " + moneyBanked, 561, coords[12]);
- g.drawString("Cash used: " + tCashUsed, 561, coords[13]);
- g.drawString("Profit made: " + profitMade, 561, coords[14]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement