A RuneTek3 client (377) that is deobfuscated, converted to Kotlin, and includes QoL improvements.
1#!/usr/bin/env bash
2#
3# Build the High Level Alchemy RS377 client into a single self-contained jar.
4#
5# Compiles every .kt under src/main/kotlin with kotlinc, bundling the Kotlin
6# runtime so the jar runs with a bare `java -jar`. The Main-Class is set to
7# com.jagex.runescape.Game (its companion `@JvmStatic fun main` is exposed as a
8# static method on that class).
9#
10# The client has no third-party runtime dependencies — configuration is parsed
11# with the JDK's java.util.Properties — so a clean kotlinc build needs nothing on
12# the classpath. The jars under lib/ are test-only and not used here.
13#
14# A full kotlinc build from src/ every time keeps "what you run" identical to
15# "what's in src/", sidestepping stale IDE/Gradle incremental-build surprises.
16#
17# Usage: ./build-client.sh
18set -euo pipefail
19
20CLIENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21SRC_DIR="$CLIENT_DIR/src/main/kotlin"
22OUT_JAR="$CLIENT_DIR/hla-client.jar"
23MAIN_CLASS="com.jagex.runescape.Game"
24
25KOTLINC="${KOTLINC:-kotlinc}"
26JAR="${JAR_BIN:-jar}"
27
28# kotlinc can be memory-hungry compiling the full client; give it room.
29export JAVA_OPTS="${JAVA_OPTS:-"-Xmx3g"}"
30
31command -v "$KOTLINC" >/dev/null 2>&1 || { echo "error: kotlinc not found (set \$KOTLINC)"; exit 1; }
32command -v "$JAR" >/dev/null 2>&1 || { echo "error: jar not found (set \$JAR_BIN)"; exit 1; }
33[ -d "$SRC_DIR" ] || { echo "error: src dir not found at $SRC_DIR"; exit 1; }
34
35echo "[build] compiling $(find "$SRC_DIR" -name '*.kt' | wc -l | tr -d ' ') Kotlin files from $SRC_DIR ..."
36echo "[build] this is a full (non-incremental) compile; expect ~1-2 min."
37
38# -include-runtime bundles kotlin-stdlib so the jar is standalone.
39# -jvm-target matches the JDK the run scripts use.
40"$KOTLINC" "$SRC_DIR" \
41 -include-runtime \
42 -jvm-target 21 \
43 -d "$OUT_JAR"
44
45# kotlinc doesn't write a Main-Class; set it so `java -jar` works.
46"$JAR" --update --file "$OUT_JAR" --main-class "$MAIN_CLASS"
47
48echo "[build] done -> $OUT_JAR"
49echo "[build] run it with: ./run.sh"