mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 16:49:10 +00:00
Merge branch 'development' into cleanup/duplicated-class
This commit is contained in:
@@ -185,9 +185,13 @@ public class Context {
|
|||||||
panel.add(gameApplet);
|
panel.add(gameApplet);
|
||||||
panel.validate();
|
panel.validate();
|
||||||
|
|
||||||
|
serverProvider.preAppletInit();
|
||||||
|
|
||||||
gameApplet.init();
|
gameApplet.init();
|
||||||
gameApplet.start();
|
gameApplet.start();
|
||||||
|
|
||||||
|
serverProvider.postAppletStart();
|
||||||
|
|
||||||
java.util.Timer t = new java.util.Timer();
|
java.util.Timer t = new java.util.Timer();
|
||||||
t.schedule(new TimerTask() {
|
t.schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -40,17 +40,19 @@ public class AddCallbackAdapter implements Injectable, Opcodes {
|
|||||||
Label l0 = new Label();
|
Label l0 = new Label();
|
||||||
inject.add(new LabelNode(l0));
|
inject.add(new LabelNode(l0));
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (int arg : args) {
|
if (args != null) {
|
||||||
if (Modifier.isStatic(method.access)) {
|
for (int arg : args) {
|
||||||
int loadOpcode = ASMUtils.getLoadOpcode(types[arg]
|
if (Modifier.isStatic(method.access)) {
|
||||||
.getDescriptor());
|
int loadOpcode = ASMUtils.getLoadOpcode(types[arg]
|
||||||
inject.add(new VarInsnNode(loadOpcode, arg + offset));
|
.getDescriptor());
|
||||||
if (loadOpcode == Opcodes.LLOAD) {
|
inject.add(new VarInsnNode(loadOpcode, arg + offset));
|
||||||
offset++;
|
if (loadOpcode == Opcodes.LLOAD) {
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
inject.add(new VarInsnNode(ASMUtils.getLoadOpcode(types[arg]
|
||||||
|
.getDescriptor()), arg + 1));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
inject.add(new VarInsnNode(ASMUtils.getLoadOpcode(types[arg]
|
|
||||||
.getDescriptor()), arg + 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inject.add(new MethodInsnNode(INVOKESTATIC,
|
inject.add(new MethodInsnNode(INVOKESTATIC,
|
||||||
|
|||||||
@@ -26,14 +26,16 @@ public class Callback implements Injectable {
|
|||||||
this.invokeMethod = callbackMethod;
|
this.invokeMethod = callbackMethod;
|
||||||
this.desc = callbackDesc;
|
this.desc = callbackDesc;
|
||||||
this.conditional = conditional;
|
this.conditional = conditional;
|
||||||
if (args.contains(",")) {
|
if (args.length() > 0) {
|
||||||
final String[] strArgs = args.split(",");
|
if (args.contains(",")) {
|
||||||
this.args = new int[strArgs.length];
|
final String[] strArgs = args.split(",");
|
||||||
for (int i = 0; i < this.args.length; i++) {
|
this.args = new int[strArgs.length];
|
||||||
this.args[i] = Integer.parseInt(strArgs[i]);
|
for (int i = 0; i < this.args.length; i++) {
|
||||||
|
this.args[i] = Integer.parseInt(strArgs[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.args = new int[]{Integer.parseInt(args)};
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.args = new int[]{ Integer.parseInt(args) };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ public class ServerDescription implements Comparable<ServerDescription> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ServerDescription o) {
|
public int compareTo(ServerDescription o) {
|
||||||
|
if (this.getServerName().equalsIgnoreCase(o.getServerName())) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return this.getServerName().compareTo(o.getServerName());
|
return this.getServerName().compareTo(o.getServerName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,17 @@ public class XMLHookParser extends HookParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final String getValue(String tag, Element element) {
|
private static final String getValue(String tag, Element element) {
|
||||||
|
if (element.getElementsByTagName(tag).item(0) == null) {
|
||||||
|
throw new NullPointerException("MISSING HOOK TAG: The '" + tag + "' xml tag is missing from one of the hooks of type: " + element.getParentNode().getNodeName());
|
||||||
|
}
|
||||||
NodeList nodes = element.getElementsByTagName(tag).item(0)
|
NodeList nodes = element.getElementsByTagName(tag).item(0)
|
||||||
.getChildNodes();
|
.getChildNodes();
|
||||||
|
if (nodes.getLength() == 0 || nodes.item(0) == null) {
|
||||||
|
if (Core.inVerboseMode()) {
|
||||||
|
System.err.println("WARNING: Invalid Hook " + tag + " subnode. Tag is missing or empty?");
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
Node node = (Node) nodes.item(0);
|
Node node = (Node) nodes.item(0);
|
||||||
return node.getNodeValue();
|
return node.getNodeValue();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,4 +146,20 @@ public abstract class ServerProvider implements Opcodes {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called in Context.setApplet before applet.init() is called. Exclusively used for manipulating the Frame attached
|
||||||
|
* to the applet of Roatpkz.
|
||||||
|
*/
|
||||||
|
public void preAppletInit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called in Context.setApplet before after applet.start() and applet.init() are called. Exclusively used for manipulating the Frame attached
|
||||||
|
* to the applet of Roatpkz.
|
||||||
|
*/
|
||||||
|
public void postAppletStart() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user