clanwarsplugin

 avatar
unknown
java
a year ago
35 kB
3
Indexable
package com.piggyplugins.PlayerClanWars;

import com.example.EthanApiPlugin.Collections.Players;
import com.example.EthanApiPlugin.Collections.TileObjects;
import com.example.EthanApiPlugin.EthanApiPlugin;
import com.example.InteractionApi.InteractionHelper;
import com.example.InteractionApi.PlayerInteractionHelper;
import com.example.InteractionApi.TileObjectInteraction;
import com.example.PacketUtils.PacketUtilsPlugin;
import com.example.Packets.MousePackets;
import com.example.Packets.MovementPackets;
import com.example.Packets.PlayerPackets;
import com.example.Packets.WidgetPackets;
import com.google.inject.Provides;
import com.piggyplugins.PiggyUtils.API.PrayerUtil;
import com.piggyplugins.PiggyUtils.BreakHandler.ReflectBreakHandler;
import com.piggyplugins.PiggyUtils.PiggyUtilsPlugin;

import java.awt.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import javax.inject.Inject;

import net.runelite.api.*;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependencies;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.RandomUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@PluginDependencies({@PluginDependency(PacketUtilsPlugin.class), @PluginDependency(EthanApiPlugin.class), @PluginDependency(PiggyUtilsPlugin.class)})
@PluginDescriptor(name = "<html><font color=\"#FF0000\">[NS] </font> URQUITTING</font>", description = "NO SUBMIT IS GOD", enabledByDefault = false, tags = {"ethan", "piggy"})
public class ClanWarsPlugin extends Plugin {
    private static final Logger log = LoggerFactory.getLogger(ClanWarsPlugin.class);

    @Inject
    private Client client;

    @Inject
    private ClientThread clientThread;

    @Inject
    private ConfigManager configManager;

    private EthanApiPlugin api;

    @Inject
    private MousePackets mousePackets;

    @Inject
    private WidgetPackets widgetPackets;

    @Inject
    private ClanWarsConfig config;

    private Random rnd = new Random();

    @Inject
    private ReflectBreakHandler breakHandler;

    @Inject
    private OverlayManager overlayManager;

    @Inject
    private ClanWarsConfig panelConfig;

    private int timeout = 0;

    private int trollModeState = 1;

    private int DragmodeState = 1;

    private int KillUrselfState = 1;
    private int HallyDragMode = 1;

    WorldArea houses = new WorldArea(3356, 4801, 21, 29, 0);

    WorldArea ragArea = new WorldArea(3329, 4760, 6, 3, 0);

    protected void startUp() throws Exception {}

    protected void shutDown() throws Exception {}
    String hello = "flash2: Jono the crossdresser will quit to us";
    String hello1 = "flash2: Pipe up pipsqueak";
    @Provides
    private ClanWarsConfig getPanelConfig() {
        return (ClanWarsConfig)this.configManager.getConfig(ClanWarsConfig.class);
    }

    @Subscribe
    public void onChatMessage(ChatMessage message) {
        if (message.getType() != ChatMessageType.GAMEMESSAGE || (message.getType() == ChatMessageType.PUBLICCHAT))
            return;
        if (message.getType() == ChatMessageType.PUBLICCHAT && Text.toJagexName(message.getName()).equals("Jet kaii2")) {
            client.runScript(ScriptID.CHAT_SEND, hello1, 0, 0, 0, -1);
        }
        MousePackets.queueClickPacket();
        if (message.getMessage().contains("Head further north to fight") && !this.config.trollMode() && !this.config.KillUrselfMode() && !this.config.Dragmode() && !this.config.Hallydrag())
            walkUpGang();
        if (message.getMessage().contains("Head further north to fight") && !this.config.trollMode() && !this.config.KillUrselfMode() && this.config.Dragmode() && !this.config.Hallydrag())
            MovementPackets.queueMovement(DragModeStart().iterator().next());
    }


    private WorldPoint getRandomPointInArea(WorldArea area) {
        int minX = area.getX();
        int minY = area.getY();
        int maxX = minX + area.getWidth();
        int maxY = minY + area.getHeight();
        int randomX = minX + this.rnd.nextInt(maxX - minX);
        int randomY = minY + this.rnd.nextInt(maxY - minY);
        return new WorldPoint(randomX, randomY, area.getPlane());
    }

    private void walkUpGang() {
        MousePackets.queueClickPacket();
        MovementPackets.queueMovement(getRandomPointInArea(this.ragArea));
    }
    private void Dragstart() {
        MousePackets.queueClickPacket();
        MovementPackets.queueMovement(getRandomPointInArea(this.ragArea));
    }

    public Set<WorldPoint> combatArea() {
        return new HashSet<>((new WorldArea(new WorldPoint(3328, 4760, 0), 4, 4))
                .toWorldPointList());
    }
    public Set<WorldPoint> dragstuck() {
        return new HashSet<>((new WorldArea(new WorldPoint(3349, 4760, 0), 24, 4))
                .toWorldPointList());
    }

    public Set<WorldPoint> safeLineArea() {
        return new HashSet<>((new WorldArea(new WorldPoint(3274, 4749, 0), 105, 10)).toWorldPointList());
    }

    public Set<WorldPoint> trollModeArea() {
        return new HashSet<>((new WorldArea(new WorldPoint(3328, 4760, 0), 1, 1)).toWorldPointList());
    }
    public Set<WorldPoint> HallyDragArea() {
        return new HashSet<>((new WorldArea(new WorldPoint(3332, 4760, 0), 1, 1)).toWorldPointList());
    }
    public Set<WorldPoint> HallyDragArea1() {
        return new HashSet<>((new WorldArea(new WorldPoint(3336, 4760, 0), 1, 1)).toWorldPointList());
    }
    public Set<WorldPoint> HallyDragArea2() {
        return new HashSet<>((new WorldArea(new WorldPoint(3339, 4757, 0), 1, 1)).toWorldPointList());
    }

    public Set<WorldPoint> szone() {
        return new HashSet<>((new WorldArea(new WorldPoint(3330, 4759, 0), 1, 1)).toWorldPointList());
    }

    public Set<WorldPoint> DragModeStart() {
        return new HashSet<>((new WorldArea(new WorldPoint(3334, 4761, 0), 1, 1)).toWorldPointList());
    }

    public Set<WorldPoint> DragmodeDest() {
        return new HashSet<>((new WorldArea(new WorldPoint(3347, 4761, 0), 1, 1)).toWorldPointList());
    }

    public Set<WorldPoint> Dragmodenext() {
        return new HashSet<>((new WorldArea(new WorldPoint(3357, 4761, 0), 1, 1)).toWorldPointList());
    }
    public Set<WorldPoint> Dragmodenextafter() {
        return new HashSet<>((new WorldArea(new WorldPoint(3362, 4758, 0), 1, 1)).toWorldPointList());
    }
    public Set<WorldPoint> Dragmodenextafterafter() {
        return new HashSet<>((new WorldArea(new WorldPoint(3366, 4758, 0), 1, 1)).toWorldPointList());
    }
    public Set<WorldPoint> trollModeStepBack() {
        return new HashSet<>((new WorldArea(new WorldPoint(3328, 4758, 0), 1, 1)).toWorldPointList());
    }

    public Set<WorldPoint> kysstepback() {
        return new HashSet<>((new WorldArea(new WorldPoint(3332, 4759, 0), 1, 1)).toWorldPointList());
    }

    public Set<WorldPoint> outside() {
        return new HashSet<>((new WorldArea(new WorldPoint(3332, 4760, 0), 1, 1)).toWorldPointList());
    }

    public Set<WorldPoint> AtHouses() {
        return new HashSet<>((new WorldArea(new WorldPoint(3334, 4803, 0), 31, 46)).toWorldPointList());
    }

    public Set<WorldPoint> blocks() {
        return new HashSet<>((new WorldArea(new WorldPoint(3376, 4832, 0), 21, 29)).toWorldPointList());
    }

    public boolean isSafeLineArea() {
        return safeLineArea().contains(this.client.getLocalPlayer().getWorldLocation());
    }

    public boolean istrollModeArea() {
        return safeLineArea().contains(this.client.getLocalPlayer().getWorldLocation());
    }

    public boolean isAtHouses(Actor actor) {
        return AtHouses().contains(actor.getWorldLocation());
    }
    public boolean isAtBlocks(Actor actor) {
        return blocks().contains(actor.getWorldLocation());
    }
    public boolean isAtBlocks() {
        return blocks().contains(this.client.getLocalPlayer().getWorldLocation());
    }
    public boolean isAtHouses() {
        return AtHouses().contains(this.client.getLocalPlayer().getWorldLocation());
    }

    public boolean isdragstuck() {
        return dragstuck().contains(this.client.getLocalPlayer().getWorldLocation());
    }

    public boolean isInCombatArea() {
        return combatArea().contains(this.client.getLocalPlayer().getWorldLocation());
    }

    private int fuckurmompoints() {
        Widget wid = this.client.getWidget(160, 20);
        if (wid != null)
            return Integer.parseInt(wid.getText());
        return -1;
    }

    private void enterPortal() {
        Optional<TileObject> portal = TileObjects.search().withName("Free-for-all portal").withAction("Enter").nearestToPlayer();
        if (portal.isPresent()) {
            System.out.println("Portal found.");
            TileObjectInteraction.interact(portal.get(), new String[] { "Enter" });
        }
    }

    private boolean localIsInsideArena() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() > 4759);
    }

    private boolean localIsInsideClanWars() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() >= 4751);
    }

    private boolean localIsOnTrollTile() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() == 4751);
    }
    private boolean localIsOnEndTile() {
        return (this.client.getLocalPlayer().getWorldLocation().getX() == 3362);
    }

    private boolean localIsOnDragModeTile() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() == 4751);
    }
    private boolean Localisabove() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() >= 4763);
    }
    private boolean Localisonend() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() == 4758);
    }
    private boolean localIsOnDragModeTile1() {
        return (this.client.getLocalPlayer().getWorldLocation().getX() == 3357);
    }
    private boolean localIsOnDragModeTile2() {
        return (this.client.getLocalPlayer().getWorldLocation().getX() == 3362);
    }
    private boolean localIsOnDragModeTile3() {
        return (this.client.getLocalPlayer().getWorldLocation().getX() == 3368);
    }

    private boolean localIsOnThisTile() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() == 4751);
    }

    private boolean localisonanothertile() {
        return (this.client.getLocalPlayer().getWorldLocation().getY() == 4751);
    }
    private boolean localisondragtile1() {
        return (this.client.getLocalPlayer().getWorldLocation().getX() == 3347);
    }
    private boolean localisondragtile2() {
        return (this.client.getLocalPlayer().getWorldLocation().getX() == 3357);
    }
    private boolean localisondragtile3() {
        return (this.client.getLocalPlayer().getWorldLocation().getX() == 3368);
    }

    private boolean isLocalBeingAttacked() {
        return Players.search().interactingWithLocal().first().isPresent();
    }

    @Subscribe
    private void onGameTick(GameTick event) {
        if (this.client.getGameState() != GameState.LOGGED_IN)
            return;
        if (this.timeout > 0) {
            this.timeout--;
            return;
        }
        if (!this.config.Dragmode() && !this.config.Hallydrag() && !this.config.KillUrselfMode() && EthanApiPlugin.getClient().getVarpValue(173) == 0 && EthanApiPlugin.getClient().getEnergy() > 100) {
            MousePackets.queueClickPacket();
            WidgetPackets.queueWidgetActionPacket(1, 10485787, -1, -1);
        }
        Player localPlayer = this.client.getLocalPlayer();
        if (this.config.toggleSpec() && this.client.getVarpValue(301) == 0 && this.client.getVarpValue(300) >= this.config.specEnergy() * 10) {
            MousePackets.queueClickPacket();
            WidgetPackets.queueWidgetActionPacket(1, 10485795, -1, -1);
        }
        List<Player> playersToFocus = Players.search().filter(p -> Arrays.stream(config.playerName().split(","))
                .anyMatch(configName -> p.getName() != null && p.getName().equalsIgnoreCase((configName))) && p.getWorldLocation().getY() > 4759).result();

        Optional<WorldPoint> goal = EthanApiPlugin.reachableTiles().stream().filter(wp -> combatArea().contains(wp)).min(Comparator.comparingInt(t -> t.distanceTo(this.client.getLocalPlayer().getWorldLocation())));

        Player targetPlayer = playersToFocus.stream().min(Comparator.comparingInt(t -> t.getWorldLocation().distanceTo(this.client.getLocalPlayer().getWorldLocation()))).orElse(null);

        if (this.config.Dragmode() && Localisabove() && localIsInsideClanWars() && !isLocalBeingAttacked()) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(DragModeStart().iterator().next());
            EthanApiPlugin.sendClientMessage("Moving back");
            DragmodeState = 1;
        }


        if (localIsOnTrollTile() && this.config.trollMode()) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(trollModeArea().iterator().next());
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(trollModeArea().iterator().next());
            EthanApiPlugin.sendClientMessage("Move from port tile to troll tile");
        }
        if (localIsOnDragModeTile() && this.config.Dragmode()) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(DragModeStart().iterator().next());
            EthanApiPlugin.sendClientMessage("Move from port tile to drag tile");
        }
        if (localIsOnDragModeTile() && this.config.Hallydrag()) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(HallyDragArea().iterator().next());
            EthanApiPlugin.sendClientMessage("Move from port tile to drag tile");
        }
        if (localIsOnThisTile() && this.config.KillUrselfMode()) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(kysstepback().iterator().next());
            EthanApiPlugin.sendClientMessage("Move from port tile");
        }
        if (localIsOnEndTile() && this.config.Dragmode()) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(DragModeStart().iterator().next());
            EthanApiPlugin.sendClientMessage("heading back");
            DragmodeState = 1;
        }
        if (isdragstuck() && (
                !this.client.getLocalPlayer().isInteracting() && !isLocalBeingAttacked()
        )) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(DragModeStart().iterator().next());
            EthanApiPlugin.sendClientMessage("okwegobackbitch");
        }
        if (isAtHouses() &&  (
                !this.client.getLocalPlayer().isInteracting() || isAtHouses(this.client.getLocalPlayer().getInteracting()))) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(getRandomPointInArea(this.ragArea));
            EthanApiPlugin.sendClientMessage("We are at houses, returning");
        }
        if (isAtBlocks() &&  (
                !this.client.getLocalPlayer().isInteracting() || isAtBlocks(this.client.getLocalPlayer().getInteracting()))) {
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(getRandomPointInArea(this.ragArea));
            EthanApiPlugin.sendClientMessage("We are at blocks, returning");
        }
        if (this.config.autoPray()) {
            if (targetPlayer != null) {
                WeaponType weaponType = WeaponType.checkWeaponOnPlayer(this.client, targetPlayer);
                EthanApiPlugin.sendClientMessage("Weapon type: " + weaponType);
                switch (weaponType) {
                    case WEAPON_MELEE:
                        if (!PrayerUtil.isPrayerActive(Prayer.PROTECT_FROM_MELEE))
                            PrayerUtil.togglePrayer(Prayer.PROTECT_FROM_MELEE);
                        break;
                    case WEAPON_RANGED:
                        if (!PrayerUtil.isPrayerActive(Prayer.PROTECT_FROM_MISSILES))
                            PrayerUtil.togglePrayer(Prayer.PROTECT_FROM_MISSILES);
                        break;
                    case WEAPON_MAGIC:
                        if (!PrayerUtil.isPrayerActive(Prayer.PROTECT_FROM_MAGIC))
                            PrayerUtil.togglePrayer(Prayer.PROTECT_FROM_MAGIC);
                        break;
                }
            }
        } else if (fuckurmompoints() > 0 && !EthanApiPlugin.isQuickPrayerEnabled()) {
            InteractionHelper.togglePrayer();
        }

        if (this.config.Dragmode() && localIsInsideClanWars() && !localIsOnTrollTile()) {
            switch (this.DragmodeState) {
                case 1:
                    MousePackets.queueClickPacket();
                    MovementPackets.queueMovement(DragModeStart().iterator().next());
                    EthanApiPlugin.sendClientMessage("East Drag Tile1");
                    this.DragmodeState = 2;
                    break;
                case 2:
                    if ((localIsInsideArena() && !isSafeLineArea() && targetPlayer != null && targetPlayer.getHealthRatio() >= -1 && !isAtHouses())) {
                        if (!isSafeLineArea()) {
                            MousePackets.queueClickPacket();
                            PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                            EthanApiPlugin.sendClientMessage("Sending bolt at neck");
                        }
                        this.timeout = 3;
                        this.DragmodeState = 3;
                        break;
                    }
                    log.info("Target player is null");
                    break;
                case 3:
                    if (targetPlayer != null && (targetPlayer != null && targetPlayer.getAnimation() == 4230 || targetPlayer.getAnimation() == 9166 || targetPlayer.getAnimation() == 390 || targetPlayer.getAnimation() == 9741 || targetPlayer.getAnimation() == 426 || targetPlayer.getAnimation() == 2067 || targetPlayer.getAnimation() == 1074 || targetPlayer.getAnimation() == 423)) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(DragmodeDest().iterator().next());
                        EthanApiPlugin.sendClientMessage("starting drag");
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(DragmodeDest().iterator().next());
                        this.timeout = 5;
                        this.DragmodeState = 4;
                        break;
                    }
                case 4:
                    if ((targetPlayer != null && !isLocalBeingAttacked() && !isSafeLineArea())) {
                        MousePackets.queueClickPacket();
                        PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                        EthanApiPlugin.sendClientMessage("target check, bitch ran re-attacking and switching case");
                        timeout = 4;
                        this.DragmodeState = 5;
                        break;
                    }else if (isLocalBeingAttacked()) {
                        EthanApiPlugin.sendClientMessage("we are being attacked still, continue");
                        EthanApiPlugin.sendClientMessage("starting drag");
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(DragmodeDest().iterator().next());
                        timeout = 4;
                        this.DragmodeState = 5;
                        break;
                    }
                case 5:
                    if ((targetPlayer != null && !isLocalBeingAttacked() && !isSafeLineArea())) {
                        MousePackets.queueClickPacket();
                        PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                        EthanApiPlugin.sendClientMessage("target check, bitch ran re-attacking and switching case");
                        timeout = 4;
                        this.DragmodeState = 5;
                        break;
                    }else if (isLocalBeingAttacked()) {
                        EthanApiPlugin.sendClientMessage("we are being attacked still, continue");
                        timeout = 4;
                        this.DragmodeState = 6;
                        break;
                    }
                case 6:
                    if (!isLocalBeingAttacked() && !isSafeLineArea()) {
                        MousePackets.queueClickPacket();
                        PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                        EthanApiPlugin.sendClientMessage("target ran2, re-attacking and switching case");
                        timeout = 5;
                        this.DragmodeState = 5;
                        break;
                    } else if (targetPlayer != null && isLocalBeingAttacked()) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(DragmodeDest().iterator().next());
                        EthanApiPlugin.sendClientMessage("Starting Drag");
                        timeout = 3;
                        this.DragmodeState = 7;
                        break;
                    }
                case 7:
                    if ((targetPlayer != null && !isLocalBeingAttacked() && !isSafeLineArea())) {
                        MousePackets.queueClickPacket();
                        PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                        EthanApiPlugin.sendClientMessage("target check, bitch ran re-attacking and switching case");
                        this.timeout = 8;
                        this.DragmodeState = 5;
                        break;
                    }else if (isLocalBeingAttacked()) {
                        EthanApiPlugin.sendClientMessage("we are being attacked still, continue2");
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(Dragmodenext().iterator().next());
                        EthanApiPlugin.sendClientMessage("Second drag");
                        this.DragmodeState = 6;
                        timeout = 7;
                        break;
                    }
                case 8:
                    if ((targetPlayer != null && !isLocalBeingAttacked() && !isSafeLineArea())) {
                        MousePackets.queueClickPacket();
                        PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                        EthanApiPlugin.sendClientMessage("target check, bitch ran re-attacking and switching case");
                        this.timeout = 1;
                        this.DragmodeState = 5;
                        break;
                    }else if (isLocalBeingAttacked()) {
                        EthanApiPlugin.sendClientMessage("we are being attacked still, continue3");
                        this.timeout = 6;
                        this.DragmodeState = 9;
                        break;
                    }
                case 9:
                    if (!isLocalBeingAttacked() && !isSafeLineArea()) {
                        MousePackets.queueClickPacket();
                        PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                        EthanApiPlugin.sendClientMessage("drag failed, target ran, attacking");
                        timeout = 5;
                        this.DragmodeState = 6;
                    } else if (isLocalBeingAttacked()) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(Dragmodenextafter().iterator().next());
                        EthanApiPlugin.sendClientMessage("almost done dragging bitch");
                        this.timeout = 14;
                        this.DragmodeState = 1;
                        break;

                    }

            }

            return;}
        if (this.config.Dragmode() && !this.client.getLocalPlayer().isInteracting() && localIsInsideClanWars()  && !isLocalBeingAttacked()) {
            timeout = 16;
            MousePackets.queueClickPacket();
            MovementPackets.queueMovement(DragModeStart().iterator().next());
            EthanApiPlugin.sendClientMessage("Moving back2");
            DragmodeState = 1;
            timeout = 3;
        }
        if (this.config.trollMode() && localIsInsideClanWars()) {
            switch (this.trollModeState) {
                case 1:
                    MousePackets.queueClickPacket();
                    MovementPackets.queueMovement(trollModeArea().iterator().next());
                    EthanApiPlugin.sendClientMessage("Boarderline Tile");
                    this.trollModeState = 2;
                    this.timeout = 1;
                    break;
                case 2:
                    log.info("Target Player: {}, Target Player Health Ratio: {}", targetPlayer.getName(), targetPlayer.getHealthRatio());
                    if ((targetPlayer != null && targetPlayer.getHealthRatio() >= -1)) {
                        if (!isSafeLineArea()) {
                            MousePackets.queueClickPacket();
                            PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                            EthanApiPlugin.sendClientMessage("Sending bolt at necks");
                        }
                        this.trollModeState = 3;
                        this.timeout = 1;
                        break;
                    }
                case 3:
                    if (client.getLocalPlayer().getAnimation() == 4230) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(trollModeStepBack().iterator().next());
                        EthanApiPlugin.sendClientMessage("Attempting drag.");
                        this.trollModeState = 1;
                        this.timeout = 2;
                        break;
                    }else if (!isLocalBeingAttacked())
                        this.trollModeState = 1;
                    break;

            }

            return; }
        if (this.config.Hallydrag() && localIsInsideClanWars()) {
            switch (this.HallyDragMode) {
                case 1:
                    if (this.config.Hallydrag()) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(HallyDragArea().iterator().next());
                        EthanApiPlugin.sendClientMessage("Boarderline Tile");
                        this.HallyDragMode = 2;
                        this.timeout = 3;
                        break;
                    }
                case 2:
                    if ((targetPlayer != null && Players.search().interactingWith((Actor) targetPlayer).isEmpty()) || Players.search().interactingWith((Actor) targetPlayer).result().contains(this.client.getLocalPlayer())) {
                        if (!isSafeLineArea()) {
                            MousePackets.queueClickPacket();
                            PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                            EthanApiPlugin.sendClientMessage("Attacking");
                        }
                        this.HallyDragMode = 3;
                        this.timeout = 3;
                        break;
                    }
                    log.info("Target player is null");
                    break;
                case 3:
                    if (!(targetPlayer.getAnimation() == 1)) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(HallyDragArea1().iterator().next());
                        EthanApiPlugin.sendClientMessage("Attempting drag1.");
                        this.HallyDragMode = 4;
                        this.timeout = 1;
                        break;
                    }
                case 4:
                    MousePackets.queueClickPacket();
                    MovementPackets.queueMovement(HallyDragArea2().iterator().next());
                    EthanApiPlugin.sendClientMessage("Attempting final drag.");
                    this.HallyDragMode = 1;
                    this.timeout = 2;
                    break;
            }


            return;}

        if (this.config.KillUrselfMode() && localIsInsideClanWars()) {
            switch (this.KillUrselfState) {
                case 1:
                    if ((targetPlayer != null && Players.search().interactingWith((Actor)targetPlayer).isEmpty()) || Players.search().interactingWith((Actor)targetPlayer).result().contains(this.client.getLocalPlayer())) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(outside().iterator().next());
                        EthanApiPlugin.sendClientMessage("Boarderline Tile");
                        this.KillUrselfState = 2;
                        this.timeout = 1;
                        break;
                    }
                case 2:
                    if (targetPlayer != null && Players.search().interactingWith((Actor)targetPlayer).isEmpty()) {
                        if (!isSafeLineArea()) {
                            MousePackets.queueClickPacket();
                            PlayerPackets.queuePlayerAction(targetPlayer, new String[] { "Attack" });
                            EthanApiPlugin.sendClientMessage("Sending bolt at neck");
                        }
                        this.KillUrselfState = 3;
                        this.timeout = 1;
                        break;
                    }
                    log.info("Target player is null");
                    break;
                case 3:
                    MousePackets.queueClickPacket();
                    MovementPackets.queueMovement(kysstepback().iterator().next());
                    EthanApiPlugin.sendClientMessage("kys stepback");
                    this.KillUrselfState = 1;
                    this.timeout = 1;
                    break;
            }

            return; }

        if (!EthanApiPlugin.isMoving()) {
            enterPortal();
            RandomUtils.nextInt(1, 8);

            if (config.Dragmode() && localIsInsideClanWars() && !isLocalBeingAttacked() && !isSafeLineArea() && !isAtHouses()) {
                if (this.client.getLocalPlayer().getInteracting() != targetPlayer && !isSafeLineArea() && Players.search().interactingWith((Actor) targetPlayer).isEmpty() && !isAtHouses()) {
                    MousePackets.queueClickPacket();
                    PlayerPackets.queuePlayerAction(targetPlayer, new String[]{"Attack"});
                    EthanApiPlugin.sendClientMessage("Attacking");
                    return;
                }

            }
            if (!this.config.trollMode() && !this.config.KillUrselfMode() && !this.config.Dragmode() && !this.config.Hallydrag()) {
                if (!this.ragArea.contains(localPlayer.getWorldLocation()) && localIsInsideClanWars() && !isLocalBeingAttacked() && targetPlayer == null) {
                    this.timeout = 10;
                    walkUpGang();
                    EthanApiPlugin.sendClientMessage("RETURNING to combat area");
                }
                if (isSafeLineArea()) {
                    RandomUtils.nextInt(3, 7);
                    walkUpGang();
                    return;
                }

                if (!localIsInsideArena()) {
                    if (EthanApiPlugin.isMoving())
                        return;
                    goal.ifPresent(g -> {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(g);
                    });
                    return;
                }
                if (!isSafeLineArea() && !Players.search().interactingWith((Actor)localPlayer).withName(targetPlayer.getName()).isEmpty()) {
                    Player attacker = Players.search().interactingWithLocal().first().orElseThrow();
                    if (this.client.getLocalPlayer().getInteracting() != attacker) {
                        MousePackets.queueClickPacket();
                        EthanApiPlugin.sendClientMessage("Attacked by someone");
                        PlayerInteractionHelper.interact(attacker, new String[] { "Attack" });
                    }
                    return;
                }
                if (!isLocalBeingAttacked() && !isSafeLineArea() && !isAtHouses()) {
                    if (targetPlayer != null && targetPlayer.getHealthRatio() >= -1) {
                        MousePackets.queueClickPacket();
                        PlayerPackets.queuePlayerAction(targetPlayer, new String[] { "Attack" });
                        EthanApiPlugin.sendClientMessage("Attacking");
                        return;
                    }
                    if ((!isLocalBeingAttacked() && !isInCombatArea() && !this.client.getLocalPlayer().isInteracting()) || isAtHouses((Actor)targetPlayer)) {
                        MousePackets.queueClickPacket();
                        MovementPackets.queueMovement(getRandomPointInArea(this.ragArea));
                    }
                }
            }
        }
    }
}
Editor is loading...