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 uncooked pizza's using the summining scrolls and incomplete pizza's.")
  14.  
  15. public class TunaPotatoMaker extends Script implements PaintListener,
  16. ServerMessageListener {
  17.  
  18. public long seconds1;
  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. if (!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.deposit(ButterID, 13);
  113. wait(random(200,300));
  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.deposit(PotatoID, 13);
  123. wait(random(200, 300));
  124. bank.withdraw(PotatoID, 13);
  125. wait(random(1000, 1250));
  126. Counter = getInventoryCount(PotatoID);
  127. }
  128. bank.close();
  129. wait(random(200,300));
  130. atInventoryItem(ButterID, "Use");
  131. wait(random(200,300));
  132. while (!isItemSelected()){
  133. atInventoryItem(ButterID, "Use");
  134. wait(random(200, 300));
  135. }
  136. atInventoryItem(PotatoID, "Use");
  137. wait(random(1000,1200));
  138. while (!RSInterface.getInterface(513).isValid()){
  139. wait(random(200,300));
  140. atInventoryItem(ButterID, "Use");
  141. wait(random(200,300));
  142. while (!isItemSelected()){
  143. atInventoryItem(ButterID, "Use");
  144. wait(random(200, 300));
  145. }
  146. atInventoryItem(PotatoID, "Use");
  147. wait(random(1000,1250));
  148. }
  149. if (RSInterface.getInterface(513).isValid()){
  150. clickMouse(260, 415, 10, 10, false);
  151. if (getMenuActions().contains("Make All")){
  152. atMenu("Make All");
  153. }
  154. }
  155. for (int i = 0; i <= 13; i++) {
  156. if (RSInterface.getInterface(
  157. Constants.INTERFACE_LEVELUP)
  158. .isValid()) {
  159. clickContinue();
  160. }
  161. antiBan();
  162. wait(1250);
  163. }
  164. }catch(Exception e){
  165.  
  166. }
  167. return true;
  168. }
  169.  
  170. public boolean doCorn(){
  171. try{
  172. doBank();
  173. wait(random(500,800));
  174. if (!bank.isOpen()){
  175. doBank();
  176. wait(random(500,800));
  177. }
  178. bank.depositAllExcept(KnifeID);
  179. wait(random(250,300));
  180. bank.withdraw(CornID, 13);
  181. wait(random(1000,1250));
  182. Counter = getInventoryCount(CornID);
  183. while (Counter != 13){
  184. bank.deposit(CornID, 13);
  185. wait(random(250,300));
  186. bank.withdraw(CornID, 13);
  187. wait(random(1000,1250));
  188. Counter = getInventoryCount(CornID);
  189. }
  190. bank.withdraw(BowlID,13);
  191. wait(random(1000,1250));
  192. Counter = getInventoryCount(BowlID);
  193. while (Counter != 13){
  194. Counter = getInventoryCount(CornID);
  195. while (Counter > 13){
  196. bank.depositAllExcept(KnifeID);
  197. wait(random(300,400));
  198. bank.withdraw(CornID, 13);
  199. wait(random(1000,1250));
  200. Counter = getInventoryCount(CornID);
  201. }
  202. bank.deposit(BowlID, 13);
  203. wait(random(300,400));
  204. bank.withdraw(BowlID, 13);
  205. wait(random(1000,1250));
  206. Counter = getInventoryCount(BowlID);
  207. }
  208. bank.close();
  209. wait(random(300,400));
  210. atInventoryItem(BowlID, "Use");
  211. wait(random(200,300));
  212. while (!isItemSelected()){
  213. atInventoryItem(BowlID, "Use");
  214. wait(random(200,300));
  215. }
  216. atInventoryItem(CornID, "Use");
  217. wait(random(1000,1250));
  218. while (!RSInterface.getInterface(513).isValid()){
  219. atInventoryItem(BowlID, "Use");
  220. wait(random(200,300));
  221. while (!isItemSelected()){
  222. atInventoryItem(BowlID, "Use");
  223. wait(random(200,300));
  224. }
  225. atInventoryItem(CornID, "Use");
  226. wait(random(500,600));
  227. }
  228. if (RSInterface.getInterface(513).isValid()){
  229. clickMouse(260, 415, 10, 10, false);
  230. if (getMenuActions().contains("Make All")){
  231. atMenu("Make All");
  232. }
  233. }
  234. for (int i = 0; i <= 13; i++) {
  235. if (RSInterface.getInterface(
  236. Constants.INTERFACE_LEVELUP)
  237. .isValid()) {
  238. clickContinue();
  239. }
  240. antiBan();
  241. wait(1250);
  242. }
  243. }catch(Exception e){
  244.  
  245. }
  246. return true;
  247. }
  248.  
  249. public boolean doTuna(){
  250. try{
  251. doBank();
  252. wait(random(500,600));
  253. if (!bank.isOpen()){
  254. doBank();
  255. wait(random(500,600));
  256. }
  257. bank.depositAllExcept(KnifeID, CornBowlID);
  258. wait(random(300,400));
  259. bank.withdraw(TunaID, 13);
  260. wait(random(1000,1250));
  261. Counter = getInventoryCount(TunaID);
  262. while (Counter != 13){
  263. bank.deposit(TunaID, 13);
  264. wait(random(200,300));
  265. bank.withdraw(TunaID, 13);
  266. wait(random(1000,1250));
  267. }
  268. bank.close();
  269. atInventoryItem(TunaID, "Use");
  270. wait(random(200,300));
  271. while (!isItemSelected()){
  272. atInventoryItem(TunaID, "Use");
  273. wait(random(200,300));
  274. }
  275. atInventoryItem(CornBowlID, "Use");
  276. wait(random(1000,1250));
  277. while (!RSInterface.getInterface(513).isValid()){
  278. atInventoryItem(TunaID, "Use");
  279. wait(random(200,300));
  280. while (!isItemSelected()){
  281. atInventoryItem(TunaID, "Use");
  282. wait(random(200,300));
  283. }
  284. atInventoryItem(CornBowlID, "Use");
  285. wait(random(1000,1250));
  286. }
  287. if (RSInterface.getInterface(513).isValid()){
  288. clickMouse(260, 415, 10, 10, false);
  289. if (getMenuActions().contains("Make All")){
  290. atMenu("Make All");
  291. }
  292. }
  293. for (int i = 0; i <= 13; i++) {
  294. if (RSInterface.getInterface(
  295. Constants.INTERFACE_LEVELUP)
  296. .isValid()) {
  297. clickContinue();
  298. }
  299. antiBan();
  300. wait(1250);
  301. }
  302. }catch(Exception e){
  303.  
  304. }
  305. return true;
  306. }
  307.  
  308. public boolean doFinal(){
  309. try{
  310. doBank();
  311. wait(random(500,600));
  312. if (!bank.isOpen()){
  313. doBank();
  314. wait(random(500,600));
  315. }
  316. bank.depositAllExcept(KnifeID, TunaBowlID);
  317. wait(random(200,300));
  318. bank.withdraw(ButterPotatoID, 13);
  319. wait(random(1000,1250));
  320. Counter = getInventoryCount(ButterPotatoID);
  321. while (Counter != 13){
  322. bank.deposit(ButterPotatoID, 13);
  323. wait(random(200,300));
  324. bank.withdraw(ButterPotatoID, 13);
  325. wait(random(1000,1250));
  326. Counter = getInventoryCount(ButterPotatoID);
  327. }
  328. wait(random(300,400));
  329. bank.close();
  330. wait(random(300,400));
  331. atInventoryItem(ButterPotatoID, "Use");
  332. wait(random(200,300));
  333. while (!isItemSelected()){
  334. atInventoryItem(ButterPotatoID, "Use");
  335. wait(random(200,300));
  336. }
  337. atInventoryItem(TunaBowlID, "Use");
  338. wait(random(1000,1250));
  339. while (!RSInterface.getInterface(513).isValid()){
  340. wait(random(200,300));
  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. }
  350. if (RSInterface.getInterface(513).isValid()){
  351. clickMouse(260, 415, 10, 10, false);
  352. if (getMenuActions().contains("Make All")){
  353. atMenu("Make All");
  354. }
  355. }
  356. for (int i = 0; i <= 13; i++) {
  357. if (RSInterface.getInterface(
  358. Constants.INTERFACE_LEVELUP)
  359. .isValid()) {
  360. clickContinue();
  361. }
  362. antiBan();
  363. wait(1250);
  364. }
  365. wait(random(100,200));
  366. }catch(Exception e){
  367.  
  368. }
  369. return true;
  370. }
  371.  
  372. @Override
  373. public int loop() {
  374. if (doButter()){
  375. if (doCorn()){
  376. if (doTuna()){
  377. if (doFinal()){
  378.  
  379. }
  380. }
  381. }
  382. }
  383. return(random(500,1000));
  384. }
  385.  
  386. @Override
  387. public void onRepaint(Graphics g) {
  388. if (isLoggedIn()){
  389. long millis = System.currentTimeMillis() - startTime;
  390. final long hours = millis / (1000 * 60 * 60);
  391. millis -= hours * 1000 * 60 * 60;
  392. final long minutes = millis / (1000 * 60);
  393. millis -= minutes * 1000 * 60;
  394. final long seconds = millis / 1000;
  395. seconds1 = seconds1 + millis / 1000;
  396. TotalProfit = TunaPotatoMade * 700;
  397. ProfitPerHour = ((TotalProfit / seconds1) * 60) * 60;
  398. g.setColor(Color.GREEN);
  399. g.drawRect(0, 0, 226 , 163);
  400. g.fillRect(0, 0, 226, 163);
  401. g.setColor(Color.white);
  402. g.drawString("Butter with Potato's made : " + PotatoButterMade, 9, 23 );
  403. g.drawString("Sweet corn bowls made : " + CornBowlMade, 9,43);
  404. g.drawString("Tuna bowls made : " + TunaBowlMade, 9, 63);
  405. g.drawString("Tuna potato's made : " + TunaPotatoMade, 9, 83);
  406. g.drawString("Total Profit made : " + TotalProfit + "!", 9, 103);
  407. g.drawString("Profit P/Hour : " + ProfitPerHour + "!", 9, 123);
  408. g.drawString("Duration : " + hours + ":" + minutes + ":" + seconds, 9, 143);
  409. }
  410. }
  411.  
  412. @Override
  413. public void serverMessageRecieved(ServerMessageEvent e) {
  414. String serverString = e.getMessage();
  415. if (serverString.contains("You put the cooked sweetcorn into the bowl.")){
  416. CornBowlMade++;
  417. }
  418. if (serverString.contains("You mix the ingredients to make the topping.")){
  419. TunaBowlMade++;
  420. }
  421. if (serverString.contains("You add the butter to the potato.")){
  422. PotatoButterMade++;
  423. }
  424. if (serverString.contains("You add the topping to the potato.")){
  425. TunaPotatoMade++;
  426. }
  427. }
  428. }
  429.