Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.64 KB | None | 0 0
  1. import impsoft.bots.ColorBot;
  2. import impsoft.scripting.ibot.interfaces.AutoPaint;
  3. import impsoft.scripting.ibot.structs.AryanTile;
  4. import impsoft.scripting.types.ColorScript;
  5. import impsoft.utils.general.Timer;
  6. import impsoft.scripting.ibot.enums.Skill;
  7. import impsoft.scripting.ibot.enums.Prayer;
  8.  
  9. import java.text.DecimalFormat;
  10. import java.awt.Color;
  11. import java.awt.Graphics;
  12.  
  13. import bergCoder.BergUtils;
  14.  
  15. public class MonkeySlicer extends ColorScript implements AutoPaint {
  16. public MonkeySlicer(ColorBot c) {
  17. super(c);
  18. }
  19.  
  20. public static String author = "Afif";
  21. public static String description = "Monkey Attacker/Prayer";
  22. public static double version = 1.0;
  23.  
  24. int[] exptolevel = { 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358,
  25. 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624,
  26. 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456,
  27. 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171,
  28. 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333,
  29. 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466,
  30. 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254,
  31. 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278,
  32. 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818,
  33. 2421087, 2673114, 2951373, 3258594, 3597792, 3972294, 4385776,
  34. 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558,
  35. 9684577, 10692629, 11805606, 13034431, 200000001 };
  36.  
  37. public int XPGained = 0;
  38. public int sXP = 0;
  39. public int cXP = 0;
  40.  
  41. Timer timeran = new Timer(0);
  42.  
  43. AryanTile AltarTile = new AryanTile(2797,2793);
  44. AryanTile FightTile = new AryanTile(2803,2786);
  45.  
  46. BergUtils util = new BergUtils(this);
  47.  
  48. public void script() throws InterruptedException{
  49. while (!theLoggedInTest.isLoggedIn()) {
  50. log("Not logged in, script waiting.");
  51. sleep(2000);
  52. }
  53. log("Script starting.");
  54. sleep(200,300);
  55.  
  56. sXP = theTabs.Statistics.getStatExperience(Skill.STRENGTH);
  57.  
  58.  
  59. //////////////THE NON-ENDING LOOP////////////
  60. while(true) {
  61. cXP = theTabs.Statistics.getStatExperience(Skill.STRENGTH);
  62. XPGained = cXP - sXP;
  63. if(theTabs.Statistics.getStatTop(Skill.PRAYER) <= 10) {
  64. log("Prayer stat below 10, praying.");
  65. GoPray();
  66. sleep(1000,1500);
  67. } else {
  68. GoKill();
  69. }
  70. }
  71. /////////////////////////////////////////////
  72. }
  73.  
  74. public void GoPray() throws InterruptedException {
  75. if(getLocation().x >= 102700 || getLocation().y >= 102700) {
  76. log("Need to climb down stairs.");
  77. util.clickInteractiveObject(4755, "Stairs", "Climb-down");
  78. sleep(500,600);
  79. } else {
  80. util.walk(AltarTile);
  81. util.sleepUntilStill();
  82. }
  83.  
  84. util.clickTile(new AryanTile(AltarTile.x,AltarTile.y+1), "Statue", "Pray-at");
  85. sleep(1000,1500);
  86. }
  87.  
  88. public void GoKill() throws InterruptedException {
  89. if(!theTabs.Prayer.isPrayerSelected(Prayer.PROTECT_FROM_MELEE)) {
  90. theTabs.Prayer.setPrayer(Prayer.PROTECT_FROM_MELEE, true);
  91. sleep(300,400);
  92. }
  93. if(getLocation().distanceTo(FightTile) >= 5) {
  94. util.walkToMinimapTarget(FightTile);
  95. util.sleepUntilStill();
  96. }
  97. if(getLocation().x >= 102700 || getLocation().y >= 102700) {
  98. log("Need to climb down stairs.");
  99. util.clickInteractiveObject(4755, "Stairs", "Climb-down");
  100. sleep(200,300);
  101. }
  102. if(getMyPlayer().getInteractingNPC() != null && inCombat()) {
  103. ThinkCombat();
  104. sleep(1500,2000);
  105. } else {
  106. util.clickNPCByName("Monkey Guard", "Attack");
  107. sleep(1000,1500);
  108.  
  109. }
  110. }
  111.  
  112. public void ThinkCombat() throws InterruptedException {
  113. if(theTabs.Statistics.getStatTop(Skill.STRENGTH) ==
  114. theTabs.Statistics.getStatBottom(Skill.STRENGTH) ||
  115. theTabs.Statistics.getStatTop(Skill.ATTACK) ==
  116. theTabs.Statistics.getStatBottom(Skill.ATTACK)) {
  117. if(theTabs.Inventory.count("Super strength") >= 1) {
  118. theTabs.Inventory.doAction("strength", "Drink", 1, true);
  119. }
  120. if(theTabs.Inventory.count("Super strength") >= 1) {
  121. theTabs.Inventory.doAction("attack", "Drink", 1, true);
  122. }
  123. }
  124. if(theMiniMapIndicators.isPoisioned() && theTabs.Inventory.count("antipoison") >= 1) {
  125. theTabs.Inventory.doAction("antipoison", "Drink", 1, true);
  126. }
  127. }
  128.  
  129. private String formatNumber(double number, int mod) {
  130. number /= mod;
  131. return new DecimalFormat("#########0.00").format(number);
  132. }
  133.  
  134. public void paint(Graphics g){
  135. try {
  136. if(theLoggedInTest.isLoggedIn()) {
  137.  
  138. StringBuilder b = new StringBuilder();
  139. long runtime = timeran.timePassed();
  140. long TotalSecs = runtime / 1000;
  141. long TotalMins = TotalSecs / 60;
  142. long TotalHours = TotalMins / 60;
  143. int seconds = (int) TotalSecs % 60;
  144. int minutes = (int) TotalMins % 60;
  145. int hours = (int) TotalHours % 60;
  146. if (hours < 10)
  147. b.append("0");
  148. b.append(hours);
  149. b.append(" : ");
  150. if (minutes < 10)
  151. b.append("0");
  152. b.append(minutes);
  153. b.append(" : ");
  154. if (seconds < 10)
  155. b.append("0");
  156. b.append(seconds);
  157.  
  158. g.setColor(new Color(0, 0, 0, 190));
  159. g.fillRect(6,345,506, 113);
  160.  
  161.  
  162. g.setColor(new Color(255,0,0,150)); // red
  163. g.fillRect(6,458,505, 15);
  164. double xpCurrent = theTabs.Statistics.getStatExperience(Skill.STRENGTH) -
  165. exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH) - 1];
  166. double nextLevel = exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH)] -
  167. exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH) - 1];
  168. //double currentLevel = exptolevel[theTabs.Statistics
  169. // .getStatBottom(Skill.FLETCHING)];
  170. double xpDone = xpCurrent;
  171. double xpTotal = nextLevel;
  172. double percent = xpDone / xpTotal;
  173.  
  174. g.setColor(new Color(0,255,0,200)); // green
  175. g.fillRect(6,458,(int)(505*percent), 15);
  176. g.setColor(Color.BLACK);
  177. g.drawString(formatNumber(percent * 100, 1) + "%",260,470);
  178.  
  179. g.setColor(Color.WHITE);
  180. g.drawString("by Afif", 250,370);
  181. g.drawString("Ran For " + String.valueOf(b.toString()), 32,360);
  182.  
  183. //g.drawString("Yews Cut: " + YewsCut + "/" + YewCount, 6, 70);
  184. g.drawString("Current Level: " + theTabs.Statistics.getStatBottom(Skill.STRENGTH), 32, 375);
  185. g.drawString("XP Left: " + (exptolevel[theTabs.Statistics.getStatBottom(Skill.STRENGTH)] - theTabs.Statistics.getStatExperience(Skill.STRENGTH)), 32, 390);
  186. g.drawString("XP Gained: " + XPGained, 32, 432);
  187. if(TotalSecs > 1) {
  188. g.drawString("XP/Hour: " + (3600*XPGained)/TotalSecs, 32, 445);
  189. } else {
  190. g.drawString("XP/Hour: 0", 32, 445);
  191. }
  192. g.drawString("Monkey Killer " + version, 233,357);
  193. }
  194. } catch(InterruptedException e) {
  195. log(e);
  196. }
  197. }
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement