1. import java.awt.*;
  2. import java.awt.event.KeyEvent;
  3. import java.util.*;
  4.  
  5. import org.rsbot.script.*;
  6. import org.rsbot.script.wrappers.*;
  7. import org.rsbot.bot.Bot;
  8. import org.rsbot.bot.input.Mouse;
  9. import org.rsbot.event.listeners.PaintListener;
  10. import org.rsbot.event.listeners.ServerMessageListener;
  11. import org.rsbot.event.events.ServerMessageEvent;
  12.  
  13. @ScriptManifest(authors = "Rapid", category = "AlexMaley", name = "Tuna Potato Maker", version = 0.1, description = "Makes tuna potatoes.")
  14.  
  15. public class TunaPotatoMaker extends Script implements PaintListener,
  16. ServerMessageListener {
  17.  
  18. public long seconds2;
  19. public long ProfitPerHour;
  20. public long startTime = System.currentTimeMillis();
  21. public int TotalProfit;
  22. public int CornBowlMade;
  23. public int TunaBowlMade;
  24. public int PotatoButterMade;
  25. public int TunaPotatoMade;
  26. public int Counter;
  27. public int BankBoothID = 11402;
  28. public int KnifeID = 946;
  29. //Primary ingredients
  30. public int ButterID = 6697;
  31. public int PotatoID = 6701;
  32. public int CornID = 5988;
  33. public int BowlID = 1923;
  34. public int TunaID = 361;
  35. //Secondary Ingredients
  36. public int ButterPotatoID = 6703;
  37. public int CornBowlID = 7088;
  38. public int TunaBowlID = 7068;
  39. //Final product
  40. public int TunaPotatoID = 7060;
  41.  
  42. private int antiBan() {
  43. int random = random(1, 4);
  44. switch (random) {
  45. case 1:
  46. if (random(1, 4) == 2) {
  47. moveMouseRandomly(300);
  48. return random(100, 500);
  49. }
  50. case 2:
  51. if (random(1, 10) == 5) {
  52. if (getCurrentTab() != TAB_INVENTORY) {
  53. openTab(TAB_INVENTORY);
  54. return random(100, 500);
  55. } else {
  56. return random(100, 500);
  57. }
  58. }
  59. case 3:
  60. if (random(1, 200) == 100) {
  61. if (getMyPlayer().isMoving()) {
  62. return random(100, 500);
  63. }
  64. if (getCurrentTab() != TAB_STATS) {
  65. openTab(TAB_STATS);
  66. }
  67. moveMouse(686, 306, 20, 10);
  68. wait(random(1500, 3000));
  69. if (getCurrentTab() != TAB_INVENTORY) {
  70. openTab(TAB_INVENTORY);
  71. }
  72. return random(100, 500);
  73. }
  74. case 4:
  75. if (random(1, 150) == 75) {
  76. openTab(random(0, 8));
  77. wait(random(1500, 2500));
  78. return random(100, 500);
  79. }
  80. }
  81. return 50;
  82. }
  83.  
  84. public void doBank(){
  85. RSObject BankBooth = getNearestObjectByID(BankBoothID);
  86. atObject(BankBooth, "Use-quickly");
  87. }
  88.  
  89. public boolean doButter(){
  90. try{
  91. doBank();
  92. wait(random(500,600));
  93. while (!bank.isOpen()){
  94. doBank();
  95. wait(random(200,300));
  96. }
  97. wait(random(1000,1250));
  98. while (!isLoggedIn()){
  99. wait(random(100,200));
  100. }
  101. Counter = bank.getCount(ButterID);
  102. if (Counter < 13){
  103. log("No butter in bank, stopping script.");
  104. stopScript();
  105. }
  106. bank.depositAllExcept(KnifeID);
  107. wait(random(200,300));
  108. bank.withdraw(ButterID, 13);
  109. wait(random(1000,1250));
  110. Counter = getInventoryCount(ButterID);
  111. while (Counter == 0){
  112. bank.depositAllExcept(KnifeID);
  113. wait(random(1000,1250));
  114. bank.withdraw(ButterID, 13);
  115. wait(random(1000,1250));
  116. Counter = getInventoryCount(ButterID);
  117. }
  118. bank.withdraw(PotatoID, 13);
  119. wait(random(1000,1250));
  120. Counter = getInventoryCount(PotatoID);
  121. while (Counter == 0){
  122. bank.depositAllExcept(KnifeID, ButterID);
  123. wait(random(200, 300));
  124. bank.withdraw(PotatoID, 13);
  125. wait(random(1000, 1250));
  126. Counter = getInventoryCount(PotatoID);
  127. }
  128. while (bank.isOpen()){
  129. bank.close();
  130. wait(random(1000,1250));
  131. }
  132. atInventoryItem(ButterID, "Use");
  133. wait(random(200,300));
  134. while (!isItemSelected()){
  135. atInventoryItem(ButterID, "Use");
  136. wait(random(200, 300));
  137. }
  138. atInventoryItem(PotatoID, "Use");
  139. wait(random(1000,1200));
  140. while (!RSInterface.getInterface(513).isValid()){
  141. wait(random(200,300));
  142. atInventoryItem(ButterID, "Use");
  143. wait(random(200,300));
  144. while (!isItemSelected()){
  145. atInventoryItem(ButterID, "Use");
  146. wait(random(200, 300));
  147. }
  148. atInventoryItem(PotatoID, "Use");
  149. wait(random(1000,1250));
  150. }
  151. if (RSInterface.getInterface(513).isValid()){
  152. clickMouse(260, 415, 10, 10, false);
  153. if (getMenuActions().contains("Make All")){
  154. atMenu("Make All");
  155. }
  156. }
  157. for (int i = 0; i <= 13; i++) {
  158. if (RSInterface.getInterface(
  159. Constants.INTERFACE_LEVELUP)
  160. .isValid()) {
  161. clickContinue();
  162. }
  163. antiBan();
  164. wait(1250);
  165. }
  166. }catch(Exception e){
  167.  
  168. }
  169. return true;
  170. }
  171.  
  172. public boolean doCorn(){
  173. try{
  174. doBank();
  175. wait(random(500,800));
  176. while (!bank.isOpen()){
  177. doBank();
  178. wait(random(500,800));
  179. }
  180. bank.depositAllExcept(KnifeID);
  181. wait(random(250,300));
  182. bank.withdraw(CornID, 13);
  183. wait(random(1000,1250));
  184. Counter = getInventoryCount(CornID);
  185. while (Counter != 13){
  186. bank.depositAllExcept(KnifeID);
  187. wait(random(1000,1250));
  188. bank.withdraw(CornID, 13);
  189. wait(random(1000,1250));
  190. Counter = getInventoryCount(CornID);
  191. }
  192. bank.withdraw(BowlID,13);
  193. wait(random(1000,1250));
  194. Counter = getInventoryCount(BowlID);
  195. while (Counter != 13){
  196. Counter = getInventoryCount(BowlID);
  197. while (Counter > 13){
  198. bank.depositAllExcept(KnifeID, CornID);
  199. wait(random(300,400));
  200. bank.withdraw(CornID, 13);
  201. wait(random(1000,1250));
  202. Counter = getInventoryCount();
  203. }
  204. bank.depositAllExcept(KnifeID, CornID);
  205. wait(random(300,400));
  206. bank.withdraw(BowlID, 13);
  207. wait(random(1000,1250));
  208. Counter = getInventoryCount(BowlID);
  209. }
  210. while (bank.isOpen()){
  211. bank.close();
  212. wait(random(1000,1250));
  213. }
  214. atInventoryItem(BowlID, "Use");
  215. wait(random(200,300));
  216. while (!isItemSelected()){
  217. atInventoryItem(BowlID, "Use");
  218. wait(random(200,300));
  219. }
  220. atInventoryItem(CornID, "Use");
  221. wait(random(1000,1250));
  222. while (!RSInterface.getInterface(513).isValid()){
  223. atInventoryItem(BowlID, "Use");
  224. wait(random(200,300));
  225. while (!isItemSelected()){
  226. atInventoryItem(BowlID, "Use");
  227. wait(random(200,300));
  228. }
  229. atInventoryItem(CornID, "Use");
  230. wait(random(500,600));
  231. }
  232. if (RSInterface.getInterface(513).isValid()){
  233. clickMouse(260, 415, 10, 10, false);
  234. if (getMenuActions().contains("Make All")){
  235. atMenu("Make All");
  236. }
  237. }
  238. for (int i = 0; i <= 13; i++) {
  239. if (RSInterface.getInterface(
  240. Constants.INTERFACE_LEVELUP)
  241. .isValid()) {
  242. clickContinue();
  243. }
  244. antiBan();
  245. wait(1250);
  246. }
  247. }catch(Exception e){
  248.  
  249. }
  250. return true;
  251. }
  252.  
  253. public boolean doTuna(){
  254. try{
  255. doBank();
  256. wait(random(500,600));
  257. while (!bank.isOpen()){
  258. doBank();
  259. wait(random(500,600));
  260. }
  261. bank.depositAllExcept(KnifeID, CornBowlID);
  262. wait(random(300,400));
  263. bank.withdraw(TunaID, 13);
  264. wait(random(1000,1250));
  265. Counter = getInventoryCount(TunaID);
  266. while (Counter != 13){
  267. bank.depositAllExcept(KnifeID, CornBowlID);
  268. wait(random(1000,1250));
  269. bank.withdraw(TunaID, 13);
  270. wait(random(1000,1250));
  271. Counter = getInventoryCount(TunaID);
  272. }
  273. while (bank.isOpen()){
  274. bank.close();
  275. wait(random(1000,1250));
  276. }
  277. atInventoryItem(TunaID, "Use");
  278. wait(random(200,300));
  279. while (!isItemSelected()){
  280. atInventoryItem(TunaID, "Use");
  281. wait(random(200,300));
  282. }
  283. atInventoryItem(CornBowlID, "Use");
  284. wait(random(1000,1250));
  285. while (!RSInterface.getInterface(513).isValid()){
  286. atInventoryItem(TunaID, "Use");
  287. wait(random(200,300));
  288. while (!isItemSelected()){
  289. atInventoryItem(TunaID, "Use");
  290. wait(random(200,300));
  291. }
  292. atInventoryItem(CornBowlID, "Use");
  293. wait(random(1000,1250));
  294. }
  295. if (RSInterface.getInterface(513).isValid()){
  296. clickMouse(260, 415, 10, 10, false);
  297. if (getMenuActions().contains("Make All")){
  298. atMenu("Make All");
  299. }
  300. }
  301. for (int i = 0; i <= 13; i++) {
  302. if (RSInterface.getInterface(
  303. Constants.INTERFACE_LEVELUP)
  304. .isValid()) {
  305. clickContinue();
  306. }
  307. antiBan();
  308. wait(1250);
  309. }
  310. }catch(Exception e){
  311.  
  312. }
  313. return true;
  314. }
  315.  
  316. public boolean doFinal(){
  317. try{
  318. doBank();
  319. wait(random(500,600));
  320. while (!bank.isOpen()){
  321. doBank();
  322. wait(random(500,600));
  323. }
  324. bank.depositAllExcept(KnifeID, TunaBowlID);
  325. wait(random(200,300));
  326. bank.withdraw(ButterPotatoID, 13);
  327. wait(random(1000,1250));
  328. Counter = getInventoryCount(ButterPotatoID);
  329. while (Counter != 13){
  330. bank.depositAllExcept(TunaBowlID, KnifeID);
  331. wait(random(1000,1250));
  332. bank.withdraw(ButterPotatoID, 13);
  333. wait(random(1000,1250));
  334. Counter = getInventoryCount(ButterPotatoID);
  335. }
  336. while (bank.isOpen()){
  337. bank.close();
  338. wait(random(1000,1250));
  339. }
  340. wait(random(300,400));
  341. atInventoryItem(ButterPotatoID, "Use");
  342. wait(random(200,300));
  343. while (!isItemSelected()){
  344. atInventoryItem(ButterPotatoID, "Use");
  345. wait(random(200,300));
  346. }
  347. atInventoryItem(TunaBowlID, "Use");
  348. wait(random(1000,1250));
  349. while (!RSInterface.getInterface(513).isValid()){
  350. wait(random(200,300));
  351. atInventoryItem(ButterPotatoID, "Use");
  352. wait(random(200,300));
  353. while (!isItemSelected()){
  354. atInventoryItem(ButterPotatoID, "Use");
  355. wait(random(200,300));
  356. }
  357. atInventoryItem(TunaBowlID, "Use");
  358. wait(random(1000,1250));
  359. }
  360. if (RSInterface.getInterface(513).isValid()){
  361. clickMouse(260, 415, 10, 10, false);
  362. if (getMenuActions().contains("Make All")){
  363. wait(random(200,300));
  364. atMenu("Make All");
  365. }
  366. }
  367. for (int i = 0; i <= 13; i++) {
  368. if (RSInterface.getInterface(
  369. Constants.INTERFACE_LEVELUP)
  370. .isValid()) {
  371. clickContinue();
  372. }
  373. antiBan();
  374. wait(1250);
  375. }
  376. wait(random(100,200));
  377. }catch(Exception e){
  378.  
  379. }
  380. return true;
  381. }
  382.  
  383. @Override
  384. public int loop() {
  385. if (isLoggedIn()){
  386. if (doButter()){
  387. if (doCorn()){
  388. if (doTuna()){
  389. if (doFinal()){
  390.  
  391. }
  392. }
  393. }
  394. }
  395. }else{
  396. wait(random(5000,6000));
  397. }
  398. return(random(500,1000));
  399. }
  400.  
  401. @Override
  402. public void onRepaint(Graphics g) {
  403. if (isLoggedIn()){
  404. long millis = System.currentTimeMillis() - startTime;
  405. final long hours = millis / (1000 * 60 * 60);
  406. millis -= hours * 1000 * 60 * 60;
  407. final long minutes = millis / (1000 * 60);
  408. millis -= minutes * 1000 * 60;
  409. final long seconds = millis / 1000;
  410. TotalProfit = (TunaPotatoMade * 78) + (PotatoButterMade * 83) + (CornBowlMade * 295) + (TunaBowlMade * 284);
  411. final int profitPerHour = (int) (3600000D / (System.currentTimeMillis() - startTime)* (TotalProfit));
  412. g.setColor(new Color(255, 255, 0));
  413. g.drawRect(0, 0, 226 , 163);
  414. g.fillRect(0, 0, 226, 163);
  415. g.setColor(Color.white);
  416. g.drawString("Butter with Potato's made : " + PotatoButterMade, 9, 23 );
  417. g.drawString("Sweet corn bowls made : " + CornBowlMade, 9,43);
  418. g.drawString("Tuna bowls made : " + TunaBowlMade, 9, 63);
  419. g.drawString("Tuna potato's made : " + TunaPotatoMade, 9, 83);
  420. g.drawString("Total Profit made : " + TotalProfit + "!", 9, 103);
  421. g.drawString("Profit P/Hour : " + profitPerHour + "!", 9, 123);
  422. g.drawString("Duration : " + hours + ":" + minutes + ":" + seconds, 9, 143);
  423. }
  424. }
  425.  
  426. @Override
  427. public void serverMessageRecieved(ServerMessageEvent e) {
  428. String serverString = e.getMessage();
  429. if (serverString.contains("You put the cooked sweetcorn into the bowl.")){
  430. CornBowlMade++;
  431. }
  432. if (serverString.contains("You mix the ingredients to make the topping.")){
  433. TunaBowlMade++;
  434. }
  435. if (serverString.contains("You add the butter to the potato.")){
  436. PotatoButterMade++;
  437. }
  438. if (serverString.contains("You add the topping to the potato.")){
  439. TunaPotatoMade++;
  440. }
  441. }
  442. }
  443.