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.event.listeners.PaintListener;
  9. import org.rsbot.event.listeners.ServerMessageListener;
  10. import org.rsbot.event.events.ServerMessageEvent;
  11.  
  12. @ScriptManifest(authors = "Rapid", category = "Rapid", name = "Cheese Producer ;) v2", version = 1.0, description = "WHAT_YOU_WANT_IT_TO_SAY_IN_DESCRIPTION")
  13.  
  14. public class CheeseProducer extends Script implements ServerMessageListener {
  15.  
  16. //Summoning Regeneration Timers
  17. public long SummoningTimer;
  18. public long CurrentTime;
  19. public long TimeToNextSpecial;
  20. public Boolean SpecialRegained;
  21.  
  22. //SkillsTab
  23. public int FirstTabX = 554;
  24. public int FirstTabY = 211;
  25. public int TabDifferenceX = 62;
  26. public int TabDifferenceY = 23;
  27.  
  28. //Log Variables
  29. public int TotalPizzaMade;
  30.  
  31. //General Variables
  32. public int RandomNumber;
  33. public int RandomX;
  34. public int RandomY;
  35.  
  36. //Summoning/Pizza Swap
  37. public Boolean usingScrolls = true;
  38. public Boolean makingPizza = false;
  39.  
  40. //Pizza Variables
  41. public int CheeseID = 1985;
  42. public int UncookedID = 2287;
  43. public int IncompleteID = 2285;
  44. public int CheeseCount;
  45. public int PizzaCount;
  46. public int PizzaMade;
  47. public int CombinedWithdraw;
  48. public int CheeseInv;
  49. public int PizzaInv;
  50.  
  51. //Make-All ID's
  52. public int PizzaX = 236;
  53. public int PizzaY = 397;
  54. public int MakeX = 192;
  55. public int MakeY = 457;
  56.  
  57. //Withdraw
  58. public Boolean WithdrawPotion = false;
  59.  
  60. //Objects
  61. public RSObject FindBank;
  62.  
  63. //ID's
  64. public int SummoningPotion1 = 12146;
  65. public int SummoningPotion2 = 12144;
  66. public int SummoningPotion3 = 12142;
  67. public int VialID = 229;
  68. public int ScrollID = 12430;
  69. public int PouchID = 12067;
  70. public int BankBoothID = 11402;
  71. public int Animation = 7660;
  72.  
  73. //Mouse Variables
  74. public int DepositSummonX = 457;
  75. public int DepositSummonY = 295;
  76.  
  77. public int SummonIconX = 695;
  78. public int SummonIconY = 135;
  79.  
  80. //Count Variables
  81. public int SpecialCount;
  82. public int SummoningPotionCounter;
  83.  
  84. //Check Variables
  85. public int CheckScroll;
  86. public int CheckPotion;
  87. public int CheckPotionInv;
  88. public Boolean CheckDeposit;
  89. public Boolean PotUp;
  90. public int SummoningPoint = 60;
  91. public int SummoningPotionCount;
  92.  
  93. public void doAntiBanPizza(){
  94. RandomNumber = random(1, 3);
  95. if (RandomNumber == 1){
  96. log("Using anti-ban method 1.");
  97. RandomX = 520 + random(0, 15);
  98. RandomY = 53 + random(0, 15);
  99. moveMouse(RandomX, RandomY);
  100. clickMouse(true);
  101. WaitRandom();
  102. RandomX = RandomX + random(-200, 200);
  103. RandomY = RandomY + random(-200, 200);
  104. moveMouse(RandomX, RandomY);
  105. WaitRandom();
  106. RandomX = 520 + random(0, 15);
  107. RandomY = 53 + random(0, 15);
  108. moveMouse(RandomX, RandomY);
  109. clickMouse(true);
  110. WaitRandom();
  111. }
  112. if (RandomNumber == 3){
  113. log("Using anti-ban method 2.");
  114. RandomX = 553 + random(0, 20);
  115. RandomY = 168 + random(0, 30);
  116. moveMouse(RandomX, RandomY);
  117. clickMouse(true);
  118. WaitRandom();
  119. RandomNumber = random(1, 24);
  120. if (RandomNumber == 1){
  121. RandomX = 554 + random(0, 40);
  122. RandomY = 211 + random(0, 20);
  123. moveMouse(RandomX, RandomY);
  124. }
  125. if (RandomNumber == 2){
  126. RandomX = FirstTabX + TabDifferenceX + random(0, 40);
  127. RandomY = FirstTabY + random(0, 20);
  128. moveMouse(RandomX, RandomY);
  129. }
  130. if (RandomNumber == 3){
  131. RandomX = FirstTabX + (TabDifferenceX * 2) + random(0, 40);
  132. RandomY = FirstTabY + random(0, 20);
  133. moveMouse(RandomX, RandomY);
  134. }
  135. if (RandomNumber == 4){
  136. RandomX = FirstTabX + random(0, 40);
  137. RandomY = FirstTabY + TabDifferenceY + random(0, 20);
  138. moveMouse(RandomX, RandomY);
  139. }
  140. if (RandomNumber == 5){
  141. RandomX = FirstTabX + TabDifferenceX + random(0, 40);
  142. RandomY = FirstTabY + TabDifferenceY + random(0,20);
  143. moveMouse(RandomX, RandomY);
  144. }
  145. if (RandomNumber == 6){
  146. RandomX = FirstTabX + (TabDifferenceX * 2) + random(0, 40);
  147. RandomY = FirstTabY + TabDifferenceY + random(0, 20);
  148. moveMouse(RandomX, RandomY);
  149. }
  150. if (RandomNumber == 7){
  151. RandomX = FirstTabX + random(0,40);
  152. RandomY = FirstTabY + (TabDifferenceY * 2) + random(0, 20);
  153. moveMouse(RandomX, RandomY);
  154. }
  155. if (RandomNumber == 8){
  156. RandomX = FirstTabX + TabDifferenceX + random(0,40);
  157. RandomY = FirstTabY + (TabDifferenceY * 2) + random(0, 20);
  158. moveMouse(RandomX, RandomY);
  159. }
  160. if (RandomNumber == 9){
  161. RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40);
  162. RandomY = FirstTabY + (TabDifferenceY * 2) + random(0, 20);
  163. moveMouse(RandomX, RandomY);
  164. }
  165. if (RandomNumber == 10){
  166. RandomX = FirstTabX + random(0, 40);
  167. RandomY = FirstTabY + (TabDifferenceY * 3) + random(0,20);
  168. moveMouse(RandomX, RandomY);
  169. }
  170. if (RandomNumber == 11){
  171. RandomX = FirstTabX + TabDifferenceX + random(0, 40);
  172. RandomY = FirstTabY + (TabDifferenceY * 3) + random(0,20);
  173. moveMouse(RandomX, RandomY);
  174. }
  175. if (RandomNumber == 12){
  176. RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40);
  177. RandomY = FirstTabY + (TabDifferenceY * 3) + random(0,20);
  178. moveMouse(RandomX, RandomY);
  179. }
  180. if (RandomNumber == 13){
  181. RandomX = FirstTabX + random(0,40);
  182. RandomY = FirstTabY + (TabDifferenceY * 4) + random(0,20);
  183. moveMouse(RandomX, RandomY);
  184. }
  185. if (RandomNumber == 14){
  186. RandomX = FirstTabX + TabDifferenceX + random(0,40);
  187. RandomY = FirstTabY + (TabDifferenceY * 4) + random(0,20);
  188. moveMouse(RandomX, RandomY);
  189. }
  190. if (RandomNumber == 15){
  191. RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40);
  192. RandomY = FirstTabY + (TabDifferenceY * 4) + random(0,20);
  193. moveMouse(RandomX, RandomY);
  194. }
  195. if (RandomNumber == 16){
  196. RandomX = FirstTabX + random(0,40);
  197. RandomY = FirstTabY + (TabDifferenceY * 5) + random(0,20);
  198. moveMouse(RandomX, RandomY);
  199. }
  200. if (RandomNumber == 17){
  201. RandomX = FirstTabX + TabDifferenceX + random(0,40);
  202. RandomY = FirstTabY + (TabDifferenceY * 5) + random(0,20);
  203. moveMouse(RandomX, RandomY);
  204. }
  205. if (RandomNumber == 18){
  206. RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40);
  207. RandomY = FirstTabY + (TabDifferenceY * 5) + random(0,20);
  208. moveMouse(RandomX, RandomY);
  209. }
  210. if (RandomNumber == 19){
  211. RandomX = FirstTabX + random(0, 40);
  212. RandomY = FirstTabY + (TabDifferenceY * 6) + random(0,20);
  213. moveMouse(RandomX, RandomY);
  214. }
  215. if (RandomNumber == 20){
  216. RandomX = FirstTabX + TabDifferenceX + random(0,40);
  217. RandomY = FirstTabY + (TabDifferenceY * 6) + random(0,20);
  218. moveMouse(RandomX, RandomY);
  219. }
  220. if (RandomNumber == 21){
  221. RandomX = FirstTabX + (TabDifferenceX * 2) + random(0,40);
  222. RandomY = FirstTabY + (TabDifferenceY * 6) + random(0,20);
  223. moveMouse(RandomX, RandomY);
  224. }
  225. if (RandomNumber == 21){
  226. RandomX = FirstTabX + random(0, 40);
  227. RandomY = FirstTabY + (TabDifferenceY * 7) + random(0,20);
  228. moveMouse(RandomX, RandomY);
  229. }
  230. if (RandomNumber == 22){
  231. RandomX = FirstTabX + TabDifferenceX + random(0,40);
  232. RandomY = FirstTabY + (TabDifferenceY * 7) + random(0,20);
  233. moveMouse(RandomX, RandomY);
  234. }
  235. if (RandomNumber == 23){
  236. RandomX = FirstTabX + TabDifferenceX + random(0, 40);
  237. RandomY = FirstTabY + (TabDifferenceY * 7) + random(0,20);
  238. moveMouse(RandomX, RandomY);
  239. }
  240. if (RandomNumber == 24){
  241. RandomX = FirstTabX + random(0,40);
  242. RandomY = FirstTabY + (TabDifferenceY * 8) + random(0,20);
  243. moveMouse(RandomX, RandomY);
  244. }
  245. WaitRandom();
  246. WaitRandom();
  247. }
  248. if (RandomNumber == 2){
  249. log("Using anti-ban method 2.");
  250. RandomX = random(0, 500);
  251. RandomY = random(0, 250);
  252. moveMouse(RandomX, RandomY);
  253. wait(random(10000, 30000));
  254. }
  255.  
  256. }
  257.  
  258. public void doAntiBan(){
  259.  
  260. }
  261.  
  262. public void WaitRandom(){
  263. RandomNumber = random(1, 5);
  264. if (RandomNumber == 1){
  265. wait(random(500,1000));
  266. }
  267. if (RandomNumber == 2){
  268. wait(random(750,1250));
  269. }
  270. if (RandomNumber == 3){
  271. wait(random(1000, 1500));
  272. }
  273. if (RandomNumber == 4){
  274. wait(random(1500,2000));
  275. }
  276. if (RandomNumber == 5){
  277. wait(random(2000, 2500));
  278. }
  279. }
  280.  
  281. public void WithdrawPot(){
  282. CheckPotionInv = getInventoryCount(SummoningPotion3);
  283. CheckPotionInv = CheckPotionInv + getInventoryCount(SummoningPotion2);
  284. CheckPotionInv = CheckPotionInv + getInventoryCount(SummoningPotion1);
  285. if (CheckPotionInv == 0);
  286. RSObject FindBank = getNearestObjectByID(BankBoothID);
  287. if (FindBank != null){
  288. while (!bank.open()){
  289. if (!bank.open()){
  290. atObject(FindBank, "Use-quickly");
  291. wait(random(4000, 5000));
  292. bank.getCount(SummoningPotion3);
  293. if (SummoningPotionCount == 0){
  294. log("Out of potions");
  295. stopScript();
  296. }
  297. }
  298. }
  299. }
  300. bank.withdraw(SummoningPotion3, 1);
  301. }
  302.  
  303. public void DrinkPot(){
  304. bank.close();
  305. SummoningPotionCount = getInventoryCount(SummoningPotion3);
  306. while (SummoningPotionCount == 1){
  307. SummoningPotionCount = getInventoryCount(SummoningPotion3);
  308. atInventoryItem(SummoningPotion3, "Drink");
  309. SummoningPoint = SummoningPoint + 15;
  310. wait(random(2000,3000));
  311. atInventoryItem(SummoningPotion2, "Drink");
  312. SummoningPoint = SummoningPoint + 15;
  313. wait(random(2000,3000));
  314. atInventoryItem(SummoningPotion1, "Drink");
  315. SummoningPoint = SummoningPoint + 15;
  316. wait(random(2000,3000));
  317. }
  318. }
  319.  
  320. public void MakePizza(){
  321. atInventoryItem(IncompleteID, "Use");
  322. wait(random(1000,2000));
  323. atInventoryItem(CheeseID, "Use");
  324. wait(random(1000,2000));
  325. PizzaX = PizzaX + random(0, 30);
  326. PizzaY = PizzaY + random(0, 10);
  327. moveMouse(PizzaX, PizzaY);
  328. PizzaX = 236;
  329. PizzaY = 397;
  330. clickMouse(false);
  331. MakeX = 194 + random(0, 90);
  332. MakeY = 457 + random(0, 5);
  333. moveMouse(MakeX, MakeY);
  334. clickMouse(true);
  335. MakeX = 194;
  336. MakeY = 457;
  337. }
  338.  
  339. public int loop(){
  340.  
  341. TimeToNextSpecial = System.currentTimeMillis() - SummoningTimer;
  342. if (TimeToNextSpecial == 300000){
  343. SpecialRegained = true;
  344. SummoningPoint = SummoningPoint + 10;
  345.  
  346. }
  347. if (SpecialRegained == true){
  348. SummoningTimer = System.currentTimeMillis();
  349. SpecialRegained = false;
  350. }
  351.  
  352. try{
  353. if (usingScrolls == true){
  354. CheckScroll = getInventoryCount(ScrollID);
  355. if (CheckScroll == 0){
  356. log("No scrolls left. Going to make pizza's");
  357. usingScrolls = false;
  358. makingPizza = true;
  359. }
  360. }
  361. if (usingScrolls == true){
  362. log("Using scrolls option.");
  363. while (SpecialCount <= 7){
  364. log("Doing Special.");
  365. SummonIconX = SummonIconX + random(0, 50);
  366. SummonIconY = SummonIconY + random(0, 10);
  367. moveMouse(SummonIconX, SummonIconY);
  368. clickMouse(true);
  369. SummonIconX = 695;
  370. SummonIconY = 135;
  371. SummoningPoint = SummoningPoint - 6;
  372. SpecialCount = SpecialCount + random(1, 2);
  373. WaitRandom();
  374. if (SummoningPoint <= 6){
  375. WithdrawPot();
  376. WaitRandom();
  377. DrinkPot();
  378. }
  379. }
  380. SpecialCount = 0;
  381. log("Banking.");
  382. RSObject FindBank = getNearestObjectByID(BankBoothID);
  383. if (FindBank == null){
  384. log("Couldn't find bank...");
  385. stopScript();
  386. }
  387. while (!bank.isOpen()){
  388. atObject(FindBank, "Use-quickly");
  389. WaitRandom();
  390. }
  391. if (bank.isOpen());
  392. bank.depositAllFamiliar();
  393. }
  394. if (makingPizza == true){
  395. PizzaCount = getInventoryCount(IncompleteID);
  396. CheeseCount = getInventoryCount(CheeseID);
  397. CombinedWithdraw = PizzaCount + CheeseCount;
  398. if (CombinedWithdraw != 28){
  399. RSObject FindBank = getNearestObjectByID(BankBoothID);
  400. while (!bank.isOpen()){
  401. atObject(FindBank, "Use-quickly");
  402. WaitRandom();
  403. }
  404. PizzaCount = bank.getCount(IncompleteID);
  405. CheeseCount = bank.getCount(CheeseID);
  406. if (PizzaCount == 0){
  407. log("No Pizza's");
  408. stopScript();
  409. }
  410. if (CheeseCount == 0){
  411. log("No Cheese");
  412. stopScript();
  413. }
  414. bank.depositAll();
  415. bank.withdraw(IncompleteID, 14);
  416. wait(random(100,200));
  417. bank.withdraw(CheeseID, 14);
  418. WaitRandom();
  419. CheeseInv = getInventoryCount(CheeseID);
  420. PizzaInv = getInventoryCount(IncompleteID);
  421. CombinedWithdraw = PizzaInv + CheeseInv;
  422. while (CombinedWithdraw != 28){
  423. CombinedWithdraw = 0;
  424. bank.depositAll();
  425. bank.withdraw(IncompleteID, 14);
  426. wait(random(100,200));
  427. bank.withdraw(CheeseID, 14);
  428. WaitRandom();
  429. CheeseInv = getInventoryCount(CheeseID);
  430. PizzaInv = getInventoryCount(IncompleteID);
  431. CombinedWithdraw = PizzaInv + CheeseInv;
  432. }
  433. bank.close();
  434. WaitRandom();
  435. while(bank.isOpen()){
  436. bank.close();
  437. WaitRandom();
  438. }
  439. }
  440. MakePizza();
  441. WaitRandom();
  442. PizzaMade = getInventoryCount(UncookedID);
  443. WaitRandom();
  444. PizzaMade = getInventoryCount(UncookedID);
  445.  
  446. while (PizzaMade == 0){
  447. MakePizza();
  448. WaitRandom();
  449. PizzaMade = getInventoryCount(UncookedID);
  450. }
  451.  
  452. doAntiBanPizza();
  453.  
  454. while (PizzaMade < 14){
  455. PizzaMade = getInventoryCount(UncookedID);
  456. wait(random(100,200));
  457. }
  458. log("Pizza's done.");
  459.  
  460. atObject(FindBank, "Use-quickly");
  461. WaitRandom();
  462. while (!bank.isOpen()){
  463. atObject(FindBank, "Use-quickly");
  464. WaitRandom();
  465. }
  466. bank.depositAll();
  467. bank.withdraw(IncompleteID, 14);
  468. wait(random(100,200));
  469. bank.withdraw(CheeseID, 14);
  470. WaitRandom();
  471. CheeseInv = getInventoryCount(CheeseID);
  472. PizzaInv = getInventoryCount(IncompleteID);
  473. CombinedWithdraw = PizzaInv + CheeseInv;
  474. while (CombinedWithdraw != 28){
  475. bank.withdraw(IncompleteID, 14);
  476. wait(random(100,200));
  477. bank.withdraw(CheeseID, 14);
  478. WaitRandom();
  479. CheeseInv = getInventoryCount(CheeseID);
  480. PizzaInv = getInventoryCount(IncompleteID);
  481. CombinedWithdraw = PizzaInv + CheeseInv;
  482. }
  483. bank.close();
  484. WaitRandom();
  485. while(bank.isOpen()){
  486. bank.close();
  487. wait(random(1000,2000));
  488. }
  489. }
  490. }
  491. catch (Exception e){
  492. log("Script failed. Trying to start again.");
  493. }
  494. return random(500,1000);
  495. }
  496.  
  497. public void onFinish(){
  498. log("Thanks for using I2HYCheeseProducer");
  499. log("Uncooked pizza's made: " + TotalPizzaMade + ".");
  500. }
  501.  
  502. @Override
  503. public void serverMessageRecieved(ServerMessageEvent e) {
  504. String word = e.getMessage();
  505. if (word.contains("You add the cheese to the pizza.")){
  506. TotalPizzaMade = TotalPizzaMade + 1;
  507. }
  508. }
  509. }