I'm following Shenandoah's tutorial here, and at the moment I'm having issues getting the loader working. I was originally setting this up for a local version but now I'm trying to get it working for ORSC's vanilla 1x server as I didn't want to mess with trying to get a local server running and am only interested in the bot development stuff right now.
Here is a link to the server - Here's a link to their client, but as you can see they have a whole git repo with their code which frankly is awesome & I love how dedicated they are to RSC. I don't want to mess with their game at all, just use it as a platform for building my own bot, so anything I make will be kept local, private - and outside of testing - basically unused.
So here's where I'm at - I'm trying to get the loader working, but it seems like there are some complications I'm not noticing w/ the setup code. Using the java decompiler with the launcher, there are some parameters for the server that get set when you click on the OpenRSC option: (ButtonListener.class in OpenRSC.jar)
The launch() function then checks if you are starting the dev version or not, we're not so it just launches the client:
I'm not a great programmer and have no experience with RE, so this is around where I get lost. I'm not sure what I need to setup in my loader. The actual client is downloaded to /Cache/ and is named "Open_RSC_Client.jar" I'm not finding where it initiates the client, but if you open the actual client in the decompiler it looks like we want OpenRSC.class, which contains:
Then of course we have ORSCApplet.java which contains a lot of the required parameter info...
So I believe that is most of the immediately relevant code, but I need help piecing this info together to get a working loader. I'm sure some of my issues are probably simple, I don't have a ton of programming experience beyond some relatively simple JS and Java stuff. This version of the game is a little different from the main tutorial of course, so the first thing I need to figure out is the extent of what needs to be included in the loader as far as what needs to be instantiated (I believe) - This is about where my brain turns to mush so any insight would be super helpful. Here is where I'm at with the code. (Roughly at Part 2 of the loader portion of Shenandoah's guide)
Madbot.java:
Sorry for the disorganized request help thread, I'm just uncertain of what my next steps should be. I know I need to get all of the required parameters setup now, but there's so much here and I'm just unsure what is actually required. How do I know what I need to load?
Here is a link to the server - Here's a link to their client, but as you can see they have a whole git repo with their code which frankly is awesome & I love how dedicated they are to RSC. I don't want to mess with their game at all, just use it as a platform for building my own bot, so anything I make will be kept local, private - and outside of testing - basically unused.
So here's where I'm at - I'm trying to get the loader working, but it seems like there are some complications I'm not noticing w/ the setup code. Using the java decompiler with the launcher, there are some parameters for the server that get set when you click on the OpenRSC option: (ButtonListener.class in OpenRSC.jar)
Code:
case "openrsc":
ip = "game.openrsc.com";
port = "43596";
set(ip, port);
launch();
return;
Code:
private void launch() {
launch(false);
}
private void launch(boolean dev) {
File f = new File("Cache" + File.separator + "client.properties");
f.delete();
File configFile = new File("Cache" + File.separator + "config.txt");
configFile.delete();
CheckCombo.store[] entries = AppFrame.get().getComboBoxState();
if (entries.length != 1 || !(entries[0]).text.equalsIgnoreCase("none"))
try {
FileWriter write = new FileWriter(configFile, true);
PrintWriter writer = new PrintWriter(write);
for (CheckCombo.store entry : entries)
writer.println(entry.text + ":" + (entry.state.booleanValue() ? 1 : 0));
writer.close();
write.close();
} catch (IOException a) {
a.printStackTrace();
}
ClientLauncher.launchClient(dev);
}
I'm not a great programmer and have no experience with RE, so this is around where I get lost. I'm not sure what I need to setup in my loader. The actual client is downloaded to /Cache/ and is named "Open_RSC_Client.jar" I'm not finding where it initiates the client, but if you open the actual client in the decompiler it looks like we want OpenRSC.class, which contains:
Code:
public class OpenRSC extends ORSCApplet {
private static JFrame jframe;
private static final long serialVersionUID = 1L;
public static void main(String[] args) {
SwingUtilities.invokeLater(OpenRSC::createAndShowGUI);
}
public static void createAndShowGUI() {
try {
jframe = new JFrame(Config.getServerNameWelcome());
Applet applet = new OpenRSC();
applet.setPreferredSize(new Dimension(512, 346));
jframe.getContentPane().setLayout(new BorderLayout());
jframe.setDefaultCloseOperation(3);
jframe.setIconImage(Utils.getImage("icon.png").getImage());
jframe.setTitle(Config.WINDOW_TITLE);
jframe.getContentPane().add(applet);
jframe.setResizable(true);
jframe.setVisible(true);
jframe.setBackground(Color.black);
jframe.setMinimumSize(new Dimension(528, 385));
jframe.pack();
jframe.setLocationRelativeTo(null);
applet.init();
applet.start();
} catch (HeadlessException e) {
e.printStackTrace();
}
}
...
Code:
public class ORSCApplet extends Applet implements MouseListener, MouseMotionListener, KeyListener, MouseWheelListener, ComponentListener, ImageObserver, ImageProducer, ClientPort {
private static final long serialVersionUID = 1L;
public static int globalLoadingPercent = 0;
public static String globalLoadingState = "";
private static mudclient mudclient;
static PacketHandler packetHandler;
private final boolean m_hb = false;
protected int resizeWidth;
protected int resizeHeight;
...
Madbot.java:
Code:
public class Madbot {
File file = new File("C:/Users/Jared/Desktop/rsc/Cache/Open_RSC_Client.jar");
ClassLoader cl = new URLClassLoader(new URL[] { file.toURI().toURL() });
Class<?> clazz = cl.loadClass("OpenRSC");
Constructor<?> init = clazz.getDeclaredConstructor();
init.setAccessible(true);
Applet applet = (Applet) init.newInstance();
}