diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..a049986 Binary files /dev/null and b/.DS_Store differ diff --git a/src/main/java/org/rev317/min/callback/MenuAction.java b/src/main/java/org/rev317/min/callback/MenuAction.java index e596d62..fdf0947 100644 --- a/src/main/java/org/rev317/min/callback/MenuAction.java +++ b/src/main/java/org/rev317/min/callback/MenuAction.java @@ -9,11 +9,26 @@ import org.rev317.min.script.ScriptEngine; /** * @author Everel + * @author JKetelaar * @author Matt123337 */ public class MenuAction { + private static final String[][] outputs = { + { + "[index: %d, action1: %d, action2: %d, action3: %d, action4: %d, id: %d]", + "[id: %d, action1: %d, action2: %d, action3: %d, action4: %d, index: %d]" + }, + { + "[index: %d, action1: %d, action2: %d, action3: %d, id: %d]", + "[id: %d, action1: %d, action2: %d, action3: %d, index: %d]" + } + }; + private static int currentOutputIndex = 0; + public static void intercept(int index) { + int outputIndex = 0; + Client client = Loader.getClient(); int action1 = client.getMenuAction1()[index]; int action2 = client.getMenuAction2()[index]; @@ -23,9 +38,9 @@ public class MenuAction { if (DActions.debugActions()) { if (Game.hasAction4()) { action4 = client.getMenuAction4()[index]; - System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, action4: %d, id: %d]", index, action1, action2, action3, action4, actionId)); + System.out.println(String.format(outputs[0][outputIndex], index, action1, action2, action3, action4, actionId)); } else { - System.out.println(String.format("[index: %d, action1: %d, action2: %d, action3: %d, id: %d]", index, action1, action2, action3, actionId)); + System.out.println(String.format(outputs[1][outputIndex], index, action1, action2, action3, actionId)); } } @@ -33,4 +48,19 @@ public class MenuAction { ScriptEngine.getInstance().dispatch(actionEvent); } + /** + * Sets the current output index + * + * @param currentOutputIndex + */ + public static void setCurrentOutputIndex(int currentOutputIndex) { + if (currentOutputIndex > outputs.length - 1) { + currentOutputIndex = 0; + } + MenuAction.currentOutputIndex = currentOutputIndex; + } + + public static String[][] getOutputs() { + return outputs; + } } diff --git a/src/main/java/org/rev317/min/ui/BotMenu.java b/src/main/java/org/rev317/min/ui/BotMenu.java index b541dcf..0654f24 100644 --- a/src/main/java/org/rev317/min/ui/BotMenu.java +++ b/src/main/java/org/rev317/min/ui/BotMenu.java @@ -2,6 +2,7 @@ package org.rev317.min.ui; import org.parabot.core.Context; import org.parabot.core.paint.PaintDebugger; +import org.rev317.min.callback.MenuAction; import org.rev317.min.debug.*; import javax.swing.*; @@ -18,7 +19,9 @@ public class BotMenu implements ActionListener { JMenu debug = new JMenu("Debug"); - JMenuItem actions = newItem("Actions"); + JMenu actions = new JMenu("Actions"); + JMenuItem enableActions = newItem("Enable Actions"); + JMenuItem animation = newItem("Animation"); JMenuItem bank = newItem("Bank"); JMenuItem flags = newItem("Collision flags"); @@ -32,7 +35,7 @@ public class BotMenu implements ActionListener { JMenuItem objects = newItem("Objects"); JMenuItem players = newItem("Players"); - debugger.addDebugger("Actions", new DActions()); + debugger.addDebugger("Enable Actions", new DActions()); debugger.addDebugger("Animation", new DAnimation()); debugger.addDebugger("Bank", new DBank()); debugger.addDebugger("Collision flags", new DCollisionFlags()); @@ -47,6 +50,7 @@ public class BotMenu implements ActionListener { debugger.addDebugger("Players", new DPlayers()); debug.add(actions); + actions.add(enableActions); debug.add(animation); debug.add(bank); debug.add(flags); @@ -60,6 +64,22 @@ public class BotMenu implements ActionListener { debug.add(objects); debug.add(players); + actions.addSeparator(); + for (int i = 0; i < MenuAction.getOutputs().length; i++){ + final int index = i; + JMenuItem debugOutput = new JCheckBoxMenuItem("Output: " + index); + debugOutput.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + MenuAction.setCurrentOutputIndex(index); + } + }); + if (i == 0){ + debugOutput.setEnabled(true); + } + actions.add(debugOutput); + } + bar.add(debug); }