Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.84 KB | None | 0 0
  1. package parabotp;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import java.awt.Image;
  8. import java.awt.Point;
  9. import java.io.IOException;
  10. import java.net.URL;
  11. import java.util.ArrayList;
  12.  
  13.  
  14.  
  15.  
  16. import javax.imageio.ImageIO;
  17.  
  18. import org.parabot.core.ui.components.LogArea;
  19. import org.parabot.environment.api.interfaces.Paintable;
  20. import org.parabot.environment.api.utils.Time;
  21. import org.parabot.environment.api.utils.Timer;
  22. import org.parabot.environment.scripts.Category;
  23. import org.parabot.environment.scripts.ScriptManifest;
  24. import org.parabot.environment.scripts.Script;
  25. import org.parabot.environment.scripts.framework.Strategy;
  26. import org.rev317.accessors.NpcDef;
  27. import org.rev317.api.events.MessageEvent;
  28. import org.rev317.api.events.listeners.MessageListener;
  29. import org.rev317.api.methods.Bank;
  30. import org.rev317.api.methods.Camera;
  31. import org.rev317.api.methods.Interfaces;
  32. import org.rev317.api.methods.Inventory;
  33. import org.rev317.api.methods.Menu;
  34. import org.rev317.api.methods.Npcs;
  35. import org.rev317.api.methods.Players;
  36. import org.rev317.api.methods.SceneObjects;
  37. import org.rev317.api.methods.Skill;
  38. import org.rev317.api.methods.Walking;
  39. import org.rev317.api.wrappers.hud.Interface;
  40. import org.rev317.api.wrappers.hud.Item;
  41. import org.rev317.api.wrappers.hud.Tab;
  42. import org.rev317.api.wrappers.interactive.Character;
  43. import org.rev317.api.wrappers.interactive.Npc;
  44. import org.rev317.api.wrappers.scene.Area;
  45. import org.rev317.api.wrappers.scene.SceneObject;
  46. import org.rev317.api.wrappers.scene.Tile;
  47. import org.rev317.api.wrappers.walking.TilePath;
  48. import org.rev317.api.methods.Interfaces;
  49.  
  50.  
  51. @ScriptManifest(author = "Brookpc", category = Category.THIEVING, description = "Steals and Sells items on UltimateScape 2", name = "USThiever", servers = { "UltimateScape" }, version = 1.0)
  52. public class USThiever extends Script implements Paintable, MessageListener {
  53.  
  54. private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
  55. public static Area TA = new Area (new Tile(2676, 3324, 0), new Tile(2648, 3324, 0), new Tile(2645, 3289, 0), new Tile(2672, 3289, 0));
  56. public int npcID;
  57. public int stallID;
  58. public int startlvl;
  59. public int[] sellIDs = {950, 1891, 1901,2309,958,4658}; //Silk, Cake, Chocolate Slice,Bread,Wolf Fur,Silver Pot
  60. public int curlvl;
  61. public int lvlcount;
  62. public int cashMade;
  63. public int infID;
  64. public int current;
  65. private final Color color1 = new Color(229, 255, 59);
  66. private final Font font1 = new Font("Arial", 0, 20);
  67. private final Font font2 = new Font("Arial", 0, 14);
  68. private final Color color2 = new Color(225, 50, 55);
  69. private final Timer RUNTIME = new Timer();
  70. public static Image img1;
  71.  
  72.  
  73. @Override
  74. public boolean onExecute() {
  75. img1 = getImage("http://i.imgur.com/5b9BJFi.png");
  76. startlvl = Skill.THIEVING.getLevel();
  77. curlvl = Skill.THIEVING.getLevel();
  78. if (curlvl < 20){
  79. stallID = 1616;} //Bread
  80. if (curlvl >= 20 && curlvl <35){
  81. stallID = 1615;} //Silk
  82. if (curlvl >= 35 && curlvl < 50){
  83. stallID = 1619;} //Fur
  84. if (curlvl >= 50 && curlvl < 65){
  85. stallID = 1614;} //Silver
  86. if (curlvl >= 65 && curlvl < 75){
  87. stallID = 1618;} //Spice
  88. if (curlvl >=75){
  89. stallID = 1617;} //Gems
  90.  
  91. strategies.add(new steal());
  92. strategies.add(new trade());
  93. provide(strategies);
  94. return true;
  95. }
  96. public static Image getImage(String url) {
  97. try {
  98. return ImageIO.read(new URL(url));
  99. } catch (IOException e) {
  100. return null;
  101. }
  102. }
  103. public void atlvlchange() {
  104. curlvl = Skill.THIEVING.getLevel();
  105. lvlcount = (curlvl - startlvl);
  106. return;
  107. }
  108. public enum check {
  109. curlvl = Skill.THIEVING.getLevel();
  110. Stall current = null;
  111. for (Stall s : Stall.values()) {
  112. if (s.getLevelReq() <= lvl) {
  113. current = s;
  114. }
  115. }
  116. if (current != null) {
  117. stallID = current.getStallId();
  118. }
  119. Thieving.stall = SceneObjects.getClosest(stallID);
  120. }
  121. public class steal implements Strategy{
  122.  
  123.  
  124. @Override
  125. public boolean activate() {
  126. curlvl = Skill.THIEVING.getLevel();
  127. if (curlvl < 20){
  128. stallID = 1616;} //Bread
  129. if (curlvl >= 20 && curlvl <35){
  130. stallID = 1615;} //Silk
  131. if (curlvl >= 35 && curlvl < 50){
  132. stallID = 1619;} //Fur
  133. if (curlvl >= 50 && curlvl < 65){
  134. stallID = 1614;} //Silver
  135. if (curlvl >= 65 && curlvl < 75){
  136. stallID = 1618;} //Spice
  137. if (curlvl >=75){
  138. stallID = 1617;} //Gems
  139.  
  140. final SceneObject Stalls[] = SceneObjects.getNearest(stallID);
  141. final SceneObject Steal = Stalls[0];
  142. return !Inventory.isFull()
  143. && TA.contains(Players.getLocal().getLocation())
  144. && Steal != null;
  145. }
  146.  
  147. @Override
  148. public void execute() {
  149. atlvlchange();
  150. final SceneObject Stalls[] = SceneObjects.getNearest(stallID);
  151. final SceneObject Steal = Stalls[0];
  152. for (SceneObject i : SceneObjects.getNearest(stallID)) {;
  153. if (Steal.isOnScreen() && Players.getLocal().getAnimation() == -1 && Steal != null && !Players.getLocal().isWalking()) {
  154. try{
  155. i.interact("");
  156.  
  157. } catch(Exception e) {
  158.  
  159. }
  160. Time.sleep(500);
  161. } else if (!Steal.isOnScreen() && Players.getLocal().getAnimation() == -1 && Steal != null){
  162. Tile Loc = Steal.getLocation();
  163. Loc.clickMM();
  164. Time.sleep(500);
  165. }
  166. else break;
  167. }
  168. while (Players.getLocal().getAnimation() != -1) {
  169. Time.sleep(500);
  170.  
  171. }
  172.  
  173. }
  174.  
  175.  
  176. }
  177. public class trade implements Strategy{
  178.  
  179. @Override
  180. public boolean activate() {
  181. final Npc Sells[] = Npcs.getNearest(2270);
  182. final Npc Marty = Sells[0];
  183. return Inventory.isFull()
  184. && TA.contains(Players.getLocal().getLocation())
  185. && Marty != null;
  186. }
  187.  
  188. @Override
  189. public void execute() {
  190. final Npc Sells[] = Npcs.getNearest(2270);
  191. final Npc Marty = Sells[0];
  192.  
  193. LogArea.log("Interface ID: " + Interfaces.getOpenInterfaceId());
  194. if(!Marty.isOnScreen()){
  195. Tile NLoc = Marty.getLocation();
  196. NLoc.clickMM();
  197. Time.sleep(500);
  198. }
  199. if (Interfaces.getOpenInterfaceId() != 3824 && Marty != null) {
  200. Npcs.getNearest(2270)[0].interact("Trade");
  201. Time.sleep(200);
  202. } else if (Interfaces.getOpenInterfaceId() == 3824) {
  203. for (Item i : Inventory.getItems(sellIDs)) {
  204. i.interact("Sell 50");
  205. }
  206. Time.sleep(1000);
  207. } else if (Marty == null) {
  208. Time.sleep(200);
  209. }
  210. Time.sleep(100);
  211. }
  212.  
  213. }
  214. @Override
  215. public void messageReceived(MessageEvent arg0) {
  216.  
  217.  
  218. }
  219.  
  220. @Override
  221. public void paint(Graphics arg0) {
  222. Graphics2D g = (Graphics2D) arg0;
  223. g.setColor(new Color(0f, 0f, 0f, .5f));
  224. g.fillRect(4, 23, 130, 75);
  225. g.drawImage(img1, 4, 23, null);
  226. g.setFont(font2);
  227. g.setColor(color1);
  228. g.drawString("Levels Gained: " + lvlcount, 6, 58);
  229. g.drawString("Runtime: " + RUNTIME, 6, 71);
  230. g.drawString("Cash Made: N/A", 6, 84);
  231. g.drawString("Current Level: " + startlvl, 6, 97);
  232.  
  233.  
  234. }
  235.  
  236.  
  237. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement