Skip to content

Instantly share code, notes, and snippets.

@RandomKendal
Last active September 4, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RandomKendal/bce2bfb18d1186949cc8 to your computer and use it in GitHub Desktop.
Save RandomKendal/bce2bfb18d1186949cc8 to your computer and use it in GitHub Desktop.
This little script is used as a cheap-fix for when the PkHonor client is outdated. It changes the client version to the variable "set_to_version".
import java.lang.reflect.Field;
import org.parabot.environment.scripts.Category;
import org.parabot.environment.scripts.Script;
import org.parabot.environment.scripts.ScriptManifest;
import org.rev317.min.Loader;
@ScriptManifest(
author = "Random (Kendal)",
category = Category.UTILITY,
description = "This script is used to change your version-number. This lasts for the a single session (the version number will change back after closing the client).",
name = "Version Changer",
servers = { "PkHonor" },
version = 0.1
)
public class ChangeVersion extends Script {
int set_to_version = 99;
@Override
public boolean onExecute() {
try
{
System.out.println();
System.out.println("Attempting to load version class...");
Field path = Class.forName("pkhonor.ek", false, Loader.getClient().getClass().getClassLoader()).getDeclaredField("a");
path.setAccessible(true);
System.out.println("Succesfully loaded version class.");
int current_version = (int) path.get(Loader.getClient());
System.out.println("Current version: " + current_version + ".");
System.out.println("Desired version: " + set_to_version + ".");
if(set_to_version != current_version) {
path.set(Loader.getClient(), set_to_version);
System.out.println("Changed version from " + current_version + " -> " + (int) path.get(Loader.getClient()) + ".");
System.out.println("New version: " + (int) path.get(Loader.getClient()) + ".");
} else {
System.out.println("You're already on version " + set_to_version + "!");
}
}
catch (Exception e)
{
e.printStackTrace();
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment