Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into config-options-resi…
Browse files Browse the repository at this point in the history
…zable-and-render-flames

# Conflicts:
#	config/client-435.conf.example.yaml
  • Loading branch information
Promises committed Sep 7, 2024
2 parents 726c1f1 + 4926d1d commit b6f3065
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 56 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ artifacts/
.DS_Store
.classpath
.project
.settings/org.eclipse.jdt.core.prefs
.settings/org.eclipse.jdt.core.prefs

# as of 2024-09-04, prebuilt dir is deprecated in favor of releases due to
# increasing binary blob file sizes
/prebuilt
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// do not autoformat java files in this repository
"[java]": {
"editor.formatOnSave": false,
"editor.formatOnPaste": false,
"editor.formatOnType": false,
},
}
96 changes: 65 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,22 @@
# RuneJS Java Client #435

A RuneScape game client from October 2006 which has been modified to work with RuneJS, a RuneScape game server written in NodeJS and TypeScript. **This client is not for OldSchool RuneScape** - client #435 pre-dates the very first OSRS client by quite some time.
A RuneScape game client from October 2006 which has been modified to work with RuneJS, a RuneScape game server written in NodeJS and TypeScript. **This client is not for OldSchool RuneScape** - client #435 pre-dates the very first OSRS client by quite some time.

We've no interest in OSRS client hacking, this client exists as a means to develop on RuneJS game servers and will not work with other server emulators.

## Usage

Running the client can be done either with the pre-built client JAR file or by building the Java code and running it manually in an IDE.
Running the client can be done either with the pre-built client `.jar` file from this repository's [releases](https://github.com/runejs/refactored-client-435/releases) page, or by building the Java code and running it manually in an IDE.

### Pre-Built Client

Running the pre-built client requires having Java installed: https://www.java.com/en/
Running the pre-built client requires having Java installed: <https://www.java.com/en/>

Once installed, go into the `/prebuilt/` and simply double-click the JAR file to run it. Alternatively if executing the JAR does not work, the command `java -jar client-435-0.3.jar` may be used from within the `/prebuilt/` directory.
Once installed, go to the [releases](https://github.com/runejs/refactored-client-435/releases) page, download the latest release, and simply double-click the `.jar` file file to run it. Alternatively if executing the `.jar` file does not work, the command `java -jar client-435-0.3.jar` can be used.

The client will use a set of default configurations if no file is provided. The default client configuration matches up to the default RuneJS server configuration for quick and easy initial setup. It's highly advised that you generate your own RSA public and private keys for long term use.

To provide your own configurations, create a file named `client-435.conf.yaml` in your User Home directory with the following content:

```yaml
net:
address: 127.0.0.1
game_port: 43594
cache:
cacheDir: .filestore_435
rsa:
rsaPub: YOUR_RSA_PUBLIC_KEY (default dev pair provided in the example file)
rsaModulus: YOUR_RSA_PRIVATE_KEY (default dev pair provided in the example file)
login:
useStaticCredentials: true
username: a
password: a
game:
roofsEnabled: true
freeTeleports: false
debugContextMenu: true
serverDisplayName: Build 435
```
Make sure to modify the given configuration for your specific needs.
To provide your own configurations, copy the file [`./config/client-435.conf.example.yml`](./config/client-435.conf.example.yaml) to `client-435.conf.yaml` in your user's home directory, and modify the given configuration for your specific needs.

### Gradle

Expand All @@ -47,20 +25,76 @@ without the help of an IDE such as IntelliJ. Gradle is also configured to automa

The following examples use the unix executable `./gradlew`, however Windows can replace these with `./gradlew.bat`.

**Running via Gradle**
#### Running via Gradle

The `application` gradle plugin provides the `run` task, which starts up the Main client class. With this option,
arguments can be provided via `--args`.

```
```bash
./gradlew run
```

**Building a Jar**
#### Building a `.jar` file

The `jar` task can be used to build a jar, which is generated in the `build/libs` directory.

```
```bash
./gradlew jar
java -jar ./build/libs/client-435-0.3.jar
```

#### Gradle and Java versions

As of 2024-09-04, our manual builds are done with the following Gradle and Java versions - both appear to produce a similar result:

```bash
gradle -v
```

```text
------------------------------------------------------------
Gradle 8.10
------------------------------------------------------------
Build time: 2024-08-14 12:23:39 UTC
Revision: <unknown>
Kotlin: 1.9.24
Groovy: 3.0.22
Ant: Apache Ant(TM) version 1.10.14 compiled on August 16 2023
Launcher JVM: 1.8.0_422 (Arch Linux 25.422-b05)
Daemon JVM: /usr/lib/jvm/java-8-openjdk (no JDK specified, using current Java home)
OS: Linux 6.10.6-arch1-1 amd64
```

```text
------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------
Build time: 2021-08-17 09:59:03 UTC
Revision: a773786b58bb28710e3dc96c4d1a7063628952ad
Kotlin: 1.5.21
Groovy: 3.0.8
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 17.0.10 (Azul Systems, Inc. 17.0.10+7-LTS)
OS: Mac OS X 14.4.1 aarch64
```

You can also view our [GitHub actions workflow](./.github/workflows/build-and-publish.yml) to see the automated build setup.

## Creating tags and releases

Our [GitHub actions workflow](./.github/workflows/build-and-publish.yml) is configured to build a new `.jar` file upon a `tag` push event. If you create a release in GitHub, the workflow will fail, because its purpose is to *create* the release.

The proper process for creating a new build is as follows:

1. `git fetch --all` (ensures everything is up to date - helps prevent creating a tag that someone else already created)
2. `git pull origin master` (sync your local repository with the latest changes)
3. `git tag -a -s v0.0.X`
4. `git push origin v0.0.X`

Swap out `v0.0.X` for your actual version, and please try to use the `-s` flag if you can - using GPG keys to sign tags is preferred.

In a few minutes, a new `.jar` and release will be ready on the releases page!
1 change: 1 addition & 0 deletions config/client-435.conf.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ game:
debugContextMenu: true
renderFlames: true
resizable: false
shiftClickModifier: true
serverDisplayName: Build 435
Binary file removed prebuilt/client-435-0.3.jar
Binary file not shown.
9 changes: 9 additions & 0 deletions src/main/java/org/runejs/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static void read() {
USERNAME = (String) login.get("username");
PASSWORD = (String) login.get("password");
ROOFS_ENABLED = (boolean) game.get("roofsEnabled");
SHIFT_CLICK_MODIFIER = (boolean) game.get("shiftClickModifier");
SOUND_MUTED = (boolean) game.get("soundMuted");
FREE_TELEPORTS = (boolean) game.get("freeTeleports");
DEBUG_CONTEXT = (boolean) game.get("debugContextMenu");
Expand Down Expand Up @@ -80,6 +81,7 @@ public static void read() {

Map<String, Object> game = new HashMap<String, Object>();
game.put("roofsEnabled", ROOFS_ENABLED);
game.put("shiftClickModifier", SHIFT_CLICK_MODIFIER);
game.put("freeTeleports", FREE_TELEPORTS);
game.put("debugContextMenu", DEBUG_CONTEXT);
game.put("soundMuted", SOUND_MUTED);
Expand Down Expand Up @@ -175,6 +177,13 @@ public static void read() {
*/
public static boolean ROOFS_ENABLED = true;

/**
* If true, the shift key will cause the second-highest menu item to be
* shown instead of the first, and if there is a "Drop" value present, it
* will be prioritized.
*/
public static boolean SHIFT_CLICK_MODIFIER = true;

/**
* Always light up teleports
*/
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/org/runejs/client/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ public class Game {
public static int playerRights = 0;
public static Timer gameTimer;
public static int idleLogout = 0;

/**
* If the shift key has been pressed, this reflects the state, but only
* `Game.isShiftModifierActive()` should be used for confirming that the key
* is pressed as well as checking that player's client's configuration
* allows shift modifiers to be leveraged.
*/
public static boolean shiftPressed = false;
/**
* Backup port if the first one fails?
*/
Expand Down Expand Up @@ -990,7 +998,7 @@ public static void drawGameScreen() {
ChatBox.redrawChatbox = true;
}
}

if(flashingTabId != -1) {
GameInterface.drawTabIcons = true;
}
Expand Down Expand Up @@ -2058,4 +2066,14 @@ public void startup() {
MovedStatics.showFps = true;
chatboxInterface = new GameInterface();
}

/**
* Checks if the shift modifiers are enabled and active.
*
* @return true if the player is currently pressing the shift key and if
* player has configured their client to accept shift modifiers.
*/
public static boolean isShiftModifierActive() {
return Game.shiftPressed == true && Configuration.SHIFT_CLICK_MODIFIER;
}
}
Loading

0 comments on commit b6f3065

Please sign in to comment.