diff --git a/Cache/sound0.wav b/Cache/sound0.wav index c02a4dc..80bf91c 100644 Binary files a/Cache/sound0.wav and b/Cache/sound0.wav differ diff --git a/Cache/sound1.wav b/Cache/sound1.wav index 1c32e41..80bf91c 100644 Binary files a/Cache/sound1.wav and b/Cache/sound1.wav differ diff --git a/Cache/sound2.wav b/Cache/sound2.wav index 1c32e41..80bf91c 100644 Binary files a/Cache/sound2.wav and b/Cache/sound2.wav differ diff --git a/Cache/sound3.wav b/Cache/sound3.wav index 1c32e41..80bf91c 100644 Binary files a/Cache/sound3.wav and b/Cache/sound3.wav differ diff --git a/Cache/sound4.wav b/Cache/sound4.wav index c02a4dc..80bf91c 100644 Binary files a/Cache/sound4.wav and b/Cache/sound4.wav differ diff --git a/src/main/java/org/rebotted/Client.java b/src/main/java/org/rebotted/Client.java index de98863..1e910ef 100644 --- a/src/main/java/org/rebotted/Client.java +++ b/src/main/java/org/rebotted/Client.java @@ -99,9 +99,9 @@ public class Client extends GameApplet { public static int anInt1290; public static String server = ""; public static int[] fullScreenTextureArray; - static int openInterfaceId; + public static int openInterfaceId; static int anInt1211; - static int tabId; + public static int tabId; private static int anInt849; private static int anInt854; private static int anInt924; @@ -273,14 +273,14 @@ public class Client extends GameApplet { private long loadingStartTime; private int[][] anIntArrayArray825; private int[] friendsNodeIDs; - private Deque[][][] groundItems; + public Deque[][][] groundItems; private int[] anIntArray828; private int[] anIntArray829; private volatile boolean aBoolean831; private Socket jaggrab; private int loginScreenState; private Buffer chatBuffer; - private Npc[] npcs; + public Npc[] npcs; private int npcCount; private int[] npcIndices; private int removedMobCount; @@ -297,11 +297,11 @@ public class Client extends GameApplet { private int[] anIntArray852; private int[] anIntArray853; private int hintIconDrawType; - private int xCameraPos; - private int zCameraPos; - private int yCameraPos; - private int yCameraCurve; - private int xCameraCurve; + public int xCameraPos; + public int zCameraPos; + public int yCameraPos; + public int yCameraCurve; + public int xCameraCurve; private int myPrivilege; private Sprite mapFlag; private Sprite mapMarker; @@ -309,10 +309,10 @@ public class Client extends GameApplet { private MouseDetection mouseDetection; private volatile boolean drawFlames; private String reportAbuseInput; - private boolean menuOpen; + public boolean menuOpen; private int anInt886; private String inputString; - private Player[] players; + public Player[] players; private int playerCount; private int[] playerList; private int mobsAwaitingUpdateCount; @@ -328,7 +328,7 @@ public class Client extends GameApplet { private int crossY; private int crossIndex; private int crossType; - private int plane; + public int plane; private boolean loadingError; private int[][] anIntArrayArray929; private Sprite aClass30_Sub2_Sub1_Sub1_931; @@ -345,8 +345,8 @@ public class Client extends GameApplet { private int menuScreenArea; private int menuOffsetX; private int menuOffsetY; - private int menuWidth; - private int menuHeight; + public int menuWidth; + public int menuHeight; private long aLong953; private boolean aBoolean954; private long[] friendsListAsLongs; @@ -390,15 +390,15 @@ public class Client extends GameApplet { private int anInt1026; private boolean aBoolean1031; private Sprite[] mapFunctions; - private int regionBaseX; - private int regionBaseY; + public int regionBaseX; + public int regionBaseY; private int previousAbsoluteX; private int previousAbsoluteY; private int loginFailures; private int anInt1039; private int anInt1040; private int anInt1041; - private int dialogueId; + public int dialogueId; private int member; private boolean maleCharacter; private int anInt1048; @@ -430,10 +430,10 @@ public class Client extends GameApplet { private int activeInterfaceType; private int anInt1087; private int anInt1088; - private int[] firstMenuAction; - private int[] secondMenuAction; - private int[] menuActionTypes; - private int[] selectedMenuActions; + public int[] firstMenuAction; + public int[] secondMenuAction; + public int[] menuActionTypes; + public int[] selectedMenuActions; private Sprite[] headIcons; private Sprite[] skullIcons; private Sprite[] headIconsHint; @@ -456,15 +456,15 @@ public class Client extends GameApplet { private String aString1121; private Sprite compass; private ProducingGraphicsBuffer chatSettingImageProducer; - private int cameraY; - private int menuActionRow; - private int spellSelected; + public int cameraY; + public int menuActionRow; + public int spellSelected; private int anInt1137; - private int spellUsableOn; + public int spellUsableOn; private String spellTooltip; private Sprite[] minimapHint; private boolean inPlayerOwnedHouse; - private int runEnergy = 100; + public int runEnergy = 100; private boolean continuedDialogue; private Sprite[] crosses; private IndexedImage[] titleIndexedImages; @@ -487,7 +487,7 @@ public class Client extends GameApplet { private int cameraHorizontal; private int anInt1186; private int anInt1187; - private int overlayInterfaceId; + public int overlayInterfaceId; private int[] anIntArray1190; private int[] anIntArray1191; private Buffer outgoing; @@ -498,9 +498,9 @@ public class Client extends GameApplet { private Sprite flameLeftSprite; private Sprite flameRightSprite; private int minimapRotation; - private String promptInput; + public String promptInput; private int anInt1213; - private int[][][] tileHeights; + public int[][][] tileHeights; private long serverSeed; private int loginScreenCursorPos; private long aLong1220; @@ -526,17 +526,17 @@ public class Client extends GameApplet { private int anInt1253; private boolean welcomeScreenRaised; private boolean messagePromptRaised; - private byte[][][] tileFlags; + public byte[][][] tileFlags; private int prevSong; - private int destinationX; - private int destY; + public int destinationX; + public int destY; private Sprite minimapImage; private int anInt1264; private int anInt1265; private String firstLoginMessage; private String secondLoginMessage; - private int localX; - private int localY; + public int localX; + public int localY; private GameFont smallText; private GameFont regularText; private GameFont boldText; @@ -552,7 +552,6 @@ public class Client extends GameApplet { private int anInt1285; private String selectedItemName; private int publicChatMode; - private ClassArchive classArchive; private RebottedAPI api; private APIData apiData; public Client() { @@ -2630,7 +2629,7 @@ public class Client extends GameApplet { NpcDefinition entityDef = ((Npc) obj).desc; if (Configuration.namesAboveHeads) { npcScreenPos(((Mob) (obj)), ((Mob) (obj)).height + 15); - smallText.drawText(0x0099FF, entityDef.name, spriteDrawY - 5, spriteDrawX); // -15 + smallText.drawText(0x0099FF, entityDef.name + " - ID: ["+entityDef.id+"]", spriteDrawY - 5, spriteDrawX); // -15 // from // original } @@ -4736,21 +4735,34 @@ public class Client extends GameApplet { } // TODO menu actions - private void processMenuActions(int id) { - if (id < 0) { - return; - } + private void processMenuActions(int index) { + processMenuActions(index, null); + } + + public void processMenuActions(int index, MenuAction menuAction) { if (inputDialogState != 0) { inputDialogState = 0; updateChatbox = true; } + int first = -1; + int button = -1; + int action = -1; + int clicked = -1; + //First: 0 button: 0 action: 412 clicked: 777 actionText: Attack @yel@Man@gr1@ (level-2) + if(menuAction != null) { + first = menuAction.getMouseX(); + button = menuAction.getMouseX(); + action = menuAction.getActionId(); + clicked = menuAction.getHash(); + } else { + first = firstMenuAction[index]; + button = secondMenuAction[index]; + action = menuActionTypes[index]; + clicked = selectedMenuActions[index]; + } - int first = firstMenuAction[id]; - int button = secondMenuAction[id]; - int action = menuActionTypes[id]; - int clicked = selectedMenuActions[id]; - + //System.out.println("First: "+first + " button: "+button + " action: "+action + " clicked: "+clicked+ " actionText: "+menuActionText[index]); if (action >= 2000) { action -= 2000; } @@ -5079,7 +5091,7 @@ public class Client extends GameApplet { } if (action == 337 || action == 42 || action == 792 || action == 322) { - String string = menuActionText[id]; + String string = menuActionText[index]; int indexOf = string.indexOf("@whi@"); if (indexOf != -1) { long usernameHash = StringUtils.encodeBase37(string.substring(indexOf + 5).trim()); @@ -5133,7 +5145,7 @@ public class Client extends GameApplet { } } if (action == 484 || action == 6) { - String string = menuActionText[id]; + String string = menuActionText[index]; int indexOf = string.indexOf("@whi@"); if (indexOf != -1) { string = string.substring(indexOf + 5).trim(); @@ -5756,17 +5768,17 @@ public class Client extends GameApplet { // Clicking report abuse button if (action == 606) { - String s2 = menuActionText[id]; + String s2 = menuActionText[index]; int j2 = s2.indexOf("@whi@"); if (j2 != -1) if (openInterfaceId == -1) { clearTopInterfaces(); reportAbuseInput = s2.substring(j2 + 5).trim(); canMute = false; - for (int index = 0; index < Widget.interfaceCache.length; index++) { - if (Widget.interfaceCache[index] == null || Widget.interfaceCache[index].contentType != 600) + for (int z = 0; z < Widget.interfaceCache.length; z++) { + if (Widget.interfaceCache[z] == null || Widget.interfaceCache[z].contentType != 600) continue; - reportAbuseInterfaceID = openInterfaceId = Widget.interfaceCache[index].parent; + reportAbuseInterfaceID = openInterfaceId = Widget.interfaceCache[z].parent; break; } @@ -5797,7 +5809,7 @@ public class Client extends GameApplet { // reply to private message if (action == 639) { - String text = menuActionText[id]; + String text = menuActionText[index]; int indexOf = text.indexOf("@whi@"); @@ -5997,7 +6009,6 @@ public class Client extends GameApplet { } itemSelected = 0; spellSelected = 0; - } @SuppressWarnings("unused") @@ -8233,8 +8244,7 @@ public class Client extends GameApplet { secondLoginMessage = "Error connecting to server."; } - private boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, - int k2) { + public boolean doWalkTo(int type, int j, int k, int i1, int j1, int k1, int l1, int i2, int j2, boolean flag, int k2) { byte byte0 = 104; byte byte1 = 104; for (int l2 = 0; l2 < byte0; l2++) { @@ -11174,14 +11184,16 @@ public class Client extends GameApplet { } private void loadAllOrbs(int xOffset) { - loadHpOrb(xOffset); - loadPrayerOrb(xOffset); - loadRunOrb(xOffset); - loadSpecialOrb(xOffset); - if (frameMode == ScreenMode.FIXED) { - SpriteCache.lookup(worldHover ? 54 : 53).drawSprite(202, 20); - } else { - SpriteCache.lookup(worldHover ? 52 : 51).drawSprite(frameWidth - 118, 154); + if(Configuration.enableOrbs) { + loadHpOrb(xOffset); + loadPrayerOrb(xOffset); + loadRunOrb(xOffset); + loadSpecialOrb(xOffset); + if (frameMode == ScreenMode.FIXED) { + SpriteCache.lookup(worldHover ? 54 : 53).drawSprite(202, 20); + } else { + SpriteCache.lookup(worldHover ? 52 : 51).drawSprite(frameWidth - 118, 154); + } } } diff --git a/src/main/java/org/rebotted/GameApplet.java b/src/main/java/org/rebotted/GameApplet.java index b8cf8be..b3b2df8 100644 --- a/src/main/java/org/rebotted/GameApplet.java +++ b/src/main/java/org/rebotted/GameApplet.java @@ -71,7 +71,7 @@ public class GameApplet extends Applet implements Runnable, MouseListener, boolean resizable, boolean full) { SwingUtilities.invokeLater(() -> { if(!resizable) { - Client.botFrame.setSize(new Dimension(774, 559)); + Client.botFrame.setSize(new Dimension(774, 567)); } Client.botFrame.setResizable(resizable); }); diff --git a/src/main/java/org/rebotted/MenuAction.java b/src/main/java/org/rebotted/MenuAction.java new file mode 100644 index 0000000..56297e3 --- /dev/null +++ b/src/main/java/org/rebotted/MenuAction.java @@ -0,0 +1,50 @@ +package org.rebotted; + +public class MenuAction { + private int hash = 0; + private String action; + private String target; + private int mouseX = 0; + private int mouseY = 0; + private int actionId; + + public MenuAction(int hash, String action, String target, int mouseX, int mouseY, int actionId) { + this.hash = hash; + this.action = action; + this.target = target; + this.mouseX = mouseX; + this.mouseY = mouseY; + this.actionId = actionId; + } + + public MenuAction(int hash, String action, String target, int actionId) { + this.hash = hash; + this.action = action; + this.target = target; + this.actionId = actionId; + } + + public int getHash() { + return hash; + } + + public String getAction() { + return action; + } + + public String getTarget() { + return target; + } + + public int getMouseX() { + return mouseX; + } + + public int getMouseY() { + return mouseY; + } + + public int getActionId() { + return actionId; + } +} diff --git a/src/main/java/org/rebotted/cache/def/ObjectDefinition.java b/src/main/java/org/rebotted/cache/def/ObjectDefinition.java index 22d2f7e..e9f6612 100644 --- a/src/main/java/org/rebotted/cache/def/ObjectDefinition.java +++ b/src/main/java/org/rebotted/cache/def/ObjectDefinition.java @@ -257,6 +257,7 @@ public final class ObjectDefinition { public static ObjectDefinition lookup(int id) { if (id > streamIndices.length) { + System.out.println("ID: "+id + " instance is larger than objects we have."); id = streamIndices.length - 1; } switch (id) { diff --git a/src/main/java/org/rebotted/ui/BotFrame.java b/src/main/java/org/rebotted/ui/BotFrame.java index 2cef653..d261d2b 100644 --- a/src/main/java/org/rebotted/ui/BotFrame.java +++ b/src/main/java/org/rebotted/ui/BotFrame.java @@ -4,20 +4,22 @@ import org.rebotted.Client; import org.rebotted.Configuration; import org.rebotted.GameApplet; import org.rebotted.script.ScriptHandler; -import org.rebotted.script.types.Script; +import org.rebotted.ui.menu.BotMenuBar; +import org.rebotted.ui.script.ScriptUI; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public final class BotFrame extends JFrame implements ActionListener { +public final class BotFrame extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; private static BotMenuBar botMenuBar; private final Client client; private final ScriptUI scriptUI; + public BotFrame(Client client, boolean resizable) { this.client = client; final GameApplet applet = client; @@ -28,6 +30,7 @@ public final class BotFrame extends JFrame implements ActionListener { add(applet, BorderLayout.CENTER); setMinimumSize(new Dimension(774, 567)); setSize(new Dimension(774, 567)); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(getParent()); setLocationRelativeTo(getOwner()); @@ -61,9 +64,9 @@ public final class BotFrame extends JFrame implements ActionListener { public void actionPerformed(ActionEvent e) { switch (e.getActionCommand().toLowerCase()) { case "run": - if(ScriptHandler.getInstance().getScriptState() == ScriptHandler.State.STOPPED) { + if (ScriptHandler.getInstance().getScriptState() == ScriptHandler.State.STOPPED) { scriptUI.show(); - } else if(ScriptHandler.getInstance().getScriptState() == ScriptHandler.State.PAUSE) { + } else if (ScriptHandler.getInstance().getScriptState() == ScriptHandler.State.PAUSE) { ScriptHandler.getInstance().setScriptState(ScriptHandler.State.RUNNING); setRunning(); } @@ -76,6 +79,10 @@ public final class BotFrame extends JFrame implements ActionListener { setStopped(); ScriptHandler.getInstance().stop(); break; + + case "entities": + Configuration.namesAboveHeads = !Configuration.namesAboveHeads; + break; } } } \ No newline at end of file diff --git a/src/main/java/org/rebotted/ui/BotMenuBar.java b/src/main/java/org/rebotted/ui/menu/BotMenuBar.java similarity index 88% rename from src/main/java/org/rebotted/ui/BotMenuBar.java rename to src/main/java/org/rebotted/ui/menu/BotMenuBar.java index 13bceb3..7b79f67 100644 --- a/src/main/java/org/rebotted/ui/BotMenuBar.java +++ b/src/main/java/org/rebotted/ui/menu/BotMenuBar.java @@ -1,4 +1,6 @@ -package org.rebotted.ui; +package org.rebotted.ui.menu; + +import org.rebotted.ui.BotFrame; import javax.swing.*; @@ -9,9 +11,11 @@ import javax.swing.*; public class BotMenuBar extends JMenuBar { private BotFrame botUI; private static JButton startButton, pauseButton, stopButton; - private JMenu file, scripts; + private JMenu file, scripts, debugs; private JMenuItem run, pause, stop; + private JMenuItem debugEntities; + public BotMenuBar(BotFrame botUI) { this.botUI = botUI; configure(); @@ -26,6 +30,7 @@ public class BotMenuBar extends JMenuBar { file = new JMenu("File"); scripts = new JMenu("Script"); + debugs = new JMenu("Debugs"); final JMenuItem exit = new JMenuItem("Exit"); @@ -36,12 +41,18 @@ public class BotMenuBar extends JMenuBar { stop = createNewJMenuItem("Stop", false); + stop = createNewJMenuItem("Stop", false); + + debugEntities = createNewJMenuItem("Entities", true); + exit.addActionListener(botUI); scripts.add(run); scripts.add(pause); scripts.add(stop); + debugs.add(debugEntities); + file.add(exit); @@ -76,6 +87,7 @@ public class BotMenuBar extends JMenuBar { removeAll(); add(file); add(scripts); + add(debugs); add(Box.createHorizontalGlue()); add(startButton); add(pauseButton); diff --git a/src/main/java/org/rebotted/ui/ScriptController.java b/src/main/java/org/rebotted/ui/script/ScriptController.java similarity index 97% rename from src/main/java/org/rebotted/ui/ScriptController.java rename to src/main/java/org/rebotted/ui/script/ScriptController.java index 5b8dd4b..913c42d 100644 --- a/src/main/java/org/rebotted/ui/ScriptController.java +++ b/src/main/java/org/rebotted/ui/script/ScriptController.java @@ -1,4 +1,4 @@ -package org.rebotted.ui; +package org.rebotted.ui.script; import javafx.fxml.FXML; import javafx.fxml.Initializable; @@ -10,6 +10,7 @@ import org.rebotted.script.ScriptHandler; import org.rebotted.script.scriptdata.ScriptData; import org.rebotted.script.scriptdata.SkillCategory; import org.rebotted.script.types.Script; +import org.rebotted.ui.BotFrame; import java.net.URL; diff --git a/src/main/java/org/rebotted/ui/ScriptUI.java b/src/main/java/org/rebotted/ui/script/ScriptUI.java similarity index 98% rename from src/main/java/org/rebotted/ui/ScriptUI.java rename to src/main/java/org/rebotted/ui/script/ScriptUI.java index 9347df4..ba02deb 100644 --- a/src/main/java/org/rebotted/ui/ScriptUI.java +++ b/src/main/java/org/rebotted/ui/script/ScriptUI.java @@ -1,4 +1,4 @@ -package org.rebotted.ui; +package org.rebotted.ui.script; import javafx.application.Platform; import javafx.collections.FXCollections; diff --git a/src/main/java/org/rebotted/util/Filter.java b/src/main/java/org/rebotted/util/Filter.java new file mode 100644 index 0000000..5bee7f6 --- /dev/null +++ b/src/main/java/org/rebotted/util/Filter.java @@ -0,0 +1,5 @@ +package org.rebotted.util; + +public interface Filter { + boolean accept(F f); +} \ No newline at end of file diff --git a/src/main/resources/ScriptUI.fxml b/src/main/resources/ScriptUI.fxml index d0d4f27..dd4a10f 100644 --- a/src/main/resources/ScriptUI.fxml +++ b/src/main/resources/ScriptUI.fxml @@ -5,7 +5,7 @@ + fx:controller="org.rebotted.ui.script.ScriptController">