Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Version 1.0 *** Created By Spike
- */
- package com.scripts;
- import java.awt.Color;
- import java.awt.Point;
- import java.awt.Graphics;
- import java.util.Map;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.wrappers.NPC;
- import com.kbot2.scriptable.methods.wrappers.Obj;
- import com.kbot2.scriptable.methods.wrappers.Tile;
- import com.kbot2.scriptable.methods.wrappers.Interface;
- import com.kbot2.scriptable.methods.data.NPCs;
- import com.kbot2.scriptable.methods.data.Walking;
- import com.kbot2.scriptable.methods.data.Bank;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- public class CraftGuildMiner extends Script {
- Tile[] TO_GUILD = new Tile[]{new Tile(3012,3355),
- new Tile(3009,3359), new Tile(3008,3354),
- new Tile(3008,3349), new Tile(3008,3344),
- new Tile(3008,3339), new Tile(3008,3334),
- new Tile(3008,3329), new Tile(3006,3324),
- new Tile(3003,3320), new Tile(2999,3316),
- new Tile(2995,3313), new Tile(2992,3309),
- new Tile(2989,3304), new Tile(2986,3300),
- new Tile(2983,3296), new Tile(2978,3295),
- new Tile(2973,3293), new Tile(2968,3293),
- new Tile(2963,3293), new Tile(2958,3292),
- new Tile(2954,3289), new Tile(2949,3289),
- new Tile(2944,3292), new Tile(2939,3293),
- new Tile(2934,3293), };
- Tile[] TO_BANK = walking.reversePath(TO_GUILD);
- Tile[] IN_GUILD = new Tile[]{new Tile(2933,3288), new Tile(2936,3283), };
- Tile[] OUT_GUILD = walking.reversepath(IN_GUILD);
- int PICK[] = { 1275, 1271, 1273, 1269, 1267, 1265 };
- int ANIMATION = 625;
- int Gold_ID[] = { 11185, 11184, 11183, 11185};
- int MINED = 0;
- int MIN_START_XP;
- int MIN_START_LEVEL;
- int BANK_ID = 11758;
- int APRON = 1757;
- int GOLD_ORE = 444;
- int DOOR_ID =31119;
- int status = 0;
- int MINED = 0;
- int trips = 0;
- long startTime;
- String Status;
- public boolean active(){
- return true;
- }
- public boolean onStart() {
- MIN_START_LEVEL = skills.getLevel(Skills.SKILL_MINING);
- MIN_START_XP = skills.getExperience(Skills.SKILL_MINING);
- startTime = System.currentTimeMillis();
- return true;
- }
- public void onServerMessage(String message) {
- if (message.contains("You manage")) {
- MINED++;
- }
- }
- public void onStop() {
- }
- public void antiBan() {
- if (random(1, 10) == 5) {
- camera.setAngle(random(1, 360));
- }
- if (random(1, 15) == 10) {
- mouse.moveMouse(random(1, 765), random(1, 503), random(1, 30), random(1, 30));
- }
- if (random(1, 8) == 4) {
- sleep(400, 1200);
- }
- }
- public String getAuthor() {
- return "Spike";
- }
- public String getDescription() {
- return "Mines gold at crafting guild.";
- }
- public int loop() { // main stuff goes here
- setMouseSpeed(random(0,2));
- if(walking.getEnergy() > 50)
- walking.setRunning(true);
- if(getMyPlayer().getAnimation() != -1) {
- return (random(100,200));
- }
- switch (status) {
- case 0:
- /* To Shop
- */
- Status = "Walking to the craft guild";
- log("Walking to the craft guild");
- if(walking.getEnergy() > 10)
- walking.setRunning(true);
- walking.walkPath(walking.randomizePath(TO_GUILD, 2, 2));
- if(!getMyPlayer().isMoving()) {
- status = 1;
- }
- break;
- case 1:
- /* Opening Door
- */
- Status = "Opening Door";
- log("Opening..");
- camera.setAltitude(false);
- sleep(random(100, 350));
- Obj d = getClosestObject(3, DOOR_ID);
- if(d != null)
- d.doActionAtDoor('w', "open");
- log("Door is Opened");
- status = 2;
- break;
- case 2:
- /* Walking to ores
- */
- Status = "To ore..";
- log("To ore..");
- camera.setAltitude(true);
- walking.walkPath(IN_GUILD);
- status = 3;
- break;
- case 3:
- /* mining :S
- */
- Status = "mining..";
- log("mining..");
- camera.setAltitude(true);
- Obj rock = getClosestObject(GOLD_ID);
- rock.doAction("Mine");
- if (inventory.isFull()) {
- status++;
- }
- break;
- case 4:
- /* To Bank
- */
- Status = "walking to bank";
- log("To bank");
- if(walking.getEnergy() > 10)
- walking.setRunning(true);
- camera.setAltitude(true);
- walking.walkPath(walking.randomizePath(OUT_GUILD, 1, 1));
- status = 5;
- break;
- case 5:
- /* To Bank
- */
- Status = "walking to bank";
- log("To bank");
- if(walking.getEnergy() > 10)
- walking.setRunning(true);
- camera.setAltitude(true);
- walking.walkPath(walking.randomizePath(TO_BANK, 2, 2));
- status = 6;
- break;
- case 6:
- /* walking to bank
- */
- Status = "Banking";
- log("Banking");
- camera.setCompass('e');
- Obj b = getClosestObject(7, BANK_ID);
- b.doAction("Use-quickly");
- sleep(random(350, 500));
- bank.depositAllExcept( APRON, PICK);
- sleep(random(350, 500));
- trips++;
- status = 0;
- return random(150, 300);
- }
- return random(1000, 2000);
- }
- public void onRepaint(Graphics w) {
- long runTime = System.currentTimeMillis() - startTime;
- int secs = ((int) ((runTime / 1000) % 60));
- int mins = ((int) (((runTime / 1000) / 60) % 60));
- int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
- w.setColor(Color.red);
- w.drawString("Spikee's Craftin Guild Miner", 34, 43);
- w.drawString("Status: " + Status, 34, 61);
- w.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":"
- + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "")
- + secs, 34, 79);
- w.drawString("Experience gained: " + (skills.getExperience(Skills.SKILL_MINING) - MIN_START_XP), 34, 115);
- w.drawString("Exp to next level: " + (skills.getExperienceToNextLevel(Skills.SKILL_MINING)), 34, 133);
- w.drawString("To next level: " + (skills.getExperienceToNextLevel(Skills.SKILL_MINING)) / 40 + " Ores", 34, 151);
- w.drawString((skills.getPercentageToNextLevel(Skills.SKILL_MINING)) + "% to next level" , 34, 169);
- w.drawString("Current Level: " +(skills.getLevel(Skills.SKILL_MINING)) , 34, 187);
- w.drawString("No. of Ores: " + MINED , 34, 205);
- w.drawstring("Trips Made: " + trips ,34, 223);
- }
- }
Add Comment
Please, Sign In to add comment