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