Skip to content

Commit bfbb5ae

Browse files
committed
Implement new compiling methods to work with current client system
* Use included scripts to update client from remote github repo * Hide patcher debug messages, only shows actually patched methods now * Add spotless support to openrsc client subproject (automatic when building) * this isn't required to pass pipeline right now * Add patcher automatic spotless apply (required for pipeline) * Remove create zip cache for now * update resource folder path * update cache sprites in assets * always replace our jar when compiling (for now) - our method of task (not copy specific task) does not respect MD5 hash checking, so we can't check versions here (yet) * Move resources for client into main/java/bot folder for easier access * always copyJar AFTER jar is finished running * update release to include cache and exclude run files * turn back on cache generation but include cache with main repo - this is more for a fall back if cache gets removed, and for server and world switching in the future!!! * include zipcache in the repo,
1 parent fd49f71 commit bfbb5ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+801
-295
lines changed

app/build.gradle

+6-10
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,14 @@ tasks.named('jar') {
6060
'Build-Jdk' : "${System.properties['java.version']}",
6161
)
6262
}
63-
6463
// FTBFS: Set duplicate handling strategy for module-info.class.
6564
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
6665
}
6766

6867
tasks.register('copyJar') {
69-
// Final JAR
70-
group 'build'
71-
description 'copy app.jar to main dir'
7268

73-
inputs.file "${project(':app').getBuildDir()}/libs/app.jar"
74-
outputs.file "Idlersc.jar"
69+
description 'copy app.jar to main dir and rename to IdleRSC.jar'
70+
dependsOn('build')
7571

7672
doLast {
7773
copy {
@@ -81,19 +77,19 @@ tasks.register('copyJar') {
8177
into '../'
8278
}
8379
}
84-
85-
//File appJar = new File(project(':app').getBuildDir(), "libs/${project(':app').getName()}.jar")
86-
// from("${project(':app').getBuildDir()}/libs/app.jar")
87-
// into "."
8880
}
8981

9082
tasks.named('testClasses') {
9183
finalizedBy('copyJar')
9284
}
85+
tasks.named('build') {
86+
finalizedBy('copyJar')
87+
}
9388

9489
// Add additional files to clean task
9590
tasks.named('clean') {
9691
delete 'src/main/resources'
92+
delete '../IdleRSC.jar'
9793
}
9894

9995
// Create resources before processResources runs

app/src/main/java/bot/AuthFrame.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class AuthFrame extends JFrame {
1818
private Color backgroundColor = Main.getColorCode(1, 0);
1919
private Color textColor = Main.getColorCode(0, 0);
2020
private boolean loadSettings = false;
21-
private final String resourceLocation = "src/main/resources/";
21+
private final String resourceLocation = "app/src/main/java/bot/res/";
2222
private static final Dimension fieldSize = new Dimension(100, 25);
2323
private final Window parent;
2424
private JPasswordField password;

app/src/main/java/bot/EntryFrame.java

+24-24
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,14 @@ public final class EntryFrame extends JFrame {
1818
private static String account = "";
1919
private final Choice accountChoice;
2020
private String themeName = "RuneDark Theme";
21-
private final String resourceLocation = "src/main/resources/";
21+
private final String resourceLocation = "app/src/main/java/bot/res/";
2222
private boolean okie = false;
2323

2424
// todo add theme select to cli
2525
public static String getAccount() {
2626
return account;
2727
}
2828

29-
private String getStringProperty(final String name, String propertyName) {
30-
if (name == null || propertyName == null) {
31-
System.out.println("Error accessing string property");
32-
}
33-
final Properties p = new Properties();
34-
final File file = Paths.get("accounts").resolve(name + ".properties").toFile();
35-
try (final FileInputStream stream = new FileInputStream(file)) {
36-
p.load(stream);
37-
return p.getProperty(propertyName, " ");
38-
} catch (final Throwable t) {
39-
System.out.println("Error loading account " + name + ": " + t);
40-
}
41-
return "";
42-
}
43-
4429
private void loadAccounts() {
4530
try {
4631
final File dir = Paths.get("accounts").toFile();
@@ -75,14 +60,14 @@ public EntryFrame() {
7560
new ImageIcon(resourceLocation + "icons/welcome.icon.png")
7661
.getImage()
7762
.getScaledInstance(230, 30, java.awt.Image.SCALE_SMOOTH);
78-
Image okImage =
79-
new ImageIcon(resourceLocation + "icons/ok.icon.png")
80-
.getImage()
81-
.getScaledInstance(120, 26, java.awt.Image.SCALE_SMOOTH);
82-
Image cancelImg =
83-
new ImageIcon(resourceLocation + "icons/cancel2.icon.png")
84-
.getImage()
85-
.getScaledInstance(120, 26, java.awt.Image.SCALE_SMOOTH);
63+
// Image okImage =
64+
// new ImageIcon(resourceLocation + "icons/ok.icon.png")
65+
// .getImage()
66+
// .getScaledInstance(120, 26, java.awt.Image.SCALE_SMOOTH);
67+
// Image cancelImg =
68+
// new ImageIcon(resourceLocation + "icons/cancel2.icon.png")
69+
// .getImage()
70+
// .getScaledInstance(120, 26, java.awt.Image.SCALE_SMOOTH);
8671
// ImageIcon icon = new ImageIcon("res/ui/present_edit.png"); // Christmas mode
8772
// ImageIcon icon = new ImageIcon("res/ui/scales.png"); // Red
8873

@@ -283,6 +268,21 @@ public void waitForLaunch() {
283268
dispose();
284269
}
285270

271+
private String getStringProperty(final String name, String propertyName) {
272+
if (name == null || propertyName == null) {
273+
System.out.println("Error accessing string property");
274+
}
275+
final Properties p = new Properties();
276+
final File file = Paths.get("accounts").resolve(name + ".properties").toFile();
277+
try (final FileInputStream stream = new FileInputStream(file)) {
278+
p.load(stream);
279+
return p.getProperty(propertyName, " ");
280+
} catch (final Throwable t) {
281+
System.out.println("Error loading account " + name + ": " + t);
282+
}
283+
return "";
284+
}
285+
286286
@Override
287287
public void setVisible(final boolean visible) {
288288
if (visible) {

app/src/main/java/bot/Main.java

+94-87
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import controller.Controller;
1313
import java.awt.*;
1414
import java.awt.event.*;
15+
import java.io.File;
16+
import java.io.FileWriter;
1517
import java.io.IOException;
1618
import java.lang.reflect.InvocationTargetException;
1719
import java.net.MalformedURLException;
@@ -38,6 +40,7 @@
3840
import orsc.mudclient;
3941
import reflector.Reflector;
4042
import scripting.idlescript.IdleScript;
43+
import utils.Extractor;
4144
import utils.Version;
4245

4346
/**
@@ -263,7 +266,7 @@ public static void main(String[] args)
263266
}
264267

265268
config.absorb(parseResult);
266-
// handleCache(config);
269+
handleCache(config);
267270

268271
Reflector reflector = new Reflector(); // start up our reflector helper
269272
OpenRSC client = reflector.createClient(); // start up our client jar
@@ -946,92 +949,96 @@ public void focusLost(FocusEvent e) {
946949
};
947950
}
948951

949-
// /** Checks if the user has made a Cache/ folder. If not, spawns a wizard to create the folder.
950-
// */
951-
// private static void handleCache(Config config) {
952-
// final int COLESLAW_PORT = 43599;
953-
// final int URANIUM_PORT = 43601;
954-
// // Does the directory exist?
955-
// File cacheDirectory = new File("Cache/");
956-
//
957-
// if (cacheDirectory.exists()) return;
958-
//
959-
// // If --init-cache argument is used, bypass the GUI
960-
// if (!config.getInitCache().isEmpty()) {
961-
// if (config.getInitCache().equals("uranium")) {
962-
// // Create Uranium cache
963-
// createCache(URANIUM_PORT);
964-
// return;
965-
// } else if (config.getInitCache().equals("coleslaw")) {
966-
// // Create Coleslaw cache
967-
// createCache(COLESLAW_PORT);
968-
// return;
969-
// } else {
970-
// System.out.println("Server (" + config.getInitCache() + ") is not known.");
971-
// }
972-
// }
973-
//
974-
// JFrame cacheFrame = new JFrame("Cache Setup");
975-
// JLabel cacheLabel = new JLabel("First setup: you must select either Uranium or Coleslaw.");
976-
// JButton uraniumButton = new JButton("Uranium (2018 RSC)");
977-
// JButton coleslawButton = new JButton("Coleslaw (modified RSC, new content)");
978-
//
979-
// uraniumButton.addActionListener(
980-
// e -> {
981-
// // Create Uranium cache
982-
// createCache(URANIUM_PORT);
983-
// });
984-
//
985-
// coleslawButton.addActionListener(
986-
// e -> {
987-
// // Create Coleslaw cache
988-
// createCache(COLESLAW_PORT);
989-
// });
990-
//
991-
// cacheFrame.setLayout(new GridLayout(0, 1));
992-
// cacheFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
993-
// cacheFrame.add(cacheLabel);
994-
// cacheFrame.add(uraniumButton);
995-
// cacheFrame.add(coleslawButton);
996-
//
997-
// cacheFrame.pack();
998-
// cacheFrame.setLocationRelativeTo(null);
999-
// cacheFrame.setVisible(true);
1000-
// cacheFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1001-
//
1002-
// while (!cacheDirectory.exists()) {
1003-
// try {
1004-
// Thread.sleep(100);
1005-
// } catch (InterruptedException e) {
1006-
// e.printStackTrace();
1007-
// }
1008-
// cacheDirectory = new File("Cache/");
1009-
// }
1010-
// cacheFrame.setVisible(false);
1011-
// cacheFrame.dispose();
1012-
// }
1013-
1014-
// private static void createCache(int ServerPort) {
1015-
// // Create Cache directory
1016-
// File dir = new File("." + File.separator + "Cache");
1017-
// dir.mkdirs();
1018-
//
1019-
// // Copy embedded cache to cache directory
1020-
// try {
1021-
// Extractor.extractZipResource("/cache/ZipCache.zip", dir.toPath());
1022-
// } catch (IOException ignored) {
1023-
// System.out.print(ignored);
1024-
// }
1025-
//
1026-
// // Add port to client cache
1027-
// try {
1028-
// FileWriter portFile = new FileWriter("Cache/port.txt");
1029-
// portFile.write(Integer.toString(43599));
1030-
// portFile.close();
1031-
// } catch (IOException ignored) {
1032-
// System.out.print(ignored);
1033-
// }
1034-
// }
952+
/** Checks if the user has made a Cache/ folder. If not, spawns a wizard to create the folder. */
953+
private static void handleCache(Config config) {
954+
final int COLESLAW_PORT = 43599;
955+
final int URANIUM_PORT = 43601;
956+
// Does the directory exist?
957+
File cacheDirectory = new File("Cache/");
958+
959+
if (cacheDirectory.exists()) return;
960+
961+
// If --init-cache argument is used, bypass the GUI
962+
if (!config.getInitCache().isEmpty()) {
963+
if (config.getInitCache().equals("uranium")) {
964+
// Create Uranium cache
965+
createCache(URANIUM_PORT);
966+
return;
967+
} else if (config.getInitCache().equals("coleslaw")) {
968+
// Create Coleslaw cache
969+
createCache(COLESLAW_PORT);
970+
return;
971+
} else {
972+
System.out.println("Server (" + config.getInitCache() + ") is not known.");
973+
}
974+
} else {
975+
createCache(COLESLAW_PORT);
976+
return;
977+
}
978+
979+
JFrame cacheFrame = new JFrame("Cache Setup");
980+
JLabel cacheLabel = new JLabel("First setup: you must select either Uranium or Coleslaw.");
981+
JButton uraniumButton = new JButton("Uranium (2018 RSC)");
982+
JButton coleslawButton = new JButton("Coleslaw (modified RSC, new content)");
983+
984+
uraniumButton.addActionListener(
985+
e -> {
986+
// Create Uranium cache
987+
createCache(URANIUM_PORT);
988+
});
989+
990+
coleslawButton.addActionListener(
991+
e -> {
992+
// Create Coleslaw cache
993+
createCache(COLESLAW_PORT);
994+
});
995+
996+
cacheFrame.setLayout(new GridLayout(0, 1));
997+
cacheFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
998+
cacheFrame.add(cacheLabel);
999+
cacheFrame.add(uraniumButton);
1000+
cacheFrame.add(coleslawButton);
1001+
1002+
cacheFrame.pack();
1003+
cacheFrame.setLocationRelativeTo(null);
1004+
cacheFrame.setVisible(true);
1005+
cacheFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
1006+
1007+
while (!cacheDirectory.exists()) {
1008+
try {
1009+
Thread.sleep(100);
1010+
} catch (InterruptedException e) {
1011+
e.printStackTrace();
1012+
}
1013+
cacheDirectory = new File("Cache/");
1014+
}
1015+
cacheFrame.setVisible(false);
1016+
cacheFrame.dispose();
1017+
}
1018+
1019+
private static void createCache(int ServerPort) {
1020+
// Create Cache directory
1021+
File dir = new File("." + File.separator + "Cache");
1022+
dir.mkdirs();
1023+
1024+
// Copy embedded cache to cache directory
1025+
try {
1026+
Extractor.extractZipResource("/cache/ZipCache.zip", dir.toPath());
1027+
} catch (IOException e) {
1028+
e.printStackTrace();
1029+
System.out.println(e.getMessage());
1030+
}
1031+
1032+
// Add port to client cache
1033+
try {
1034+
FileWriter portFile = new FileWriter("Cache/port.txt");
1035+
portFile.write(Integer.toString(43599));
1036+
portFile.close();
1037+
} catch (IOException e) {
1038+
e.printStackTrace();
1039+
System.out.println(e.getMessage());
1040+
}
1041+
}
10351042

10361043
private static void copyDirectory(
10371044
String sourceDirectoryLocation, String destinationDirectoryLocation) {
File renamed without changes.
File renamed without changes.

assets/cache/MD5.SUM

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
70a77a7b18554b81941b23e966b76561 ./config.txt
2+
f900366006fb6f98b73a07c265694e53 ./OpenRSC.jar
3+
4ee4ae8bf5c68343effce65d6697ed71 ./openrsc.apk
4+
59f8d97492fdb1286018ec89b0755657 ./Open_RSC_Client_dev.jar
5+
b8419160170a41ae01abab13a3b887df ./ip.txt
6+
2bc77ee6aff6405a4233e55c87138d8c ./port.txt
7+
e7db55346a3c9e1e2dc4156a5080e3e3 ./audio/spellfail.wav
8+
a35f59926c22a2763a898509ac46ac05 ./audio/chisel.wav
9+
e975b69136d8cea9eafd1f7dad2f6e92 ./audio/spellok.wav
10+
1a6bd03dc01873ca5a2a3e51c6f13b12 ./audio/combat2b.wav
11+
98395590acfc5a09ca6838d2c73846ca ./audio/foundgem.wav
12+
3ba2c9d80d3876bbd53e03a16ad415bb ./audio/potato.wav
13+
9c48528aa1856071bddd96f1ccf0280d ./audio/sounds.mem
14+
4e5da6ef24f2f1d51d6cab1d38b40e17 ./audio/prayeroff.wav
15+
67d5e5731f6fee2bd0825f1f886ac7b1 ./audio/recharge.wav
16+
2987aa4c8fa1d396ace73b71eda3118d ./audio/closedoor.wav
17+
9f266ba9ec03a5f6d25c27434b447e6d ./audio/retreat.wav
18+
5eca4d35fc8ee3ea435560da0eca6c6d ./audio/anvil.wav
19+
eeaafe253ccb7f566fc2d30c03915842 ./audio/cooking.wav
20+
821a71555b8e0924784ad07b02e63582 ./audio/death.wav
21+
6d8f9ccb2338ec9b5579da52cfd51195 ./audio/outofammo.wav
22+
a2237aa906d418df12f801a67948710b ./audio/secretdoor.wav
23+
19f3c3b2d2dc7d0a8bb190c2c4d1c8fd ./audio/prayeron.wav
24+
e2721d63e3df7b55e081ee71c66e56c3 ./audio/underattack.wav
25+
8f3b3864c52cf51814fdf0fa0b2b741b ./audio/advance.wav
26+
bbe470bcd82a2e2dc605760d7d0ffaa5 ./audio/takeobject.wav
27+
ef610914a731786b42bbce9bb622d3a0 ./audio/combat1b.wav
28+
da1e22c96fb52e7f72dd0464e833b4d2 ./audio/filljug.wav
29+
7b3039a8bd7120135d50679ea5d8f792 ./audio/combat3a.wav
30+
652c31cb123c1a7260827294ebaa80ab ./audio/mine.wav
31+
b88a5f4a16ed18b0665b459723fd2211 ./audio/dropobject.wav
32+
06da45374b5113d1aea98a72c9699539 ./audio/combat1a.wav
33+
6be1531321281f9099b3184f938f1715 ./audio/eat.wav
34+
9fab30ff683e4933115549efcce1aa16 ./audio/shoot.wav
35+
55ef3d424e79626e32748b9032ed48df ./audio/combat2a.wav
36+
347fc00ecee0aad4a75909599fc4b21c ./audio/mix.wav
37+
6fabaf1726a553115835427a7f3ae269 ./audio/victory.wav
38+
7da40aec7309e78fdc338cc1ea809711 ./audio/opendoor.wav
39+
5ffadf2eebd5da8e852351193455af02 ./audio/coins.wav
40+
82e2da66cecbcf84002461ca47cdb37d ./audio/click.wav
41+
532df52e741613540730be1ca109a424 ./audio/prospect.wav
42+
3493216d321637c2c56237ce3c161ae9 ./audio/fish.wav
43+
daa945fd3476cb088b7822ad44a000ac ./audio/mechanical.wav
44+
2bdc3e524ce56419c10079f05b74786e ./audio/combat3b.wav
45+
d41d8cd98f00b204e9800998ecf8427e ./uid.dat
46+
3bbc851bd8a0aff7dc4a01ca327b30bc ./video/Authentic_Sprites.orsc
47+
f868a8fb9266f219edd7f47ef0028a6b ./video/Custom_Landscape.orsc
48+
1a8c3f966fc4259a6f3d6ff32cebd6a8 ./video/models.orsc
49+
c95ded5d48c3a78c5a267e0301160367 ./video/spritepacks/Menus.osar
50+
6cdb4549a7813f54a3473564a3231399 ./video/Authentic_Landscape.orsc
51+
8ccf8b4697c432ccdcd84be3979b91b3 ./video/Custom_Sprites.osar
52+
4445d7d9c1535a6f47a09ef33c02c15f ./video/library.orsc
53+
8101c301d8ad141b92842f6a1e4d295c ./Open_RSC_Client.jar

assets/cache/Open_RSC_Client.jar

2.98 MB
Binary file not shown.

assets/cache/Open_RSC_Client_dev.jar

923 KB
Binary file not shown.

0 commit comments

Comments
 (0)