Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.70 KB | None | 0 0
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Dimension;
  4. import java.awt.FlowLayout;
  5. import java.awt.Font;
  6. import java.awt.Graphics;
  7. import java.awt.Graphics2D;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10.  
  11. import javax.swing.JButton;
  12. import javax.swing.JComboBox;
  13. import javax.swing.JDialog;
  14.  
  15. import xobot.bot.Context;
  16. import xobot.client.ItemDef;
  17. import xobot.client.callback.listeners.PaintListener;
  18. import xobot.script.ActiveScript;
  19. import xobot.script.Manifest;
  20. import xobot.script.methods.Calculations;
  21. import xobot.script.methods.GameObjects;
  22. import xobot.script.methods.NPCs;
  23. import xobot.script.methods.Packets;
  24. import xobot.script.methods.Players;
  25. import xobot.script.methods.Widgets;
  26. import xobot.script.methods.tabs.Inventory;
  27. import xobot.script.methods.tabs.Prayer;
  28. import xobot.script.methods.tabs.Prayer.Prayers;
  29. import xobot.script.methods.tabs.Skills;
  30. import xobot.script.util.Time;
  31. import xobot.script.util.Timer;
  32. import xobot.script.wrappers.Tile;
  33. import xobot.script.wrappers.interactive.GameObject;
  34. import xobot.script.wrappers.interactive.Item;
  35. import xobot.script.wrappers.interactive.NPC;
  36.  
  37. @Manifest(authors = { "" }, name = "nDung")
  38. public class nDung extends ActiveScript implements PaintListener{
  39.  
  40. final Tile[] dung = {new Tile(3233, 9315), new Tile(2618, 9797)};
  41. //floor 1
  42. final Tile wall = new Tile(3232,9295);
  43. final Tile[] wallP = new Tile[]{wall, new Tile(3217, 9315), new Tile(3214, 9331)};
  44. //floor 2
  45. final Tile sculptureT = new Tile(2609, 9823);
  46. final Tile crateT = new Tile(2565, 9833);
  47. final Tile crateP = new Tile(2585, 9838);
  48. final int[] bosses = { 10044, 10110, 10116, 9989, 9916, 10064 };
  49.  
  50. final String[] eq = { "platebody", "platelegs", "full helm", "2h" };
  51.  
  52. int startxp = 0;
  53. Timer t;
  54. public boolean onStart() {
  55. JDialog frame = new JDialog();
  56. frame.setPreferredSize(new Dimension(250,90));
  57. frame.setLocationRelativeTo(null);
  58. frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  59. FlowLayout layout = new FlowLayout();
  60. layout.setHgap(5);
  61. layout.setVgap(5);
  62. frame.setLayout(layout);
  63.  
  64. JComboBox<String> combo = new JComboBox<String>();
  65. combo.setPreferredSize(new Dimension(150,30));
  66. combo.setFocusable(false);
  67. combo.addItem("Floor 1");
  68. combo.addItem("Floor 2");
  69.  
  70. JButton button = new JButton("Start");
  71. button.setFocusable(false);
  72. button.setPreferredSize(new Dimension(60,32));
  73. button.addActionListener(new ActionListener() {
  74.  
  75. @Override
  76. public void actionPerformed(ActionEvent arg0) {
  77. switch((String)combo.getSelectedItem()) {
  78. case "Floor 1":
  79. floor = 1;
  80. break;
  81. case "Floor 2":
  82. floor = 2;
  83. break;
  84. }
  85. frame.dispose();
  86. }
  87.  
  88. });
  89.  
  90. frame.add(combo);
  91. frame.add(button);
  92. frame.setTitle("NeoDungeoneering");
  93.  
  94. frame.pack();
  95. frame.setVisible(true);
  96. while(frame.isVisible()) {
  97. Time.sleep(500);
  98. }
  99. t = new Timer();
  100. startxp = Skills.DUNGEONEERING.getCurrentExp();
  101. return floor != -1;
  102. }
  103.  
  104. int floor = -1;
  105.  
  106. @Override
  107. public int loop() {
  108. try {
  109. if (inDung()) {
  110. switch(floor) {
  111. case 1:
  112. return floor1();
  113. case 2:
  114. return floor2();
  115. }
  116. }else {
  117. NPC master = NPCs.getNearest(9713);
  118. if(master != null) {
  119. if(Widgets.getBackDialogId() == 4887) {
  120. Packets.sendAction("Continue", "", 679, 0, 0, 4892, 0);
  121. Time.sleep(() -> Widgets.getBackDialogId() == 2469, 4500);
  122. Packets.sendAction("Ok", null, 315, 0, 0, 2471, 0);
  123. Time.sleep(() -> Widgets.getBackDialogId() == 2459, 4500);
  124. Packets.sendAction("Ok", null, 315, 0, 0, 2461, 0);
  125. Time.sleep(() -> Widgets.getBackDialogId() == 2469, 4500);
  126. Packets.sendAction("Ok", null, 315, 0, 0, 2470 + floor, 0);
  127. Time.sleep(() -> inDung(), 4500);
  128. return 450;
  129. }
  130. master.interact("talk-to");
  131. }
  132. }
  133. }catch(Exception e) {
  134.  
  135. }
  136. return 1500;
  137. }
  138.  
  139. public boolean inDung() {
  140. return dung[floor - 1].getDistance() < 100 || NPCs.getNearest(bosses) != null;
  141. }
  142.  
  143. public void equip() {
  144. for (Item i : Inventory.getItems()) {
  145. ItemDef id = Context.client.forItemId(i.getID());
  146. if(id != null) {
  147. String name = id.getName();
  148. if (name != null) {
  149. for (String e : this.eq) {
  150. if (name.toLowerCase().contains(e)) {
  151. i.interact("wear");
  152. Time.sleep(350);
  153. }
  154. }
  155.  
  156. }
  157. }
  158. }
  159. }
  160.  
  161. public int floor1() {
  162. if(dung[0].isReachable()) {
  163. if(Inventory.Contains(18165)) {
  164. GameObject door = GameObjects.getNearest(6553);
  165. if(door != null) {
  166. door.interact("open");
  167. Time.sleep(() -> !dung[0].isReachable(), 4500);
  168. }
  169. }else {
  170. equip();
  171. GameObject sarc = GameObjects.getNearest(6516);
  172. if(sarc != null) {
  173. sarc.interact("search");
  174. Time.sleep(() -> Inventory.Contains(18165), 4500);
  175. }
  176. }
  177. }else {
  178. NPC boss = NPCs.getNearest(bosses);
  179. if(boss != null) {
  180. if (Prayer.getRemainingPoints() > 0 && Skills.PRAYER.getCurrentLevel() > 60) {
  181. Prayers.PROTECT_FROM_MAGIC.Activate();
  182. Prayers.CHIVALRY.Activate();
  183. }
  184. if(Skills.CONSTITUTION.getCurrentLevel() < 60) {
  185. Item food = Inventory.getItem(18165);
  186. if(food != null) {
  187. food.interact("eat");
  188. return 450;
  189. }
  190. }
  191. xobot.script.wrappers.interactive.Character c = Players.getMyPlayer().getInteractingCharacter();
  192. if (c != null) {
  193. if (c.equals(boss)) {
  194. return 150;
  195. }
  196. }
  197. boss.interact("attack");
  198. }else if(wall.getDistance() < 100){
  199. if(Players.getMyPlayer().getLocation().equals(wall)) {
  200. GameObject wallO = GameObjects.getNearest(2156);
  201. if(wallO != null) {
  202. wallO.interact("enter");
  203. Time.sleep(() -> wall.getDistance() > 20, 4500);
  204. }
  205. }else {
  206. Tile next = getTile();
  207. if(next != null) {
  208. next.walk();
  209. }
  210. return 4500;
  211. }
  212. }
  213. }
  214. return 1500;
  215. }
  216.  
  217. private Tile getTile() {
  218. for(Tile t : wallP) {
  219. if(Calculations.realDistanceTo(t, false) < 70) {
  220. return t;
  221. }
  222. }
  223. return null;
  224. }
  225.  
  226. public int floor2() {
  227. NPC boss = NPCs.getNearest(bosses);
  228. if (boss != null) {
  229. if (Prayer.getRemainingPoints() > 0 && Skills.PRAYER.getCurrentLevel() > 60) {
  230. Prayers.PROTECT_FROM_MAGIC.Activate();
  231. Prayers.CHIVALRY.Activate();
  232. }
  233. xobot.script.wrappers.interactive.Character c = Players.getMyPlayer().getInteractingCharacter();
  234. if (c != null) {
  235. if (c.equals(boss)) {
  236. return 150;
  237. }
  238. }
  239. boss.interact("attack");
  240. return 1500;
  241. }
  242. if (!Inventory.Contains(18165) && dung[1].getDistance() < 10) {
  243. equip();
  244. GameObject chest = GameObjects.getNearest(5270);
  245. if (chest != null) {
  246. chest.interact("open");
  247. Time.sleep(() -> Inventory.Contains(18165), 4500);
  248. }
  249. }
  250. if (Inventory.Contains(1480)) {
  251. if (Inventory.Contains(6821)) {
  252. GameObject shrine = GameObjects.getNearest(3634);
  253. if (shrine != null) {
  254. shrine.interact("touch");
  255. return 4500;
  256. }
  257. } else {
  258. GameObject crate = GameObjects.getNearest(o -> o.getId() == 357 && o.getLocation().equals(crateT));
  259. if (crate != null && crate.getDistance() < 30) {
  260. crate.interact("search");
  261. Time.sleep(() -> Inventory.Contains(6821), 4500);
  262. } else {
  263. if (crateP.getDistance() > 30) {
  264. sculptureT.walk();
  265. return 150;
  266. }
  267. crateP.walk();
  268. return 3500;
  269. }
  270. }
  271.  
  272. } else {
  273. GameObject sculpture = GameObjects.getNearest(5808);
  274. if (sculpture != null && sculpture.getDistance() < 20) {
  275. sculpture.interact("look");
  276. Time.sleep(() -> Inventory.Contains(1480), 4500);
  277. } else {
  278. sculptureT.walk();
  279. if (sculpture != null) {
  280. Time.sleep(() -> sculpture.getDistance() < 22, 4500);
  281. return 150;
  282. }
  283. return 3500;
  284. }
  285. }
  286. return 1500;
  287. }
  288.  
  289. private final Color color1 = new Color(0, 0, 0, 43);
  290. private final Color color2 = new Color(204, 0, 0);
  291.  
  292. private final BasicStroke stroke1 = new BasicStroke(1);
  293.  
  294. private final Font font1 = new Font("Arial", 0, 24);
  295. private final Font font2 = new Font("Arial", 0, 16);
  296.  
  297. @Override
  298. public void repaint(Graphics g1) {
  299. int xp = Skills.DUNGEONEERING.getCurrentExp() - startxp;
  300. int ph = (int) ((xp) * 3600000D / (t.getElapsed()));
  301.  
  302. Graphics2D g = (Graphics2D)g1;
  303. g.setColor(color1);
  304. g.fillRect(1, 183, 309, 155);
  305. g.setColor(color2);
  306. g.setStroke(stroke1);
  307. g.drawRect(1, 183, 309, 155);
  308. g.setFont(font1);
  309. g.drawString("NeoDungeoneering", 77, 214);
  310. g.setFont(font2);
  311. g.drawString("Neo ", 268, 333);
  312. g.drawString("Time: " + t.toElapsedString(), 10, 245);
  313. g.drawString("XP: " + xp + "(" + ph + ")", 10, 265);
  314. }
  315.  
  316. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement