From 893781ed430265b1f7e74b9065ca19d6abb198f9 Mon Sep 17 00:00:00 2001 From: Fryslan Date: Wed, 12 Oct 2016 20:44:05 +0200 Subject: [PATCH 01/18] [Completion] Completed Curses Prayer enum. --- .../org/rev317/min/api/methods/Prayer.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/rev317/min/api/methods/Prayer.java b/src/main/java/org/rev317/min/api/methods/Prayer.java index 6c7ebe3..ceb97d0 100644 --- a/src/main/java/org/rev317/min/api/methods/Prayer.java +++ b/src/main/java/org/rev317/min/api/methods/Prayer.java @@ -105,26 +105,26 @@ public class Prayer { } public enum Curse implements Book { - PROTECT_ITEM_CURSE(0, 0, 50), - SAP_WARRIOR(0, 0, 50), - SAP_RANGER(0, 0, 52), - SAP_MAGE(0, 0, 54), - SAP_SPIRIT(0, 0, 56), - BERSERKER(0, 0, 59), - DEFLECT_SUMMONING(0, 0, 62), - DEFLECT_MAGIC(0, 0, 65), - DEFLECT_MISSILE(0, 0, 68), - DEFLECT_MELEE(0, 0, 71), - LEECH_ATTACK(0, 0, 74), - LEECH_RANGE(0, 0, 76), - LEECH_MAGIC(0, 0, 78), - LEECH_DEFENCE(0, 0, 80), - LEECH_STRENGTH(0, 0, 82), - LEECH_ENERGY(0, 0, 84), - LEECH_SPECIAL_ATTACK(0, 0, 86), - WRATH(0, 0, 89), - SOUL_SPLIT(0, 0, 92), - TURMOIL(0, 0, 95); + PROTECT_ITEM_CURSE(601, 22503, 50), + SAP_WARRIOR(611, 22505, 50), + SAP_RANGER(612, 22507, 52), + SAP_MAGE(613, 22509, 54), + SAP_SPIRIT(614, 22511, 56), + BERSERKER(615, 22513, 59), + DEFLECT_SUMMONING(616, 22515, 62), + DEFLECT_MAGIC(617, 22517, 65), + DEFLECT_MISSILE(618, 22519, 68), + DEFLECT_MELEE(619, 22521, 71), + LEECH_ATTACK(620, 22523, 74), + LEECH_RANGE(621, 22525, 76), + LEECH_MAGIC(622, 22527, 78), + LEECH_DEFENCE(623, 22529, 80), + LEECH_STRENGTH(624, 22531, 82), + LEECH_ENERGY(625, 22533, 84), + LEECH_SPECIAL_ATTACK(626, 22535, 86), + WRATH(627, 22537, 89), + SOUL_SPLIT(628, 22539, 92), + TURMOIL(629, 22541, 95); private int setting; private int action; From bc6803752c5381921f3c6aa0cb30159119208e68 Mon Sep 17 00:00:00 2001 From: Fryslan Date: Sat, 15 Oct 2016 14:50:46 +0200 Subject: [PATCH 02/18] [FIX] Fixed WalkTo method for PKHonor. --- .../java/org/rev317/min/api/methods/Walking.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/rev317/min/api/methods/Walking.java b/src/main/java/org/rev317/min/api/methods/Walking.java index bbce3b8..8b065a7 100644 --- a/src/main/java/org/rev317/min/api/methods/Walking.java +++ b/src/main/java/org/rev317/min/api/methods/Walking.java @@ -1,5 +1,9 @@ package org.rev317.min.api.methods; + +import org.parabot.core.Context; +import org.parabot.core.reflect.RefClass; +import org.parabot.core.reflect.RefMethod; import org.rev317.min.Loader; import org.rev317.min.api.wrappers.Tile; import org.rev317.min.api.wrappers.TilePath; @@ -16,7 +20,13 @@ public class Walking { * @param to Tile to Walk To. */ public static void walkTo(Tile from, Tile to) { - Loader.getClient().walkTo(0, 0, 0, 0, from.getRegionY(), 0, 0, to.getRegionY(), from.getRegionX(), true, to.getRegionX()); + if (Context.getInstance().getServerProviderInfo().getServerName().toLowerCase().contentEquals("pkhonor")) { + RefClass refClass = new RefClass(Loader.getClient()); + RefMethod method = refClass.getMethod("walkTo"); + method.invoke(false,false,0, 0, 0, 0, from.getLocation().getRegionY(), 0, 0, to.getRegionY(), from.getLocation().getRegionX(), true, to.getRegionX()); + } else { + Loader.getClient().walkTo(0, 0, 0, 0, from.getRegionY(), 0, 0, to.getRegionY(), from.getRegionX(), true, to.getRegionX()); + } } /** @@ -25,7 +35,7 @@ public class Walking { * @param to Destination Tile. */ public static void walkTo(Tile to) { - Loader.getClient().walkTo(0, 0, 0, 0, Players.getMyPlayer().getLocation().getRegionY(), 0, 0, to.getRegionY(), Players.getMyPlayer().getLocation().getRegionX(), true, to.getRegionX()); + walkTo(Players.getMyPlayer().getLocation(), to); } /** From fa5030262a16cec8b6f25c0668b670a4795a3f81 Mon Sep 17 00:00:00 2001 From: Fryslan Date: Sat, 15 Oct 2016 15:39:57 +0200 Subject: [PATCH 03/18] [FIX] Setting action debug unchecked when selecting another option. --- src/main/java/org/rev317/min/ui/BotMenu.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/rev317/min/ui/BotMenu.java b/src/main/java/org/rev317/min/ui/BotMenu.java index 0654f24..eee8fa0 100644 --- a/src/main/java/org/rev317/min/ui/BotMenu.java +++ b/src/main/java/org/rev317/min/ui/BotMenu.java @@ -68,6 +68,7 @@ public class BotMenu implements ActionListener { for (int i = 0; i < MenuAction.getOutputs().length; i++){ final int index = i; JMenuItem debugOutput = new JCheckBoxMenuItem("Output: " + index); + debugOutput.setEnabled(false); debugOutput.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { From 0ae03219a236602daa83e5e1d5d13280d143e3dc Mon Sep 17 00:00:00 2001 From: Emmastone Date: Sun, 16 Oct 2016 23:47:21 +0100 Subject: [PATCH 04/18] [FEATURE] Added dialog input && Set amount --- src/main/java/org/rev317/min/accessors/Client.java | 4 ++++ src/main/java/org/rev317/min/api/methods/Game.java | 8 ++++++++ .../java/org/rev317/min/api/methods/Interfaces.java | 8 ++++++++ .../java/org/rev317/min/api/methods/Inventory.java | 1 - src/main/java/org/rev317/min/api/methods/Menu.java | 13 +++++++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/rev317/min/accessors/Client.java b/src/main/java/org/rev317/min/accessors/Client.java index f9555de..430797f 100644 --- a/src/main/java/org/rev317/min/accessors/Client.java +++ b/src/main/java/org/rev317/min/accessors/Client.java @@ -20,6 +20,8 @@ public interface Client { void setInterface(int id); + void setAmountOrNameInput(int amount); + int[] getCurrentExp(); Deque[][][] getGroundItems(); @@ -28,6 +30,8 @@ public interface Client { int getBackDialogId(); + int getInputDialogState(); + int getPlane(); int[] getMenuActionId(); diff --git a/src/main/java/org/rev317/min/api/methods/Game.java b/src/main/java/org/rev317/min/api/methods/Game.java index e1f0419..cf728e7 100644 --- a/src/main/java/org/rev317/min/api/methods/Game.java +++ b/src/main/java/org/rev317/min/api/methods/Game.java @@ -45,6 +45,14 @@ public class Game { return Loader.getClient().getBackDialogId(); } + /** + * Get current input dialog state + * @return input dialog state + */ + public static int getInputDialogState() { + return Loader.getClient().getInputDialogState(); + } + /** * Gets loop cycle * diff --git a/src/main/java/org/rev317/min/api/methods/Interfaces.java b/src/main/java/org/rev317/min/api/methods/Interfaces.java index 4e038c9..12e1142 100644 --- a/src/main/java/org/rev317/min/api/methods/Interfaces.java +++ b/src/main/java/org/rev317/min/api/methods/Interfaces.java @@ -36,6 +36,14 @@ public class Interfaces { Loader.getClient().setInterface(id); } + /** + * Sets the int by the given Amount + * @param amount Amount to set + */ + public static void setAmountOrNameInput(int amount) { + Loader.getClient().setAmountOrNameInput(amount); + } + /** * Get's the Open Interface ID. * @return The ID of the Open Interface , will be -1 if all Interfaces are closed. diff --git a/src/main/java/org/rev317/min/api/methods/Inventory.java b/src/main/java/org/rev317/min/api/methods/Inventory.java index bc925e6..86015b7 100644 --- a/src/main/java/org/rev317/min/api/methods/Inventory.java +++ b/src/main/java/org/rev317/min/api/methods/Inventory.java @@ -296,4 +296,3 @@ public class Inventory { return false; } } - diff --git a/src/main/java/org/rev317/min/api/methods/Menu.java b/src/main/java/org/rev317/min/api/methods/Menu.java index c069c70..b964c3b 100644 --- a/src/main/java/org/rev317/min/api/methods/Menu.java +++ b/src/main/java/org/rev317/min/api/methods/Menu.java @@ -6,6 +6,8 @@ import org.rev317.min.accessors.Client; import org.rev317.min.api.wrappers.Character; import org.rev317.min.api.wrappers.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.HashMap; /** @@ -320,6 +322,17 @@ public class Menu { Client client = Loader.getClient(); + try { + Method doAction = client.getClass().getDeclaredMethod("doAction", int.class); + doAction.setAccessible(true); + + doAction.invoke(client, 0); + + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { + e.printStackTrace(); + } + + client.getMenuAction1()[index] = cmd1; client.getMenuAction2()[index] = cmd2; client.getMenuAction3()[index] = cmd3; From 0c07067201b1a939c4d61a24547ebdedf60fe84d Mon Sep 17 00:00:00 2001 From: Emmastone Date: Sun, 16 Oct 2016 23:55:41 +0100 Subject: [PATCH 05/18] [CLEANUP] Removed duplicated method && unused code --- .../java/org/rev317/min/api/methods/Game.java | 17 --------- .../rev317/min/api/methods/Interfaces.java | 38 ++++++++++++++----- .../java/org/rev317/min/api/methods/Menu.java | 36 +++++------------- .../org/rev317/min/debug/DInterfaces.java | 3 +- 4 files changed, 39 insertions(+), 55 deletions(-) diff --git a/src/main/java/org/rev317/min/api/methods/Game.java b/src/main/java/org/rev317/min/api/methods/Game.java index cf728e7..768a583 100644 --- a/src/main/java/org/rev317/min/api/methods/Game.java +++ b/src/main/java/org/rev317/min/api/methods/Game.java @@ -36,23 +36,6 @@ public class Game { return Loader.getClient().getOpenInterfaceId(); } - /** - * Get open back dialog id - * - * @return back dialog id - */ - public static int getOpenBackDialogId() { - return Loader.getClient().getBackDialogId(); - } - - /** - * Get current input dialog state - * @return input dialog state - */ - public static int getInputDialogState() { - return Loader.getClient().getInputDialogState(); - } - /** * Gets loop cycle * diff --git a/src/main/java/org/rev317/min/api/methods/Interfaces.java b/src/main/java/org/rev317/min/api/methods/Interfaces.java index 12e1142..9bd2b39 100644 --- a/src/main/java/org/rev317/min/api/methods/Interfaces.java +++ b/src/main/java/org/rev317/min/api/methods/Interfaces.java @@ -13,31 +13,35 @@ public class Interfaces { /** * Get's the interfaces loaded in the interface Cache. + * * @return Interfaces in the Interface Cache. */ - public static Interface[] getInterfaces(){ + public static Interface[] getInterfaces() { return Loader.getClient().getInterfaceCache(); } /** * Get's the Interface from the Interface Cache using the given ID. + * * @param id Interface ID. * @return Interface from the cache by the given ID. */ - public static Interface getInterface(int id){ + public static Interface getInterface(int id) { return getInterfaces()[id]; } /** * Opens the Interface by the given ID. + * * @param id ID of the Interface to Open. */ - public static void openInterface(int id){ + public static void openInterface(int id) { Loader.getClient().setInterface(id); } /** * Sets the int by the given Amount + * * @param amount Amount to set */ public static void setAmountOrNameInput(int amount) { @@ -46,45 +50,59 @@ public class Interfaces { /** * Get's the Open Interface ID. + * * @return The ID of the Open Interface , will be -1 if all Interfaces are closed. */ - public static int getOpenInterfaceId(){ + public static int getOpenInterfaceId() { return Loader.getClient().getOpenInterfaceId(); } /** * Get's the Open Back Dialog ID. + * * @return The ID of the Open Back Dialog , will be -1 if all Back Dialogs are closed. */ - public static int getBackDialogId(){ + public static int getBackDialogId() { return Loader.getClient().getBackDialogId(); } + /** + * Get current input dialog state + * + * @return input dialog state + */ + public static int getInputDialogState() { + return Loader.getClient().getInputDialogState(); + } + /** * Checks if the Interface or Back Dialog by the given ID is Open. + * * @param id ID of the Interface or Back Dialog to check for. * @return True is the Interface or Back Dialog is Open else will return false. */ - public static boolean isOpen(int id){ + public static boolean isOpen(int id) { return getOpenInterfaceId() == id || getBackDialogId() == id; } /** * Checks if the Interface by the given ID is Open. - * @param id ID of the Interface or Back Dialog to check for depending on the backDialog boolean. + * + * @param id ID of the Interface or Back Dialog to check for depending on the backDialog boolean. * @param backDialog When tru it will check the Bank Dialog ID else it will check for the Interface ID. * @return True is the Interface or Back Dialog is Open else will return false. */ - public static boolean isOpen(int id, boolean backDialog){ - if(backDialog){ + public static boolean isOpen(int id, boolean backDialog) { + if (backDialog) { return getBackDialogId() == id; - }else{ + } else { return getOpenInterfaceId() == id; } } /** * Clicks an option from the given back dialog + * * @param index Index of the requested option whereas you start at 0 */ public static void clickBackDialogOption(int index) { diff --git a/src/main/java/org/rev317/min/api/methods/Menu.java b/src/main/java/org/rev317/min/api/methods/Menu.java index b964c3b..703a228 100644 --- a/src/main/java/org/rev317/min/api/methods/Menu.java +++ b/src/main/java/org/rev317/min/api/methods/Menu.java @@ -6,8 +6,6 @@ import org.rev317.min.accessors.Client; import org.rev317.min.api.wrappers.Character; import org.rev317.min.api.wrappers.*; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.HashMap; /** @@ -34,10 +32,9 @@ public class Menu { /** * Interacts with a sceneobject * - * @deprecated - * * @param object * @param actionIndex + * @deprecated */ public static void interact(SceneObject object, int actionIndex) { int actionId = SceneObjects.Option.FIRST.getActionId(); @@ -88,10 +85,9 @@ public class Menu { /** * Interacts with a character * - * @deprecated - * * @param character * @param actionIndex + * @deprecated */ public static void interact(Character character, int actionIndex) { int actionId = 20; @@ -131,11 +127,10 @@ public class Menu { /** * Interacts with an item when it has the following menu Transform-1 Transform-5 Transform-10 etc.. * - * @deprecated - * * @param item * @param actionIndex * @param interfaceParentId + * @deprecated */ public static void transformItem(Item item, int actionIndex, int interfaceParentId) { @@ -183,10 +178,9 @@ public class Menu { /** * Interacts with a ground item * - * @deprecated - * * @param item * @param action + * @deprecated */ public static void interact(GroundItem item, int action) { int actionId = GroundItems.Option.FIRST.getActionId(); @@ -210,16 +204,16 @@ public class Menu { sendAction(actionId, item.getId(), item.getX(), item.getY()); } - public static void interact(Item item, Items.Option action){ + public static void interact(Item item, Items.Option action) { sendAction(action.getActionId(), item.getId() - 1, item.getSlot(), 3214); } /** * @deprecated */ - public static void interact(Item item, int action){ + public static void interact(Item item, int action) { int actionId = 447; - switch (action){ + switch (action) { case 0: actionId = 447; break; @@ -239,9 +233,9 @@ public class Menu { /** * @deprecated */ - public static void interact(Item item, String action){ + public static void interact(Item item, String action) { int actionId = 447; - switch (action.toLowerCase()){ + switch (action.toLowerCase()) { case "use": actionId = 447; break; @@ -319,20 +313,8 @@ public class Menu { * @param index */ public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) { - Client client = Loader.getClient(); - try { - Method doAction = client.getClass().getDeclaredMethod("doAction", int.class); - doAction.setAccessible(true); - - doAction.invoke(client, 0); - - } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { - e.printStackTrace(); - } - - client.getMenuAction1()[index] = cmd1; client.getMenuAction2()[index] = cmd2; client.getMenuAction3()[index] = cmd3; diff --git a/src/main/java/org/rev317/min/debug/DInterfaces.java b/src/main/java/org/rev317/min/debug/DInterfaces.java index 045f297..18af28c 100644 --- a/src/main/java/org/rev317/min/debug/DInterfaces.java +++ b/src/main/java/org/rev317/min/debug/DInterfaces.java @@ -4,6 +4,7 @@ import org.parabot.core.Context; import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.PaintDebugger; import org.rev317.min.api.methods.Game; +import org.rev317.min.api.methods.Interfaces; import java.awt.*; @@ -14,7 +15,7 @@ public class DInterfaces extends AbstractDebugger { public void paint(Graphics g) { PaintDebugger p = Context.getInstance().getPaintDebugger(); p.addLine("Open interface: " + Game.getOpenInterfaceId()); - p.addLine("Open back dialog: " + Game.getOpenBackDialogId()); + p.addLine("Open back dialog: " + Interfaces.getBackDialogId()); } @Override From 33393875a687120b49ebbc3831c657a61e882626 Mon Sep 17 00:00:00 2001 From: Emmastone Date: Mon, 17 Oct 2016 00:20:12 +0100 Subject: [PATCH 06/18] [BUGFIX] Set getOpenBackDialogId as deprecated --- .../java/org/rev317/min/api/methods/Game.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/rev317/min/api/methods/Game.java b/src/main/java/org/rev317/min/api/methods/Game.java index 768a583..f2482e5 100644 --- a/src/main/java/org/rev317/min/api/methods/Game.java +++ b/src/main/java/org/rev317/min/api/methods/Game.java @@ -36,6 +36,18 @@ public class Game { return Loader.getClient().getOpenInterfaceId(); } + + /** + * Get open back dialog id + * + * @return back dialog id + * @deprecated Use {@link Interfaces #getBackDialogId()} instead. + */ + @Deprecated + public static int getOpenBackDialogId() { + return Loader.getClient().getBackDialogId(); + } + /** * Gets loop cycle * @@ -81,10 +93,9 @@ public class Game { * Returns the settings within the client * * @param index The index of the setting you want to gather - * * @return The specific setting for the given index */ - public static int getSetting(int index){ + public static int getSetting(int index) { return Loader.getClient().getSettings()[index]; } @@ -93,7 +104,7 @@ public class Game { * * @return All settings */ - public static int[] getSettings(){ + public static int[] getSettings() { return Loader.getClient().getSettings(); } @@ -109,15 +120,16 @@ public class Game { /** * Just simply drops the client */ - public static void dropClient(){ + public static void dropClient() { Loader.getClient().dropClient(); } /** * Drops the client and returns if the game is logged out or not + * * @return True if game is logged out, false if not */ - public static boolean confirmedDropClient(){ + public static boolean confirmedDropClient() { Loader.getClient().dropClient(); Time.sleep(new SleepCondition() { @Override From ec1feb393ff822ebf549235aaa3c48cc6ded3935 Mon Sep 17 00:00:00 2001 From: Emmastone Date: Mon, 17 Oct 2016 00:26:42 +0100 Subject: [PATCH 07/18] [CLEANUP] Deprecated code --- src/main/java/org/rev317/min/api/methods/Game.java | 4 +++- src/main/java/org/rev317/min/debug/DInterfaces.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/rev317/min/api/methods/Game.java b/src/main/java/org/rev317/min/api/methods/Game.java index f2482e5..e0bf09f 100644 --- a/src/main/java/org/rev317/min/api/methods/Game.java +++ b/src/main/java/org/rev317/min/api/methods/Game.java @@ -31,7 +31,9 @@ public class Game { * Gets open interface id * * @return interface id + * @deprecated Use {@link Interfaces #getOpenInterfaceId()} instead */ + @Deprecated public static int getOpenInterfaceId() { return Loader.getClient().getOpenInterfaceId(); } @@ -41,7 +43,7 @@ public class Game { * Get open back dialog id * * @return back dialog id - * @deprecated Use {@link Interfaces #getBackDialogId()} instead. + * @deprecated Use {@link Interfaces #getBackDialogId()} instead */ @Deprecated public static int getOpenBackDialogId() { diff --git a/src/main/java/org/rev317/min/debug/DInterfaces.java b/src/main/java/org/rev317/min/debug/DInterfaces.java index 18af28c..4f7e382 100644 --- a/src/main/java/org/rev317/min/debug/DInterfaces.java +++ b/src/main/java/org/rev317/min/debug/DInterfaces.java @@ -14,7 +14,7 @@ public class DInterfaces extends AbstractDebugger { @Override public void paint(Graphics g) { PaintDebugger p = Context.getInstance().getPaintDebugger(); - p.addLine("Open interface: " + Game.getOpenInterfaceId()); + p.addLine("Open interface: " + Interfaces.getOpenInterfaceId()); p.addLine("Open back dialog: " + Interfaces.getBackDialogId()); } From 96b39afd59c37a228d7160c65f731c18a1a102b5 Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Mon, 17 Oct 2016 01:36:50 +0200 Subject: [PATCH 08/18] [BUGFIX] Proper pkhonor walking method --- src/main/java/org/rev317/min/accessors/Client.java | 2 ++ src/main/java/org/rev317/min/api/methods/Walking.java | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/rev317/min/accessors/Client.java b/src/main/java/org/rev317/min/accessors/Client.java index 430797f..10ae439 100644 --- a/src/main/java/org/rev317/min/accessors/Client.java +++ b/src/main/java/org/rev317/min/accessors/Client.java @@ -49,6 +49,8 @@ public interface Client { // args switched boolean walkTo(int clickType, int sizeX, int sizeY, int startX, int startY, int destX, int destY, int type, int face, boolean arbitrary, int rotation); + boolean walkToPKH(boolean flag1, boolean flag2, int clickType, int sizeX, int sizeY, int startX, int startY, int destX, int destY, int type, int face, boolean arbitrary, int rotation); + void doAction(int i); void dropClient(); diff --git a/src/main/java/org/rev317/min/api/methods/Walking.java b/src/main/java/org/rev317/min/api/methods/Walking.java index 8b065a7..4cc026a 100644 --- a/src/main/java/org/rev317/min/api/methods/Walking.java +++ b/src/main/java/org/rev317/min/api/methods/Walking.java @@ -2,8 +2,6 @@ package org.rev317.min.api.methods; import org.parabot.core.Context; -import org.parabot.core.reflect.RefClass; -import org.parabot.core.reflect.RefMethod; import org.rev317.min.Loader; import org.rev317.min.api.wrappers.Tile; import org.rev317.min.api.wrappers.TilePath; @@ -20,11 +18,9 @@ public class Walking { * @param to Tile to Walk To. */ public static void walkTo(Tile from, Tile to) { - if (Context.getInstance().getServerProviderInfo().getServerName().toLowerCase().contentEquals("pkhonor")) { - RefClass refClass = new RefClass(Loader.getClient()); - RefMethod method = refClass.getMethod("walkTo"); - method.invoke(false,false,0, 0, 0, 0, from.getLocation().getRegionY(), 0, 0, to.getRegionY(), from.getLocation().getRegionX(), true, to.getRegionX()); - } else { + if (Context.getInstance().getServerProviderInfo().getServerName().equalsIgnoreCase("pkhonor")) { + Loader.getClient().walkToPKH(false, false, 0, 0, 0, 0, from.getLocation().getRegionY(), 0, 0, to.getRegionY(), from.getLocation().getRegionX(), true, to.getRegionX()); + } else { Loader.getClient().walkTo(0, 0, 0, 0, from.getRegionY(), 0, 0, to.getRegionY(), from.getRegionX(), true, to.getRegionX()); } } From 23af9fae7068ed12c46dc890499ce275fbdc83f0 Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Mon, 17 Oct 2016 01:49:09 +0200 Subject: [PATCH 09/18] [BUGFIX] Solved problem where you could select multiple items Solves issue #52 --- src/main/java/org/rev317/min/ui/BotMenu.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/rev317/min/ui/BotMenu.java b/src/main/java/org/rev317/min/ui/BotMenu.java index eee8fa0..8e3ce45 100644 --- a/src/main/java/org/rev317/min/ui/BotMenu.java +++ b/src/main/java/org/rev317/min/ui/BotMenu.java @@ -65,19 +65,19 @@ public class BotMenu implements ActionListener { debug.add(players); actions.addSeparator(); + + ButtonGroup group = new ButtonGroup(); for (int i = 0; i < MenuAction.getOutputs().length; i++){ final int index = i; - JMenuItem debugOutput = new JCheckBoxMenuItem("Output: " + index); - debugOutput.setEnabled(false); + JMenuItem debugOutput = new JRadioButtonMenuItem("Output: " + index); debugOutput.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { MenuAction.setCurrentOutputIndex(index); + } }); - if (i == 0){ - debugOutput.setEnabled(true); - } + group.add(debugOutput); actions.add(debugOutput); } From 03280055e12ed2d50215521e993d1cceb40c64df Mon Sep 17 00:00:00 2001 From: Emmastone Date: Mon, 17 Oct 2016 01:10:27 +0100 Subject: [PATCH 10/18] [FEATURE] Login method --- .../java/org/rev317/min/accessors/Client.java | 2 ++ .../java/org/rev317/min/api/methods/Game.java | 18 ++++++++++++++++++ .../java/org/rev317/min/debug/DInterfaces.java | 1 - 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/rev317/min/accessors/Client.java b/src/main/java/org/rev317/min/accessors/Client.java index 10ae439..9fbed8f 100644 --- a/src/main/java/org/rev317/min/accessors/Client.java +++ b/src/main/java/org/rev317/min/accessors/Client.java @@ -55,6 +55,8 @@ public interface Client { void dropClient(); + void login(String username, String password, boolean reconnecting); + int[] getCurrentStats(); int[] getSettings(); diff --git a/src/main/java/org/rev317/min/api/methods/Game.java b/src/main/java/org/rev317/min/api/methods/Game.java index e0bf09f..462fceb 100644 --- a/src/main/java/org/rev317/min/api/methods/Game.java +++ b/src/main/java/org/rev317/min/api/methods/Game.java @@ -142,4 +142,22 @@ public class Game { return !isLoggedIn(); } + /** + * Login to a server + * @param username String + * @param password String + * @param reconnecting True if it's a retry, false if not + */ + public static void login(String username, String password, boolean reconnecting) { + Loader.getClient().login(username, password, reconnecting); + } + + /** + * Login to a server + * @param username String + * @param password String + */ + public static void login(String username, String password) { + login(username, password, false); + } } diff --git a/src/main/java/org/rev317/min/debug/DInterfaces.java b/src/main/java/org/rev317/min/debug/DInterfaces.java index 4f7e382..a4cd85d 100644 --- a/src/main/java/org/rev317/min/debug/DInterfaces.java +++ b/src/main/java/org/rev317/min/debug/DInterfaces.java @@ -3,7 +3,6 @@ package org.rev317.min.debug; import org.parabot.core.Context; import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.PaintDebugger; -import org.rev317.min.api.methods.Game; import org.rev317.min.api.methods.Interfaces; import java.awt.*; From a2860ce06491a32a97873b51386a638c5f3e0924 Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 00:55:58 +0200 Subject: [PATCH 11/18] [TASK] Updated pom to correct and bumped version --- pom.xml | 56 ++++++++++++++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/pom.xml b/pom.xml index 8b633a1..32108fd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.parabot 317-api-minified - 1.15 + 1.201 Parabot 317-API-Minified @@ -19,6 +19,7 @@ 1.7 + -Xdoclint:none @@ -39,7 +40,7 @@ - ${artifactId}-V${version} + Provider-V${version}${build.version} org.apache.maven.plugins @@ -50,39 +51,30 @@ ${jdk.version} - - - - org.apache.maven.wagon - wagon-ftp - 2.10 - - - - - - https://maven.parabot.org/ - - false - parabot-maven - Custom Maven Repository - ftp://maven.parabot.org - default - - - parabot-maven - Frontend Parabot Maven - ftp://maven.parabot.org/docs/${artifactId}/ - - - - - org.apache.maven.plugins - maven-javadoc-plugin + maven-assembly-plugin + 2.5.3 + + + jar-with-dependencies + + ${project.build.directory}/final/ + false + + + + + make-assembly + + package + + single + + + - + \ No newline at end of file From c3c8dc3b113e8073cfe21f78c8af786858876bcf Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 00:57:19 +0200 Subject: [PATCH 12/18] [FEATURE] Added Travis file --- .travis.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9d790ce --- /dev/null +++ b/.travis.yml @@ -0,0 +1,52 @@ +language: java + +jdk: + - oraclejdk7 + - oraclejdk8 + +before_install: + - chmod +x ./.travis/maven-build.sh + - chmod +x ./.travis/call-creation.sh + - mvn clean + +install: + - sudo apt-get update && sudo apt-get --assume-yes install zip unzip + +script: "./.travis/maven-build.sh" + +after_deploy: "./.travis/call-creation.sh" + +notifications: + email: false + slack: + secure: osWX769z0hSVPbeF1ZHSENgR4i+VKFTMGFNIV02RhvZ4a1BXsGUG5VCCDYUoBzWPCA5avJHg+FrN7nEEaoIjc5/qqFmZFGwOitZJsOzvR8C18QcgyuEX+35U4eQF4h5ITpruvwNNQ/7hIWyPl/fEPcAswHFDAccEb5iRNJeFNeM= + webhooks: + on_success: always + on_failure: always + on_start: never + +env: + global: + - PROVIDER_VERSION=1.201 + +cache: + directories: + - ".autoconf" + - "$HOME/.m2" + +deploy: + - provider: s3 + access_key_id: AKIAJDZLZNH2PIKHUKOA + secret_access_key: + secure: m5kZDaOBSljVQJkXds5aK4aybtxnFJLNjS4qaCeNsDahxWxEBAbM/DJOYTYa4KN2hEiwFriuwVjwRws9Kgf7zDnL8CvTqWnSKtOc8UzTsBX+xw+hv9lEVKNia+ccMsW71omo4FXUX7ulaKOIY2KY92xRoK+ycYVxB6OI1jQa9Eo= + bucket: parabot + skip_cleanup: true + local-dir: "./target/final/" + upload-dir: "artifacts/provider" + region: us-west-1 + detect_encoding: true + acl: public_read + on: + repo: Parabot/Parabot-317-API-Minified + all_branches: true + jdk: 'oraclejdk7' \ No newline at end of file From 50a80b0b3759ad8cfd6e60d6158b3ac70999b243 Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 00:57:29 +0200 Subject: [PATCH 13/18] [TASK] Added creation calling file --- .travis/call-creation.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis/call-creation.sh diff --git a/.travis/call-creation.sh b/.travis/call-creation.sh new file mode 100644 index 0000000..e633671 --- /dev/null +++ b/.travis/call-creation.sh @@ -0,0 +1,4 @@ +#! /bin/bash + +sleep 15 +curl -sS "http://v3.bdn.parabot.org/api/bot/create/provider?build_id=$TRAVIS_BUILD_ID&version=$PROVIDER_VERSION" >/dev/null \ No newline at end of file From 17256688dc5b75bc8c8655b02fe8824a32c37ffa Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 01:00:45 +0200 Subject: [PATCH 14/18] [BUGFIX] Added maven build file --- .travis/maven-build.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .travis/maven-build.sh diff --git a/.travis/maven-build.sh b/.travis/maven-build.sh new file mode 100644 index 0000000..f618ba6 --- /dev/null +++ b/.travis/maven-build.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +if [ "$TRAVIS_BRANCH" == "master" ]; then + mvn -U package +else + mvn -Dbuild.version="-RC-$TRAVIS_BUILD_ID" -U package +fi \ No newline at end of file From 9f0f7680545d58c5686d9b03df2c3b646f5805fd Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 01:12:32 +0200 Subject: [PATCH 15/18] [TASK] Updated secure key --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9d790ce..e56f2e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ deploy: - provider: s3 access_key_id: AKIAJDZLZNH2PIKHUKOA secret_access_key: - secure: m5kZDaOBSljVQJkXds5aK4aybtxnFJLNjS4qaCeNsDahxWxEBAbM/DJOYTYa4KN2hEiwFriuwVjwRws9Kgf7zDnL8CvTqWnSKtOc8UzTsBX+xw+hv9lEVKNia+ccMsW71omo4FXUX7ulaKOIY2KY92xRoK+ycYVxB6OI1jQa9Eo= + secure: Opk2uGg0CyBIeqDX5EIu6UBRjaxjZwfNVNsjGbsA8QWjIu2zIUwFe1ZWJEkqzF5jqrN8ykgHw74ofrgZyBKH2nhGn7MN4wWWktKN4iIeq2D6gf8Cq31tzZcpgEfUaJnARXtu0jjCKag2PqglQAEc/OgVEeEFuUapJ0I4ITDZWbk= bucket: parabot skip_cleanup: true local-dir: "./target/final/" From 6e82b0c3cb44d283fa1d795bedc63c1bdee5abab Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 01:15:21 +0200 Subject: [PATCH 16/18] [BUGFIX] Set correct creation call --- .travis/call-creation.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis/call-creation.sh b/.travis/call-creation.sh index e633671..926ada4 100644 --- a/.travis/call-creation.sh +++ b/.travis/call-creation.sh @@ -1,4 +1,4 @@ #! /bin/bash -sleep 15 -curl -sS "http://v3.bdn.parabot.org/api/bot/create/provider?build_id=$TRAVIS_BUILD_ID&version=$PROVIDER_VERSION" >/dev/null \ No newline at end of file +sleep 1 +curl --data "build_id=$TRAVIS_BUILD_ID&version=$PROVIDER_VERSION" "http://v3.bdn.parabot.org/api/bot/create/provider" \ No newline at end of file From 077ec05d8e7c355bd278f06c329ac911202c5677 Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 01:16:07 +0200 Subject: [PATCH 17/18] [TASK] Testing if multiple branches work --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e56f2e5..eaab26d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,5 +48,7 @@ deploy: acl: public_read on: repo: Parabot/Parabot-317-API-Minified - all_branches: true + branch: + - master + - development jdk: 'oraclejdk7' \ No newline at end of file From 15c2d82f8f09ac9800ff924df64c7c3291c00af3 Mon Sep 17 00:00:00 2001 From: JKetelaar Date: Sun, 23 Oct 2016 01:28:25 +0200 Subject: [PATCH 18/18] [FEATURE] Updated Client version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 32108fd..8a41e1e 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ org.parabot client - 2.6 + 2.6.0