Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1. .rsbot.script.Script;
  2.  
  3. import org.rsbot.script.ScriptManifest;
  4.  
  5. import java.util.Map;
  6.  
  7. import org.rsbot.script.wrappers.RSObject;
  8.  
  9. import org.rsbot.script.wrappers.RSTile;
  10.  
  11. import org.rsbot.script.wrappers.RSArea;
  12.  
  13. import org.rsbot.script.methods.Magic;
  14.  
  15. import org.rsbot.script.methods.Walking;
  16.  
  17. import org.rsbot.script.methods.Game;
  18.  
  19. import org.rsbot.script.methods.Camera;
  20.  
  21.  
  22. @ScriptManifest(authors = "Komatose", name = "The Chair Master", version = 1.0, description = "Power constructs chairs in a player owned house.")
  23.  
  24.  
  25. public class theChairMaster extends Script
  26.  
  27. {
  28.  
  29. boolean buildMode = false;
  30.  
  31. boolean inHouse = false;
  32.  
  33. //int[] bankerID = {6533, 6535};
  34.  
  35. int oakPlankID = 8778;
  36.  
  37. int[] blankChairID = {15411, 15412, 15410};
  38.  
  39. int builtChairID = 13584;
  40.  
  41. //saw, hammer, law, fire, earth, air
  42.  
  43. int[] noDepositID = {8794, 2347, 563, 554, 557, 556};
  44.  
  45. RSTile walkToGE = new RSTile(3165, 3487);
  46.  
  47.  
  48.  
  49.  
  50. public boolean onStart()
  51.  
  52. {
  53.  
  54. log("CHAIR MASTER ENGUAGE!");
  55.  
  56. return true;
  57.  
  58. }
  59.  
  60.  
  61. public void onFinish()
  62.  
  63. {
  64.  
  65. log("Thank you for using the Chair Master!");
  66.  
  67. }
  68.  
  69.  
  70. private void setBuildOn()
  71.  
  72. {
  73.  
  74. sleep(5000, 7500);
  75.  
  76. log("Turning build mode on.");
  77.  
  78. game.openTab(12);
  79.  
  80. sleep(200, 500);
  81.  
  82. mouse.move(699, 429, 3, 3);
  83.  
  84. sleep(200, 500);
  85.  
  86. mouse.click(true);
  87.  
  88. sleep(500, 1200);
  89.  
  90. mouse.move(580, 269, 3, 3);
  91.  
  92. sleep(200, 500);
  93.  
  94. mouse.click(true);
  95.  
  96. buildMode = true;
  97.  
  98. }
  99.  
  100.  
  101.  
  102. private void teleport()
  103.  
  104. {
  105.  
  106. if (!atGrandExchange())
  107.  
  108. {
  109.  
  110. log("Teleporting to Varrock.");
  111.  
  112. magic.castSpell(40);
  113.  
  114. game.openTab(4);
  115.  
  116. inHouse = false;
  117.  
  118. }
  119.  
  120. else if (atGrandExchange())
  121.  
  122. {
  123.  
  124. log("Teleporting to your house.");
  125.  
  126. magic.castSpell(48);
  127.  
  128. game.openTab(4);
  129.  
  130. }
  131.  
  132. }
  133.  
  134.  
  135.  
  136. /**private boolean atHouse()
  137.  
  138. {
  139.  
  140. RSArea area = new RSArea(new RSTile(8396, 2190), new RSTile(8410, 2201));
  141.  
  142. return area.contains(getMyPlayer().getLocation());
  143.  
  144. }*/
  145.  
  146.  
  147.  
  148. private boolean atGrandExchange()
  149.  
  150. {
  151.  
  152. RSArea area = new RSArea(new RSTile(3157, 3462), new RSTile(3174, 3492));
  153.  
  154. return area.contains(getMyPlayer().getLocation());
  155.  
  156. }
  157.  
  158.  
  159.  
  160. private boolean walkToBank()
  161.  
  162. {
  163.  
  164. log("Walking to the bank.");
  165.  
  166. return walking.walkTo(walkToGE);
  167.  
  168. }
  169.  
  170.  
  171.  
  172. private void walkInHouse()
  173.  
  174. {
  175.  
  176. log("Walking into your house.");
  177.  
  178. camera.setNorth();
  179.  
  180. camera.setPitch(true);
  181.  
  182. sleep(1000, 2500);
  183.  
  184. mouse.move(628, 59, 2, 2);
  185.  
  186. sleep(200, 500);
  187.  
  188. mouse.click(true);
  189.  
  190. sleep(4000, 6000);
  191.  
  192. inHouse = true;
  193.  
  194. }
  195.  
  196.  
  197.  
  198. private void makeChair()
  199.  
  200. {
  201.  
  202. log("Making a chair.");
  203.  
  204. RSObject blankChair = objects.getNearest(blankChairID);
  205.  
  206. if (blankChair != null && getMyPlayer().getAnimation() == -1)
  207.  
  208. {
  209.  
  210. blankChair.doAction("Build");
  211.  
  212. sleep(2000, 4000);
  213.  
  214. mouse.move(112, 270, 3, 3);
  215.  
  216. sleep(200, 500);
  217.  
  218. mouse.click(true);
  219.  
  220. sleep(1000, 2000);
  221.  
  222. }
  223.  
  224. }
  225.  
  226.  
  227.  
  228. private void removeChair()
  229.  
  230. {
  231.  
  232. log("Removing a chair.");
  233.  
  234. RSObject builtChair = objects.getNearest(builtChairID);
  235.  
  236. if (builtChair != null && getMyPlayer().getAnimation() == -1)
  237.  
  238. {
  239.  
  240. builtChair.doAction("Remove");
  241.  
  242. sleep(1000, 2000);
  243.  
  244. mouse.move(261, 404, 5, 3);
  245.  
  246. sleep(200, 500);
  247.  
  248. mouse.click(true);
  249.  
  250. sleep(1000, 2000);
  251.  
  252. }
  253.  
  254. }
  255.  
  256.  
  257.  
  258. private void openBank()
  259.  
  260. {
  261.  
  262. log("Opening bank.");
  263.  
  264. bank.open();
  265.  
  266. sleep(500, 1500);
  267.  
  268. }
  269.  
  270.  
  271.  
  272. private void withdrawPlanks()
  273.  
  274. {
  275.  
  276. log("Withdrawing planks.");
  277.  
  278. if(bank.isOpen())
  279.  
  280. {
  281.  
  282. bank.withdraw(oakPlankID, 22);
  283.  
  284. sleep(200, 500);
  285.  
  286. }
  287.  
  288. sleep(500, 1500);
  289.  
  290. }
  291.  
  292.  
  293.  
  294. private void closeBank()
  295.  
  296. {
  297.  
  298. log("Closing the bank.");
  299.  
  300. if(bank.isOpen())
  301.  
  302. {
  303.  
  304. mouse.move(490, 36, 3, 3);
  305.  
  306. sleep(200, 500);
  307.  
  308. mouse.click(true);
  309.  
  310. }
  311.  
  312. sleep(500, 1500);
  313.  
  314. }
  315.  
  316.  
  317.  
  318. private void bank()
  319.  
  320. {
  321.  
  322. openBank();
  323.  
  324. withdrawPlanks();
  325.  
  326. closeBank();
  327.  
  328. }
  329.  
  330.  
  331.  
  332. @Override
  333.  
  334. public int loop()
  335.  
  336. {
  337.  
  338. if (!buildMode)
  339.  
  340. {
  341.  
  342. log("Calling setBuildOn method.");
  343.  
  344. setBuildOn();
  345.  
  346. }
  347.  
  348. else if ( !atGrandExchange() && !inventory.contains(oakPlankID) )
  349.  
  350. {
  351.  
  352. log("Calling teleport to varrock method.");
  353.  
  354. teleport();
  355.  
  356. }
  357.  
  358. else if ( atGrandExchange() && !inventory.contains(oakPlankID) )
  359.  
  360. {
  361.  
  362. log("Calling banking method.");
  363.  
  364. walkToBank();
  365.  
  366. bank();
  367.  
  368. }
  369.  
  370. else if( atGrandExchange() && inventory.contains(oakPlankID) )
  371.  
  372. {
  373.  
  374. log("Calling teleport to house method.");
  375.  
  376. teleport();
  377.  
  378. }
  379.  
  380. else if ( !atGrandExchange() && inventory.contains(oakPlankID) )
  381.  
  382. {
  383.  
  384. log("Calling building methods.");
  385.  
  386. if (!inHouse)
  387.  
  388. {
  389.  
  390. walkInHouse();
  391.  
  392. }
  393.  
  394. else if (inHouse)
  395.  
  396. {
  397.  
  398. makeChair();
  399.  
  400. sleep(2200, 4200);
  401.  
  402. removeChair();
  403.  
  404. }
  405.  
  406. }
  407.  
  408. return random(1650, 3500);
  409.  
  410. }
  411.  
  412.  
  413.  
  414. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement