Guest User

Untitled

a guest
Jul 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.*;
  3. import java.util.List;
  4. import java.util.logging.Level;
  5. import javax.accessibility.*;
  6. import javax.swing.*;
  7.  
  8. import org.rsbot.bot.Bot;
  9. import org.rsbot.script.*;
  10. import org.rsbot.script.wrappers.*;
  11. import org.rsbot.event.listeners.PaintListener;
  12. import org.rsbot.event.listeners.ServerMessageListener;
  13. import org.rsbot.event.events.ServerMessageEvent;
  14.  
  15. @ScriptManifest(authors = { "Grapes" }, category = "Combat", name = "Grapes' Hill Giants", version = 1.00, description = "<html><head></head><body><center><h1>Grapes' Hill Giants</h1></center><br>"
  16. + "<center><strong>By Grapes</strong></center><br>"
  17. )
  18.  
  19.  
  20. public class GrapesHillGiants extends Script implements PaintListener, ServerMessageListener {
  21.  
  22.  
  23. //VARIABLES\\
  24. private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  25.  
  26. private final int[] giantID = { 4691, 4692, 4693 };
  27. private final int[] foodID = { 6701, 365, 1891, 1897, 2011, 379, 7946, 329,
  28. 385, 333, 361 };
  29.  
  30. private final int[] bigBonesID = { 523 };
  31. private final int limpwurtRootID = ( 225 );
  32. private final int[] lawRuneID = { 563 };
  33. private final int[] natureRuneID = { 561 };
  34. private final int[] items = { 523, 225, 563, 561 };
  35.  
  36. public int bonesPrice = grandExchange.loadItemInfo(523).getMarketPrice();
  37. public int rootPrice = grandExchange.loadItemInfo(225).getMarketPrice();
  38. public int lawPrice = grandExchange.loadItemInfo(563).getMarketPrice();
  39. public int naturePrice = grandExchange.loadItemInfo(561).getMarketPrice();
  40.  
  41. public long startTime = System.currentTimeMillis();
  42. long runTime = System.currentTimeMillis() - startTime;
  43.  
  44. public int strengthExp = skills.getCurrentSkillExp(STAT_STRENGTH);
  45. public int attackExp = skills.getCurrentSkillExp(STAT_ATTACK);
  46. public int defenseExp = skills.getCurrentSkillExp(STAT_DEFENSE);
  47. public int rangeExp = skills.getCurrentSkillExp(STAT_RANGE);
  48. public int hitpointsExp = skills.getCurrentSkillExp(STAT_HITPOINTS);
  49.  
  50. public int gainedStrength = skills.getCurrentSkillExp(STAT_STRENGTH)
  51. - strengthExp;
  52. public int gainedAttack = skills.getCurrentSkillExp(STAT_ATTACK)
  53. - attackExp;
  54. public int gainedDefense = skills.getCurrentSkillExp(STAT_DEFENSE)
  55. - defenseExp;
  56. public int gainedRange = skills.getCurrentSkillExp(STAT_RANGE) - rangeExp;
  57. public int gainedHitpoints = skills.getCurrentSkillExp(STAT_HITPOINTS)
  58. - hitpointsExp;
  59.  
  60. public int totalXpGained = gainedStrength + gainedAttack + gainedDefense
  61. + gainedRange;
  62.  
  63. public int Hp = skills.getCurrentSkillExp(STAT_HITPOINTS);
  64.  
  65. int xpPerHour = (int) (3600000.0 / runTime * totalXpGained);
  66.  
  67. protected int getMouseSpeed() {
  68. return (random(6, 9));
  69. }
  70.  
  71.  
  72.  
  73. public boolean onStart(Map<String, String> args) {
  74. startTime = System.currentTimeMillis();
  75. strengthExp = skills.getCurrentSkillExp(STAT_STRENGTH);
  76. attackExp = skills.getCurrentSkillExp(STAT_ATTACK);
  77. defenseExp = skills.getCurrentSkillExp(STAT_DEFENSE);
  78. rangeExp = skills.getCurrentSkillExp(STAT_RANGE);
  79. hitpointsExp = skills.getCurrentSkillExp(STAT_HITPOINTS);
  80. return true;
  81. }
  82. public boolean run() {
  83. if (!isRunning() && getEnergy() > 50) {
  84. setRun(true);
  85. }
  86. return true;
  87. }
  88. public boolean attack(){
  89. RSNPC Giant = getNearestFreeNPCToAttackByID(giantID);
  90. atNPC(Giant, "Attack");
  91. wait(random(1000, 1500));
  92. if (getMyPlayer().getInteracting() != null) {
  93. wait(random(1000,2000));
  94. }
  95. return true;
  96. }
  97. public boolean eat() {
  98. if (skills.getCurrentSkillLevel(STAT_HITPOINTS) <= (skills
  99. .getRealSkillLevel(STAT_HITPOINTS) / 4)) {
  100. for (int i = 0; i < foodID.length; i++) {
  101. if (getInventoryCount(foodID[i]) != 0) {
  102. atInventoryItem(foodID[i], "Eat");
  103. if (getInventoryCount(foodID[i]) != 0) {
  104. wait(random(436, 669));
  105. }
  106. return true;
  107. }
  108. if (foodID == null)
  109. ;
  110. return false;
  111. }
  112. return true;
  113. }
  114. return true;
  115. }
  116.  
  117. public boolean pickUp(){
  118. RSItemTile item = getNearestGroundItemByID(items);
  119. if (items != null);
  120. return pickUp();
  121. }
  122.  
  123. public int loop() {
  124.  
  125. while (getMyPlayer().isMoving()) {
  126. return (random(100, 300));
  127. }
  128. if (!isRunning() && getEnergy() > 50) {
  129. setRun(true);
  130. }
  131. if (skills.getCurrentSkillLevel(STAT_HITPOINTS) <= (skills
  132. .getRealSkillLevel(STAT_HITPOINTS) / 4)) {
  133. eat();
  134. }
  135. if (getMyPlayer().getInteracting() != null) {
  136. return random(300, 450);
  137. }
  138. if (getMyPlayer().getInteracting() == null) {
  139. attack();
  140. }
  141. return 100;
  142. }
  143.  
  144. public void serverMessageRecieved(final ServerMessageEvent arg0) {
  145. final String serverString = arg0.getMessage();
  146. }
  147.  
  148. public void onRepaint(Graphics g) {
  149. if(!isLoggedIn() || isLoginScreen())
  150. return;
  151.  
  152. long millis = System.currentTimeMillis() - startTime;
  153. long hours = millis / (1000 * 60 * 60);
  154. millis -= hours * (1000 * 60 * 60);
  155. long minutes = millis / (1000 * 60);
  156. millis -= minutes * (1000 * 60);
  157. long seconds = millis / 1000;
  158. long minutes2 = minutes + (hours * 60);
  159. g.setColor(new Color(128, 0, 0, 128));
  160. g.fillRoundRect(550, 206, 185, 260, 10, 10);
  161. g.setColor(Color.white);
  162. g.setFont(new Font("Arial", Font.BOLD, 13));
  163. g.drawString("Grapes' Hill Giants", 588, 225);
  164. g.setFont(new Font("Arial", Font.PLAIN, 12));
  165. g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds,
  166. 560, 255);
  167. gainedStrength = skills.getCurrentSkillExp(STAT_STRENGTH) - strengthExp;
  168. gainedAttack = skills.getCurrentSkillExp(STAT_ATTACK) - attackExp;
  169. gainedDefense = skills.getCurrentSkillExp(STAT_DEFENSE) - defenseExp;
  170. gainedHitpoints = skills.getCurrentSkillExp(STAT_HITPOINTS)
  171. - hitpointsExp;
  172. g.drawString("Strength XP Gained: " + gainedStrength, 560, 275);
  173. g.drawString("Attack XP Gained: " + gainedAttack, 560, 295);
  174. g.drawString("Defense XP Gained: " + gainedDefense, 560, 315);
  175. g.drawString("Hitpoints XP Gained: " + gainedHitpoints, 560, 335);
  176. float xpPerSec = 0;
  177. if ((minutes > 0 || hours > 0 || seconds > 0) && totalXpGained > 0) {
  178. xpPerSec = (float) totalXpGained
  179. / (float) (seconds + minutes * 60 + hours * 60 * 60);
  180. }
  181. final float xpPerMin = xpPerSec * 60;
  182. final float xpPerHour = xpPerMin * 60;
  183. totalXpGained = gainedStrength + gainedAttack + gainedDefense
  184. + gainedRange;
  185. g.drawString("Exp/Hour: " + xpPerHour, 560, 370);
  186. }
  187.  
  188.  
  189. public void onFinish() {
  190. }
  191. }
Add Comment
Please, Sign In to add comment