TRiLeZ
2011-04-26 03:39:57
On December 2/3rd, Jagex released an update to make the IDs of balloon animals shift around every revision or something, and made it so that their model ID would not change…
However, it took some work to figure out how to get the model ID, but I finally found how.
Here is my RSNPCDef class for TRiBot:
There are 2 approaches to making a fix…
That is how you would go upon identifying the balloon animals. Someone just needs to convert my TRiBot code to srl-reflection/simba format, since I'm very busy these days.
Hooks for revision 645 can be found here: http://tribot.org/gethooks.php?r=645.
However, it took some work to figure out how to get the model ID, but I finally found how.
Here is my RSNPCDef class for TRiBot:
package org.tribot.wrappers;
import java.lang.ref.Reference;
import org.tribot.bot.Methods;
import org.tribot.methods.Constants;
public class RSNPCDef {
Object def;
Methods me;
public RSNPCDef(Object def, Methods methods) {
this.def = def;
this.me = methods;
}
public Object getRawObject() {
return this.def;
}
public String getName() {
return this.me.getFieldString(Constants.Hooks.NPCDef.getName, this.def);
}
public String[] getActions() {
return this.me.getFieldStringArray(Constants.Hooks.NPCDef.getActions,
this.def);
}
public int getID() {
return this.me.getFieldInt(Constants.Hooks.NPCDef.getType, this.def);
}
public int[] getChildrenIDs() {
return this.me.getFieldIntArray(Constants.Hooks.NPCDef.getChildrenIDs,
this.def);
}
public int getSettingIndex() {
return this.me.getFieldInt(Constants.Hooks.NPCDef.getSettingIndex,
this.def);
}
public RSNPCDefLoader getLoader() {
Object loader = this.me.getFieldObject(
Constants.Hooks.NPCDef.getDefLoader, this.def);
if (loader == null)
return null;
return new RSNPCDefLoader(loader, this.me);
}
public RSNPCDef getChild() {
int[] childrenIDs = getChildrenIDs();
if (childrenIDs == null)
return null;
RSNPCDefLoader loader = getLoader();
if (loader == null)
return null;
boolean b = false;
int index1 = -1;
if (getSettingIndex() == -1)
b = true;
if (!b)
index1 = this.me.getSetting(getSettingIndex());
if (((index1 ^ 0xFFFFFFFF) > -1) || (index1 >= childrenIDs.length - 1)
|| (childrenIDs[index1] == -1) || b) {
int index2 = childrenIDs[childrenIDs.length - 1];
if (index2 != -1)
return loader.getNPCDef(index2);
return null;
}
return loader.getNPCDef(childrenIDs[index1]);
}
protected Object getRSModel() {
int[] childrenIDs = getChildrenIDs();
if (childrenIDs != null) {
RSNPCDef child = getChild();
if (child != null)
return child.getRSModel();
}
RSNPCDefLoader defLoader = getLoader();
if (defLoader == null)
return null;
Object models = this.me.getFieldObject(
Constants.Hooks.NPCDefLoader.getModels, defLoader.loader);
Object cache = this.me.getFieldObject(
Constants.Hooks.Cache.getHashTable, models);
RSHashTable nodeCache = new RSHashTable(cache, this.me);
int index = this.me
.getFieldInt(Constants.Hooks.GraphicsToolkit.getIndex,
this.me.getFieldObject(
Constants.Hooks.Static.getToolkit, null));
int ID = getID() | index << 16;
RSNode node = this.me.calculations.findNodeByID(nodeCache, ID);
if (node == null) {
this.me.println("NPC Model Node = null... " + (defLoader == null)
+ " " + (models == null) + " " + (cache == null) + " "
+ (nodeCache == null) + " " + index);
return null;
}
Object model = this.me.getFieldObject(
Constants.Hooks.HardReference.getObject, node.getNode());
if (model == null) {
Object referenceObject = this.me.getFieldObject(
Constants.Hooks.SoftReference.getReference, node.getNode());
if (referenceObject == null
|| !(referenceObject instanceof Reference<?>))
return null;
if ((model = ((Reference<?>) referenceObject).get()) == null)
return null;
}
return model;
}
}
There are 2 approaches to making a fix…
- This method would allow for less code, but it is less reliable (still very reliable though). You would go off model IDs. After you get the NPCDef from the child, you would get that NPCDef's ID and that would be the model ID, specific to the balloon animal. Every different type of balloon animal will have a different model ID.
- This method would be the most reliable. You would rely on the length of indices the models of the balloon animals. Every different type of balloon animal will have a different length of indices1.
That is how you would go upon identifying the balloon animals. Someone just needs to convert my TRiBot code to srl-reflection/simba format, since I'm very busy these days.
Hooks for revision 645 can be found here: http://tribot.org/gethooks.php?r=645.