ULTIMATE GUIDE

LoG iN

Join the forum, it's quick and easy

ULTIMATE GUIDE

LoG iN

ULTIMATE GUIDE

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ULTIMATE GUIDE


    FoulFighter

    avatar
    Turk4life321
    Admin


    Posts : 41
    Join date : 2009-08-09
    Location : In Saims Room *cough*

    FoulFighter Empty FoulFighter

    Post  Turk4life321 Fri Jan 01, 2010 4:53 am

    import java.awt.Color;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Rectangle;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.Map;

    import javax.swing.DefaultListModel;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    import javax.swing.SwingConstants;
    import javax.swing.border.EmptyBorder;
    import javax.swing.border.LineBorder;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;

    import org.rsbot.bot.Bot;
    import org.rsbot.bot.input.CanvasWrapper;
    import org.rsbot.event.events.ServerMessageEvent;
    import org.rsbot.event.listeners.PaintListener;
    import org.rsbot.event.listeners.ServerMessageListener;
    import org.rsbot.script.Constants;
    import org.rsbot.script.Script;
    import org.rsbot.script.ScriptManifest;
    import org.rsbot.script.Skills;
    import org.rsbot.script.wrappers.RSInterfaceComponent;
    import org.rsbot.script.wrappers.RSItemTile;
    import org.rsbot.script.wrappers.RSNPC;
    import org.rsbot.script.wrappers.RSTile;


    @ScriptManifest(authors = {"Foulwerp"}, category = "Combat", name = "FoulFighter", version = 1.51, description = "Settings In GUI")
    public class FoulFighter extends Script implements PaintListener, ServerMessageListener {

    /*
    * Credits to Ruski for Food ID's
    */
    final int[] FOODID = {1895, 1893, 1891, 4293, 2142, 291, 2140, 3228, 9980,
    7223, 6297, 6293, 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343,
    1861, 13433, 315, 325, 319, 3144, 347, 355, 333, 339, 351, 329,
    3381, 361, 10136, 5003, 379, 365, 373, 7946, 385, 397, 391, 3369,
    3371, 3373, 2309, 2325, 2333, 2327, 2331, 2323, 2335, 7178, 7180,
    7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2003, 2011, 2289,
    2291, 2293, 2295, 2297, 2299, 2301, 2303, 1891, 1893, 1895, 1897,
    1899, 1901, 7072, 7062, 7078, 7064, 7084, 7082, 7066, 7068, 1942,
    6701, 6703, 7054, 6705, 7056, 7060, 2130, 1985, 1993, 1989, 1978,
    5763, 5765, 1913, 5747, 1905, 5739, 1909, 5743, 1907, 1911, 5745,
    2955, 5749, 5751, 5753, 5755, 5757, 5759, 5761, 2084, 2034, 2048,
    2036, 2217, 2213, 2205, 2209, 2054, 2040, 2080, 2277, 2225, 2255,
    2221, 2253, 2219, 2281, 2227, 2223, 2191, 2233, 2092, 2032, 2074,
    2030, 2281, 2235, 2064, 2028, 2187, 2185, 2229, 6883, 1971, 4608,
    1883, 1885, 15272};
    private final int[] clueIDs = new int[]{2677, 2678, 2679, 2680, 2681,
    2682, 2683, 2684, 2685, 2686, 2687, 2688, 2689, 2690, 2692, 2693,
    2694, 2695, 2696, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704,
    2705, 2706, 2707, 2708, 2709, 2710, 2711, 2712, 2713, 2716, 2719,
    2722, 2723, 2725, 2727, 2729, 2731, 2733, 2735, 2737, 2739, 2741,
    2743, 2745, 2747, 2773, 2774, 2776, 2778, 2780, 2782, 2783, 2785,
    2786, 2788, 2790, 2792, 2793, 2794, 2796, 2797, 2799, 2801, 2803,
    2805, 2807, 2809, 2811, 2813, 2815, 2817, 2819, 2821, 2823, 2825,
    2827, 2829, 2831, 2833, 2835, 2837, 2839, 2841, 2843, 2845, 2847,
    2848, 2849, 2851, 2853, 2855, 2856, 2857, 2858, 3490, 3491, 3492,
    3493, 3494, 3495, 3496, 3497, 3498, 3499, 3500, 3501, 3502, 3503,
    3504, 3505, 3506, 3507, 3508, 3509, 3510, 3512, 3513, 3514, 3515,
    3516, 3518, 3520, 3522, 3524, 3525, 3526, 3528, 3530, 3532, 3534,
    3536, 3538, 3540, 3542, 3544, 3546, 3548, 3550, 3552, 3554, 3556,
    3558, 3560, 3562, 3564, 3566, 3568, 3570, 3572, 3573, 3574, 3575,
    3577, 3579, 3580, 3582, 3584, 3586, 3588, 3590, 3592, 3594, 3596,
    3598, 3598, 3599, 3601, 3602, 3604, 3605, 3607, 3609, 3610, 3611,
    3612, 3613, 3614, 3615, 3616, 3617, 3618, 7236, 7238, 7239, 7241,
    7243, 7245, 7247, 7248, 7249, 7250, 7251, 7252, 7253, 7254, 7255,
    7256, 7258, 7260, 7262, 7264, 7266, 7268, 7270, 7272, 7274, 7276,
    7278, 7280, 7282, 7284, 7286, 7288, 7290, 7292, 7294, 7296, 7298,
    7300, 7301, 7303, 7304, 7305, 7307, 7309, 7311, 7313, 7315, 7317,
    10180, 10182, 10184, 10186, 10188, 10190, 10192, 10194, 10196,
    10198, 10200, 10202, 10204, 10206, 10208, 10210, 10212, 10214,
    10216, 10218, 10220, 10222, 10224, 10226, 10228, 10230, 10232,
    10234, 10236, 10238, 10240, 10242, 10244, 10246, 10248, 10250,
    10252, 10254, 10256, 10258, 10260, 10262, 10264, 10266, 10268,
    10270, 10272, 10274, 10276, 10278, 13010, 13012, 13014, 13016,
    13018, 13020, 13022, 13024, 13026, 13028, 13030, 13032, 13034,
    13036, 13038, 13040, 13041, 13042, 13044, 13046, 13048, 13049,
    13050, 13051, 13053, 13055, 13056, 13058, 13060, 13061, 13063,
    13065, 13067, 13068, 13069, 13070, 13071, 13072, 13074, 13075,
    13076, 13078, 13079, 13080, 13058, 13060, 13061, 13063, 13065,
    13067, 13068, 13069, 13070, 13071, 13072, 13074, 13075, 13076,
    13078, 13079, 13080};

    final int[] PBONES = {526, 532, 530, 528, 3183, 2859};
    final int[] BBONES = {526, 532, 530, 528, 3183, 2859};
    final int[] FRUNES = {554, 4694, 4699, 4697};
    int[] CHARMS = {12158, 12159, 12160, 12163};
    int[] FSTAFFS = {1387, 1401, 1393, 3054, 3053, 11738, 11736};
    final int[] SPOT = {113, 115, 117, 119, 2440, 157, 159, 161, 9739, 9741, 9743, 9745};
    final int[] DPOT = {2442, 163, 165, 167, 137, 135, 133, 2432};
    final int[] APOT = {2436, 145, 147, 149, 2428, 121, 123, 125, 9739, 9741, 9743, 9745};
    final int[] BPTAB = {8015};
    public int[] itemids = {};
    public String[] itemnames = {};
    public int[] alchable = {};
    public int[] NPCID = {};
    public int startExp[] = null;
    public int spec;
    public boolean useFood = false;
    public boolean useBTP = false;
    public boolean buryBones = false;
    public boolean charms = false;
    public boolean clue = false;
    public boolean ePickup = false;
    public boolean attack = false;
    public boolean strength = false;
    public boolean defence = false;
    public boolean usepotion = false;
    public boolean paint = true;
    RSNPC Npc;
    RSNPC npc;
    RSNPC cNPC;
    long start;
    FoulFighterGUI gui;

    public double getVersion() {
    return 1.51;
    }

    public int slayerLeft() {
    return getSetting(394);
    }

    @Override
    public boolean onStart(Map<String, String> s) {
    start = System.currentTimeMillis();
    gui = new FoulFighterGUI();
    while (gui.isVisible()) {
    wait(random(100, 500));
    }
    for (int i = 0; i < itemids.length; i++) {
    log(itemids[i]+","+itemnames[i]);
    }
    startExp = new int[20];
    for (int i = 0; i < 20; i++) {
    startExp[i] = skills.getCurrentSkillExp(i);
    }
    return true;
    }

    public int loop() {
    if (!isLoggedIn()) {
    return random(200, 700);
    }
    if (!isRunning() && getEnergy() > random(50, 75)) {
    setRun(true);
    wait(random(400, 800));
    }
    if (useBTP) {
    if (getInventoryCount(BPTAB) != 0) {
    if (getInventoryCount(FOODID) == 0 && getInventoryCount(PBONES) != 0) {
    if (getCurrentTab() != TAB_INVENTORY)
    openTab(TAB_INVENTORY);
    wait(random(300, 500));
    doInventoryItem(BPTAB, "Break");
    if (waitForAnim(1500) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(1250, 1500));
    }
    log("Used a Bones to Peaches Tab!");
    }
    }
    }
    if (useFood) {
    if (skills.getCurrentSkillLevel(STAT_HITPOINTS) <= random(skills.getRealSkillLevel(STAT_HITPOINTS) / 2, skills.getRealSkillLevel(STAT_HITPOINTS) / 1.5)) {
    if (getInventoryCount(FOODID) != 0) {
    if (getCurrentTab() != TAB_INVENTORY)
    openTab(TAB_INVENTORY);
    wait(random(400, 600));
    doInventoryItem(FOODID, "Eat");
    if (waitForAnim(829) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(300, 600));
    if (getInteractingNPC() != null) {
    atNPC(getInteractingNPC(),"Attack");
    if (waitToMove(750)) {
    while (getMyPlayer().isMoving()) {
    wait(random(20,30));
    }
    }
    }
    }
    } else {
    if (getInventoryCount(FOODID) == 0 && isLoggedIn()) {
    if (useBTP) {
    if (getInventoryCount(BPTAB) == 0) {
    log("Out of Bones to Peaches Tabs! Stopping Script!");
    stopScript();
    } else {
    if (getInventoryCount(PBONES) == 0) {
    log("Out of Bones for Bones to Peaches! Stopping Script!");
    stopScript();
    } else {
    if (getInventoryCount(BPTAB) != 0) {
    if (getInventoryCount(FOODID) == 0 && getInventoryCount(PBONES) != 0) {
    if (getCurrentTab() != TAB_INVENTORY)
    openTab(TAB_INVENTORY);
    wait(random(300, 500));
    doInventoryItem(BPTAB, "Break");
    if (waitForAnim(1500) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(1250, 1500));
    }
    log("Used a Bones to Peaches Tab!");
    }
    }
    }
    }
    } else {
    log("Out of Food! Stopping Script!");
    stopScript();
    }
    }
    }
    }
    }
    RSItemTile tile;
    for (int i = 0; i < itemids.length; i++) {
    while ((tile = getGroundItemByID(itemids[i])) != null) {
    if (!tileOnScreen(tile)) {
    break;
    }
    if (getMyPlayer().getInteracting() != null) {
    break;
    }
    if (isInventoryFull()) {
    if (getInventoryCount(tile.getItem().getID()) == 0 || getInventoryItemByID(tile.getItem().getID()).getStackSize() == 1 ) {
    if (buryBones && getInventoryCount(BBONES) > 0) {
    doInventoryItem(BBONES, "Bury");
    wait(random(1000, 1500));
    } else {
    if (useBTP && getInventoryCount(PBONES) > 0) {
    doInventoryItem(PBONES, "Drop");
    wait(random(750, 1000));
    } else {
    if (useFood && getInventoryCount(FOODID) > 0) {
    doInventoryItem(FOODID, "Eat");
    wait(random(750, 1000));
    } else {
    break;
    }
    }
    }
    }
    }
    String action2 = "Take " + itemnames[i];
    atTile(tile, action2);
    waitToMove(1000);
    while (getMyPlayer().isMoving())
    wait(random(20, 60));
    }
    }
    if (clue) {
    RSItemTile tileclue;
    while ((tileclue = getGroundItemByID(clueIDs)) != null) {
    if (!tileOnScreen(tileclue)) {
    break;
    }
    if (getMyPlayer().getInteracting() != null) {
    break;
    }
    if (isInventoryFull()) {
    if (getInventoryCount(tileclue.getItem().getID()) == 0) {
    if (buryBones && getInventoryCount(BBONES) > 0) {
    doInventoryItem(BBONES, "Bury");
    wait(random(1000, 1500));
    } else {
    if (useBTP && getInventoryCount(PBONES) > 0) {
    doInventoryItem(PBONES, "Drop");
    wait(random(750, 1000));
    } else {
    if (useFood && getInventoryCount(FOODID) > 0) {
    doInventoryItem(FOODID, "Eat");
    wait(random(750, 1000));
    } else {
    break;
    }
    }
    }
    }
    String action2 = "Take Clue";
    atTile(tileclue, action2);
    waitToMove(1000);
    while (getMyPlayer().isMoving())
    wait(random(20, 60));
    }
    }
    }
    if (charms) {
    while ((tile = getGroundItemByID(CHARMS)) != null) {
    if (!tileOnScreen(tile)) {
    break;
    }
    if (getMyPlayer().getInteracting() != null) {
    break;
    }
    if (isInventoryFull() && getInventoryCount(tile.getItem().getID()) == 0) {
    if (buryBones && getInventoryCount(BBONES) > 0) {
    doInventoryItem(BBONES, "Bury");
    wait(random(1000, 1500));
    } else {
    if (useBTP && getInventoryCount(PBONES) > 0) {
    doInventoryItem(PBONES, "Drop");
    wait(random(750, 1000));
    } else {
    if (useFood && getInventoryCount(FOODID) > 0) {
    doInventoryItem(FOODID, "Eat");
    wait(random(750, 1000));
    } else {
    break;
    }
    }
    }
    }
    String action2 = "charm";
    atTile(tile, action2);
    waitToMove(1000);
    while (getMyPlayer().isMoving())
    wait(random(20, 60));
    }
    }
    if (buryBones || useBTP) {
    if (getInventoryCount(BBONES) != 0 && getInventoryCount() >= 27) {
    doInventoryItem(BBONES, "Drop");
    wait(random(300, 500));
    }
    RSItemTile tile3;
    while ((tile3 = getNearestGroundItemByID(PBONES)) != null) {
    if (getInventoryCount() >= 26) {
    break;
    }
    if (!tileOnScreen(tile3)) {
    break;
    }
    if (getMyPlayer().getInteracting() != null) {
    break;
    }
    if (getInteractingNPC() != null) {
    atNPC(getInteractingNPC(), "Attack");
    wait (random (300, 600));
    }
    String action = "ones";
    atTile(tile3, action);
    waitToMove(1000);
    while (getMyPlayer().isMoving())
    wait(random(20, 60));
    }
    }
    while (getInventoryCount(alchable) > 0 && getInteractingNPC() == null) {
    if (getInventoryCount(561) >= 1 && getInventoryCount(FRUNES) >= 5) {
    if (getCurrentTab() != Constants.TAB_MAGIC)
    openTab(Constants.TAB_MAGIC);
    wait(random(500, 750));
    castSpell(Constants.SPELL_HIGH_LEVEL_ALCHEMY);
    doInventoryItem(alchable, "Cast");
    if (waitForAnim(713) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(750, 1000));
    }
    } else {
    break;
    }
    }
    if (buryBones) {
    if (getInventoryCount() >= 26) {
    if (getMyPlayer().getInteracting() == null && getInteractingNPC() == null) {
    while (getInventoryCount(BBONES) != 0) {
    if (doInventoryItem(BBONES, "Bury")) {
    if (waitForAnim(300) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(100, 300));
    }
    }
    }
    log("Bury Bones Complete!");
    }
    }
    }
    if (usepotion && getMyPlayer().getInteracting() == null) {
    if (strength) {
    if (skills.getCurrentSkillLevel(STAT_STRENGTH) <= skills.getRealSkillLevel(STAT_STRENGTH) + random(3, 5)) {
    if (getInventoryCount(SPOT) != 0) {
    if (getCurrentTab() != TAB_INVENTORY)
    openTab(TAB_INVENTORY);
    doInventoryItem(SPOT, "Drink");
    if (waitForAnim(829) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(100, 300));
    }
    }
    }
    }
    if (defence) {
    if (skills.getCurrentSkillLevel(STAT_DEFENSE) <= skills.getRealSkillLevel(STAT_DEFENSE) + random(3, 5)) {
    if (getInventoryCount(DPOT) != 0) {
    if (getCurrentTab() != TAB_INVENTORY)
    openTab(TAB_INVENTORY);
    doInventoryItem(DPOT, "Drink");
    if (waitForAnim(829) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(100, 300));
    }
    }
    }
    }
    if (attack) {
    if (skills.getCurrentSkillLevel(STAT_ATTACK) <= skills.getRealSkillLevel(STAT_ATTACK) + random(3, 5)) {
    if (getInventoryCount(APOT) != 0) {
    if (getCurrentTab() != TAB_INVENTORY)
    openTab(TAB_INVENTORY);
    doInventoryItem(APOT, "Drink");
    if (waitForAnim(829) != -1) {
    while (getMyPlayer().getAnimation() != -1)
    wait(random(100, 300));
    }
    }
    }
    }
    if (getInventoryCount(229) != 0) {
    atInventoryItem(229, "Drop");
    }
    }
    Npc = getNearestFreeNPCToAttackByID(NPCID);
    if (Npc == null) {
    return antiban();
    }
    if (!pointOnScreen(Npc.getScreenLocation()) && getMyPlayer().getInteracting() == null) {
    walkToNpc();
    }
    if (pointOnScreen(Npc.getScreenLocation()) && getMyPlayer().getInteracting() == null) {
    atNPC(Npc, "Attack " + Npc.getName());
    if (waitToMove(1000)) {
    while (getMyPlayer().isMoving()) {
    wait(random(100, 300));
    }
    }
    } else {
    return antiban();
    }
    return random(100, 300);
    }

    public int antiban() {
    int i = random(0, 20);
    if (i == 2) {
    moveMouse(random(0, CanvasWrapper.getGameWidth()), random(0,
    CanvasWrapper.getGameHeight()));
    return random(0, 400);
    } else if (i == 3 || i == 12) {
    char dir = 37;
    if (random(0, 3) == 2)
    dir = 39;
    Bot.getInputManager().pressKey(dir);
    wait(random(500, 2000));
    Bot.getInputManager().releaseKey(dir);
    return random(0, 500);
    } else if (i == 7 || i == 4) {
    setCameraAltitude(random(35, 150));
    return random(0, 500);
    } else if (i == 5 || i == 10 || i == 11 || i == 13 || i == 18) {
    moveMouseRandomly(random(-4, 4));
    } else if (i == 1 || i == 8 || i == 15 || i == 20) {
    Thread camera = new Thread() {
    @Override
    public void run() {
    char dir = 37;
    if (random(0, 3) == 2)
    dir = 39;
    Bot.getInputManager().pressKey(dir);
    try {
    Thread.sleep(random(500, 2000));
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    Bot.getInputManager().releaseKey(dir);
    }
    };
    Thread mouse = new Thread() {
    @Override
    public void run() {
    moveMouse(random(0, CanvasWrapper.getGameWidth()), random(0,
    CanvasWrapper.getGameHeight()));
    }
    };
    if (i == 7 || i == 20) {
    camera.start();
    }
    if (i == 1) {
    mouse.start();
    }
    while (camera.isAlive() || mouse.isAlive())
    wait(random(100, 300));
    return random(300, 700);
    }
    return random(1000, 2000);
    }

    @Override
    public int getMouseSpeed() {
    return 6;
    }


    public void moveMouse(Rectangle r) {
    int x = (r.x + 1) + random(0, r.width - 1);
    int y = (r.y + 1) + random(0, r.height - 1);
    moveMouse(x, y);
    }

    public boolean menuContains(String item) {
    try {
    for (String s : getMenuItems()) {
    if (s.toLowerCase().contains(item.toLowerCase()))
    return true;
    }
    } catch (Exception e) {
    return menuContains(item);
    }
    return false;
    }

    public boolean isItemSelected() {
    for (RSInterfaceComponent com : getInventoryInterface().getComponents()) {
    if (com.getBorderThickness() == 2)
    return true;
    }
    return false;
    }

    public boolean doInventoryItem(int[] ids, String action) {
    ArrayList<RSInterfaceComponent> possible = new ArrayList<RSInterfaceComponent>();
    for (RSInterfaceComponent com : getInventoryInterface().getComponents()) {
    for (int i : ids) {
    if (i == com.getComponentID())
    possible.add(com);
    }
    }
    if (possible.size() == 0)
    return false;
    RSInterfaceComponent winner = possible.get(random(0,
    possible.size() - 1));
    Rectangle loc = winner.getArea();
    moveMouse(loc);
    String top = getMenuItems().get(0).toLowerCase();
    if (isItemSelected()) {
    moveMouse(random(0, 492), random(340, 450));
    clickMouse(true);
    wait(random(300, 600));
    }
    if (top.contains(action.toLowerCase())) {
    clickMouse(true);
    return true;
    } else if (menuContains(action)) {
    wait(random(400, 700));
    return atMenu(action);
    }
    return false;
    }

    public RSNPC getInteractingNPC() {
    final int[] validNPCs = Bot.getClient().getRSNPCIndexArray();
    final org.rsbot.accessors.RSNPC[] npcs = Bot.getClient()
    .getRSNPCArray();

    for (final int element : validNPCs) {
    if (npcs[element] == null) {
    continue;
    }
    final RSNPC Monster = new RSNPC(npcs[element]);
    if (Monster.getInteracting() != null) {
    if (Monster.getInteracting().equals(getMyPlayer())) {
    return Monster;
    }
    }
    }
    try {
    Thread.sleep(300);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    return null;
    }

    public void serverMessageRecieved(ServerMessageEvent arg0) {
    String serverString = arg0.getMessage();
    if (serverString.contains("You've just") || serverString.contains("Congratulations")) {
    log("You just advanced a level, attempting to click continue!");
    wait(random(1500, 2500));
    if (canContinue())
    clickContinue();
    }
    }

    public void walkToNpc() {
    int ran = random(0, 2);
    int pX = getMyPlayer().getLocation().getX();
    int pY = getMyPlayer().getLocation().getY();
    int mX = Npc.getLocation().getX();
    int mY = Npc.getLocation().getY();
    int pmX = (((pX + mX) / 2) + ran);
    int pmY = (((pY + mY) / 2) + ran);
    RSTile loc = new RSTile(pmX, pmY).randomizeTile(2, 2);
    Npc = getNearestFreeNPCToAttackByID(NPCID);
    if (distanceTo(Npc.getLocation()) <= 10 && tileOnScreen(loc)) {
    atTile(loc, "Walk");
    if (waitToMove(600)) {
    while (getMyPlayer().isMoving() && !tileOnScreen(Npc.getLocation().randomizeTile(2, 2)))
    wait(random(20, 30));
    }
    } else {
    if (!tileOnScreen(loc) && tileOnMap(loc)) {
    walkTileMM(Npc.getLocation().randomizeTile(2, 2));
    if (waitToMove(600)) {
    while (getMyPlayer().isMoving() && !pointOnScreen(Npc.getScreenLocation()))
    wait(random(20, 30));
    }
    } else {
    return;
    }
    }
    }

    public void onRepaint(Graphics g) {
    if (paint) {
    int x = 0;
    int y = 0;
    long millis = System.currentTimeMillis() - start;
    final long hours = millis / (1000 * 60 * 60);
    millis -= hours * 1000 * 60 * 60;
    final long minutes = millis / (1000 * 60);
    millis -= minutes * 1000 * 60;
    final long seconds = millis / 1000;
    paintBar(g, x, y, "FoulFighter Time Running : " + hours + ":" + minutes
    + ":" + seconds);
    String ver = Double.toString(getVersion());
    if (slayerLeft() != 0) {
    String sl = Integer.toString(slayerLeft());
    g.drawString("Left of Task: " + sl, 240, y + 13);
    }
    g.drawString("Version " + ver, 436, y + 13);
    y += 15;
    for (int i = 0; i < 7; i++) {
    if (startExp != null
    && (skills.getCurrentSkillExp(i) - startExp[i]) > 0) {
    paintSkillBar(g, x, y, i, startExp[i]);
    y += 15;
    }
    }
    if (startExp != null && (skills.getCurrentSkillExp(18) - startExp[18] > 0)) {
    paintSkillBar(g, x, y, 18, startExp[18]);
    y += 15;
    }
    }
    }

    public void paintSkillBar(Graphics g, int x, int y, int skill, int start) {
    if (paint) {
    g.setFont(new Font("Century Gothic", Font.PLAIN, 13));
    int gained = (skills.getCurrentSkillExp(skill) - start);
    String s = SkillToString(skill) + " Exp Gained: " + gained;
    String firstLetter = s.substring(0, 1); // Get first letter
    String remainder = s.substring(1); // Get remainder of word.
    String capitalized = firstLetter.toUpperCase() + remainder;
    String exp = Integer.toString(skills.getXPToNextLevel(skill));
    g.setColor(new Color(255, 0, 0, 90));
    g.fillRoundRect(416, y + 3, 100, 9, 10, 10);
    g.setColor(Color.BLACK);
    g.drawRoundRect(416, y + 3, 100, 9, 10, 10);
    g.setColor(new Color(0, 255, 0, 255));
    g.fillRoundRect(416, y + 3, skills.getPercentToNextLevel(skill), 9, 10, 10);
    g.setColor(Color.BLACK);
    g.drawRoundRect(416, y + 3, skills.getPercentToNextLevel(skill), 9, 10, 10);
    g.setColor(new Color(0, 200, 255));
    paintBar(g, x, y, capitalized);
    g.drawString("Exp To Level: " + exp, 240, y + 13);
    }
    }

    public void paintBar(Graphics g, int x, int y, String s) {
    g.setFont(new Font("Century Gothic", Font.PLAIN, 13));
    int width = 516;
    int height = (int) g.getFontMetrics().getStringBounds(s, g).getHeight();
    g.setColor(Color.BLACK);
    g.drawRect(0, y, width, height);

    g.setColor(new Color(0, 0, 0, 90));
    g.fillRect(0, y, width, height);

    g.setColor(new Color(255, 255, 255));
    g.drawString(s, x + 7, y + height - 2);
    }

    public String SkillToString(int skill) {
    return Skills.statsArray[skill];
    }

    class FoulFighterGUI extends JFrame implements ListSelectionListener,
    ActionListener {
    /**
    *
    */
    private static final long serialVersionUID = 1L;
    private DefaultListModel model;
    private DefaultListModel model1;
    private DefaultListModel model2;
    private DefaultListModel model3;
    private JPanel contentPane;
    private JTextField txtItemId;
    private JTextField txtAlchable;
    private JTextField txtItemName;
    private JList list;
    private JList list_1;
    private JList list_2;
    private JList list_4;
    private JButton btnStartScript;
    private JButton btnAdd;
    private JButton btnAdd2;
    private JButton btnLoad;
    private JScrollPane scrollPane;
    private JScrollPane scrollPane_1;
    private JScrollPane scrollPane_2;
    private JCheckBox chckbxUseFood;
    private JCheckBox chckbxuseBonesToPeaches;
    private JCheckBox chckbxBuryBones;
    private JCheckBox chckbxCharms;
    private JCheckBox chckbxClue;
    private JCheckBox chckbxUsePotion;
    private JCheckBox chckbxStrength;
    private JCheckBox chckbxDefence;
    private JCheckBox chckbxAttack;
    private JCheckBox chckbxPaint;
    private JLabel MobsInArea;
    private JLabel MobsToAttack;
    private JLabel ItemPickup;
    private JLabel AddItem;
    private JLabel Alch;
    private JLabel AddAlch;
    private JLabel AddNote;

    /**
    * Create the frame.
    */
    public FoulFighterGUI() {
    setTitle("FoulFighter");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 450, 450);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    {
    JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP);
    tabbedPane.setBounds(10, 10, 414, 354);
    contentPane.add(tabbedPane);
    {
    JPanel panel = new JPanel();
    tabbedPane.addTab("Fighting", null, panel, null);
    panel.setLayout(null);
    {
    model = new DefaultListModel();
    {
    MobsToAttack = new JLabel();
    MobsToAttack.setBounds(10, 150, 390, 9);
    MobsToAttack.setText("These are the NPC's you will attack. Click a NPC to remove it from the attack list");
    panel.add(MobsToAttack);
    scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 160, 390, 125);
    panel.add(scrollPane);
    list_1 = new JList(model);
    scrollPane.setViewportView(list_1);
    list_1.addListSelectionListener(this);
    list_1.setBorder(new LineBorder(new Color(0, 0, 0)));
    }
    }
    {
    model1 = new DefaultListModel();
    {
    MobsInArea = new JLabel();
    MobsInArea.setBounds(10, 10, 390, 9);
    MobsInArea.setText("These are the NPC's in your area. Click a NPC to add it to the attack list");
    panel.add(MobsInArea);
    scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(10, 20, 390, 125);
    panel.add(scrollPane_1);
    list_2 = new JList(model1);
    scrollPane_1.setViewportView(list_2);
    list_2.addListSelectionListener(this);
    list_2.setBorder(new LineBorder(new Color(0, 0, 0)));
    }
    }
    {
    chckbxUseFood = new JCheckBox("Eat Food (Eats when your HP is between HPLvl/2 and HPLvl/1.5)");
    chckbxUseFood.setBounds(10, 300, 390, 13);
    panel.add(chckbxUseFood);
    }
    }
    {
    JPanel panel = new JPanel();
    tabbedPane.addTab("Items", null, panel, null);
    panel.setLayout(null);
    {
    scrollPane_2 = new JScrollPane();
    model2 = new DefaultListModel();
    ItemPickup = new JLabel();
    ItemPickup.setBounds(10, 7, 390, 12);
    ItemPickup.setText("These Items are to be picked up. Click an Item to remove it from the pickup list");
    panel.add(ItemPickup);
    list = new JList(model2);
    list.setBorder(new LineBorder(new Color(0, 0, 0)));
    scrollPane_2.setBounds(10, 20, 390, 125);
    panel.add(scrollPane_2);
    scrollPane_2.setViewportView(list);
    list.addListSelectionListener(this);
    }
    {
    AddItem = new JLabel();
    AddItem.setBounds(10, 150, 100, 12);
    AddItem.setText("Item ID");
    panel.add(AddItem);
    }
    {
    AddItem = new JLabel();
    AddItem.setBounds(130, 150, 100, 12);
    AddItem.setText("Item Name");
    panel.add(AddItem);
    }
    {
    btnAdd = new JButton("Add");
    btnAdd.addActionListener(this);
    btnAdd.setBounds(230, 163, 79, 23);
    panel.add(btnAdd);
    }
    {
    btnLoad = new JButton("Load");
    btnLoad.addActionListener(this);
    btnLoad.setBounds(319, 163, 79, 23);
    panel.add(btnLoad);
    }
    {
    txtItemId = new JTextField();
    txtItemId.setBounds(10, 163, 100, 19);
    panel.add(txtItemId);
    txtItemId.setColumns(20);
    }
    {
    txtItemName = new JTextField();
    txtItemName.setBounds(120, 163, 100, 19);
    panel.add(txtItemName);
    txtItemName.setColumns(20);
    }
    {
    chckbxBuryBones = new JCheckBox("Bury Bones (Will bury when inventory is full)");
    chckbxBuryBones.addActionListener(this);
    chckbxBuryBones.setBounds(10, 217, 390, 13);
    panel.add(chckbxBuryBones);
    }
    {
    chckbxCharms = new JCheckBox("Pickup Charms (Gold, Green, Crimson, Blue)");
    chckbxCharms.addActionListener(this);
    chckbxCharms.setBounds(10, 188, 390, 13);
    panel.add(chckbxCharms);
    }
    {
    chckbxuseBonesToPeaches = new JCheckBox("Bones to Peaches (Uses tab when out of food)");
    chckbxuseBonesToPeaches.addActionListener(this);
    chckbxuseBonesToPeaches.setBounds(10, 247, 390, 13);
    panel.add(chckbxuseBonesToPeaches);
    }
    {
    chckbxClue = new JCheckBox("Pickup Clue Scrolls");
    chckbxClue.addActionListener(this);
    chckbxClue.setBounds(10, 276, 390, 13);
    panel.add(chckbxClue);
    }
    }
    {
    JPanel panel = new JPanel();
    tabbedPane.addTab("Alch Items", null, panel, null);
    panel.setLayout(null);
    {
    model3 = new DefaultListModel();
    Alch = new JLabel();
    Alch.setBounds(10, 7, 380, 12);
    Alch.setText("These are the Items you will cast high alch on if in your inventory");
    panel.add(Alch);
    list_4 = new JList(model3);
    list_4.setBorder(new LineBorder(new Color(0, 0, 0)));
    list_4.setBounds(10, 20, 390, 125);
    panel.add(list_4);
    list_4.addListSelectionListener(this);
    }
    {
    btnAdd2 = new JButton("Add");
    btnAdd2.addActionListener(this);
    btnAdd2.setBounds(180, 163, 89, 23);
    panel.add(btnAdd2);
    }
    {
    AddAlch = new JLabel();
    AddAlch.setBounds(10, 150, 390, 12);
    AddAlch.setText("If adding an item to alch only add the items ID, item name is not needed");
    panel.add(AddAlch);
    }
    {
    txtAlchable = new JTextField();
    txtAlchable.setBounds(10, 163, 150, 19);
    panel.add(txtAlchable);
    txtAlchable.setColumns(20);
    }
    {
    AddNote = new JLabel();
    AddNote.setBounds(10, 200, 390, 12);
    AddNote.setText("Note: High Alching currently only works with runes does not support staffs");
    panel.add(AddNote);
    }
    }
    {
    JPanel panel = new JPanel();
    tabbedPane.addTab("Potions", null, panel, null);
    panel.setLayout(null);
    {
    chckbxUsePotion = new JCheckBox("Use Potions");
    chckbxUsePotion.addActionListener(this);
    chckbxUsePotion.setBounds(10, 10, 390, 13);
    panel.add(chckbxUsePotion);
    }
    {
    chckbxStrength = new JCheckBox("Strength Potions (Super, Regular or Combat)");
    chckbxStrength.addActionListener(this);
    chckbxStrength.setBounds(30, 50, 370, 13);
    panel.add(chckbxStrength);
    }
    {
    chckbxAttack = new JCheckBox("Attack Potion (Super, Regular or Combat)");
    chckbxAttack.addActionListener(this);
    chckbxAttack.setBounds(30, 70, 370, 13);
    panel.add(chckbxAttack);
    }
    {
    chckbxDefence = new JCheckBox("Defence Potion (Super and Regular)");
    chckbxDefence.addActionListener(this);
    chckbxDefence.setBounds(30, 90, 370, 13);
    panel.add(chckbxDefence);
    }
    {
    btnStartScript = new JButton("Start Script");
    btnStartScript.addActionListener(this);
    btnStartScript.setBounds(10, 375, 414, 23);
    contentPane.add(btnStartScript);
    }
    }
    {
    JPanel panel = new JPanel();
    tabbedPane.addTab("Other Options", null, panel, null);
    panel.setLayout(null);
    {
    chckbxPaint = new JCheckBox("Disable Paint");
    chckbxPaint.addActionListener(this);
    chckbxPaint.setBounds(10, 10, 390, 13);
    panel.add(chckbxPaint);
    }
    setVisible(true);
    npcupdater.start();
    }
    }
    }

    public void valueChanged(final ListSelectionEvent arg0) {
    if (arg0.getSource() == list) {
    String i = (String) list.getSelectedValue();
    if (i == null)
    return;
    model2.remove(list.getSelectedIndex());
    }
    if (arg0.getSource() == list_2) {
    String text = (String) list_2.getSelectedValue();
    if (text == null || text.isEmpty())
    return;
    model.addElement(text);
    model1.remove(list_2.getSelectedIndex());
    }
    if (arg0.getSource() == list_1) {
    String text = (String) list_1.getSelectedValue();
    if (text == null || text.isEmpty())
    return;
    model1.addElement(text);
    model.remove(list_1.getSelectedIndex());
    }
    if (arg0.getSource() == list_4) {
    Integer i = (Integer) list_4.getSelectedValue();
    if (i == null)
    return;
    model3.remove(list_4.getSelectedIndex());
    }
    }

    public void actionPerformed(final ActionEvent arg0) {
    if (arg0.getSource() == chckbxuseBonesToPeaches) {
    useBTP = chckbxuseBonesToPeaches.isSelected();
    }
    if (arg0.getSource() == chckbxBuryBones) {
    buryBones = chckbxBuryBones.isSelected();
    }
    if (arg0.getSource() == chckbxClue) {
    clue = chckbxClue.isSelected();
    }
    if (arg0.getSource() == chckbxPaint) {
    paint = !chckbxPaint.isSelected();
    }
    if (arg0.getSource() == chckbxUsePotion) {
    usepotion = chckbxUsePotion.isSelected();
    }
    if (arg0.getSource() == chckbxStrength) {
    strength = chckbxStrength.isSelected();
    }
    if (arg0.getSource() == chckbxDefence) {
    defence = chckbxDefence.isSelected();
    }
    if (arg0.getSource() == chckbxAttack) {
    attack = chckbxAttack.isSelected();
    }
    if (arg0.getSource() == chckbxCharms) {
    charms = chckbxCharms.isSelected();
    }
    if (arg0.getSource() == btnAdd) {
    // add food to list
    try {
    String s = (txtItemId.getText());
    String j = (txtItemName.getText());
    String firstLetter = j.substring(0, 1);
    String remainder = j.substring(1);
    String n = firstLetter.toUpperCase() + remainder.toLowerCase();
    model2.addElement(s+","+n);
    txtItemId.setText("");
    txtItemName.setText("");
    } catch (Exception ignored) {

    }
    }
    if (arg0.getSource() == btnAdd2) {
    try {
    int i = Integer.parseInt(txtAlchable.getText());
    model3.addElement(i);
    } catch (Exception ignored) {
    }
    }
    if (arg0.getSource() == btnLoad) {
    try {
    JFileChooser fc = new JFileChooser();
    if(fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
    BufferedReader in = new BufferedReader(new FileReader(fc.getSelectedFile().getPath()));
    String str;
    while ((str = in.readLine()) != null) {
    if (!model2.contains(str)) {
    String delims = "[,]";
    String[] tokens = str.split(delims);
    String s = (tokens[1]);
    String firstLetter = s.substring(0, 1);
    String remainder = s.substring(1);
    String cap = firstLetter.toUpperCase() + remainder.toLowerCase();
    model2.addElement(tokens[0]+","+cap);
    }
    }
    in.close();
    }
    } catch (IOException e) {
    }
    }
    if (arg0.getSource() == btnStartScript) {
    NPCID = new int[model.size()];
    for (int i = 0; i < model.getSize(); i++) {
    String idNameLevel = (String) model.get(i);
    String delims = "[ -]";
    String[] tokens = idNameLevel.split(delims);
    NPCID[i] = Integer.parseInt(tokens[0]);
    }
    itemids = new int[model2.size()];
    for (int i = 0; i < model2.getSize(); i++) {
    String delims = "[,]";
    String[] tokens = ((String) model2.get(i)).split(delims);
    int in = Integer.parseInt(tokens[0]);
    itemids[i] = in;
    }
    itemnames = new String[model2.size()];
    for (int i = 0; i < model2.getSize(); i++) {
    String delims = "[,]";
    String[] tokens = ((String) model2.get(i)).split(delims);
    itemnames[i] = tokens[1];
    }
    alchable = new int[model3.size()];
    for (int i = 0; i < model3.getSize(); i++) {
    int in = (Integer) model3.get(i);
    alchable[i] = in;
    log("Alching - " + alchable[i]);
    }
    useFood = chckbxUseFood.isSelected();
    dispose();
    }
    }

    Thread npcupdater = new Thread() {
    @Override
    public void run() {
    while (isVisible()) {
    final int[] validNPCs = Bot.getClient()
    .getRSNPCIndexArray();
    final org.rsbot.accessors.RSNPC[] npcs = Bot.getClient()
    .getRSNPCArray();

    for (final int element : validNPCs) {
    if (npcs[element] == null) {
    continue;
    }
    final RSNPC Monster = new RSNPC(npcs[element]);
    if (!model1.contains(Monster.getID() + " -" + " Name: " + Monster.getName() + " [" + Monster.getLevel() + "]")
    && !model.contains(Monster.getID() + " -" + " Name: " + Monster.getName() + " [" + Monster.getLevel() + "]") && Monster.getLevel() != 0)
    model1.add(model1.getSize(), Monster.getID() + " -" + " Name: " + Monster.getName() + " [" + Monster.getLevel() + "]");
    }
    try {
    Thread.sleep(300);
    } catch (InterruptedException e) {
    e.printStackTrace();
    }
    }
    }
    };
    }
    }

      Current date/time is Fri Mar 29, 2024 1:58 am