Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.*;
- import com.kbot2.scriptable.methods.*;
- import com.kbot2.scriptable.methods.data.*;
- import com.kbot2.scriptable.methods.wrappers.*;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.scriptable.methods.data.GameScreen;
- import com.kbot2.scriptable.methods.wrappers.Interface;
- import com.kbot2.scriptable.methods.data.Skills;
- import com.kbot2.scriptable.methods.wrappers.Obj;
- import com.kbot2.scriptable.methods.wrappers.Tile;
- import java.awt.*;
- public class JnDYakPwner extends Script implements PaintListener {
- private long startTime;
- private int expOnStart;
- private int yaksAmount;
- private int curExp;
- private final static int[] yaks = new int[]{5529};
- NPC C;
- public String getName() {
- /**
- * Insert the name of your script here
- */
- return "JnD Yak Pwner";
- }
- public String getAuthor() {
- /**
- * Your name here
- */
- return "J93 and Descrete";
- }
- public String getDescription() {
- /**
- * A short description of your script
- */
- return "A yak killin' machine made by J93 and Descrete any questions or comments post on the thread :P";
- }
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- expOnStart = -1;
- yaksAmount = 0;
- return true;
- }
- public void onStop(){
- /*
- * Stops the script.
- */
- return;
- }
- public int loop() {
- if(walking.getEnergy() > 30) {
- walking.setRunning(true);
- sleep(300, 500);
- }
- if(getMyPlayer().isInCombat()) {
- return 300;
- }
- if(getMyPlayer().isMoving()) {
- return 300;
- }
- C = npcs.getClosestFree(50, yaks);
- if (C != null) {
- C.doAction("Attack"); }
- return 300;
- }
- public void onRepaint(Graphics g) {
- int trainedExp = curExp - expOnStart;
- yaksAmount = trainedExp/200;
- 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 x = 13;
- int y = 210;
- g.fill3DRect(x, y, 230, 117, true);
- x += 5;
- y += 15;
- g.setColor(Color.lightGray);
- g.drawString("Yak Pwner by J and D", x, y);
- g.setColor(Color.WHITE);
- y+=20;
- g.drawString("Runtime: "
- + (hours < 10 ? "0" : "") + hours
- + ":" + (mins < 10 ? "0" : "") + mins
- + ":" + (secs < 10 ? "0" : "") + secs, x, y);
- y+=15;
- g.drawString("Exp trained: " + trainedExp, x, y);
- y+=15;
- g.drawString("Yaks pwned: " + yaksAmount, x, y);
- }
- }
Add Comment
Please, Sign In to add comment