diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 65704e6..a41948f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -60,6 +60,7 @@ + @@ -119,4 +120,4 @@ - \ No newline at end of file + diff --git a/src/main/java/ParaScript/Main.java b/src/main/java/ParaScript/Main.java index 6102e5b..812e789 100644 --- a/src/main/java/ParaScript/Main.java +++ b/src/main/java/ParaScript/Main.java @@ -83,7 +83,7 @@ public class Main extends Script implements MessageListener, Paintable { g.setColor(Color.WHITE); g.setFont(new Font("Arial", Font.BOLD, 14)); - g.drawString("2006AIO", 360, 247); + g.drawString("2006 AIO", 360, 247); g.setFont(new Font("Arial", Font.BOLD, 11)); g.drawString("Status: " + Variables.getStatus(), 360, 270); g.drawString("Items(P/H): " + Methods.formatNumber(Variables.itemsGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour(Variables.itemsGained)) + ")", 360, 290); @@ -116,4 +116,4 @@ public class Main extends Script implements MessageListener, Paintable { break; } } -} \ No newline at end of file +} diff --git a/src/main/java/ParaScript/data/Variables.java b/src/main/java/ParaScript/data/Variables.java index 58a2cd4..2b766e1 100644 --- a/src/main/java/ParaScript/data/Variables.java +++ b/src/main/java/ParaScript/data/Variables.java @@ -6,6 +6,8 @@ import org.rev317.min.api.methods.Skill; import org.rev317.min.api.wrappers.Tile; import org.rev317.min.api.wrappers.TilePath; +import java.util.List; + public class Variables { public static final Timer SCRIPT_TIMER = new Timer(); @@ -117,6 +119,23 @@ public class Variables { new Tile(3287, 3370), }; + // Smithing Falador + public final static Zone FALADOR_WEST_BANK_ZONE = new Zone(new Tile(2943, 3374), new Tile(2950, 3367)); + + public final static Tile[] FALADOR_WEST_BANK_TO_FURNACE = new Tile[] { + new Tile(2946, 3368), + new Tile(2953, 3378), + new Tile(2966, 3377), + new Tile(2974, 3369), + }; + + public final static Tile[] FALADOR_WEST_FURNACE_TO_BANK = new Tile[] { + new Tile(2974, 3369, 0), + new Tile(2966, 3377, 0), + new Tile(2953, 3378, 0), + new Tile(2946, 3368, 0), + }; + public static String getAccountUsername() { return username; } public static void setAccountUsername(String i) { username = i; } @@ -137,6 +156,18 @@ public class Variables { expGained = skill_to_train.getExperience() - baseExperience; } + public static int[] getItemIDs(){ + if (skill_to_train == null) return new int[]{-1}; + switch (skill_to_train.getName()){ + case "Woodcutting": + return woodcutting_tree_selected.getIDs(); + case "Mining": + return mining_ore_selected.getIDs(); + default: + return new int[]{-1}; + } + } + public static boolean shouldBankItems(){ if (skill_to_train == null) return true; switch (skill_to_train.getName()){ diff --git a/src/main/java/ParaScript/strategies/Bank.java b/src/main/java/ParaScript/strategies/Bank.java index 3654494..fd35005 100644 --- a/src/main/java/ParaScript/strategies/Bank.java +++ b/src/main/java/ParaScript/strategies/Bank.java @@ -2,6 +2,7 @@ package ParaScript.strategies; import ParaScript.data.Variables; import org.parabot.environment.api.utils.Time; +import org.parabot.environment.input.Keyboard; import org.parabot.environment.scripts.framework.Strategy; import org.rev317.min.api.methods.*; import org.rev317.min.api.wrappers.Npc; @@ -25,28 +26,24 @@ public class Bank implements Strategy { while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) { if (!Game.isLoggedIn()) new HandleLogin().execute(); Variables.pathToWalk.traverse(); - Time.sleep(2000, 3000); + Time.sleep(2500); } depositItems(); } public void depositItems() { - Npc banker[] = Npcs.getNearest(494); - - if (banker != null) { - banker[0].interact(Npcs.Option.BANK); - Time.sleep(3000); - if (Game.getOpenInterfaceId() == 5292) { - if (Variables.skill_to_train == Skill.MINING) - org.rev317.min.api.methods.Bank.depositAllExcept(1266, 1268, 1270, 1272, 1274, 1276); - if (Variables.skill_to_train == Skill.WOODCUTTING) - org.rev317.min.api.methods.Bank.depositAllExcept(1350, 1352, 1354, 1356, 1358, 1360, 6740); - if (Variables.skill_to_train == null) { - org.rev317.min.api.methods.Bank.depositAllExcept(1); - Variables.addItemGained(28); - } - Variables.setStatus("none"); + Keyboard.getInstance().sendKeys("::bank", true); + Time.sleep(3000); + if (Game.getOpenInterfaceId() == 5292) { + if (Variables.skill_to_train == Skill.MINING) + org.rev317.min.api.methods.Bank.depositAllExcept(1266, 1268, 1270, 1272, 1274, 1276); + else if (Variables.skill_to_train == Skill.WOODCUTTING) + org.rev317.min.api.methods.Bank.depositAllExcept(1350, 1352, 1354, 1356, 1358, 1360, 6740); + else { + org.rev317.min.api.methods.Bank.depositAllExcept(1); + Variables.addItemGained(28); } + Variables.setStatus("none"); } } -} \ No newline at end of file +} diff --git a/src/main/java/ParaScript/strategies/Drop.java b/src/main/java/ParaScript/strategies/Drop.java new file mode 100644 index 0000000..9f9f31e --- /dev/null +++ b/src/main/java/ParaScript/strategies/Drop.java @@ -0,0 +1,36 @@ +package ParaScript.strategies; + +import ParaScript.data.Variables; +import org.parabot.environment.api.utils.Time; +import org.parabot.environment.scripts.framework.Strategy; +import org.rev317.min.api.methods.Game; +import org.rev317.min.api.methods.Inventory; +import org.rev317.min.api.methods.Npcs; +import org.rev317.min.api.methods.Skill; +import org.rev317.min.api.wrappers.Item; +import org.rev317.min.api.wrappers.Npc; +import org.rev317.min.api.wrappers.TilePath; + +public class Drop implements Strategy { + private Item[] items; + + @Override + public boolean activate() { + items = Inventory.getItems(Variables.getItemIDs()); + return Variables.running + && Game.isLoggedIn() + && Variables.shouldDropItems() + && items != null + && items.length > 0; + } + + @Override + public void execute() { + for(Item item : items){ + if(item != null){ + item.drop(); + Time.sleep(1000); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/Killer.java b/src/main/java/ParaScript/strategies/Killer.java new file mode 100644 index 0000000..aa76f63 --- /dev/null +++ b/src/main/java/ParaScript/strategies/Killer.java @@ -0,0 +1,45 @@ +package ParaScript.strategies; + +import ParaScript.data.Variables; +import org.parabot.environment.api.utils.Time; +import org.parabot.environment.scripts.framework.Strategy; +import org.rev317.min.api.methods.Inventory; +import org.rev317.min.api.methods.Npcs; +import org.rev317.min.api.methods.Players; +import org.rev317.min.api.methods.SceneObjects; +import org.rev317.min.api.wrappers.Npc; +import org.rev317.min.api.wrappers.SceneObject; + +public class Killer implements Strategy { + private Npc victim; + + @Override + public boolean activate() { + victim = victim(); // set the local Variable + if (Variables.running + && victim != null + && !Players.getMyPlayer().isInCombat() + && Players.getMyPlayer().getAnimation() == -1 + && !Inventory.isFull()) { + return true; + } + return false; + } + + @Override + public void execute() { + victim.interact(Npcs.Option.ATTACK); + Time.sleep(1000); + //Wait for the Player to finish pickpocketing + Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 500); + } + + private Npc victim(){ + for(Npc victim : Npcs.getNearest(41)){ + if(victim != null){ + return victim; + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/ParaScript/strategies/PickupItems.java b/src/main/java/ParaScript/strategies/PickupItems.java index 00355b5..7dac137 100644 --- a/src/main/java/ParaScript/strategies/PickupItems.java +++ b/src/main/java/ParaScript/strategies/PickupItems.java @@ -59,4 +59,4 @@ public class PickupItems implements Strategy { itemIDs = Methods.combineIntArrays(Variables.fighting_item_ids, itemIDs); return itemIDs; } -} \ No newline at end of file +} diff --git a/src/main/java/ParaScript/strategies/Walk.java b/src/main/java/ParaScript/strategies/Walk.java index 278f573..32b5c56 100644 --- a/src/main/java/ParaScript/strategies/Walk.java +++ b/src/main/java/ParaScript/strategies/Walk.java @@ -26,7 +26,7 @@ public class Walk implements Strategy { while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) { if (!Game.isLoggedIn()) new HandleLogin().execute(); Variables.pathToWalk.traverse(); - Time.sleep(2000, 3000); + Time.sleep(2500); } } } \ No newline at end of file diff --git a/src/main/java/ParaScript/ui/UI.java b/src/main/java/ParaScript/ui/UI.java index 2b415d6..bf2b130 100644 --- a/src/main/java/ParaScript/ui/UI.java +++ b/src/main/java/ParaScript/ui/UI.java @@ -1,18 +1,17 @@ package ParaScript.ui; -import ParaScript.data.variables.FightingNpcs; -import ParaScript.data.variables.ThievingNpcs; -import ParaScript.data.variables.Ores; -import ParaScript.data.variables.Trees; +import ParaScript.data.variables.*; import ParaScript.data.Variables; import org.rev317.min.api.methods.Game; import org.rev317.min.api.methods.Players; import org.rev317.min.api.methods.Skill; +import org.rev317.min.api.wrappers.Player; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; -import java.awt.event.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; public class UI extends JFrame { private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup(); @@ -36,19 +35,6 @@ public class UI extends JFrame { private JComboBox oreSelect = new JComboBox(); private JComboBox miningMethod = new JComboBox(); - // Fighting - private JComboBox fightingNpcSelect = new JComboBox(); - private JLabel lblFightingNpcCustomID = new JLabel("Custom NPC IDs"); - private JTextField fightingNpcCustomID = new JTextField(); - private JCheckBox fightingBuryBones = new JCheckBox(); - private JLabel lblFightingItemCustomID = new JLabel("Pickup Item IDs"); - private JTextField fightingItemCustomID = new JTextField(); - - // Thieving - private JComboBox thievingNpcSelect = new JComboBox(); - private JLabel lblThievingNpcCustomID = new JLabel("Custom NPC IDs"); - private JTextField thievingNpcCustomID = new JTextField(); - // Our colors private Color Color_MidnightBlue = new Color(44, 62, 80); private Color Color_WetAsphalt = new Color(52, 73, 94); @@ -57,7 +43,7 @@ public class UI extends JFrame { private Color Color_Alizarin = new Color(231, 76, 60); public UI() { - setTitle("2006AIO"); + setTitle("src/ParaScript"); setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 400, 300); @@ -126,8 +112,6 @@ public class UI extends JFrame { skillSelect.setModel(new DefaultComboBoxModel(new String[]{ Skill.WOODCUTTING.getName(), Skill.MINING.getName(), - Skill.ATTACK.getName(), - Skill.THIEVING.getName(), "Bank Runner", })); skillSelect.setBounds(20, 40, 150, 20); @@ -270,180 +254,6 @@ public class UI extends JFrame { }); miningPanel.add(miningMethod); - /* - * Fighting Panel - */ - - JPanel fightingPanel = new JPanel(); - fightingPanel.setForeground(Color_WhiteSmoke); - fightingPanel.setBackground(Color_WetAsphalt); - tabbedPane.addTab("Fighting", null, fightingPanel, null); - fightingPanel.setLayout(null); - - // Select which npc should be our victim - JLabel lblFightingNpc = new JLabel("NPC"); - lblFightingNpc.setForeground(Color_WhiteSmoke); - lblFightingNpc.setBounds(20, 20, 73, 20); - fightingPanel.add(lblFightingNpc); - fightingNpcSelect.setModel(new DefaultComboBoxModel(FightingNpcs.toStringArray())); - fightingNpcSelect.setBounds(20, 40, 150, 20); - fightingNpcSelect.addActionListener (new ActionListener () { - public void actionPerformed(ActionEvent e) { - for (FightingNpcs npc : FightingNpcs.values()) { - if (npc.getName().equalsIgnoreCase(fightingNpcSelect.getSelectedItem().toString())) { - Variables.fighting_npc_selected = npc; - } - } - if (Variables.fighting_npc_selected == FightingNpcs.CUSTOM) { - lblFightingNpcCustomID.setVisible(true); - fightingNpcCustomID.setVisible(true); - } else { - lblFightingNpcCustomID.setVisible(false); - fightingNpcCustomID.setVisible(false); - } - UI.this.revalidate(); - UI.this.repaint(); - } - }); - fightingPanel.add(fightingNpcSelect); - - // Custom npc id to attack - lblFightingNpcCustomID.setForeground(Color_WhiteSmoke); - lblFightingNpcCustomID.setBounds(200, 20, 150, 20); - fightingPanel.add(lblFightingNpcCustomID); - fightingNpcCustomID.setBounds(200, 40, 150, 20); - fightingNpcCustomID.addFocusListener(new FocusListener() { - @Override - public void focusGained(FocusEvent e) { - // we don't need to do anything here - } - - @Override - public void focusLost(FocusEvent e) { - try { - String[] sample = fightingNpcCustomID.getText().split("(,|;)\\s*"); - int[] customIDs = new int[sample.length]; - - for (int i = 0; i < sample.length; i++) - customIDs[i] = Integer.parseInt(sample[i]); - Variables.fighting_npc_selected.setIDs(customIDs); - } catch (Exception ಠ_ಠ) { - FightingNpcs.CUSTOM.setIDs(new int[]{0}); - } - } - }); - fightingPanel.add(fightingNpcCustomID); - lblFightingNpcCustomID.setVisible(false); - fightingNpcCustomID.setVisible(false); - - JLabel lblFightingBuryBones = new JLabel("Collect and bury bones"); - lblFightingBuryBones.setForeground(Color_WhiteSmoke); - lblFightingBuryBones.setBounds(40, 80, 130, 20); - fightingPanel.add(lblFightingBuryBones); - fightingBuryBones.setBackground(Color_WetAsphalt); - fightingBuryBones.setForeground(Color_WhiteSmoke); - fightingBuryBones.setBounds(15, 80, 20, 20); - fightingBuryBones.setSelected(true); - fightingBuryBones.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - Variables.fighting_bury_bones = fightingBuryBones.isSelected(); - } - }); - fightingPanel.add(fightingBuryBones); - - // Custom items to pickup - lblFightingItemCustomID.setForeground(Color_WhiteSmoke); - lblFightingItemCustomID.setBounds(20, 120, 150, 20); - fightingPanel.add(lblFightingItemCustomID); - fightingItemCustomID.setBounds(20, 140, 150, 20); - fightingItemCustomID.addFocusListener(new FocusListener() { - @Override - public void focusGained(FocusEvent e) { - // we don't need to do anything here - } - - @Override - public void focusLost(FocusEvent e) { - try { - String[] sample = fightingItemCustomID.getText().split("(,|;)\\s*"); - int[] customIDs = new int[sample.length]; - - for (int i = 0; i < sample.length; i++) - customIDs[i] = Integer.parseInt(sample[i]); - Variables.fighting_item_ids = customIDs; - } catch (Exception ಠ_ಠ) { - Variables.fighting_item_ids = new int[]{}; - } - } - }); - fightingPanel.add(fightingItemCustomID); - - /* - * Thieving Panel - */ - - JPanel thievingPanel = new JPanel(); - thievingPanel.setForeground(Color_WhiteSmoke); - thievingPanel.setBackground(Color_WetAsphalt); - tabbedPane.addTab("Thieving", null, thievingPanel, null); - thievingPanel.setLayout(null); - - // Select which npc should be our victim - JLabel lblThievingNpc = new JLabel("NPC"); - lblThievingNpc.setForeground(Color_WhiteSmoke); - lblThievingNpc.setBounds(20, 20, 73, 20); - thievingPanel.add(lblThievingNpc); - thievingNpcSelect.setModel(new DefaultComboBoxModel(ThievingNpcs.toStringArray())); - thievingNpcSelect.setBounds(20, 40, 150, 20); - thievingNpcSelect.addActionListener (new ActionListener () { - public void actionPerformed(ActionEvent e) { - for (ThievingNpcs npc : ThievingNpcs.values()) { - if (npc.getName().equalsIgnoreCase(thievingNpcSelect.getSelectedItem().toString())) { - Variables.thieving_npc_selected = npc; - } - } - if (Variables.thieving_npc_selected == ThievingNpcs.CUSTOM) { - lblThievingNpcCustomID.setVisible(true); - thievingNpcCustomID.setVisible(true); - } else { - lblThievingNpcCustomID.setVisible(false); - thievingNpcCustomID.setVisible(false); - } - UI.this.revalidate(); - UI.this.repaint(); - } - }); - thievingPanel.add(thievingNpcSelect); - - // Custom npc id to steal from - lblThievingNpcCustomID.setForeground(Color_WhiteSmoke); - lblThievingNpcCustomID.setBounds(200, 20, 150, 20); - thievingPanel.add(lblThievingNpcCustomID); - thievingNpcCustomID.setBounds(200, 40, 150, 20); - thievingNpcCustomID.addFocusListener(new FocusListener() { - @Override - public void focusGained(FocusEvent e) { - // we don't need to do anything here - } - - @Override - public void focusLost(FocusEvent e) { - try { - String[] sample = thievingNpcCustomID.getText().split("(,|;)\\s*"); - int[] customIDs = new int[sample.length]; - - for (int i = 0; i < sample.length; i++) - customIDs[i] = Integer.parseInt(sample[i]); - Variables.thieving_npc_selected.setIDs(customIDs); - } catch (Exception ಠ_ಠ) { - ThievingNpcs.CUSTOM.setIDs(new int[]{0}); - } - } - }); - thievingPanel.add(thievingNpcCustomID); - lblThievingNpcCustomID.setVisible(false); - thievingNpcCustomID.setVisible(false); - /* * Slave Panel */ @@ -453,7 +263,7 @@ public class UI extends JFrame { tabbedPane.addTab("Bank Runner", null, slavePanel, null); slavePanel.setLayout(null); - // Name of the Master account + // Which skill are we training JLabel lblSlaveMaster = new JLabel("Slave Master"); lblSlaveMaster.setForeground(Color_WhiteSmoke); lblSlaveMaster.setBounds(20, 20, 73, 20); diff --git a/target/classes/config.xml b/target/classes/config.xml index 8af6022..abc1a5a 100644 --- a/target/classes/config.xml +++ b/target/classes/config.xml @@ -1,6 +1,6 @@ - +