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.scriptable.Script;
- import com.kbot2.scriptable.methods.Calculations;
- import com.kbot2.scriptable.methods.data.Walking;
- import com.kbot2.handlers.eventSystem.eventListeners.ServerMessageListener;
- import com.kbot2.scriptable.methods.*;
- import com.kbot2.scriptable.methods.data.Bank;
- import com.kbot2.scriptable.methods.data.Inventory;
- import com.kbot2.scriptable.methods.data.Skills;
- import com.kbot2.scriptable.methods.data.GameScreen;
- import com.kbot2.scriptable.methods.wrappers.Obj;
- import com.kbot2.scriptable.HTMLDescription;
- import com.kbot2.scriptable.methods.wrappers.Tile;
- import com.kbot2.scriptable.methods.data.*;
- import com.kbot2.scriptable.methods.wrappers.*;
- import com.kbot2.scriptable.methods.data.Skills;
- import com.kbot2.scriptable.methods.wrappers.NPC;
- import com.kbot2.scriptable.methods.wrappers.Character;
- import java.awt.*;
- import java.util.*;
- public class MonkR extends Script implements PaintListener, HTMLDescription{
- public String trainStat;
- public int theSkill;
- public int monk = 7727;
- public String State;
- public Tile loca;
- public long startTime;
- public boolean b;
- public boolean needToHeal;
- public boolean FAttempt = false;
- public Tile[] healTile = new Tile []{ (new Tile (3058,3486))};
- public int healAt;
- int origLevel = 0;
- int origExp = 0;
- int origLevelHp = 0;
- int origExpHp = 0;
- Tile[] DeathWalk = new Tile[]{new Tile(3221,3216), new Tile(3226,3217), new Tile(3231,3218),
- new Tile(3235,3221), new Tile(3238,3225), new Tile(3243,3225), new Tile(3248,3225), new Tile(3253,3225),
- new Tile(3257,3229), new Tile(3258,3234), new Tile(3259,3239), new Tile(3259,3244), new Tile(3256,3248),
- new Tile(3253,3253), new Tile(3250,3257), new Tile(3246,3260), new Tile(3242,3263), new Tile(3240,3269),
- new Tile(3241,3274), new Tile(3241,3279), new Tile(3239,3284), new Tile(3239,3289), new Tile(3239,3294),
- new Tile(3239,3299), new Tile(3237,3304), new Tile(3232,3307), new Tile(3228,3310), new Tile(3226,3315),
- new Tile(3222,3318), new Tile(3221,3323), new Tile(3218,3328), new Tile(3214,3332), new Tile(3210,3336),
- new Tile(3206,3340), new Tile(3206,3345), new Tile(3206,3350), new Tile(3203,3355), new Tile(3200,3359),
- new Tile(3196,3362), new Tile(3192,3365), new Tile(3187,3367), new Tile(3182,3364), new Tile(3177,3362),
- new Tile(3172,3364), new Tile(3169,3369), new Tile(3167,3374), new Tile(3164,3378), new Tile(3162,3383),
- new Tile(3159,3388), new Tile(3155,3392), new Tile(3153,3397), new Tile(3149,3400), new Tile(3148,3395),
- new Tile(3143,3393), new Tile(3139,3396), new Tile(3136,3400), new Tile(3131,3401), new Tile(3127,3404),
- new Tile(3122,3406), new Tile(3120,3411), new Tile(3116,3414), new Tile(3113,3418), new Tile(3108,3420),
- new Tile(3101,3420), new Tile(3094,3420), new Tile(3089,3420), new Tile(3083,3419), new Tile(3078,3418),
- new Tile(3072,3418), new Tile(3067,3419), new Tile(3063,3422), new Tile(3058,3422), new Tile(3055,3427),
- new Tile(3054,3433), new Tile(3051,3437), new Tile(3051,3442), new Tile(3051,3447), new Tile(3049,3452),
- new Tile(3044,3454), new Tile(3047,3460), new Tile(3050,3464), new Tile(3050,3469), new Tile(3051,3474),
- new Tile(3051,3479), new Tile(3051,3484), new Tile(3051,3489), };
- // -------------------------------------------------------------------------------------\\
- @Override
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- origLevelHp = skills.getLevel(Skills.SKILL_HITPOINTS) ;
- origExpHp = skills.getExperience(Skills.SKILL_HITPOINTS);
- if (trainStat.equals("Attack")) {
- origLevel = skills.getLevel(Skills.SKILL_ATTACK) ;
- origExp = skills.getExperience(Skills.SKILL_ATTACK);
- theSkill =0;
- } else if (trainStat.equals("Strength")) {
- origLevel = skills.getLevel(Skills.SKILL_STRENGTH) ;
- origExp = skills.getExperience(Skills.SKILL_STRENGTH);
- theSkill =2;
- } else if (trainStat.equals("Defence")) {
- origLevel = skills.getLevel(Skills.SKILL_DEFENSE) ;
- origExp = skills.getExperience(Skills.SKILL_DEFENSE);
- theSkill =1;
- }
- return true;
- }
- // -------------------------------------------------------------------------------------\\
- @Override
- public void onStop(){
- gameScreen.takeScreenshot("Monk Slayer - " +Integer.toString(random(1,3000000)), true);
- }
- // -------------------------------------------------------------------------------------\\
- public void setArguments(Map<String, String> args) {
- healAt = Integer.parseInt(args.get("amount"));
- trainStat = args.get("train");
- }
- // -------------------------------------------------------------------------------------\\
- public void onRepaint(Graphics g){
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- g.setColor(new Color(0, 0, 0, 75));
- g.fill3DRect(553, 216, 660, 330, true);
- int x = 556;
- int y = 230;
- x += 5;
- y += 15;
- g.setColor(Color.CYAN);
- g.drawString("Monk Rapist v." + getVersion(), x, y);
- g.setColor(Color.CYAN);
- y += 20;
- g.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":" + (minutes < 10 ? "0" : "") + minutes + ":" + (seconds < 10 ? "0" : "") + seconds, x, y);
- y += 15;
- g.drawString("Current State: " + State, x, y);
- y += 15;
- g.drawString(trainStat+ " levels gained: " + (skills.getLevel(theSkill) - origLevel), x, y);
- y += 15;
- g.drawString(trainStat+ " experience gained: " + (skills.getExperience(theSkill) - origExp), x, y);
- y += 15;
- g.drawString("Experience til "+trainStat+ " lvl: " + skills.getExperienceToNextLevel(theSkill), x, y);
- y += 15;
- g.drawString("Hp levels gained: " + (getRealLevel(3) - origLevelHp), x, y);
- y += 15;
- g.drawString("Hp Experience gained: " + (skills.getExperience(Skills.SKILL_HITPOINTS) - origExpHp), x, y);
- y += 15;
- y += 20;
- g.drawString("Made by nibuS", x, y);
- }
- // -------------------------------------------------------------------------------------\\
- private void deathwalk() {
- sleep(50,100);
- walking.randomizePath(DeathWalk, 2, 2);
- walking.walkPath(DeathWalk);
- State = ("Deathwalk has been initiated");
- }
- // -------------------------------------------------------------------------------------\\
- public boolean healthCheck() {
- if (skills.getLevel(Skills.SKILL_HITPOINTS) <= random(healAt + 2,
- healAt - 2)) {
- State = ("Healing | Hp Is Currently @ "
- + skills.getLevel(Skills.SKILL_HITPOINTS));
- return true;
- }
- return false;
- }
- // -------------------------------------------------------------------------------------\\
- public boolean attackNpc() {
- if (getMyPlayer().isInCombat()) {
- State = "In Fight";
- sleep(500, 1000);
- return true;
- }
- if (getMyPlayer().isMoving()){
- sleep(random(0,3000));
- }
- if (!getMyPlayer().isInCombat()) {
- State = "Attacking";
- NPC monster = npcs.getClosest(17, monk);
- if (monster != null && !monster.isInCombat()) {
- if (walking.atTile(monster.getLocation(), Calculations.random(0.1, 0.9), Calculations.random(0.1, 0.9), random(60, 128), "Attack")){
- FAttempt = true;
- sleep(random(300,3000));
- return true;
- }
- }
- if (monster == null) {
- return false;
- }
- }
- return false;
- }
- // -------------------------------------------------------------------------------------\\
- public boolean checkNpc() {
- if (!getMyPlayer().isInCombat()) {
- NPC monks = npcs.getClosest(17, monk);
- if (monks != null && !monks.isInCombat()) {
- return false;
- }
- }
- return true;
- }
- // -------------------------------------------------------------------------------------\\
- private Tile randomTile(Tile location) {
- return randomTile(location, 2);
- }
- // -------------------------------------------------------------------------------------\\
- private Tile randomTile(Tile location, int rand) {
- return randomTile(location, rand, rand);
- }
- // -------------------------------------------------------------------------------------\\
- private Tile randomTile(Tile location, int xRand, int yRand) {
- int x = location.getX(), y = location.getY();
- return new Tile(x + random((-1 * xRand), xRand), y
- + random((-1 * yRand), yRand));
- }
- // -------------------------------------------------------------------------------------\\
- public void walking(){
- Tile[] monktiles= new Tile[] {new Tile(3046,3497), new Tile(3047,3490), new Tile(3047,3484), new Tile(3052,3491), new Tile(3057,3491), new Tile(3052,3496)};
- if (!getMyPlayer().isInCombat()) {
- int randomsno = random(0, 5);
- State = ("Walking to Tile "+randomsno);
- // int distancetoLoc = getMyPlayer().getLocation().distanceTo( monktiles[randomsno]);
- if(getMyPlayer().getAnimation() == -1 && (!getMyPlayer().isMoving())){
- walking.walkToMM(randomTile(monktiles[randomsno].getLocation(), 2, 1));
- sleep(random(1000,3200));
- }
- }
- }
- /**
- By Pauwelz - thnx
- */
- public int getRealLevel(int skill) {
- int[] skillss = getClient().getMaxLevels();
- if (skillss == null || skillss.length == 0 || skill < 0 || skill >= skillss.length) {
- return -1;
- }
- return skillss[skill];
- }
- // -------------------------------------------------------------------------------------\\
- public void heal(){
- walking.randomizePath(healTile, 2, 2);
- walking.walkPath(healTile);
- sleep(random(500,3000));
- if (!getMyPlayer().isMoving()) {
- State = ("Talking to Healer");
- NPC monka = npcs.getClosest(7, 801);
- if (monka != null){
- while (getRealLevel(3) != skills.getLevel(Skills.SKILL_HITPOINTS )){
- if (monka.doAction("Talk-to")){
- sleep(random(3000,5000));
- clickInterface();
- }
- }
- }
- }
- }
- // -------------------------------------------------------------------------------------\\
- public void checkDeath(){
- int distancetoLumby = getMyPlayer().getLocation().distanceTo(new Tile(3221, 3217));
- if(getMyPlayer().getAnimation() == -1 && distancetoLumby < 5){
- State = ("Died?");
- sleep(50,100);
- deathwalk();
- }
- }
- // -------------------------------------------------------------------------------------\\
- public boolean clickInterface(){
- if(interfaces.interfaceExists(241, 5)) {
- try{
- log("interface 1");
- interfaces.getInterface(241, 5).doClick();
- sleep(random(500,1500));
- } catch ( Exception e ) {
- log("interface fail 1");
- return false;
- }
- }
- if(interfaces.interfaceExists(230, 2)) {
- try{
- log("interface 2");
- interfaces.getInterface(230, 2).doClick();
- sleep(random(500,1500));
- } catch ( Exception e ) {
- log("interface fail 2");
- return false;
- }
- }
- if(interfaces.interfaceExists(64, 5)) {
- try {
- log("interface 3");
- interfaces.getInterface(64, 5).doClick();
- sleep(random(500,1500));
- } catch ( Exception e ) {
- log("interface fail 3");
- return false;
- }
- }
- if(interfaces.interfaceExists(241, 5)) {
- try {
- log("interface 4");
- interfaces.getInterface(241, 5).doClick();
- sleep(random(500,1500));
- } catch ( Exception e ) {
- log("interface fail 4");
- return false;
- }
- }
- if(interfaces.interfaceExists(210, 2)) {
- try {
- log("interface 5");
- interfaces.getInterface(210, 2).doClick();
- sleep(random(500,1500));
- } catch ( Exception e ) {
- log("interface fail 5");
- return false;
- }
- }
- return true;
- }
- // -------------------------------------------------------------------------------------\\
- public int loop() {
- camera.setAltitude(true);
- setMouseSpeed(random(0,3));
- checkDeath();
- if(healthCheck()){
- heal();
- }
- if (!attackNpc()) {
- walking();
- }
- if (walking.getEnergy() > random(60,80)){
- walking.setRunning(true);
- }
- return random(0,3000);
- }
- // -------------------------------------------------------------------------------------\\
- public boolean tileOnScreen(final Tile t) {
- final Point p = botEnv.calculations.tileToScreen(t);
- return p.getX() > 0 && p.getY() > 0;
- }
- // -------------------------------------------------------------------------------------\\
- @Override
- public boolean active() {
- return true;
- }
- // -------------------------------------------------------------------------------------\\
- public String getName() {
- return "Monk Rapist";
- }
- // -------------------------------------------------------------------------------------\\
- public double getVersion() {
- { return 1.5; }
- }
- // -------------------------------------------------------------------------------------\\
- public String getAuthor() {
- return "Subin";
- }
- // -------------------------------------------------------------------------------------\\
- public String getDescription() {
- return "Kills monks and heals from the monks when it reaches the set hp or below ";
- }
- public String getDocument(){
- String html = "<html>";
- html += "<head>";
- html += "<style type=\"text/css\"> hr {color: white} p {margin-left: 20px}</style>";
- html += "</head>";
- html += "<body>";
- html += "<center>";
- html += "<b><font size=\"4\" color=\"red\">" + getName() + " v" + getVersion() + "</font></b><br>";
- html += "</center>";
- html += "<center><table border=\"0\"><tr><td colspan=\"2\"><font size=\"4\" color=\"blue\">This script will kill Monks at the Monsantry<BR>" +
- " Heals from the monk at the set amout.<BR>" +
- " Just stand in Monsantry and start.<BR>" +
- " </font></center></td></tr>";
- html += "<tr><td><b>What shall we train : </b></td><td><center><select name=\"train\">";
- html += "<option>Strength";
- html += "<option>Attack";
- html += "<option>Defence";
- // html += "<option>Range";
- // html += "<option>Magic";
- html += "</select></center></td></tr>";
- html += "<tr><td><b>At what hp shall we heal?</b><tr><td><center>";
- html += "<input type=\"text\" name=\"amount\" value=\"30\"></center><br>";
- html += "</table>";
- html += "</center></body>";
- html += "</html>";
- return html;
- }
- }
- // -------------------------------------------------------------------------------------\\
Add Comment
Please, Sign In to add comment