Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.97 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. final SceneObject Stalls[] = SceneObjects.getNearest(stallID);
  77. final SceneObject Steal = Stalls[0];
  78. startlvl = Skill.THIEVING.getLevel();
  79. curlvl = Skill.THIEVING.getLevel();
  80. if (curlvl < 20){
  81. stallID = 1616;} //Bread
  82. if (curlvl >= 20 && curlvl <35){
  83. stallID = 1615;} //Silk
  84. if (curlvl >= 35 && curlvl < 50){
  85. stallID = 1619;} //Fur
  86. if (curlvl >= 50 && curlvl < 65){
  87. stallID = 1614;} //Silver
  88. if (curlvl >= 65 && curlvl < 75){
  89. stallID = 1618;} //Spice
  90. if (curlvl >=75){
  91. stallID = 1617;} //Gems
  92.  
  93. strategies.add(new steal());
  94. strategies.add(new trade());
  95. provide(strategies);
  96. return true;
  97. }
  98. public static Image getImage(String url) {
  99. try {
  100. return ImageIO.read(new URL(url));
  101. } catch (IOException e) {
  102. return null;
  103. }
  104. }
  105. public void atlvlchange() {
  106. curlvl = Skill.THIEVING.getLevel();
  107. lvlcount = (curlvl - startlvl);
  108. return;
  109. }
  110. public enum check() {
  111. int lvl = Skill.THIEVING.getLevel();
  112. Stall current = null;
  113. for (Stall s : Stall.values()) {
  114. if (s.getLevelReq() <= lvl) {
  115. current = s;
  116. }
  117. }
  118. if (current != null) {
  119. stallID = current.getStallId();
  120. }
  121. Thieving.stall = SceneObjects.getClosest(stallID);
  122. }
  123. public class steal implements Strategy{
  124.  
  125.  
  126. @Override
  127. public boolean activate() {
  128. curlvl = Skill.THIEVING.getLevel();
  129. if (curlvl < 20){
  130. stallID = 1616;} //Bread
  131. if (curlvl >= 20 && curlvl <35){
  132. stallID = 1615;} //Silk
  133. if (curlvl >= 35 && curlvl < 50){
  134. stallID = 1619;} //Fur
  135. if (curlvl >= 50 && curlvl < 65){
  136. stallID = 1614;} //Silver
  137. if (curlvl >= 65 && curlvl < 75){
  138. stallID = 1618;} //Spice
  139. if (curlvl >=75){
  140. stallID = 1617;} //Gems
  141.  
  142. final SceneObject Stalls[] = SceneObjects.getNearest(stallID);
  143. final SceneObject Steal = Stalls[0];
  144. return !Inventory.isFull()
  145. && TA.contains(Players.getLocal().getLocation())
  146. && Steal != null;
  147. }
  148.  
  149. @Override
  150. public void execute() {
  151. atlvlchange();
  152. final SceneObject Stalls[] = SceneObjects.getNearest(stallID);
  153. final SceneObject Steal = Stalls[0];
  154. for (SceneObject i : SceneObjects.getNearest(stallID)) {;
  155. if (Steal.isOnScreen() && Players.getLocal().getAnimation() == -1 && Steal != null && !Players.getLocal().isWalking()) {
  156. try{
  157. i.interact("");
  158.  
  159. } catch(Exception e) {
  160.  
  161. }
  162. Time.sleep(500);
  163. } else if (!Steal.isOnScreen() && Players.getLocal().getAnimation() == -1 && Steal != null){
  164. Tile Loc = Steal.getLocation();
  165. Loc.clickMM();
  166. Time.sleep(500);
  167. }
  168. else break;
  169. }
  170. while (Players.getLocal().getAnimation() != -1) {
  171. Time.sleep(500);
  172.  
  173. }
  174.  
  175. }
  176.  
  177.  
  178. }
  179. public class trade implements Strategy{
  180.  
  181. @Override
  182. public boolean activate() {
  183. final Npc Sells[] = Npcs.getNearest(2270);
  184. final Npc Marty = Sells[0];
  185. return Inventory.isFull()
  186. && TA.contains(Players.getLocal().getLocation())
  187. && Marty != null;
  188. }
  189.  
  190. @Override
  191. public void execute() {
  192. final Npc Sells[] = Npcs.getNearest(2270);
  193. final Npc Marty = Sells[0];
  194.  
  195. LogArea.log("Interface ID: " + Interfaces.getOpenInterfaceId());
  196. if(!Marty.isOnScreen()){
  197. Tile NLoc = Marty.getLocation();
  198. NLoc.clickMM();
  199. Time.sleep(500);
  200. }
  201. if (Interfaces.getOpenInterfaceId() != 3824 && Marty != null) {
  202. Npcs.getNearest(2270)[0].interact("Trade");
  203. Time.sleep(200);
  204. } else if (Interfaces.getOpenInterfaceId() == 3824) {
  205. for (Item i : Inventory.getItems(sellIDs)) {
  206. i.interact("Sell 50");
  207. }
  208. Time.sleep(1000);
  209. } else if (Marty == null) {
  210. Time.sleep(200);
  211. }
  212. Time.sleep(100);
  213. }
  214.  
  215. }
  216. @Override
  217. public void messageReceived(MessageEvent arg0) {
  218.  
  219.  
  220. }
  221.  
  222. @Override
  223. public void paint(Graphics arg0) {
  224. Graphics2D g = (Graphics2D) arg0;
  225. g.setColor(new Color(0f, 0f, 0f, .5f));
  226. g.fillRect(4, 23, 130, 75);
  227. g.drawImage(img1, 4, 23, null);
  228. g.setFont(font2);
  229. g.setColor(color1);
  230. g.drawString("Levels Gained: " + lvlcount, 6, 58);
  231. g.drawString("Runtime: " + RUNTIME, 6, 71);
  232. g.drawString("Cash Made: N/A", 6, 84);
  233. g.drawString("Current Level: " + startlvl, 6, 97);
  234.  
  235.  
  236. }
  237.  
  238.  
  239. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement