Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Dimension;
- import java.awt.FlowLayout;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JDialog;
- import xobot.bot.Context;
- import xobot.client.ItemDef;
- import xobot.client.callback.listeners.PaintListener;
- import xobot.script.ActiveScript;
- import xobot.script.Manifest;
- import xobot.script.methods.Calculations;
- import xobot.script.methods.GameObjects;
- import xobot.script.methods.NPCs;
- import xobot.script.methods.Packets;
- import xobot.script.methods.Players;
- import xobot.script.methods.Widgets;
- import xobot.script.methods.tabs.Inventory;
- import xobot.script.methods.tabs.Prayer;
- import xobot.script.methods.tabs.Prayer.Prayers;
- import xobot.script.methods.tabs.Skills;
- import xobot.script.util.Time;
- import xobot.script.util.Timer;
- import xobot.script.wrappers.Tile;
- import xobot.script.wrappers.interactive.GameObject;
- import xobot.script.wrappers.interactive.Item;
- import xobot.script.wrappers.interactive.NPC;
- @Manifest(authors = { "" }, name = "nDung")
- public class nDung extends ActiveScript implements PaintListener{
- final Tile[] dung = {new Tile(3233, 9315), new Tile(2618, 9797)};
- //floor 1
- final Tile wall = new Tile(3232,9295);
- final Tile[] wallP = new Tile[]{wall, new Tile(3217, 9315), new Tile(3214, 9331)};
- //floor 2
- final Tile sculptureT = new Tile(2609, 9823);
- final Tile crateT = new Tile(2565, 9833);
- final Tile crateP = new Tile(2585, 9838);
- final int[] bosses = { 10044, 10110, 10116, 9989, 9916, 10064 };
- final String[] eq = { "platebody", "platelegs", "full helm", "2h" };
- int startxp = 0;
- Timer t;
- public boolean onStart() {
- JDialog frame = new JDialog();
- frame.setPreferredSize(new Dimension(250,90));
- frame.setLocationRelativeTo(null);
- frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
- FlowLayout layout = new FlowLayout();
- layout.setHgap(5);
- layout.setVgap(5);
- frame.setLayout(layout);
- JComboBox<String> combo = new JComboBox<String>();
- combo.setPreferredSize(new Dimension(150,30));
- combo.setFocusable(false);
- combo.addItem("Floor 1");
- combo.addItem("Floor 2");
- JButton button = new JButton("Start");
- button.setFocusable(false);
- button.setPreferredSize(new Dimension(60,32));
- button.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent arg0) {
- switch((String)combo.getSelectedItem()) {
- case "Floor 1":
- floor = 1;
- break;
- case "Floor 2":
- floor = 2;
- break;
- }
- frame.dispose();
- }
- });
- frame.add(combo);
- frame.add(button);
- frame.setTitle("NeoDungeoneering");
- frame.pack();
- frame.setVisible(true);
- while(frame.isVisible()) {
- Time.sleep(500);
- }
- t = new Timer();
- startxp = Skills.DUNGEONEERING.getCurrentExp();
- return floor != -1;
- }
- int floor = -1;
- @Override
- public int loop() {
- try {
- if (inDung()) {
- switch(floor) {
- case 1:
- return floor1();
- case 2:
- return floor2();
- }
- }else {
- NPC master = NPCs.getNearest(9713);
- if(master != null) {
- if(Widgets.getBackDialogId() == 4887) {
- Packets.sendAction("Continue", "", 679, 0, 0, 4892, 0);
- Time.sleep(() -> Widgets.getBackDialogId() == 2469, 4500);
- Packets.sendAction("Ok", null, 315, 0, 0, 2471, 0);
- Time.sleep(() -> Widgets.getBackDialogId() == 2459, 4500);
- Packets.sendAction("Ok", null, 315, 0, 0, 2461, 0);
- Time.sleep(() -> Widgets.getBackDialogId() == 2469, 4500);
- Packets.sendAction("Ok", null, 315, 0, 0, 2470 + floor, 0);
- Time.sleep(() -> inDung(), 4500);
- return 450;
- }
- master.interact("talk-to");
- }
- }
- }catch(Exception e) {
- }
- return 1500;
- }
- public boolean inDung() {
- return dung[floor - 1].getDistance() < 100 || NPCs.getNearest(bosses) != null;
- }
- public void equip() {
- for (Item i : Inventory.getItems()) {
- ItemDef id = Context.client.forItemId(i.getID());
- if(id != null) {
- String name = id.getName();
- if (name != null) {
- for (String e : this.eq) {
- if (name.toLowerCase().contains(e)) {
- i.interact("wear");
- Time.sleep(350);
- }
- }
- }
- }
- }
- }
- public int floor1() {
- if(dung[0].isReachable()) {
- if(Inventory.Contains(18165)) {
- GameObject door = GameObjects.getNearest(6553);
- if(door != null) {
- door.interact("open");
- Time.sleep(() -> !dung[0].isReachable(), 4500);
- }
- }else {
- equip();
- GameObject sarc = GameObjects.getNearest(6516);
- if(sarc != null) {
- sarc.interact("search");
- Time.sleep(() -> Inventory.Contains(18165), 4500);
- }
- }
- }else {
- NPC boss = NPCs.getNearest(bosses);
- if(boss != null) {
- if (Prayer.getRemainingPoints() > 0 && Skills.PRAYER.getCurrentLevel() > 60) {
- Prayers.PROTECT_FROM_MAGIC.Activate();
- Prayers.CHIVALRY.Activate();
- }
- if(Skills.CONSTITUTION.getCurrentLevel() < 60) {
- Item food = Inventory.getItem(18165);
- if(food != null) {
- food.interact("eat");
- return 450;
- }
- }
- xobot.script.wrappers.interactive.Character c = Players.getMyPlayer().getInteractingCharacter();
- if (c != null) {
- if (c.equals(boss)) {
- return 150;
- }
- }
- boss.interact("attack");
- }else if(wall.getDistance() < 100){
- if(Players.getMyPlayer().getLocation().equals(wall)) {
- GameObject wallO = GameObjects.getNearest(2156);
- if(wallO != null) {
- wallO.interact("enter");
- Time.sleep(() -> wall.getDistance() > 20, 4500);
- }
- }else {
- Tile next = getTile();
- if(next != null) {
- next.walk();
- }
- return 4500;
- }
- }
- }
- return 1500;
- }
- private Tile getTile() {
- for(Tile t : wallP) {
- if(Calculations.realDistanceTo(t, false) < 70) {
- return t;
- }
- }
- return null;
- }
- public int floor2() {
- NPC boss = NPCs.getNearest(bosses);
- if (boss != null) {
- if (Prayer.getRemainingPoints() > 0 && Skills.PRAYER.getCurrentLevel() > 60) {
- Prayers.PROTECT_FROM_MAGIC.Activate();
- Prayers.CHIVALRY.Activate();
- }
- xobot.script.wrappers.interactive.Character c = Players.getMyPlayer().getInteractingCharacter();
- if (c != null) {
- if (c.equals(boss)) {
- return 150;
- }
- }
- boss.interact("attack");
- return 1500;
- }
- if (!Inventory.Contains(18165) && dung[1].getDistance() < 10) {
- equip();
- GameObject chest = GameObjects.getNearest(5270);
- if (chest != null) {
- chest.interact("open");
- Time.sleep(() -> Inventory.Contains(18165), 4500);
- }
- }
- if (Inventory.Contains(1480)) {
- if (Inventory.Contains(6821)) {
- GameObject shrine = GameObjects.getNearest(3634);
- if (shrine != null) {
- shrine.interact("touch");
- return 4500;
- }
- } else {
- GameObject crate = GameObjects.getNearest(o -> o.getId() == 357 && o.getLocation().equals(crateT));
- if (crate != null && crate.getDistance() < 30) {
- crate.interact("search");
- Time.sleep(() -> Inventory.Contains(6821), 4500);
- } else {
- if (crateP.getDistance() > 30) {
- sculptureT.walk();
- return 150;
- }
- crateP.walk();
- return 3500;
- }
- }
- } else {
- GameObject sculpture = GameObjects.getNearest(5808);
- if (sculpture != null && sculpture.getDistance() < 20) {
- sculpture.interact("look");
- Time.sleep(() -> Inventory.Contains(1480), 4500);
- } else {
- sculptureT.walk();
- if (sculpture != null) {
- Time.sleep(() -> sculpture.getDistance() < 22, 4500);
- return 150;
- }
- return 3500;
- }
- }
- return 1500;
- }
- private final Color color1 = new Color(0, 0, 0, 43);
- private final Color color2 = new Color(204, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 24);
- private final Font font2 = new Font("Arial", 0, 16);
- @Override
- public void repaint(Graphics g1) {
- int xp = Skills.DUNGEONEERING.getCurrentExp() - startxp;
- int ph = (int) ((xp) * 3600000D / (t.getElapsed()));
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(1, 183, 309, 155);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(1, 183, 309, 155);
- g.setFont(font1);
- g.drawString("NeoDungeoneering", 77, 214);
- g.setFont(font2);
- g.drawString("Neo ", 268, 333);
- g.drawString("Time: " + t.toElapsedString(), 10, 245);
- g.drawString("XP: " + xp + "(" + ph + ")", 10, 265);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement