177 Animations readvalues error
Hi there, I've got the latest data files and packed them into the cache, tried to fix the readvalues of Animations atm since it's giving an error I can't seem to fix on my own. I'm new to readvalues and trying to learn, been stuck on this for 2 days now lol, hope someone can point me in the right direction.
Source,Client & Cache used: Ascend 171
Only things I've done to the cache and client is pack 177 data (dumped with openrs) and changed readvalues.
Error in Eclipse:
Code:
java.lang.ArrayIndexOutOfBoundsException: 847059
Error: loaderror Unpacking config 83
at com.client.Stream.readUnsignedByte(Stream.java:216)
at com.client.definitions.AnimationDefinition.readValues(AnimationDefinition.java:560)
at com.client.definitions.AnimationDefinition.unpackConfig(AnimationDefinition.java:17)
at com.client.Client.startUp(Client.java:10597)
at com.client.RSApplet.run(RSApplet.java:218)
at com.client.Client.run(Client.java:6129)
at java.lang.Thread.run(Unknown Source)
Stream.java readUnsignedByte: (red line is line 216)
Code:
public int readUnsignedByte() {
return buffer[currentOffset++] & 0xff;
}
AnimationDefinition.java Readvalues: (red line is line 560 from the error)
Code:
private void readValues(Stream stream) {
int i;
while ((i = stream.readUnsignedByte()) != 0){
if (i == 1) {
anInt352 = stream.readUnsignedWord();
anIntArray353 = new int[anInt352];
anIntArray354 = new int[anInt352];
anIntArray355 = new int[anInt352];
for (int j = 0; j < anInt352; j++) {
anIntArray355[j] = stream.readUnsignedWord();
}
for (int j = 0; j < anInt352; j++) {
anIntArray353[j] = stream.readUnsignedWord();
anIntArray354[j] = -1;
}
for (int j = 0; j < anInt352; j++) {
anIntArray353[j] += stream.readUnsignedWord() << 16;
}
} else if (i == 2) {
anInt356 = stream.readUnsignedWord();
} else if (i == 3) {
int k = stream.readUnsignedByte();
anIntArray357 = new int[k + 1];
for (int l = 0; l < k; l++) {
anIntArray357[l] = stream.readUnsignedByte();
}
anIntArray357[k] = 9999999;
} if (i == 4) {
aBoolean358 = true;
} else if (i == 5) {
anInt359 = stream.readUnsignedByte();
} else if (i == 6) {
anInt360 = stream.readUnsignedWord();
} else if (i == 7) {
anInt361 = stream.readUnsignedWord();
} else if (i == 8) {
anInt362 = stream.readUnsignedByte();
} else if (i == 9) {
anInt363 = stream.readUnsignedByte();
} else if (i == 10) {
anInt364 = stream.readUnsignedByte();
} else if (i == 11) {
anInt365 = stream.readUnsignedByte();
} else if (i == 12) {
int count = stream.readUnsignedByte();
this.anIntArray2118 = new int[count];
for (int index = 0; index < count; ++index) {
this.anIntArray2118[index] = stream.readUnsignedWord();
}
for (int index = 0; index < count; ++index) {
this.anIntArray2118[index] += (stream.readUnsignedWord()) << 16;
}
} else if (i == 13) {
int count = stream.readUnsignedByte();
this.anIntArray2126 = new int[count];
for (int index = 0; index < count; ++index) {
this.anIntArray2126[index] = stream.read3Bytes();
}
}
}
AnimationDefinition.java Unpackconfig: (red line is line 17 from the error)
Code:
public static void unpackConfig(StreamLoader streamLoader) {
Stream stream = new Stream(streamLoader.getDataForName("seq.dat"));
int length = stream.readUnsignedWord();
if (anims == null)
anims = new AnimationDefinition[length];
for (int j = 0; j < length; j++) {
if (anims[j] == null)
anims[j] = new AnimationDefinition();
anims[j].readValues(stream);
if (j == 719) {
anims[j].anInt361 = 28232;
anims[j].anInt359 = 6;
anims[j].anInt360 = 0;
anims[j].anInt365 = 1;
anims[j].anInt356 = -1;
anims[j].aBoolean358 = false;
anims[j].anInt359 = 5;
anims[j].anInt362 = 99;
anims[j].anInt363 = -1;
anims[j].anInt364 = -1;
}
switch (j) {