So ive packed 116 data and everything is okay anims, gfx and npc's! but when i add obj.dat/idx and repack index items, i can login into the game although i get this error
Code:
Exception in thread "Thread-1" java.lang.ArrayIndexOutOfBoundsException: 41058
at ItemDef.forID(ItemDef.java:397)
at ItemDef.getSprite(ItemDef.java:914)
at Client.drawInterface(Client.java:11762)
at Client.drawInterface(Client.java:11680)
at Client.draw3dScreen(Client.java:12849)
at Client.method146(Client.java:16701)
at Client.drawGameScreen(Client.java:11455)
at Client.processDrawing(Client.java:12750)
at RSApplet.run(RSApplet.java:189)
Now i know its it saying that its sending some more than it holds right?
Line 397 Itemdef.forID
Code:
stream.currentOffset = streamIndices[i];
So i got to this
Code:
public static void unpackConfig(StreamLoader archive) {
ItemDef.stream = new Stream(archive.getDataForName("obj.dat"));
Stream stream = new Stream(archive.getDataForName("obj.idx"));
totalItems = stream.readUnsignedWord() + 21;
streamIndices = new int[totalItems + 5687];
int i = 2;
int i1;
for (i1 = 0; i1 < totalItems - 21; ++i1) {
streamIndices[i1] = i;
i += stream.readUnsignedWord();
}
cache = new ItemDef[10];
for (i1 = 0; i1 < 10; ++i1) {
cache[i1] = new ItemDef();
}
Then noticed this
Code:
streamIndices = new int[totalItems + 5687];
Is this what is causing the problem? If so what do i change it to? and if not can someone please point me in the right direction.
Thanks
EDIT- 20 views and not one person can point in the right direction? i am looking at java tutorials on index out of bounds but its not helping