Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import impsoft.bots.ColorBot;
- import impsoft.scripting.ibot.interfaces.AutoPaint;
- import impsoft.scripting.ibot.structs.AryanTile;
- import impsoft.scripting.types.ColorScript;
- import impsoft.utils.general.Timer;
- import impsoft.scripting.ibot.enums.Skill;
- import impsoft.scripting.ibot.enums.Prayer;
- import java.text.DecimalFormat;
- import java.awt.Color;
- import java.awt.Graphics;
- import bergCoder.BergUtils;
- public class MonkeySlicer extends ColorScript implements AutoPaint {
- public MonkeySlicer(ColorBot c) {
- super(c);
- }
- public static String author = "Afif";
- public static String description = "Monkey Attacker/Prayer";
- public static double version = 1.0;
- int[] exptolevel = { 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358,
- 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624,
- 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456,
- 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171,
- 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333,
- 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466,
- 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254,
- 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278,
- 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818,
- 2421087, 2673114, 2951373, 3258594, 3597792, 3972294, 4385776,
- 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558,
- 9684577, 10692629, 11805606, 13034431, 200000001 };
- public int XPGained = 0;
- public int sXP = 0;
- public int cXP = 0;
- Timer timeran = new Timer(0);
- AryanTile AltarTile = new AryanTile(2797,2793);
- AryanTile FightTile = new AryanTile(2803,2786);
- BergUtils util = new BergUtils(this);
- public void script() throws InterruptedException{
- while (!theLoggedInTest.isLoggedIn()) {
- log("Not logged in, script waiting.");
- sleep(2000);
- }
- log("Script starting.");
- sleep(200,300);
- sXP = theTabs.Statistics.getStatExperience(Skill.STRENGTH);
- //////////////THE NON-ENDING LOOP////////////
- while(true) {
- cXP = theTabs.Statistics.getStatExperience(Skill.STRENGTH);
- XPGained = cXP - sXP;
- if(theTabs.Statistics.getStatTop(Skill.PRAYER) <= 10) {
- log("Prayer stat below 10, praying.");
- GoPray();
- sleep(1000,1500);
- } else {
- GoKill();
- }
- }
- /////////////////////////////////////////////
- }
- public void GoPray() throws InterruptedException {
- if(getLocation().x >= 102700 || getLocation().y >= 102700) {
- log("Need to climb down stairs.");
- util.clickInteractiveObject(4755, "Stairs", "Climb-down");
- sleep(500,600);
- } else {
- util.walk(AltarTile);
- util.sleepUntilStill();
- }
- util.clickTile(new AryanTile(AltarTile.x,AltarTile.y+1), "Statue", "Pray-at");
- sleep(1000,1500);
- }
- public void GoKill() throws InterruptedException {
- if(!theTabs.Prayer.isPrayerSelected(Prayer.PROTECT_FROM_MELEE)) {
- theTabs.Prayer.setPrayer(Prayer.PROTECT_FROM_MELEE, true);
- sleep(300,400);
- }
- if(getLocation().distanceTo(FightTile) >= 5) {
- util.walkToMinimapTarget(FightTile);
- util.sleepUntilStill();
- }
- if(getLocation().x >= 102700 || getLocation().y >= 102700) {
- log("Need to climb down stairs.");
- util.clickInteractiveObject(4755, "Stairs", "Climb-down");
- sleep(200,300);
- }
- if(getMyPlayer().getInteractingNPC() != null && inCombat()) {
- ThinkCombat();
- sleep(1500,2000);
- } else {
- util.clickNPCByName("Monkey Guard", "Attack");
- sleep(1000,1500);
- }
- }
- public void ThinkCombat() throws InterruptedException {
- if(theTabs.Statistics.getStatTop(Skill.STRENGTH) ==
- theTabs.Statistics.getStatBottom(Skill.STRENGTH) ||
- theTabs.Statistics.getStatTop(Skill.ATTACK) ==
- theTabs.Statistics.getStatBottom(Skill.ATTACK)) {
- if(theTabs.Inventory.count("Super strength") >= 1) {
- theTabs.Inventory.doAction("strength", "Drink", 1, true);
- }
- if(theTabs.Inventory.count("Super strength") >= 1) {
- theTabs.Inventory.doAction("attack", "Drink", 1, true);
- }
- }
- if(theMiniMapIndicators.isPoisioned() && theTabs.Inventory.count("antipoison") >= 1) {
- theTabs.Inventory.doAction("antipoison", "Drink", 1, true);
- }
- }
- private String formatNumber(double number, int mod) {
- number /= mod;
- return new DecimalFormat("#########0.00").format(number);
- }
- public void paint(Graphics g){
- try {
- if(theLoggedInTest.isLoggedIn()) {
- StringBuilder b = new StringBuilder();
- long runtime = timeran.timePassed();
- long TotalSecs = runtime / 1000;
- long TotalMins = TotalSecs / 60;
- long TotalHours = TotalMins / 60;
- int seconds = (int) TotalSecs % 60;
- int minutes = (int) TotalMins % 60;
- int hours = (int) TotalHours % 60;
- if (hours < 10)
- b.append("0");
- b.append(hours);
- b.append(" : ");
- if (minutes < 10)
- b.append("0");
- b.append(minutes);
- b.append(" : ");
- if (seconds < 10)
- b.append("0");
- b.append(seconds);
- g.setColor(new Color(0, 0, 0, 190));
- g.fillRect(6,345,506, 113);
- g.setColor(new Color(255,0,0,150)); // red
- g.fillRect(6,458,505, 15);
- double xpCurrent = theTabs.Statistics.getStatExperience(Skill.STRENGTH) -
- exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH) - 1];
- double nextLevel = exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH)] -
- exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH) - 1];
- //double currentLevel = exptolevel[theTabs.Statistics
- // .getStatBottom(Skill.FLETCHING)];
- double xpDone = xpCurrent;
- double xpTotal = nextLevel;
- double percent = xpDone / xpTotal;
- g.setColor(new Color(0,255,0,200)); // green
- g.fillRect(6,458,(int)(505*percent), 15);
- g.setColor(Color.BLACK);
- g.drawString(formatNumber(percent * 100, 1) + "%",260,470);
- g.setColor(Color.WHITE);
- g.drawString("by Afif", 250,370);
- g.drawString("Ran For " + String.valueOf(b.toString()), 32,360);
- //g.drawString("Yews Cut: " + YewsCut + "/" + YewCount, 6, 70);
- g.drawString("Current Level: " + theTabs.Statistics.getStatBottom(Skill.STRENGTH), 32, 375);
- g.drawString("XP Left: " + (exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH)] - theTabs.Statistics.getStatExperience(Skill.STRENGTH)), 32, 390);
- g.drawString("XP Gained: " + XPGained, 32, 432);
- if(TotalSecs > 1) {
- g.drawString("XP/Hour: " + (3600*XPGained)/TotalSecs, 32, 445);
- } else {
- g.drawString("XP/Hour: 0", 32, 445);
- }
- g.drawString("Monkey Killer " + version, 233,357);
- }
- } catch(InterruptedException e) {
- log(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement