/osrs-gamepack-downloader

Simple tool for downloading the official OldSchool RuneScape gamepack

Primary LanguageKotlinDo What The F*ck You Want To Public LicenseWTFPL

OSRS Gamepack Downloader

Actions Status Codacy BadgeLicense: WTFPL

Simple OldSchool RuneScape gamepack downloader written in Kotlin. A collection of downloaded gamepacks can be found here.

What does this program do?

  • Downloads and parses the official OldSchool jav_config.ws to get the gamepack URL.
  • Downloads the gamepack from the parsed URL (codebase + initial_jar)
  • Analyzes the gamepack's bytecode to determine the actual revision.
  • Writes the gamepack to the provided (or current) directory.
  • Fixes the dates (created, modified, accessed) to reflect when the gamepack was built.

Prerequisites

  • Java SE 8 or higher, available here.

Building

Use the included gradlew (Linux/OSX) or gradlew.bat (Windows) files to let gradle build the file.

./gradlew build

The executable will be located at build/libs/osrs-gamepack-downloader.jar.

Library Usage

You can add a binary as a library for your project and use the methods to download/load/verify gamepacks.

Java

To download the latest gamepack and load it into a class map (HashMap<String, ClassNode>), modify it and then save it:

import dev.mahabal.runetech.Gamepack;
import dev.mahabal.runetech.JavConfig;
import dev.mahabal.runetech.RemoteGamepack;
import org.objectweb.asm.tree.ClassNode;

import java.nio.file.Paths;
import java.util.HashMap;

public class Application {

    public static void main(String[] args) {
        // download and load the latest gamepack
        final Gamepack gamepack = new RemoteGamepack(new JavConfig().getProperties());
        // print out the gamepack revision
        System.out.printf("Gamepack Revision: %,d%n", gamepack.getRevision());
        // convert gamepack to a class map
        final HashMap<String, ClassNode> classMap = gamepack.getClassMap();
        // iterate the class map
        classMap.forEach((name, node) -> {
            // do something to the gamepack
        });
        // write the gamepack (with changes) to the desired file.
        gamepack.dump(Paths.get("./"), "osrs-${revision}.jar");
    }

}

Standalone Usage

Double clicking the osrs-gamepack-downloader.jar file will download the latest gamepack to the same directory and name it accordingly.

CLI

java -jar osrs-gamepack-downloader.jar [OPTIONS]
[OPTIONS]

    -r. --revision
        prints out the current gamepack revision to the console

    -d, --directory
        the EXACT output directory to save the gamepack. [default = "./"]

    -f, --file-name
        the format for the gamepack's name. [default = "osrs-${revision}.jar"]

    -p, --properties
        prints the contents of the jav_config.ws file to stdout

    --dry-run
        skip writing the gamepack to the filesystem

Examples

To just print out the current gamepack revision:

java -jar osrs-gamepack-downloader -r --dry-run

Contact

Discord: Matthew#0001