/* */ package clanwars;
/* */ import java.awt.GridBagConstraints;
/* */ import java.util.HashMap;
/* */ import java.util.List;
/* */ import javax.swing.JLabel;
/* */ import javax.swing.JPanel;
/* */ import org.osbot.rs07.api.def.ItemDefinition;
/* */ import org.osbot.rs07.api.map.Area;
/* */ import org.osbot.rs07.api.map.Position;
/* */ import org.osbot.rs07.api.model.Entity;
/* */ import org.osbot.rs07.api.model.Player;
/* */ import org.osbot.rs07.api.model.Projectile;
/* */ import org.osbot.rs07.api.model.Vector3D;
/* */ import org.osbot.rs07.api.ui.EquipmentSlot;
/* */ import org.osbot.rs07.api.ui.PrayerButton;
/* */ import org.osbot.rs07.api.ui.Skill;
/* */ import org.osbot.rs07.event.Event;
/* */ import org.osbot.rs07.event.WalkingEvent;
/* */ import org.osbot.rs07.utility.Condition;
/* */ import org.osbot.rs07.utility.ConditionalSleep;
/* */
/* */ @ScriptManifest(author = "dozza", info = "", name = "CW NSER", version = 0.0D, logo = "")
/* */ public class main extends Script {
/* 24 */ long randTime = 0L;
/* 25 */ int lineY = 4759;
/* */ boolean started = false;
/* */ boolean isPotatoMode = false;
/* */ boolean isPotatoModeDrag = false;
/* */ boolean isAttackMode = false;
/* */ boolean isAttackDragMode = false;
/* */ boolean useCombatPots = false;
/* */ String[] names;
/* */ String[] blacklistedWeapons;
/* 34 */ List<String> namesList = new ArrayList<>();
/* */ String specWeapon;
/* 36 */ long projectileTimer = 0L;
/* 37 */ int specNeeded = 100;
/* 38 */ final String SOTD = "Staff of the dead";
/* 39 */ final String[] COMBATPOTS = new String[] { "Combat potion(1)", "Combat potion(2)", "Combat potion(3)", "Combat potion(4)" };
/* 40 */ final String[] COMBATPOTS2 = new String[] { "Combat potion(4)", "Combat potion(3)", "Combat potion(2)", "Combat potion(1)" };
/* 41 */ final Area OUTSIDE = new Area(3379, 3163, 3349, 3182);
/* 42 */ final Area BIGAREA = new Area(3305, 4760, 3363, 4784);
/* 43 */ final Area MIDAREA = new Area(3319, 4760, 3335, 4767);
/* 44 */ final Area SMALLAREA = new Area(3323, 4760, 3331, 4765);
/* 45 */ final Area BANKAREA = new Area(3369, 3170, 3369, 3170);
/* 46 */ String state = "Initialising";
/* */
/* */ private JRadioButton potatoModeRadioButton;
/* */ private JRadioButton potatoModeDragRadioButton;
/* */ private JRadioButton attackModeRadioButton;
/* */ private JRadioButton attackModeDragRadioButton;
/* */ private JComboBox comboBox1;
/* */ private JTextArea textArea1;
/* */ private JCheckBox combatPotsCheckBox;
/* */ private JButton startButton;
/* */ private JTextField textField1;
/* */ private JFrame gui;
/* */
/* */ private void setProjectileTimer() {
/* 60 */ this.projectileTimer = System.currentTimeMillis() + 3000L;
/* */ }
/* */
/* */ private HashMap<EquipmentSlot, String> getOthersEquipment(Player p) {
/* 64 */ HashMap<EquipmentSlot, String> equipmentList = new HashMap<>();
/* 65 */ if (p != null) {
/* 66 */ int[] equipment = p.getDefinition().getAppearance();
/* 67 */ for (int i = 0; i < equipment.length; i++) {
/* 68 */ if (equipment[i] - 512 > 0) {
/* 69 */ switch (i) {
/* */ case 0:
/* 71 */ equipmentList.put(EquipmentSlot.HAT, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 1:
/* 74 */ equipmentList.put(EquipmentSlot.CAPE, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 2:
/* 77 */ equipmentList.put(EquipmentSlot.AMULET, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 3:
/* 80 */ equipmentList.put(EquipmentSlot.WEAPON, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 4:
/* 83 */ equipmentList.put(EquipmentSlot.CHEST, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 5:
/* 86 */ equipmentList.put(EquipmentSlot.SHIELD, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 7:
/* 89 */ equipmentList.put(EquipmentSlot.LEGS, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 9:
/* 92 */ equipmentList.put(EquipmentSlot.HANDS, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ case 10:
/* 95 */ equipmentList.put(EquipmentSlot.FEET, ItemDefinition.forId(equipment[i] - 512).getName());
/* */ break;
/* */ }
/* */
/* */ }
/* */ }
/* */ }
/* 102 */ return equipmentList;
/* */ }
/* */
/* */ public boolean someoneIsInteracting(Player p) {
/* 106 */ for (Player player : getPlayers().getAll()) {
/* 107 */ if (player != null && player.isAnimating() && player.getInteracting() != null &&
/* 108 */ player.getInteracting().equals(p)) {
/* 109 */ return true;
/* */ }
/* */ }
/* */
/* 113 */ return false;
/* */ }
/* */
/* */ public boolean chatContainsFrozen() {
/* 117 */ for (int i = 0; i <= 15; i += 2) {
/* 118 */ RS2Widget w = getWidgets().get(162, 44, i);
/* 119 */ if (w != null && (
/* 120 */ w.getMessage().contains("You have been frozen!") || w.getMessage().contains("A magical force stops you from moving"))) {
/* 121 */ return true;
/* */ }
/* */ }
/* */
/* 125 */ return false;
/* */ }
/* */
/* */ public Position getBestPosition(Area a) {
/* 129 */ int dist = Integer.MAX_VALUE;
/* 130 */ Position ret = a.getRandomPosition();
/* 131 */ for (Position p : a.getPositions()) {
/* 132 */ int curDist = p.distance(myPosition());
/* 133 */ if (curDist < dist) {
/* 134 */ ret = p;
/* 135 */ dist = curDist;
/* */ }
/* */ }
/* 138 */ List<Position> newPositions = new ArrayList<>();
/* 139 */ for (int i = -3; i <= 3; i++) {
/* 140 */ for (int j = -3; i <= 3; i++) {
/* 141 */ Position curP = new Position(ret.getX() + i, ret.getY() + j, ret.getZ());
/* 142 */ if (a.contains(curP) && !newPositions.contains(curP)) {
/* 143 */ if (i != 0) {
/* 144 */ newPositions.add(curP);
/* */ } else {
/* 146 */ newPositions.add(ret);
/* */ }
/* */ }
/* */ }
/* */ }
/* 151 */ if (newPositions.size() > 0) {
/* 152 */ return newPositions.get(random(0, newPositions.size() - 1));
/* */ }
/* 154 */ return a.getPositions().get(random(0, newPositions.size() - 1));
/* */ }
/* */
/* */ public String getCombatPotsInventory() {
/* 158 */ for (String s : this.COMBATPOTS) {
/* 159 */ if (getInventory().contains(new String[] { s })) {
/* 160 */ return s;
/* */ }
/* */ }
/* 163 */ return null;
/* */ }
/* */
/* */ public String getCombatPotsBank() {
/* 167 */ for (String s : this.COMBATPOTS2) {
/* 168 */ if (getBank().contains(new String[] { s })) {
/* 169 */ return s;
/* */ }
/* */ }
/* 172 */ return null;
/* */ }
/* */
/* */ final boolean weaponContainsBlacklistedWeapon(String weapon) {
/* 176 */ if (this.blacklistedWeapons.length > 0) {
/* 177 */ for (String s : this.blacklistedWeapons) {
/* 178 */ if (weapon.equalsIgnoreCase(s)) {
/* 179 */ return true;
/* */ }
/* */ }
/* */ }
/* 183 */ return false;
/* */ }
/* */
/* */
/* */ private void $$$setupUI$$$() {
/* 188 */ int GUI_WIDTH = 300, GUI_HEIGHT = 300;
/* */
/* 190 */ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
/* */
/* 192 */ int gX = (int)(screenSize.getWidth() / 2.0D) - 150;
/* 193 */ int gY = (int)(screenSize.getHeight() / 2.0D) - 150;
/* */
/* 195 */ this.gui = new JFrame("GUI");
/* 196 */ this.gui.setResizable(false);
/* 197 */ this.gui.setBounds(gX, gY, 300, 300);
/* */
/* 199 */ JPanel panel1 = new JPanel();
/* 200 */ panel1.setLayout(new GridBagLayout());
/* 201 */ this.potatoModeRadioButton = new JRadioButton();
/* 202 */ this.potatoModeRadioButton.setText("Potato Mode");
/* */
/* 204 */ GridBagConstraints gbc = new GridBagConstraints();
/* 205 */ gbc.gridx = 0;
/* 206 */ gbc.gridy = 0;
/* 207 */ gbc.weighty = 1.0D;
/* 208 */ gbc.anchor = 17;
/* 209 */ panel1.add(this.potatoModeRadioButton, gbc);
/* 210 */ this.potatoModeDragRadioButton = new JRadioButton();
/* 211 */ this.potatoModeDragRadioButton.setText("Potato Mode Drag");
/* 212 */ gbc = new GridBagConstraints();
/* 213 */ gbc.gridx = 0;
/* 214 */ gbc.gridy = 1;
/* 215 */ gbc.weighty = 1.0D;
/* 216 */ gbc.anchor = 17;
/* 217 */ panel1.add(this.potatoModeDragRadioButton, gbc);
/* 218 */ this.attackModeRadioButton = new JRadioButton();
/* 219 */ this.attackModeRadioButton.setText("Attack Mode");
/* 220 */ gbc = new GridBagConstraints();
/* 221 */ gbc.gridx = 0;
/* 222 */ gbc.gridy = 2;
/* 223 */ gbc.weighty = 1.0D;
/* 224 */ gbc.anchor = 17;
/* 225 */ panel1.add(this.attackModeRadioButton, gbc);
/* 226 */ this.attackModeDragRadioButton = new JRadioButton();
/* 227 */ this.attackModeDragRadioButton.setText("Attack Mode Drag");
/* 228 */ gbc = new GridBagConstraints();
/* 229 */ gbc.gridx = 0;
/* 230 */ gbc.gridy = 3;
/* 231 */ gbc.weighty = 1.0D;
/* 232 */ gbc.anchor = 17;
/* 233 */ panel1.add(this.attackModeDragRadioButton, gbc);
/* 234 */ this.comboBox1 = new JComboBox();
/* 235 */ DefaultComboBoxModel<String> defaultComboBoxModel1 = new DefaultComboBoxModel();
/* 236 */ defaultComboBoxModel1.addElement("None");
/* 237 */ defaultComboBoxModel1.addElement("Staff of the dead");
/* 238 */ defaultComboBoxModel1.addElement("Abyssal dagger");
/* 239 */ defaultComboBoxModel1.addElement("Bandos god sword");
/* 240 */ this.comboBox1.setModel(defaultComboBoxModel1);
/* 241 */ gbc = new GridBagConstraints();
/* 242 */ gbc.gridx = 1;
/* 243 */ gbc.gridy = 4;
/* 244 */ gbc.weightx = 1.0D;
/* 245 */ gbc.weighty = 1.0D;
/* 246 */ gbc.anchor = 17;
/* 247 */ gbc.fill = 2;
/* 248 */ panel1.add(this.comboBox1, gbc);
/* 249 */ JLabel label1 = new JLabel();
/* 250 */ label1.setText("Spec Weapon:");
/* 251 */ gbc = new GridBagConstraints();
/* 252 */ gbc.gridx = 0;
/* 253 */ gbc.gridy = 4;
/* 254 */ gbc.weighty = 1.0D;
/* 255 */ gbc.anchor = 17;
/* 256 */ panel1.add(label1, gbc);
/* 257 */ JLabel label2 = new JLabel();
/* 258 */ label2.setText("Enter names below");
/* 259 */ gbc = new GridBagConstraints();
/* 260 */ gbc.gridx = 1;
/* 261 */ gbc.gridy = 0;
/* 262 */ gbc.weightx = 1.0D;
/* 263 */ gbc.weighty = 1.0D;
/* 264 */ gbc.anchor = 17;
/* 265 */ panel1.add(label2, gbc);
/* 266 */ this.textArea1 = new JTextArea();
/* 267 */ gbc = new GridBagConstraints();
/* 268 */ gbc.gridx = 1;
/* 269 */ gbc.gridy = 1;
/* 270 */ gbc.gridheight = 3;
/* 271 */ gbc.weightx = 1.0D;
/* 272 */ gbc.weighty = 1.0D;
/* 273 */ gbc.fill = 1;
/* 274 */ panel1.add(this.textArea1, gbc);
/* 275 */ this.startButton = new JButton();
/* 276 */ this.startButton.setText("Start");
/* 277 */ gbc = new GridBagConstraints();
/* 278 */ gbc.gridx = 0;
/* 279 */ gbc.gridy = 7;
/* 280 */ gbc.gridwidth = 2;
/* 281 */ gbc.weighty = 1.0D;
/* 282 */ gbc.fill = 2;
/* 283 */ panel1.add(this.startButton, gbc);
/* 284 */ this.combatPotsCheckBox = new JCheckBox();
/* 285 */ this.combatPotsCheckBox.setText("Combat Pots");
/* 286 */ gbc = new GridBagConstraints();
/* 287 */ gbc.gridx = 0;
/* 288 */ gbc.gridy = 5;
/* 289 */ gbc.anchor = 17;
/* 290 */ panel1.add(this.combatPotsCheckBox, gbc);
/* 291 */ this.textField1 = new JTextField();
/* 292 */ gbc = new GridBagConstraints();
/* 293 */ gbc.gridx = 1;
/* 294 */ gbc.gridy = 6;
/* 295 */ gbc.anchor = 17;
/* 296 */ gbc.fill = 2;
/* 297 */ panel1.add(this.textField1, gbc);
/* 298 */ JLabel label3 = new JLabel();
/* 299 */ label3.setText("Weapons to blacklist:");
/* 300 */ gbc = new GridBagConstraints();
/* 301 */ gbc.gridx = 0;
/* 302 */ gbc.gridy = 6;
/* 303 */ gbc.anchor = 17;
/* 304 */ panel1.add(label3, gbc);
/* 305 */ this.startButton.addActionListener(e -> {
/* */ this.names = this.textArea1.getText().split("\n");
/* */ this.blacklistedWeapons = this.textField1.getText().split(",");
/* */ for (int i = 0; i < this.names.length; i++) {
/* */ this.names[i] = this.names[i].replace(' ', ' ');
/* */ }
/* */ this.namesList = Arrays.asList(this.names);
/* */ this.isPotatoMode = this.potatoModeRadioButton.isSelected();
/* */ this.isPotatoModeDrag = this.potatoModeDragRadioButton.isSelected();
/* */ this.isAttackMode = this.attackModeRadioButton.isSelected();
/* */ this.isAttackDragMode = this.attackModeDragRadioButton.isSelected();
/* */ this.useCombatPots = this.combatPotsCheckBox.isSelected();
/* */ this.specWeapon = this.comboBox1.getSelectedItem().toString();
/* */ if (this.specWeapon.equalsIgnoreCase("Staff of the dead")) {
/* */ this.specNeeded = 100;
/* */ } else {
/* */ this.specNeeded = 50;
/* */ }
/* */ this.gui.setVisible(false);
/* */ this.started = true;
/* */ });
/* 326 */ this.gui.add(panel1);
/* */
/* 328 */ ButtonGroup buttonGroup = new ButtonGroup();
/* 329 */ buttonGroup.add(this.attackModeRadioButton);
/* 330 */ buttonGroup.add(this.attackModeDragRadioButton);
/* 331 */ buttonGroup.add(this.potatoModeDragRadioButton);
/* 332 */ buttonGroup.add(this.potatoModeRadioButton);
/* */
/* 334 */ this.gui.setVisible(true);
/* */ }
/* */
/* */
/* */ public void onStart() {
/* 339 */ this.randTime = System.currentTimeMillis();
/* 340 */ $$$setupUI$$$();
/* */ }
/* */
/* */
/* */ public int onLoop() throws InterruptedException {
/* 345 */ if (this.started) {
/* 346 */ List<Projectile> pList = new LinkedList<>();
/* 347 */ Projectile projectileToMe = null;
/* 348 */ this.projectiles.getAll().forEach(x -> pList.add(x));
/* 349 */ for (Projectile p : pList) {
/* 350 */ if (p.getTargetEntity() != null && p.getTargetEntity().equals(myPlayer())) {
/* 351 */ projectileToMe = p;
/* 352 */ setProjectileTimer();
/* */ }
/* */ }
/* 355 */ if (System.currentTimeMillis() >= this.randTime) {
/* 356 */ this.state = "Random movement";
/* 357 */ getCamera().moveYaw(random(-60, 60));
/* 358 */ this.randTime = System.currentTimeMillis() + random(120000, 240000);
/* 359 */ } else if (this.OUTSIDE.contains((Entity)myPlayer()) || getBank().isOpen() || getObjects().closest(new String[] { "Free-for-all portal" }) != null || getObjects().closest(new String[] { "Bank chest" }) != null) {
/* 360 */ this.state = "Outside";
/* 361 */ RS2Object portal = (RS2Object)getObjects().closest(new String[] { "Free-for-all portal" });
/* 362 */ if (this.useCombatPots && getCombatPotsInventory() == null && (this.isAttackMode || this.isAttackDragMode)) {
/* 363 */ if (getBank().isOpen()) {
/* 364 */ if (getInventory().contains(new String[] { "Vial" })) {
/* 365 */ if (getBank().depositAll(new String[] { "Vial" })) {
/* 366 */ (new ConditionalSleep(5000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 369 */ return !main.this.getInventory().contains(new String[] { "Vial" });
/* */ }
/* 371 */ }).sleep();
/* */ }
/* 373 */ } else if (getCombatPotsInventory() == null) {
/* 374 */ if (getCombatPotsBank() != null) {
/* 375 */ if (getBank().withdrawAll(getCombatPotsBank())) {
/* 376 */ (new ConditionalSleep(5000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 379 */ return (main.this.getCombatPotsInventory() != null);
/* */ }
/* 381 */ }).sleep();
/* */ }
/* */ } else {
/* 384 */ log("Out of combat pots, stopping");
/* 385 */ stop();
/* */ }
/* */
/* 388 */ } else if (getBank().close()) {
/* 389 */ (new ConditionalSleep(5000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 392 */ return !main.this.getBank().isOpen();
/* */ }
/* 394 */ }).sleep();
/* */ }
/* */
/* */ }
/* 398 */ else if (this.BANKAREA.contains((Entity)myPlayer())) {
/* 399 */ if (getBank().open()) {
/* 400 */ (new ConditionalSleep(5000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 403 */ return main.this.getBank().isOpen();
/* */ }
/* 405 */ }).sleep();
/* */ }
/* */ } else {
/* 408 */ getWalking().webWalk(new Area[] { this.BANKAREA });
/* */ }
/* */
/* 411 */ } else if (portal != null) {
/* 412 */ Area portalArea = portal.getArea(5);
/* 413 */ if (random(0, 3) == 3 &&
/* 414 */ getSkills().getDynamic(Skill.PRAYER) > 0 && !getPrayer().isQuickPrayerActive() &&
/* 415 */ getWidgets().get(160, 14).interact(new String[] { "Activate" })) {
/* 416 */ (new ConditionalSleep(1000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 419 */ return main.this.getPrayer().isQuickPrayerActive();
/* */ }
/* 421 */ }).sleep();
/* */ }
/* */
/* */
/* 425 */ if (portalArea.contains((Entity)myPlayer())) {
/* 426 */ if (this.useCombatPots && getSkills().getDynamic(Skill.ATTACK) <= getSkills().getStatic(Skill.ATTACK) + 2 && (this.isAttackDragMode || this.isAttackMode) && getCombatPotsInventory() != null) {
/* 427 */ if (getInventory().interact("Drink", new String[] { getCombatPotsInventory() })) {
/* 428 */ (new ConditionalSleep(5000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 431 */ return (main.this.getSkills().getDynamic(Skill.ATTACK) > main.this.getSkills().getStatic(Skill.ATTACK));
/* */ }
/* 433 */ }).sleep();
/* */ }
/* */ }
/* 436 */ else if (portal.interact(new String[] { "Enter" })) {
/* 437 */ (new ConditionalSleep(5000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 440 */ return (main.this.getObjects().closest(new String[] { "Free-for-all portal" }) == null);
/* */ }
/* 442 */ }).sleep();
/* */ }
/* */ } else {
/* */
/* 446 */ getWalking().webWalk(new Area[] { portalArea });
/* */ }
/* */ } else {
/* 449 */ getWalking().webWalk(new Area[] { new Area(3354, 3165, 3352, 3162) });
/* */ }
/* 451 */ } else if (this.MIDAREA.contains((Entity)myPlayer()) && (this.isPotatoModeDrag || this.isPotatoMode || (this.isAttackDragMode && myPlayer().isUnderAttack()))) {
/* 452 */ if (this.isPotatoMode) {
/* 453 */ this.state = "Potato mode";
/* */ }
/* 455 */ else if (this.isPotatoModeDrag || (this.isAttackDragMode && myPlayer().isUnderAttack())) {
/* 456 */ this.state = "Dragging player";
/* 457 */ if (myPlayer().isUnderAttack()) {
/* 458 */ Player fighting = null;
/* 459 */ if (getCombat().getFighting() != null) {
/* 460 */ fighting = (Player)getPlayers().closest(new String[] { getCombat().getFighting().getName() });
/* */ } else {
/* 462 */ for (Player player : getPlayers().getAll()) {
/* 463 */ if (!player.equals(myPlayer()) && player.getInteracting() != null && player.getInteracting().equals(myPlayer())) {
/* 464 */ fighting = player;
/* */ break;
/* */ }
/* */ }
/* */ }
/* 469 */ if (fighting != null) {
/* 470 */ String weapon = "Emptyaedrfgadf";
/* 471 */ if (getOthersEquipment(fighting).get(EquipmentSlot.WEAPON) != null) {
/* 472 */ weapon = getOthersEquipment(fighting).get(EquipmentSlot.WEAPON);
/* */ }
/* 474 */ if (!weaponContainsBlacklistedWeapon(weapon) && !weapon.contains("bow") && !weapon.contains("spear") && ((projectileToMe == null && System.currentTimeMillis() > this.projectileTimer) || weapon.equalsIgnoreCase("Black salamander"))) {
/* 475 */ if (fighting.getX() == myPlayer().getX() && fighting.getY() >= myPlayer().getY()) {
/* 476 */ log("Walking south");
/* 477 */ final Position nextToLine = new Position(myPlayer().getX(), this.lineY + 1, myPlayer().getZ());
/* 478 */ Position dragTo = new Position(myPlayer().getX(), this.lineY - 2, myPlayer().getZ());
/* 479 */ if (nextToLine.distance((Vector3D)myPlayer()) == 0) {
/* 480 */ WalkingEvent w = new WalkingEvent(dragTo);
/* 481 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 484 */ return (main.this.lineY >= main.this.myPlayer().getY() || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 487 */ w.setMinDistanceThreshold(0);
/* 488 */ execute((Event)w);
/* */ } else {
/* 490 */ WalkingEvent w = new WalkingEvent(nextToLine);
/* 491 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 494 */ return (nextToLine.distance((Vector3D)main.this.myPlayer()) == 0 || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 497 */ w.setMinDistanceThreshold(0);
/* 498 */ execute((Event)w);
/* */ }
/* */ } else {
/* 501 */ final Position pos; int xDistance = myPlayer().getY() - this.lineY + 2;
/* */
/* 503 */ if (fighting.getX() > myPlayer().getX()) {
/* 504 */ log("Walking west");
/* 505 */ pos = new Position(myPlayer().getX() - xDistance, this.lineY - 1, myPlayer().getZ());
/* */ } else {
/* 507 */ log("Walking east");
/* 508 */ pos = new Position(myPlayer().getX() + xDistance, this.lineY - 1, myPlayer().getZ());
/* */ }
/* 510 */ WalkingEvent w = new WalkingEvent(pos);
/* 511 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 514 */ return (pos.distance((Vector3D)main.this.myPlayer()) == 0 || main.this.lineY >= main.this.myPlayer().getY() || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 517 */ w.setMinDistanceThreshold(0);
/* 518 */ execute((Event)w);
/* */ }
/* */ }
/* */ }
/* 522 */ } else if (this.isAttackDragMode && !getCombat().isFighting()) {
/* 523 */ Player p = (Player)getPlayers().closest(new Filter[] { x -> (this.namesList.contains(x.getName()) && this.BIGAREA.contains((Entity)x) && !x.isUnderAttack() && x.isAttackable() && !x.isHitBarVisible()) });
/* 524 */ if (p != null && !p.isAnimating() && !p.isHitBarVisible() && !myPlayer().isHitBarVisible() && !myPlayer().isUnderAttack() && !getCombat().isFighting() && p.getInteracting() == null &&
/* 525 */ getPlayers().getAll().stream().filter(x -> (x.getInteracting() != null && x.getInteracting().equals(p))) == null &&
/* 526 */ p.interact(new String[] { "Attack" })) {
/* 527 */ (new ConditionalSleep(3000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 530 */ return main.this.getCombat().isFighting();
/* */ }
/* 532 */ }).sleep();
/* */ }
/* */ }
/* */
/* */ }
/* 537 */ } else if (this.BIGAREA.contains((Entity)myPlayer()) && (this.isPotatoMode || this.isPotatoModeDrag)) {
/* 538 */ this.state = "In Big Area";
/* 539 */ if (!getCombat().isFighting() && !myPlayer().isUnderAttack()) {
/* 540 */ (new ConditionalSleep(10000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 543 */ return !main.this.BIGAREA.contains((Entity)main.this.myPlayer());
/* */ }
/* 545 */ }).sleep();
/* 546 */ if (this.BIGAREA.contains((Entity)myPlayer()) && !getCombat().isFighting() && !myPlayer().isUnderAttack()) {
/* 547 */ getWalking().webWalk(new Area[] { this.MIDAREA });
/* */ }
/* 549 */ } else if (myPlayer().isUnderAttack()) {
/* 550 */ Player fighting = null;
/* 551 */ if (getCombat().getFighting() != null) {
/* 552 */ fighting = (Player)getPlayers().closest(new String[] { getCombat().getFighting().getName() });
/* */ } else {
/* 554 */ for (Player player : getPlayers().getAll()) {
/* 555 */ if (!player.equals(myPlayer()) && player.getInteracting() != null && player.getInteracting().equals(myPlayer())) {
/* 556 */ fighting = player;
/* */ break;
/* */ }
/* */ }
/* */ }
/* 561 */ if (fighting != null) {
/* 562 */ log(fighting.getName());
/* 563 */ String weapon = "Emptyaedrfgadf";
/* 564 */ if (getOthersEquipment(fighting).get(EquipmentSlot.WEAPON) != null) {
/* 565 */ weapon = getOthersEquipment(fighting).get(EquipmentSlot.WEAPON);
/* */ }
/* 567 */ if (!weaponContainsBlacklistedWeapon(weapon) && !weapon.contains("bow") && !weapon.contains("spear") && ((projectileToMe == null && System.currentTimeMillis() > this.projectileTimer) || weapon.equalsIgnoreCase("Black salamander"))) {
/* 568 */ if (fighting.getX() == myPlayer().getX() && fighting.getY() >= myPlayer().getY()) {
/* 569 */ log("Walking south");
/* 570 */ final Position nextToLine = new Position(myPlayer().getX(), this.lineY + 1, myPlayer().getZ());
/* 571 */ Position dragTo = new Position(myPlayer().getX(), this.lineY - 2, myPlayer().getZ());
/* 572 */ if (nextToLine.distance((Vector3D)myPlayer()) == 0) {
/* 573 */ WalkingEvent w = new WalkingEvent(dragTo);
/* 574 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 577 */ return (main.this.lineY >= main.this.myPlayer().getY() || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 580 */ w.setMinDistanceThreshold(0);
/* 581 */ execute((Event)w);
/* */ } else {
/* 583 */ WalkingEvent w = new WalkingEvent(nextToLine);
/* 584 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 587 */ return (nextToLine.distance((Vector3D)main.this.myPlayer()) == 0 || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 590 */ w.setMinDistanceThreshold(0);
/* 591 */ execute((Event)w);
/* */ }
/* */ } else {
/* 594 */ final Position pos; int xDistance = myPlayer().getY() - this.lineY + 2;
/* */
/* 596 */ if (fighting.getX() > myPlayer().getX()) {
/* 597 */ log("Walking west");
/* 598 */ pos = new Position(myPlayer().getX() - xDistance, this.lineY - 1, myPlayer().getZ());
/* */ } else {
/* 600 */ log("Walking east");
/* 601 */ pos = new Position(myPlayer().getX() + xDistance, this.lineY - 1, myPlayer().getZ());
/* */ }
/* 603 */ WalkingEvent w = new WalkingEvent(pos);
/* 604 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 607 */ return (pos.distance((Vector3D)main.this.myPlayer()) == 0 || main.this.lineY >= main.this.myPlayer().getY() || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 610 */ w.setMinDistanceThreshold(0);
/* 611 */ execute((Event)w);
/* */ }
/* */ }
/* */ }
/* */ }
/* 616 */ } else if (this.BIGAREA.contains((Entity)myPlayer()) && this.isAttackMode && getPlayers().closest(new Filter[] { x -> (this.namesList.contains(x.getName()) && this.BIGAREA.contains((Entity)x) && (x.isAttackable() || (x.getInteracting() != null && x.getInteracting().equals(myPlayer())))) }) != null) {
/* 617 */ this.state = "Attack mode";
/* 618 */ Player p = (Player)getPlayers().closest(new Filter[] { x -> (this.namesList.contains(x.getName()) && this.BIGAREA.contains((Entity)x) && (x.isAttackable() || (x.getInteracting() != null && x.getInteracting().equals(myPlayer())))) });
/* 619 */ if (getEquipment().isWearingItem(EquipmentSlot.WEAPON, this.specWeapon) && getCombat().getSpecialPercentage() >= this.specNeeded && !getCombat().isSpecialActivated() && !this.specWeapon.equalsIgnoreCase("None") &&
/* 620 */ random(1, 20) == 20) {
/* 621 */ getCombat().toggleSpecialAttack(true);
/* */ }
/* */
/* 624 */ if (p == null && !getCombat().isFighting() && !myPlayer().isUnderAttack()) {
/* 625 */ sleep(10000L);
/* 626 */ if (!getCombat().isFighting() && !myPlayer().isUnderAttack()) {
/* 627 */ getLogoutTab().logOut();
/* */ }
/* 629 */ } else if (p != null && !p.isHitBarVisible() && !p.isAnimating() && !myPlayer().isHitBarVisible() && !myPlayer().isUnderAttack() && !getCombat().isFighting() && p.getInteracting() == null && !someoneIsInteracting(p)) {
/* */
/* 631 */ if (p.interact(new String[] { "Attack" })) {
/* 632 */ (new ConditionalSleep(3000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 635 */ return main.this.getCombat().isFighting();
/* */ }
/* 637 */ }).sleep();
/* */ }
/* 639 */ } else if (getSkills().getDynamic(Skill.PRAYER) > 0 && p != null) {
/* 640 */ String weapon = "Emptyhjaerfgad";
/* 641 */ if (getOthersEquipment(p).get(EquipmentSlot.WEAPON) != null) {
/* 642 */ weapon = ((String)getOthersEquipment(p).get(EquipmentSlot.WEAPON)).toLowerCase();
/* */ }
/* 644 */ if (projectileToMe == null && System.currentTimeMillis() > this.projectileTimer && !weaponContainsBlacklistedWeapon(weapon) && !weapon.contains("bow") && (weapon
/* 645 */ .contains("dead") || weapon.contains("ancient") || !weapon.contains("staff")) &&
/* 646 */ !getPrayer().isActivated(PrayerButton.PROTECT_FROM_MELEE)) {
/* 647 */ sleep(random(1000, 3000));
/* 648 */ if (getPrayer().set(PrayerButton.PROTECT_FROM_MELEE, true)) {
/* 649 */ (new ConditionalSleep(3000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 652 */ return main.this.getPrayer().isActivated(PrayerButton.PROTECT_FROM_MELEE);
/* */ }
/* 654 */ }).sleep();
/* */ }
/* 656 */ } else if (projectileToMe != null || this.projectileTimer >= System.currentTimeMillis() || weapon.contains("bow")) {
/* 657 */ if (weapon.contains("staff") && !getPrayer().isActivated(PrayerButton.PROTECT_FROM_MAGIC)) {
/* 658 */ sleep(random(1000, 3000));
/* 659 */ if (getPrayer().set(PrayerButton.PROTECT_FROM_MAGIC, true)) {
/* 660 */ (new ConditionalSleep(3000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 663 */ return main.this.getPrayer().isActivated(PrayerButton.PROTECT_FROM_MAGIC);
/* */ }
/* 665 */ }).sleep();
/* */ }
/* 667 */ } else if (!getPrayer().isActivated(PrayerButton.PROTECT_FROM_MISSILES)) {
/* 668 */ sleep(random(1000, 3000));
/* 669 */ if (getPrayer().set(PrayerButton.PROTECT_FROM_MISSILES, true)) {
/* 670 */ (new ConditionalSleep(3000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 673 */ return main.this.getPrayer().isActivated(PrayerButton.PROTECT_FROM_MISSILES);
/* */ }
/* 675 */ }).sleep();
/* */ }
/* */ }
/* */ }
/* */ }
/* 680 */ } else if (this.BIGAREA.contains((Entity)myPlayer()) && this.isAttackDragMode && getPlayers().closest(new Filter[] { x -> (this.namesList.contains(x.getName()) && this.BIGAREA.contains((Entity)x) && (x.isAttackable() || (x.getInteracting() != null && x.getInteracting().equals(myPlayer())))) }) != null) {
/* 681 */ this.state = "Attack drag mode";
/* 682 */ Player p = (Player)getPlayers().closest(new Filter[] { x -> (this.namesList.contains(x.getName()) && this.BIGAREA.contains((Entity)x) && (x.isAttackable() || (x.getInteracting() != null && x.getInteracting().equals(myPlayer())))) });
/* 683 */ if (myPlayer().isUnderAttack()) {
/* 684 */ Optional<Projectile> proj = this.projectiles.getAll().stream().filter(x -> (x.getTargetEntity() != null && x.getTargetEntity().equals(myPlayer()))).findFirst();
/* 685 */ Player fighting = null;
/* 686 */ if (getCombat().getFighting() != null) {
/* 687 */ fighting = (Player)getPlayers().closest(new String[] { getCombat().getFighting().getName() });
/* */ } else {
/* 689 */ for (Player player : getPlayers().getAll()) {
/* 690 */ if (!player.equals(myPlayer()) && player.getInteracting() != null && player.getInteracting().equals(myPlayer())) {
/* 691 */ fighting = player;
/* */ break;
/* */ }
/* */ }
/* */ }
/* 696 */ if (fighting != null) {
/* 697 */ String weapon = "Emptyaedrfgadf";
/* 698 */ if (getOthersEquipment(fighting).get(EquipmentSlot.WEAPON) != null) {
/* 699 */ weapon = getOthersEquipment(fighting).get(EquipmentSlot.WEAPON);
/* */ }
/* 701 */ if (!weaponContainsBlacklistedWeapon(weapon) && !weapon.contains("bow") && !weapon.contains("spear") && ((projectileToMe == null && System.currentTimeMillis() > this.projectileTimer) || weapon.equalsIgnoreCase("Black salamander"))) {
/* 702 */ if (fighting.getX() == myPlayer().getX() && fighting.getY() >= myPlayer().getY()) {
/* 703 */ log("Walking south");
/* 704 */ final Position nextToLine = new Position(myPlayer().getX(), this.lineY + 1, myPlayer().getZ());
/* 705 */ Position dragTo = new Position(myPlayer().getX(), this.lineY - 2, myPlayer().getZ());
/* 706 */ if (nextToLine.distance((Vector3D)myPlayer()) == 0) {
/* 707 */ WalkingEvent w = new WalkingEvent(dragTo);
/* 708 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 711 */ return (main.this.lineY >= main.this.myPlayer().getY() || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 714 */ w.setMinDistanceThreshold(0);
/* 715 */ execute((Event)w);
/* */ } else {
/* 717 */ WalkingEvent w = new WalkingEvent(nextToLine);
/* 718 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 721 */ return (nextToLine.distance((Vector3D)main.this.myPlayer()) == 0 || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 724 */ w.setMinDistanceThreshold(0);
/* 725 */ execute((Event)w);
/* */ }
/* */ } else {
/* 728 */ final Position pos; int xDistance = myPlayer().getY() - this.lineY + 2;
/* */
/* 730 */ sleep(random(1000, 3000));
/* 731 */ if (fighting.getX() > myPlayer().getX()) {
/* 732 */ log("Walking west");
/* 733 */ pos = new Position(myPlayer().getX() - xDistance, this.lineY - 1, myPlayer().getZ());
/* */ } else {
/* 735 */ log("Walking east");
/* 736 */ pos = new Position(myPlayer().getX() + xDistance, this.lineY - 1, myPlayer().getZ());
/* */ }
/* 738 */ WalkingEvent w = new WalkingEvent(pos);
/* 739 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 742 */ return (pos.distance((Vector3D)main.this.myPlayer()) == 0 || main.this.lineY >= main.this.myPlayer().getY() || main.this.myPlayer().getHealthPercent() <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 745 */ w.setMinDistanceThreshold(0);
/* 746 */ execute((Event)w);
/* */ }
/* */ }
/* */ }
/* 750 */ } else if (!getCombat().isFighting() && !myPlayer().isUnderAttack() && !myPlayer().isHitBarVisible() && !p.isHitBarVisible() && p.getInteracting() == null && !someoneIsInteracting(p)) {
/* */
/* 752 */ if (p.interact(new String[] { "Attack" })) {
/* 753 */ (new ConditionalSleep(5000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 756 */ return main.this.getCombat().isFighting();
/* */ }
/* 758 */ }).sleep();
/* */ }
/* */ }
/* 761 */ } else if (myPlayer().getY() <= this.lineY && !this.OUTSIDE.contains((Entity)myPlayer())) {
/* 762 */ this.state = "Not in attackable zone";
/* 763 */ if (getSkills().getDynamic(Skill.PRAYER) > 0 && !getPrayer().isQuickPrayerActive()) {
/* 764 */ if (getWidgets().get(160, 14).interact(new String[] { "Activate" })) {
/* 765 */ (new ConditionalSleep(1000)
/* */ {
/* */ public boolean condition() throws InterruptedException {
/* 768 */ return main.this.getPrayer().isQuickPrayerActive();
/* */ }
/* 770 */ }).sleep();
/* */ }
/* */ } else {
/* 773 */ log("Walking up");
/* 774 */ sleep(random(1000, 3000));
/* 775 */ if (this.isAttackDragMode || this.isPotatoModeDrag) {
/* 776 */ Position p = new Position(myPosition().getX() + random(-3, 3), this.lineY + 1, myPlayer().getZ());
/* 777 */ WalkingEvent w = new WalkingEvent(p);
/* 778 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 781 */ return (main.this.lineY < main.this.myPlayer().getY() || main.this.getSkills().getDynamic(Skill.HITPOINTS) <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 784 */ w.setMinDistanceThreshold(0);
/* 785 */ execute((Event)w);
/* */ } else {
/* 787 */ Position p = new Position(myPosition().getX() + random(-3, 3), this.lineY + random(1, 4), myPlayer().getZ());
/* 788 */ WalkingEvent w = new WalkingEvent(p);
/* 789 */ w.setBreakCondition(new Condition()
/* */ {
/* */ public boolean evaluate() {
/* 792 */ return (main.this.lineY < main.this.myPlayer().getY() || main.this.getSkills().getDynamic(Skill.HITPOINTS) <= 0 || main.this.chatContainsFrozen());
/* */ }
/* */ });
/* 795 */ w.setMinDistanceThreshold(0);
/* 796 */ execute((Event)w);
/* */ }
/* */ }
/* 799 */ } else if (this.lineY < myPlayer().getY()) {
/* 800 */ if (!this.BIGAREA.contains((Entity)myPlayer())) {
/* 801 */ this.state = "Trying to log out";
/* 802 */ if (getCombat().isFighting() || myPlayer().isUnderAttack()) {
/* 803 */ sleep(random(10000, 12500));
/* */ } else {
/* 805 */ getLogoutTab().logOut();
/* */ }
/* 807 */ } else if (!this.MIDAREA.contains((Entity)myPlayer()) && (!getCombat().isFighting() || (getCombat().isFighting() && myPlayer().isUnderAttack()))) {
/* 808 */ this.state = "Walking back to small area";
/* 809 */ getWalking().webWalk(new Area[] { this.SMALLAREA });
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 830 */ return 150;
/* */ }
/* */
/* */
/* */ public void onMessage(Message m) throws InterruptedException {
/* 835 */ if (m.getType().equals(Message.MessageType.GAME) && (m.getMessage().contains("You have been frozen!") || m.getMessage().contains("A magical force stops you from moving."))) {
/* 836 */ this.state = "Frozen";
/* 837 */ sleep(20000L);
/* */ }
/* */ }
/* */
/* */
/* */ public void onExit() {
/* 843 */ if (this.gui != null) {
/* 844 */ this.gui.dispose();
/* */ }
/* */ }
/* */
/* */
/* */ public void onPaint(Graphics2D g) {
/* 850 */ g.setColor(Color.WHITE);
/* 851 */ g.drawString("State: " + this.state, 25, 50);
/* */ }
/* */ }