Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.Calculations;
- import com.kbot2.scriptable.methods.data.Skills;
- import com.kbot2.scriptable.methods.wrappers.Obj;
- import java.awt.*;
- /**
- * Created by IntelliJ IDEA.
- * User: Koh-Koh
- * Date: 08/06/2009
- * Time: 11:37:54 AM
- * To change this template use File | Settings | File Templates.
- */
- public class KohtaGraniteMiner extends Script implements PaintListener, ServerMessageListener {
- int NUMMINED = 0;
- int MN_SXP = 0;
- long startTime = System.currentTimeMillis();
- public int loop() {
- if (getMyPlayer().getAnimation() != -1) return 100;
- if (!inventory.contains(1823, 1825, 1827, 1829, 1831))
- stopAllScripts();
- {
- if (inventory.getCount() == 28) {
- inventory.dropAllExcept(1823, 1825, 1827, 1829, 1831);
- }
- Obj rock = objects.getClosestObject(15, 10947);
- if (rock != null) {
- if (Calculations.onScreen(rock.getScreenPos())) {
- rock.doAction("mine");
- } else
- walking.walkToMM(rock.getLocation());
- }
- }
- return random(1000, 1500);
- }
- public boolean onStart() {
- MN_SXP = skills.getExperience(Skills.SKILL_MINING);
- return true;
- }
- public String getName() {
- return "Granite Smasher";
- }
- public String getAuthor() {
- return "Kohta";
- }
- public String getDescription() {
- return "Mines Granite in the desert.";
- }
- public double getVersion() { return 1.0; }
- public void onServerMessage(String e) {
- if (e.contains("mined Granite")) {
- NUMMINED++;
- }
- }
- public void onRepaint(Graphics g) {
- 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));
- g.setColor(new Color(0, 0, 0, 100));
- int MN_NXP = skills.getExperience(Skills.SKILL_MINING);
- int CUR_LVL = skills.getLevel(Skills.SKILL_MINING);
- int XP_TO_LVL = skills.getExperienceToNextLevel(Skills.SKILL_MINING);
- int GAINED_XP = MN_SXP - MN_NXP;
- int x = 13;
- int y = 210;
- g.setColor(Color.red);
- g.fill3DRect(x, y, 246, 102, true);
- x += 5;
- y += 15;
- g.setColor(Color.white);
- y += 15;
- g.drawString("Granite Smasher by Kohta", x, y);
- g.setColor(Color.black);
- g.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":" + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "") + secs, x , y);
- y += 15;
- g.drawString("Granite mined: " + NUMMINED, x, y);
- y += 15;
- g.drawString("Current lvl: " + CUR_LVL, x, y);
- y += 15;
- g.drawString("Number of granite till next level: " + XP_TO_LVL, x, y);
- y += 15;
- g.drawString("Experience gained: " + GAINED_XP, x, y);
- }
- }
Add Comment
Please, Sign In to add comment