Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.17 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Graphics2D;
  5. import java.awt.Point;
  6. import java.util.ArrayList;
  7.  
  8.  
  9. import org.parabot.core.ui.components.LogArea;
  10. import org.parabot.environment.api.interfaces.Paintable;
  11. import org.parabot.environment.api.utils.Time;
  12. import org.parabot.environment.api.utils.Timer;
  13. import org.parabot.environment.scripts.Category;
  14. import org.parabot.environment.scripts.ScriptManifest;
  15. import org.parabot.environment.scripts.Script;
  16. import org.parabot.environment.scripts.framework.Strategy;
  17. import org.rev317.accessors.NpcDef;
  18. import org.rev317.api.events.MessageEvent;
  19. import org.rev317.api.events.listeners.MessageListener;
  20. import org.rev317.api.methods.Bank;
  21. import org.rev317.api.methods.Camera;
  22. import org.rev317.api.methods.Interfaces;
  23. import org.rev317.api.methods.Inventory;
  24. import org.rev317.api.methods.Menu;
  25. import org.rev317.api.methods.Npcs;
  26. import org.rev317.api.methods.Players;
  27. import org.rev317.api.methods.SceneObjects;
  28. import org.rev317.api.methods.Skill;
  29. import org.rev317.api.methods.Walking;
  30. import org.rev317.api.wrappers.hud.Interface;
  31. import org.rev317.api.wrappers.hud.Item;
  32. import org.rev317.api.wrappers.hud.Tab;
  33. import org.rev317.api.wrappers.interactive.Character;
  34. import org.rev317.api.wrappers.interactive.Npc;
  35. import org.rev317.api.wrappers.scene.Area;
  36. import org.rev317.api.wrappers.scene.SceneObject;
  37. import org.rev317.api.wrappers.scene.Tile;
  38. import org.rev317.api.wrappers.walking.TilePath;
  39. import org.rev317.api.methods.Interfaces;
  40.  
  41.  
  42. @ScriptManifest(author = "Brookpc", category = Category.THIEVING, description = "Steals and Sells items on UltimateScape 2", name = "USThiever", servers = { "UltimateScape" }, version = 1.0)
  43. public class USThiever extends Script implements Paintable, MessageListener {
  44.  
  45. private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
  46. 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));
  47. public int npcID;
  48. public int stallID;
  49. public int startlvl;
  50. public int[] sellIDs = {950, 1891, 1901,2309,958,4658}; //Silk, Cake, Chocolate Slice,Bread,Wolf Fur,Silver Pot
  51. public int curlvl;
  52. public int lvlcount;
  53. public int cashMade;
  54. public int infID;
  55. private final Color color1 = new Color(229, 255, 59);
  56. private final Font font1 = new Font("Arial", 0, 20);
  57. private final Font font2 = new Font("Arial", 0, 14);
  58. private final Color color2 = new Color(225, 50, 55);
  59. private final Timer RUNTIME = new Timer();
  60.  
  61.  
  62. @Override
  63. public boolean onExecute() {
  64. startlvl = Skill.THIEVING.getLevel();
  65. curlvl = Skill.THIEVING.getLevel();
  66.  
  67. if (startlvl < 20)
  68. stallID = 1616;
  69. else if (curlvl >= 20 && curlvl <35)
  70. stallID = 1615;
  71. else if (curlvl >= 35 && curlvl < 50)
  72. stallID = 1614;
  73. else if (curlvl >= 50 && curlvl < 65)
  74. stallID = 1619;
  75. else if (curlvl >= 65 && curlvl < 75)
  76. stallID = 1618;
  77. else if (curlvl >=75)
  78. stallID = 1617;
  79.  
  80.  
  81.  
  82. strategies.add(new steal());
  83. strategies.add(new trade());
  84. provide(strategies);
  85. return true;
  86. }
  87. public void atlvlchange() {
  88. lvlcount = (curlvl - startlvl);
  89. return;
  90. }
  91. public class steal implements Strategy{
  92.  
  93.  
  94. @Override
  95. public boolean activate() {
  96. final SceneObject Stalls[] = SceneObjects.getNearest(stallID);
  97. final SceneObject Stall = Stalls[0];
  98. return !Inventory.isFull()
  99. && TA.contains(Players.getLocal().getLocation())
  100. && Stall != null;
  101. }
  102.  
  103. @Override
  104. public void execute() {
  105. atlvlchange();
  106. final SceneObject Stalls[] = SceneObjects.getNearest(stallID);
  107. final SceneObject Stall = Stalls[0];
  108.  
  109. if (Stall.isOnScreen() && Players.getLocal().getAnimation() == -1 && !Players.getLocal().isWalking()) {
  110. Stall.interact("");
  111. Time.sleep(1000);
  112. } else if (!Stall.isOnScreen() && Players.getLocal().getAnimation() == -1){
  113. Tile Loc = Stall.getLocation();
  114. Loc.clickMM();
  115. Time.sleep(1000);
  116. }
  117. while (Players.getLocal().getAnimation() != -1) {
  118. Time.sleep(1000);
  119.  
  120. }
  121. }
  122.  
  123. }
  124. public class trade implements Strategy{
  125.  
  126. @Override
  127. public boolean activate() {
  128. final Npc Sells[] = Npcs.getNearest(2270);
  129. final Npc Marty = Sells[0];
  130. return Inventory.isFull()
  131. && TA.contains(Players.getLocal().getLocation())
  132. && Marty != null;
  133. }
  134.  
  135. @Override
  136. public void execute() {
  137. final Npc Sells[] = Npcs.getNearest(2270);
  138. final Npc Marty = Sells[0];
  139.  
  140. LogArea.log("Interface ID: " + Interfaces.getOpenInterfaceId());
  141. if (Interfaces.getOpenInterfaceId() != 3824 && Marty != null) {
  142. Npcs.getNearest(2270)[0].interact("Trade");
  143. Time.sleep(200);
  144. } else if (Interfaces.getOpenInterfaceId() == 3824) {
  145. for (Item i : Inventory.getItems(sellIDs)) {
  146. i.interact("Sell 50");
  147. }
  148. Time.sleep(1000);
  149. } else if (Marty == null) {
  150. Time.sleep(200);
  151. }
  152. Time.sleep(100);
  153. }
  154.  
  155. }
  156. @Override
  157. public void messageReceived(MessageEvent arg0) {
  158.  
  159.  
  160. }
  161.  
  162. @Override
  163. public void paint(Graphics arg0) {
  164. Graphics2D g = (Graphics2D) arg0;
  165. g.setColor(new Color(0f, 0f, 0f, .5f));
  166. g.fillRect(4, 23, 150, 65);
  167. g.setColor(color2);
  168. g.setFont(font1);
  169. g.drawString("USThiever", 6, 43);
  170. g.setFont(font2);
  171. g.setColor(color1);
  172. g.drawString("Levels Gained: " + lvlcount, 6, 57);
  173. g.drawString("Runtime: " + RUNTIME, 6, 83);
  174.  
  175.  
  176. }
  177.  
  178.  
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement