Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.*;
- import xobot.script.methods.tabs.Equipment;
- 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;
- import javax.swing.*;
- import java.awt.*;
- @Manifest(authors = {""}, name = "nDung Upgradable")
- public class nDung extends ActiveScript implements PaintListener {
- private final Tile[] dung = {new Tile(3233, 9315), new Tile(2618, 9797)};
- //floor 1
- private final Tile wall = new Tile(3232, 9295);
- private final Tile[] wallP = new Tile[]{wall, new Tile(3217, 9315), new Tile(3214, 9331)};
- //floor 2
- private final Tile sculptureT = new Tile(2609, 9823);
- private final Tile crateT = new Tile(2565, 9833);
- private final Tile crateP = new Tile(2585, 9838);
- private final int[] bosses = {10044, 10110, 10116, 9989, 9916, 10064};
- private final String[] eq = {"platebody", "platelegs", "full helm", "2h"};
- 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", Font.PLAIN, 24);
- private final Font font2 = new Font("Arial", Font.PLAIN, 16);
- private int startxp = 0;
- private Timer t;
- private int floor = -1;
- 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<>();
- 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(a -> {
- 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 Modified");
- frame.pack();
- frame.setVisible(true);
- while (frame.isVisible()) {
- Time.sleep(500);
- }
- t = new Timer();
- startxp = Skills.DUNGEONEERING.getCurrentExp();
- return floor != -1;
- }
- @Override
- public int loop() {
- 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(this::inDung, 4500);
- return 450;
- }
- master.interact("talk-to");
- }
- }
- return 1500;
- }
- private boolean inDung() {
- return dung[floor - 1].getDistance() < 100 || NPCs.getNearest(bosses) != null;
- }
- private void equip() {
- for (Item i : Inventory.getItems()) {
- ItemDef id = Context.client.forItemId(i.getID());
- if (id != null) {
- String invItem = id.getName();
- if (invItem != null) {
- for (String arm : this.eq) {
- if (invItem.toLowerCase().contains(arm))
- if (!isWearing(arm)) {
- i.interact("wear");
- Time.sleep(() -> isWearing(arm), 1500);
- }
- }
- }
- }
- }
- }
- private boolean isWearing(String name) {
- if (name.toLowerCase().contains("2h"))
- return Equipment.isWearing(Equipment.WEAPON);
- else if (name.toLowerCase().contains("body"))
- return Equipment.isWearing(Equipment.BODY);
- else if (name.toLowerCase().contains("legs"))
- return Equipment.isWearing(Equipment.LEGS);
- else if (name.toLowerCase().contains("helm"))
- return Equipment.isWearing(Equipment.HELMET);
- return false;
- }
- private 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;
- }
- private int floor2() {
- NPC boss = NPCs.getNearest(bosses);
- if (boss != null) {
- if (Prayer.getRemainingPoints() > 0 && Skills.PRAYER.getCurrentLevel() > 60
- && (!Prayers.PROTECT_FROM_MAGIC.isActivated() || !Prayers.CHIVALRY.isActivated())) {
- if (!Prayers.PROTECT_FROM_MAGIC.isActivated())
- Prayers.PROTECT_FROM_MAGIC.Activate();
- if (!Prayers.CHIVALRY.isActivated())
- Prayers.CHIVALRY.Activate();
- } else {
- xobot.script.wrappers.interactive.Character c = Players.getMyPlayer().getInteractingCharacter();
- if (c != null) {
- if (NPCs.getNearest(bosses) != null && c.equals(boss)) {
- return 150;
- }
- } else {
- NPCs.getNearest(bosses).interact("attack");
- return 1500;
- }
- }
- } else 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);
- }
- } else 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;
- }
- @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