Advertisement
SimmysProjects

SimmysRugMaker

Oct 20th, 2019
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. import xobot.client.events.MessageEvent;
  2. import java.text.NumberFormat;
  3. import java.util.Locale;
  4. import java.awt.Color;
  5. import java.awt.Graphics;
  6. import xobot.script.wrappers.interactive.GameObject;
  7. import xobot.script.wrappers.interactive.Item;
  8. import xobot.script.wrappers.interactive.NPC;
  9. import xobot.script.methods.NPCs;
  10. import xobot.script.methods.Bank;
  11. import xobot.script.methods.GameObjects;
  12. import xobot.script.methods.tabs.Inventory;
  13. import xobot.script.methods.tabs.Skills;
  14. import xobot.script.util.Time;
  15. import xobot.script.methods.Players;
  16. import xobot.script.methods.Shop;
  17. import xobot.script.methods.Packets;
  18. import xobot.script.methods.Widgets;
  19. import xobot.script.methods.input.KeyBoard;
  20. import xobot.script.methods.Walking;
  21. import xobot.script.util.Timer;
  22. import xobot.script.Manifest;
  23. import xobot.client.callback.listeners.MessageListener;
  24. import xobot.client.callback.listeners.PaintListener;
  25. import xobot.script.ActiveScript;
  26. import xobot.script.wrappers.Tile;
  27.  
  28. @Manifest(authors = { "Simmy" }, name = "Universal Rug Maker", description = "Will Make Rugs Until 70 Construction (Requires Just Cash)", version = 1.01)
  29. public class SimmysRugMaker extends ActiveScript implements PaintListener, MessageListener{
  30.  
  31. private int ConExp = 0;
  32. private int ConLevel = 0;
  33. private Timer Timer;
  34. public static int Rugs = 0;
  35.  
  36. String status = "We Are Currently Starting The Script Up; Please Kick Back And Relax!";
  37.  
  38. public boolean onStart() {
  39. this.Timer = new Timer();
  40. this.ConExp = Skills.CONSTRUCTION.getCurrentExp();
  41. this.ConLevel = Skills.CONSTRUCTION.getCurrentLevel();
  42. return true;
  43. }
  44.  
  45. @Override
  46. public void MessageRecieved(MessageEvent message) {
  47. if (message.getMessage().contains("Congratulations"));
  48. }
  49.  
  50.  
  51. @Override
  52. public void repaint(Graphics g) {
  53. final int ConXp = Skills.CONSTRUCTION.getCurrentExp() - this.ConExp;
  54. final int CLevels = Skills.CONSTRUCTION.getCurrentLevel() - this.ConLevel;
  55. final int RugsHr = (int)(Rugs * 3600000.0 / this.Timer.getElapsed());
  56. final int ConXPs = (int)(ConXp * 3600000.0 / this.Timer.getElapsed());
  57. g.setColor(Color.YELLOW);
  58. g.drawString("Current Status: " + status, 15, 230);
  59. g.drawString("Time Running: " + this.Timer.toElapsedString(), 15, 245);
  60. g.drawString("Rugs Made: " + Rugs, 15, 260);
  61. g.drawString("Rugs Made(p/hr): " + NumberFormat.getNumberInstance(Locale.US).format(RugsHr), 15, 275);
  62. g.drawString("Construction Exp Gained: " + NumberFormat.getNumberInstance(Locale.US).format(ConXp), 15, 290);
  63. g.drawString("Construction Exp(p/hr): " + NumberFormat.getNumberInstance(Locale.US).format(ConXPs), 15, 305);
  64. g.drawString("Construction Levels Gained: " + CLevels, 15, 320);
  65. }
  66.  
  67. @Override
  68. public int loop() {
  69. //Add Variables Here;
  70. NPC Sawmill = NPCs.getNearest(4250);
  71. Item BCloth = Inventory.getItem(8790);
  72. GameObject Portal = GameObjects.getNearest(15477);
  73. GameObject CPortal = GameObjects.getNearest(13405);
  74. GameObject ERug = GameObjects.getNearest(15273);
  75. GameObject MRug = GameObjects.getNearest(13592);
  76.  
  77. if (Sawmill != null & BCloth == null & Portal != null & CPortal == null & Widgets.getOpenInterface() == -1) {
  78. status = "Attempting To Interact With Sawmill Operator!";
  79. Sawmill.interact("Trade");
  80. Time.sleep(() -> Widgets.getBackDialogId() == 3824, 2500);
  81. }
  82. else if (Sawmill != null & BCloth == null & Portal != null & CPortal == null & Widgets.getOpenInterface() == 3824) {
  83. status = "Buying Bolts Of Cloth From Sawmill Operator!";
  84. Shop.buy(8790, 24);
  85. Time.sleep(() -> BCloth != null, 1000);
  86. } else {
  87. if (Sawmill != null & BCloth != null & Portal != null & CPortal == null) {
  88. status = "Attempting To Interact With The Construction Portal! (Entering Build Mode!)";
  89. Portal.interact("Build mode");
  90. Time.sleep(() -> ERug != null | MRug != null, 2500);
  91. } else {
  92. if (Sawmill == null & BCloth == null & ERug != null & MRug == null & CPortal != null) {
  93. status = "Attempting To Interact With The Construction Portal! (Going To Sawmill!)";
  94. CPortal.interact("Enter");
  95. Time.sleep(() -> Sawmill != null, 2500);
  96. } else {
  97. if (Sawmill == null & BCloth != null & CPortal != null & ERug != null & MRug == null & Widgets.getOpenInterface() == -1) {
  98. status = "Attempting To Build An Ordinary Rug! (Opening Build Dialog)";
  99. ERug.interact("Build");
  100. Time.sleep(() -> Widgets.getOpenInterface() == 39550, 500);
  101. }
  102. else if (Sawmill == null & BCloth != null & CPortal != null & ERug != null & MRug == null & Widgets.getOpenInterface() == 39550) {
  103. status = "Attempting To Build An Ordinary Rug! (Confirming Build Dialog)";
  104. Packets.sendAction(632, 8317, 0, 39601);
  105. Time.sleep(() -> MRug != null, 750);
  106. } else {
  107. if (Sawmill == null & CPortal != null & ERug == null & MRug != null & Widgets.getBackDialogId() == -1) {
  108. status = "Attempting To Remove An Ordinary Rug! (Opening Remove Dialog)";
  109. MRug.interact("Remove");
  110. Time.sleep(() -> Widgets.getBackDialogId() == 2459, 1000);
  111. }
  112. else if (Sawmill == null & CPortal != null & ERug == null & MRug != null & Widgets.getBackDialogId() == 2459) {
  113. status = "Attempting To Remove An Ordinary Rug! (Confirming Remove Dialog)";
  114. Packets.sendAction(315, 11, -1, 2461);
  115. Time.sleep(() -> ERug != null, 1000);
  116. Rugs += 1;
  117. }
  118. }
  119. }
  120. }
  121. }
  122. return 1;
  123. }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement