Big fat update

This commit is contained in:
Ethan
2019-12-16 20:47:26 -06:00
parent f4f212705c
commit f25a72b75e
15 changed files with 161 additions and 73 deletions
+75 -63
View File
@@ -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);
}
}
}
+1 -1
View File
@@ -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);
});
@@ -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;
}
}
@@ -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) {
+11 -4
View File
@@ -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;
}
}
}
@@ -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);
@@ -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;
@@ -1,4 +1,4 @@
package org.rebotted.ui;
package org.rebotted.ui.script;
import javafx.application.Platform;
import javafx.collections.FXCollections;
@@ -0,0 +1,5 @@
package org.rebotted.util;
public interface Filter<F> {
boolean accept(F f);
}
+1 -1
View File
@@ -5,7 +5,7 @@
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="353.0" prefWidth="605.0" xmlns="http://javafx.com/javafx/11.0.1"
fx:controller="org.rebotted.ui.ScriptController">
fx:controller="org.rebotted.ui.script.ScriptController">
<children>
<TableView fx:id="scriptTable" prefHeight="325.0" prefWidth="605.0">
<columns>