import org.rsbot.util.GlobalConfiguration; import org.rsbot.event.events.MessageEvent; import org.rsbot.event.listeners.MessageListener; import org.rsbot.event.listeners.PaintListener; import org.rsbot.script.Script; import org.rsbot.script.ScriptManifest; import org.rsbot.script.wrappers.RSNPC; import org.rsbot.script.wrappers.RSComponent; import org.rsbot.script.wrappers.RSGroundItem; import org.rsbot.script.wrappers.RSObject; import org.rsbot.script.wrappers.RSPlayer; import org.rsbot.script.wrappers.RSTile; import org.rsbot.script.wrappers.RSItem; import org.rsbot.script.wrappers.RSInterface; import org.rsbot.script.wrappers.RSTilePath; import org.rsbot.script.methods.Skills; import org.rsbot.script.methods.Game; import org.rsbot.script.wrappers.RSArea; import org.rsbot.script.util.Timer; import org.rsbot.script.util.Filter; import java.io.*; import java.net.URL; import java.util.List; import java.util.ArrayList; import javax.imageio.ImageIO; import java.text.NumberFormat; import java.awt.*; import java.awt.event.*; import javax.swing.*; @ScriptManifest(authors = {"Robgob"}, keywords = {"fatal,fighter,robgob,combat,melee"}, name = "Fatal Fighter", version = 1.2, description = "Attacks NPCs, so you don't have to.") public class FatalFighter extends Script implements PaintListener, MessageListener, MouseListener { GUI gui; public Attack attack = new Attack(); public Looting loot = new Looting(); public Bones bones = new Bones(); public Skill[] skill = new Skill[7]; public Skill topSkill; public Rectangle button = new Rectangle(0,0,0,0); private boolean wait = true, start = true, noFoodLogout = false, showSkills = true, looting = false, buryBones = false, antiban = true, multiAttack = false; public Theme theme = new Theme(Color.WHITE, Color.BLACK, Color.RED); public Food food = new Food(); public Timer startTimer = new Timer(0); // The time set doesn't matter, we just need a elapsed time public Timer timer = new Timer(3600000); // Loops every hour public Timer breakTimer = new Timer(random(600000, 900000)); // Default 10-15 minute timer private int failedEat = 0, radius = 0; public RSTile startTile; public String status = "Waiting for input..."; public boolean onStart() { for (int i = 0; i < skill.length; i++) { skill[i] = new Skill(i); } gui = new GUI(); while (wait) { sleep(500); } startTile = getMyPlayer().getLocation(); return start; } @Override public int loop() { if (getContinueInterface() != null) { status("Clicking continue"); clickContinue(); return random(1200, 1600); } if (game.getCurrentTab() != Game.TAB_INVENTORY) { status("Opening inventory"); game.openTab(Game.TAB_INVENTORY); return random(700, 1500); } if (random(0,50) == 25) { mouse.setSpeed(random(2, 5)); } if(food.needFood()) { if (food.haveFood()) { status("Eating Food"); failedEat = 0; food.eatFood(); return random(1100, 1600); } else if (food.haveB2pTab() && food.haveBones()) { status("Breaking tablet"); food.breakB2pTab(); return random(2600, 3000); } else { if (noFoodLogout) { failedEat++; if (failedEat > 5) { log.severe("You ran out of food!"); quit(); return random(600, 800); } } } } if (!walking.isRunEnabled() && walking.getEnergy() > random(60, 85)) { walking.setRun(true); return random(1200, 1600); } if (bones.checkBones()) { return random(50,450); } antiban(); if (loot.canPickup()) { return loot.pickupItem(); } if (!inRadius() && !attack.inCombat()) { status("Walking to starter zone"); walking.walkTo(startTile); return random(1000, 2000); } if(!attack.inCombat()) { attack.attackNpc(); return random(1000, 1500); } return random(250, 350); } public boolean inRadius() { if(radius == 0) return true; return calc.distanceBetween(getMyPlayer().getLocation(), startTile) <= radius; } private void quit() { try { String[] args = startTimer.toElapsedString().split(":"); int hours = Integer.parseInt(args[0]); int mins = Integer.parseInt(args[1]); int secs = Integer.parseInt(args[2]); String hour = (hours > 0 ? hours + " " + (hours == 1 ? "hour" : "hours") + ", " : ""); String minutes = (mins != 0 ? mins + " mins" : ""); String seconds = (hours == 0 ? ", " + secs + " and seconds" : ""); log("You ran the script for " + hour + "" + minutes + "" + "" + seconds + " and earned " + getExpGained() + " Experience and " + getLevelsGained() + " levels!"); } catch(Exception e) { log("Thank you for using Fatal Fighter!"); } stopScript(true); } public void moving() { long start = System.currentTimeMillis(); while (System.currentTimeMillis() - start < 1500 && !getMyPlayer().isMoving()) { sleep(random(50, 200)); } while (getMyPlayer().isMoving()) { sleep(random(20, 50)); } } public void status(String s) { status = s; } public void antiban() { if(!antiban) return; int b = random(0, 10); switch (b) { case 1: if (random(0, 10) == 5) { status("Moving mouse"); mouse.moveSlightly(); sleep(200, 600); mouse.moveRandomly(150, 350); } break; case 2: if (random(0, 13) == 2) { status("Rotating camera"); camera.setAngle(random(30, 70)); sleep(400, 1200); } break; case 3: if (random(0, 24) == 6) { status("Moving mouse off-Screen"); mouse.moveOffScreen(); sleep(600, random(1200, 2000)); } break; case 4: if (random(0, 18) == 3) { status("Checking Skill"); game.openTab(1); skills.doHover(skill[random(0,6)].getID()); sleep(2100, 3400); } break; default: status(attack.inCombat() ? "Fighting..." : "Routing.."); break; } } //Paint public void onRepaint(Graphics g1) { Graphics2D g = (Graphics2D)g1; // Draw Mouse g.setColor(theme.getBorder()); g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY())); g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800); RSComponent inter = interfaces.get(137).getComponent(0); int x = inter.getLocation().x; int y = inter.getLocation().y; int width = 490; int height = 15; //Draw title info g.setColor(theme.getBackground()); g.fillRect(x, y, width, height+10); g.setColor(theme.getBorder()); g.drawString("Fatal Fighter - Exp Gained: " + getExpGained() + " - Levels Gained: " + getLevelsGained() + " Run Time:" + startTimer.toElapsedString(), x+10, y+17); g.setColor(theme.getBorder()); g.drawRect(x, y, width, height+10); y += 25; // Draw Skills if (showSkills) { if (topSkill == null) { for (Skill s : skill) { if (s != null && s.active()) { s.draw(g, x, y, width, height); y += height; } } } else { width = 490; height = 88; topSkill.drawClick(g, x, y, width, height); y += height; } } //Status + Hide/show Button g.setColor(theme.getBackground()); g.fillRect(x, y, 490, 15); g.setColor(theme.getBorder()); g.drawString("Status: " + status, x+10, y+15-2); if(getExpGained() > 0) g.drawString("Click here to " + (showSkills ? "hide" : "show") + " stats!", x+350, y+15-2); g.drawRect(x, y, 490, 15); button = new Rectangle(x, y, 490, 15); } @Override public void messageReceived(MessageEvent e) { String s = e.getMessage().toLowerCase(); if(s.contains("just advanced a")) log.severe("Congradulations! Fatal Fighter just got you another level! <3"); if (s.contains("log out until 10 seconds after")) { //log.severe("Can't log out yet, waiting til out of combat."); } } public int getExpGained() { int exp = 0; for (Skill s : skill) { if(s != null) exp += s.getExpGained(); } return exp; } public int getLevelsGained() { int lvl = 0; for (Skill s : skill) { if(s != null) lvl += s.getLevelsGained(); } return lvl; } public String format(long time) { final NumberFormat f = NumberFormat.getInstance(); final long t_seconds = time / 1000; final long t_minutes = t_seconds / 60; final long t_hours = t_minutes / 60; final long seconds = t_seconds % 60; final long minutes = t_minutes % 60; final long hours = t_hours; return (f.format(hours) + ":" + f.format(minutes) + ":" + f.format(seconds)); } private RSComponent getContinueInterface() { for(RSInterface iface : interfaces.getAll()) { //skip chat if(iface.getIndex() == 137) continue; for(RSComponent c : iface.getComponents()) { if(c != null && c.isValid() && c.containsText("Click here to continue") && c.getAbsoluteX() > 100 && c.getAbsoluteY() > 300) return c; } } return null; } private boolean clickContinue() { RSComponent c = getContinueInterface(); if(c != null) return c.doClick(); return false; } class Attack { public int failed = 0; public int[] npcIDs = new int[0]; public String[] npcNames = new String[0]; private void attackNpc() { status("Looking for Npc"); RSNPC npc = getNpc(); if (npc != null) { camera.turnTo(npc); if(!npc.isOnScreen() && random(0,4) == 2) walking.walkTo(calc.getTileOnScreen(npc.getLocation())); if(!inCombat()) npc.doAction("Attack"); mouse.moveSlightly(); status("Attacking " + npc.getName()); failed = 0; moving(); long t = System.currentTimeMillis(); while(System.currentTimeMillis() - t < 2500 && getMyPlayer().getAnimation() == -1 && (System.currentTimeMillis() - t < 1000 || getMyPlayer().getInteracting() != null)) sleep(random(50, 100)); } else { failed++; if (failed == 200) { log.severe("Failed to find the npc."); quit(); } antiban(); } } public RSNPC getNpc() { return npcs.getNearest(filter); } public boolean validNpc(RSNPC n) { if (n != null) { for (int id : npcIDs) { if (id == n.getID()) return true; } for (String s : npcNames) { if (n.getName().toLowerCase().contains(s.toLowerCase())) return true; } } return false; } public boolean inCombat() { return getMyPlayer().getInteracting() != null || getMyPlayer().isInCombat() || (getMyPlayer().getAnimation() != -1 && getMyPlayer().getAnimation() != 827); } public final Filter filter = new Filter() { public boolean accept(RSNPC n) { return (validNpc(n) && (radius == 0 || calc.distanceBetween(n.getLocation(), startTile) < radius) && (multiAttack || (!n.isInCombat() && n.getInteracting() == null)) && n.getHPPercent() != 0); } }; } class Bones { private final int[] BONE_IDS = new int[] { 526, 528, 530, 532, 534, 536, 2859, 3123, 3125, 3183, 6182 , 20268, 20266, 20264 }; public boolean bury = false; public boolean hasBones() { return inventory.getCount(BONE_IDS) > 0; } public boolean checkBones() { if(!buryBones || attack.inCombat()) return false; if (hasBones()) { if (bury || inventory.isFull()) { bury = true; status("Burying bones!"); for (RSItem item : inventory.getItems(BONE_IDS)) { item.doClick(true); if(random(0,4) == 2) mouse.moveSlightly(); waitForBury(); return true; } } } else { bury = false; } return false; } public void waitForBury() { int i = inventory.getCount(true); while (inventory.getCount(true) == i) { sleep(random(20, 70)); } sleep(50, 300); } } class Looting { private int[] itemIDs = new int[0]; private String[] itemNames = new String[0]; private RSGroundItem lootItem = null; public int pickupItem() { status("Looking for items..."); int origCount = inventory.getCount(true); String name = lootItem.getItem().getName(); int count = lootItem.getItem().getStackSize(); int result = takeItem(lootItem); if (result == 0 || result == 1) { moving(); } return random(50, 200); } public boolean canPickup() { return (lootItem = getLoot()) != null && !inventory.isFull(); } private RSGroundItem getLoot() { return groundItems.getNearest(filter); } private int takeItem(RSGroundItem item) { if (item == null) return -1; status("Picking up Item: " + item.getItem().getName()); String action = "Take " + item.getItem().getName(); if (item.isOnScreen()) { for (int i = 0; i < 5; i++) { if (menu.isOpen()) mouse.moveRandomly(300, 500); Point p = calc.tileToScreen(item.getLocation(), random(0.48, 0.52), random(0.48, 0.52), 0); if (!calc.pointOnScreen(p)) continue; mouse.move(p, 3, 3); if (menu.contains(action)) { if (menu.getItems()[0].contains(action)) { mouse.click(true); return 0; } else { mouse.click(false); sleep(random(100, 200)); if (menu.doAction(action)) return 0; } } } } else { walking.walkTileMM(walking.getClosestTileOnMap(item.getLocation())); return 1; } return -1; } private final Filter filter = new Filter() { public boolean accept(RSGroundItem t) { //Skip if we can't hold it RSItem i; if (inventory.isFull() && ((i = inventory.getItem(t.getItem().getID())) == null || i.getStackSize() <= 1)) { return false; } //Skip if its out of radius or far away if (radius > 0 && calc.distanceBetween(t.getLocation(), startTile) > radius || calc.distanceTo(t.getLocation()) > 25) { return false; } //Check ID/name int id = t.getItem().getID(); for (int iD : itemIDs) { if (iD == id) return true; } String name = t.getItem().getName(); for (String s : itemNames) { if (name != null && name.toLowerCase().contains(s.toLowerCase())) return true; } return false; } }; } class Skill { private int id; private int startExp; private int startLevel; public Rectangle area = new Rectangle(0, 0, 0, 0); public Skill(int index) { this.id = index; this.startExp = skills.getCurrentExp(index); this.startLevel = skills.getRealLevel(index); } public void draw(Graphics2D g, int x, int y, int width, int height) { area = new Rectangle(x, y, width, height); g.setColor(theme.getBackground()); g.fillRect(x, y, width, height); g.setColor(getColor()); g.drawString(getName() + "(" + skills.getRealLevel(id) + "): " + getExpGained() + " Exp Earned - " + getExpPerHour() + " EXP P/H", x+10, y+height-2); //XPBar g.setColor(theme.getOther()); g.fillRect(x+(width-101), y+1, 101, height-2); g.setColor(theme.getBorder()); g.fillRect(x+(width-101), y+1, getPercent(), height-2); g.setColor(new Color(0, 0, 0, 50)); g.fillRect(x+(width-101), y+8, 101, height-9); g.setColor(theme.getOther()); g.drawRect(x+(width-101), y+1, 101, height-2); g.setColor(theme.getBackground()); g.drawString(getPercent() + "%", x+(width-50), y+height-2); g.setColor(theme.getBorder()); g.drawRect(x, y, width, height); } public void drawClick(Graphics2D g, int x, int y, int width, int height) { //Draw background g.setColor(theme.getBackground()); g.fillRect(x, y, width, height); //Draw content g.setColor(getColor()); g.setFont(new Font("Arial", Font.PLAIN, 24)); g.drawString(getName(), x+35, y+26); g.setFont(new Font("Dialog", Font.BOLD, 16)); g.drawString("Exp Per Hour: " + getExpPerHour(), x+50, y+50); g.drawString("Exp Gained: " + getExpGained(), x+50, y+70); g.drawString("XP till Level+: " + getExpToNextLevel(), x+250, y+50); g.drawString("Lvls Gained: " + getLevelsGained(), x+250, y+70); //XPBar g.setFont(new Font("Dialog", Font.BOLD, 14)); g.setColor(theme.getOther()); g.fillRect(x+190, y+8, 291, 20); g.setColor(theme.getBorder()); g.fillRect(x+190, y+8, ((int)(getPercent()*2.90)), 20); g.setColor(new Color(0, 0, 0, 50)); // Shadow g.fillRect(x+190, y+18, 291, 10); g.setColor(theme.getOther()); g.drawRect(x+190, y+8, 291, 20); g.setColor(theme.getBackground()); g.drawString(getPercent() + "%", x+310, y+24); g.setFont(new Font("Dialog", Font.PLAIN, 12)); g.setColor(getColor()); g.drawString("Time till next level: " + timeTillLevelString(), x+170, y+84); //Draw Border g.setColor(theme.getBorder()); g.drawRect(x, y, width, height); area = new Rectangle(x, y, width, height); } public String getName() { String s = skills.SKILL_NAMES[id]; s = Character.toUpperCase(s.charAt(0)) + s.substring(1); return s; } public boolean active() { return getExp() > getStartExp(); } public int getID() { return id; } public int getStartExp() { return startExp; } public int getExp() { return skills.getCurrentExp(id); } public int getExpGained() { return getExp() - getStartExp(); } public int getExpPerHour() { return (int) (getExpGained() * 3600000D / startTimer.getElapsed()); } public int getExpToNextLevel() { return skills.getExpToNextLevel(id); } public int getStartLevel() { return startLevel; } public int getLevel() { return skills.getRealLevel(id); } public int getLevelsGained() { return getLevel() - getStartLevel(); } public int getLevelsPerHour() { return (int) (getLevelsGained() * 3600000D / startTimer.getElapsed()); } public long timeTillLevel() { return (int)(((double)getExpToNextLevel() / (double)getExpPerHour()) * 3600000); } public String timeTillLevelString() { return format(timeTillLevel()); } public int getPercent() { return skills.getPercentToNextLevel(id); } public Rectangle getArea() { return area; } public Color getColor() { switch(id) { case 0: // Attack return new Color(145, 25, 25).brighter(); case 1: // Defence return new Color(95, 115, 185); case 2: // Strength return Color.GREEN.darker(); case 3: // Constitution return Color.WHITE.darker(); case 4: // Range return new Color(70, 95, 20).brighter(); case 5: // Prayer return new Color(95, 115, 230); case 6: // Magic return theme.getBorder(); } return theme.getBorder(); } } /* * Holds the basic theme for the Script(Paint) */ class Theme { private Color border; private Color background; private Color other; public Theme(Color border, Color background, Color other) { this.border = border; this.background = background; this.other = other; } public Color getBorder() { return border; } public Color getBackground() { return background; } public Color getOther() { return other; } } // From TFigherEE private class Food { public boolean logout = false; private final int[] B2P_TAB_ID = new int[]{8015}; private final int[] BONES_ID = new int[]{526, 532, 530, 528, 3183, 2859}; private int toEatAtPercent = getRandomEatPercent(); private int getRandomEatPercent() { return random(45, 60); } private boolean haveB2pTab() { return inventory.getCount(B2P_TAB_ID) > 0; } private void breakB2pTab() { RSItem i = inventory.getItem(B2P_TAB_ID); if (i != null) i.doClick(true); } private boolean haveBones() { return inventory.getCount(BONES_ID) > 0; } private boolean haveFood() { return getFood() != null; } private RSItem getFood() { for (RSItem i : inventory.getItems()) { if (i == null || i.getID() == -1) continue; if (i.getComponent().getActions() == null || i.getComponent().getActions()[0] == null) continue; if (i.getComponent().getActions()[0].contains("Eat")) return i; } return null; } private boolean eatFood() { RSItem i = getFood(); for (int j = 0; j < 3; j++) { if (i == null) break; if (i.doAction("Eat")) { return true; } } return false; } private boolean needFood() { if(getHPPercent() <= getRandomEatPercent()) { return true; } return false; } public int getHPPercent() { try { return ((int) ((Integer.parseInt(interfaces.get(748).getComponent(8).getText().trim()) / (double)(skills.getRealLevel(Skills.CONSTITUTION) * 10)) * 100)); } catch (Exception e) { return 100; } } } class GUI extends JFrame { public GUI() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { setTitle("Fatal Fighter"); TITLE_LABEL = new javax.swing.JLabel(); NPCS_LABEL = new javax.swing.JLabel(); NPCS_TEXT = new javax.swing.JTextField(); THEME_BOX = new javax.swing.JComboBox(); THEME_LABEL = new javax.swing.JLabel(); FOOD_LOGOUT_CHECKBOX = new javax.swing.JCheckBox(); XTILE_CHECKBOX = new javax.swing.JCheckBox(); XTILE_TEXT = new javax.swing.JTextField(); ANTIBAN_CHECKBOX = new javax.swing.JCheckBox(); MULTI_ATTACK_CHECKBOX = new javax.swing.JCheckBox(); START_BUTTON = new javax.swing.JButton(); CANCEL_BUTTON = new javax.swing.JButton(); LOOT_CHECKBOX = new javax.swing.JCheckBox(); LOOT_TEXT = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setBounds(new java.awt.Rectangle(200, 100, 0, 0)); setResizable(false); TITLE_LABEL.setFont(new java.awt.Font("Arial Black", 0, 24)); TITLE_LABEL.setText("Fatal Fighter"); NPCS_LABEL.setText("Enter the npc ID's and Names:"); NPCS_LABEL.setToolTipText("Enter a NPC ID or name separated by commas(107,Scorpion,60,Giant spider)"); NPCS_TEXT.setText("91,Skeleton"); NPCS_TEXT.setToolTipText("Enter a NPC ID or name separated by commas(107,Scorpion,60,Giant spider)"); THEME_BOX.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "Bloody", "Funky", "Sunny", "Sexy", "White", "Grass" })); THEME_BOX.setToolTipText("Select a paint theme!"); THEME_LABEL.setText("Theme Select:"); THEME_LABEL.setToolTipText("Select a paint theme!"); FOOD_LOGOUT_CHECKBOX.setSelected(true); FOOD_LOGOUT_CHECKBOX.setText("Logout when out of food"); XTILE_CHECKBOX.setSelected(true); XTILE_CHECKBOX.setText("Stay within a radius of:"); XTILE_CHECKBOX.setToolTipText("If you you move out of the radious(10+ steps) you will walk back to yor location."); XTILE_TEXT.setText("10"); XTILE_TEXT.setToolTipText("If you you move out of the radious(10+ steps) you will walk back to yor location."); ANTIBAN_CHECKBOX.setSelected(true); ANTIBAN_CHECKBOX.setText("Anti-Ban"); ANTIBAN_CHECKBOX.setToolTipText("Prevents you from getting banned by performing random tasks."); MULTI_ATTACK_CHECKBOX.setText("Multi-Attack"); MULTI_ATTACK_CHECKBOX.setToolTipText("Instead of having a mouse speed of 5-6, we would make your speed 2-3 for crack addicted clicking!"); START_BUTTON.setText("Start"); START_BUTTON.setToolTipText("Start the script!"); START_BUTTON.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { startAction(); } }); CANCEL_BUTTON.setText("Quit"); CANCEL_BUTTON.setToolTipText("To Quit and not run the script, click here!"); CANCEL_BUTTON.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelAction(); } }); LOOT_CHECKBOX.setText("Loot:"); LOOT_TEXT.setText("995,Coins"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(LOOT_CHECKBOX) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(LOOT_TEXT, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(22, 22, 22)) .addGroup(layout.createSequentialGroup() .addComponent(TITLE_LABEL, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(XTILE_CHECKBOX) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(XTILE_TEXT, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) .addComponent(FOOD_LOGOUT_CHECKBOX, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(ANTIBAN_CHECKBOX, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(MULTI_ATTACK_CHECKBOX, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(THEME_LABEL) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(THEME_BOX, 0, 107, Short.MAX_VALUE) .addGap(10, 10, 10)) .addGroup(layout.createSequentialGroup() .addGap(25, 25, 25) .addComponent(START_BUTTON) .addGap(18, 18, 18) .addComponent(CANCEL_BUTTON) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE))) .addGap(4, 4, 4)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(NPCS_LABEL, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE) .addComponent(NPCS_TEXT, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)) .addContainerGap()))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(TITLE_LABEL) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(NPCS_LABEL) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(NPCS_TEXT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(LOOT_CHECKBOX) .addComponent(LOOT_TEXT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 2, Short.MAX_VALUE) .addComponent(FOOD_LOGOUT_CHECKBOX) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(XTILE_CHECKBOX) .addComponent(XTILE_TEXT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ANTIBAN_CHECKBOX) .addComponent(MULTI_ATTACK_CHECKBOX)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(THEME_LABEL, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(THEME_BOX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(START_BUTTON) .addComponent(CANCEL_BUTTON)) .addContainerGap()) ); pack(); setVisible(true); }// private void startAction() { String t = THEME_BOX.getSelectedItem().toString(); if (t.equals("Default")) { theme = new Theme(Color.CYAN.darker(), Color.BLACK, Color.RED); } else if (t.equals("Bloody")) { theme = new Theme(Color.RED.darker(), Color.BLACK, new Color(100, 0, 0)); } else if (t.equals("Funky")) { theme = new Theme(Color.YELLOW, Color.BLACK, Color.MAGENTA); } else if (t.equals("Sunny")) { theme = new Theme(Color.ORANGE, Color.BLACK, Color.RED); } else if (t.equals("Sexy")) { theme = new Theme(Color.MAGENTA, Color.BLACK, Color.CYAN.darker()); } else if (t.equals("White")) { theme = new Theme(Color.WHITE, Color.BLACK, new Color(100, 100, 100)); } else if (t.equals("Grass")) { theme = new Theme(Color.GREEN.darker(), Color.BLACK, Color.RED.darker()); } antiban = ANTIBAN_CHECKBOX.isSelected(); multiAttack = MULTI_ATTACK_CHECKBOX.isSelected(); noFoodLogout = FOOD_LOGOUT_CHECKBOX.isSelected(); if (XTILE_CHECKBOX.isSelected()) { try { radius = Integer.parseInt(XTILE_TEXT.getText()); } catch(Exception e) { radius = 10; log("Error setting radius! Setting radius to default!(10)"); } } String[] ids = NPCS_TEXT.getText().split(","); ArrayList id = new ArrayList(); ArrayList names = new ArrayList(); for (int i = 0; i < ids.length; i++) { if (ids[i] != null && !ids[i].equals("")) { try { int index = Integer.parseInt(ids[i]); id.add(index); } catch (Exception e1) { names.add(ids[i]); } } } attack.npcIDs = id.size() > 0 ? toIntArray(id.toArray(new Integer[0])) : new int[0]; attack.npcNames = names.size() > 0 ? names.toArray(new String[0]) : new String[0]; if (LOOT_CHECKBOX.isSelected()) { boolean bones = false; looting = true; ids = LOOT_TEXT.getText().split(","); id = new ArrayList(); names = new ArrayList(); for (int i = 0; i < ids.length; i++) { if (ids[i] != null && !ids[i].equals("")) { try { int index = Integer.parseInt(ids[i]); id.add(index); if(!bones) bones = isBone(index); } catch (Exception e1) { names.add(ids[i]); if(!bones) bones = isBone(ids[i]); } } } loot.itemIDs = id.size() > 0 ? toIntArray(id.toArray(new Integer[0])) : new int[0]; loot.itemNames = names.size() > 0 ? names.toArray(new String[0]) : new String[0]; if(bones) buryBones = (JOptionPane.showConfirmDialog(this, "Would you like to bury those bones?", "Loot", JOptionPane.YES_NO_OPTION) == 0); } wait = false; dispose(); } private void cancelAction() { wait = false; start = false; dispose(); log("Thank you for selecting Fatal Fighter! Hope you run this next time."); } private int[] toIntArray(Integer[] ints) { int[] done = new int[ints.length]; for (int i = 0; i < done.length; i++) { done[i] = ints[i].intValue(); } return done; } private JCheckBox ANTIBAN_CHECKBOX; private JButton CANCEL_BUTTON; private JCheckBox FOOD_LOGOUT_CHECKBOX; private JCheckBox LOOT_CHECKBOX; private JTextField LOOT_TEXT; private JCheckBox MULTI_ATTACK_CHECKBOX; private JLabel NPCS_LABEL; private JTextField NPCS_TEXT; private JButton START_BUTTON; private JComboBox THEME_BOX; private JLabel THEME_LABEL; private JLabel TITLE_LABEL; private JCheckBox XTILE_CHECKBOX; private JTextField XTILE_TEXT; public boolean isBone(int i) { for (int bone : bones.BONE_IDS) { if(i == bone) return true; } return false; } public boolean isBone(String s) { return s.toLowerCase().contains("bones"); } } public void mouseClicked(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} public void mousePressed(MouseEvent e) { Point p = e.getPoint(); if (button.contains(p)) { showSkills = !showSkills; return; } if (topSkill != null && showSkills) { if (topSkill.getArea().contains(p)) { topSkill = null; } return; } for (Skill s : skill) { if (s != null && s.active() && showSkills) { if (s.getArea().contains(p)) { topSkill = s; return; } } } } }