Added initial version

This commit is contained in:
Ceikry
2021-03-07 20:37:32 -06:00
commit b452bd670c
13290 changed files with 1178433 additions and 0 deletions
@@ -0,0 +1,257 @@
package com.alex.io;
import com.alex.io.Stream;
public final class InputStream extends Stream {
private static final int[] BIT_MASK = new int[]{0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, '\uffff', 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, Integer.MAX_VALUE, -1};
public void initBitAccess() {
this.bitPosition = this.offset * 8;
}
public void finishBitAccess() {
this.offset = (7 + this.bitPosition) / 8;
}
public int readBits(int bitOffset) {
int bytePos = this.bitPosition >> 1779819011;
int i_8_ = -(7 & this.bitPosition) + 8;
this.bitPosition += bitOffset;
int value;
for(value = 0; ~bitOffset < ~i_8_; i_8_ = 8) {
value += (BIT_MASK[i_8_] & this.buffer[bytePos++]) << -i_8_ + bitOffset;
bitOffset -= i_8_;
}
if(~i_8_ == ~bitOffset) {
value += this.buffer[bytePos] & BIT_MASK[i_8_];
} else {
value += this.buffer[bytePos] >> -bitOffset + i_8_ & BIT_MASK[bitOffset];
}
return value;
}
public InputStream(int capacity) {
this.buffer = new byte[capacity];
}
public InputStream(byte[] buffer) {
this.buffer = buffer;
this.length = buffer.length;
}
public void checkCapacity(int length) {
if(this.offset + length >= this.buffer.length) {
byte[] newBuffer = new byte[(this.offset + length) * 2];
System.arraycopy(this.buffer, 0, newBuffer, 0, this.buffer.length);
this.buffer = newBuffer;
}
}
public void skip(int length) {
this.offset += length;
}
public void setLength(int length) {
this.length = length;
}
public void setOffset(int offset) {
this.offset = offset;
}
public int getRemaining() {
return this.offset < this.length?this.length - this.offset:0;
}
public void addBytes(byte[] b, int offset, int length) {
this.checkCapacity(length - offset);
System.arraycopy(b, offset, this.buffer, this.offset, length);
this.length += length - offset;
}
public int readPacket() {
return this.readUnsignedByte();
}
public int readByte() {
return this.getRemaining() > 0?this.buffer[this.offset++]:0;
}
public void readBytes(byte[] buffer, int off, int len) {
for(int k = off; k < len + off; ++k) {
buffer[k] = (byte)this.readByte();
}
}
public void readBytes(byte[] buffer) {
this.readBytes(buffer, 0, buffer.length);
}
public int readSmart2() {
int i = 0;
int i_33_;
for(i_33_ = this.readUnsignedSmart(); ~i_33_ == -32768; i += 32767) {
i_33_ = this.readUnsignedSmart();
}
i += i_33_;
return i;
}
public int readUnsignedByte() {
return this.readByte() & 255;
}
public int readByte128() {
return (byte)(this.readByte() - 128);
}
public int readByteC() {
return (byte)(-this.readByte());
}
public int read128Byte() {
return (byte)(128 - this.readByte());
}
public int readUnsignedByte128() {
return this.readUnsignedByte() - 128 & 255;
}
public int readUnsignedByteC() {
return -this.readUnsignedByte() & 255;
}
public int readUnsigned128Byte() {
return 128 - this.readUnsignedByte() & 255;
}
public int readShortLE() {
int i = this.readUnsignedByte() + (this.readUnsignedByte() << 8);
if(i > 32767) {
i -= 65536;
}
return i;
}
public int readShort128() {
int i = (this.readUnsignedByte() << 8) + (this.readByte() - 128 & 255);
if(i > 32767) {
i -= 65536;
}
return i;
}
public int readShortLE128() {
int i = (this.readByte() - 128 & 255) + (this.readUnsignedByte() << 8);
if(i > 32767) {
i -= 65536;
}
return i;
}
public int read128ShortLE() {
int i = (128 - this.readByte() & 255) + (this.readUnsignedByte() << 8);
if(i > 32767) {
i -= 65536;
}
return i;
}
public int readShort() {
int i = (this.readUnsignedByte() << 8) + this.readUnsignedByte();
if(i > 32767) {
i -= 65536;
}
return i;
}
public int readUnsignedShortLE() {
return this.readUnsignedByte() + (this.readUnsignedByte() << 8);
}
public int readUnsignedShort() {
return (this.readUnsignedByte() << 8) + this.readUnsignedByte();
}
public int readUnsignedShort128() {
return (this.readUnsignedByte() << 8) + (this.readByte() - 128 & 255);
}
public int readUnsignedShortLE128() {
return (this.readByte() - 128 & 255) + (this.readUnsignedByte() << 8);
}
public int readInt() {
return (this.readUnsignedByte() << 24) + (this.readUnsignedByte() << 16) + (this.readUnsignedByte() << 8) + this.readUnsignedByte();
}
public int read24BitInt() {
return (this.readUnsignedByte() << 16) + (this.readUnsignedByte() << 8) + this.readUnsignedByte();
}
public int readIntV1() {
return (this.readUnsignedByte() << 8) + this.readUnsignedByte() + (this.readUnsignedByte() << 24) + (this.readUnsignedByte() << 16);
}
public int readIntV2() {
return (this.readUnsignedByte() << 16) + (this.readUnsignedByte() << 24) + this.readUnsignedByte() + (this.readUnsignedByte() << 8);
}
public int readIntLE() {
return this.readUnsignedByte() + (this.readUnsignedByte() << 8) + (this.readUnsignedByte() << 16) + (this.readUnsignedByte() << 24);
}
public long readLong() {
long l = (long)this.readInt() & 4294967295L;
long l1 = (long)this.readInt() & 4294967295L;
return (l << 32) + l1;
}
public String readString() {
String s;
int b;
for(s = ""; (b = this.readByte()) != 0; s = s + (char)b) {
;
}
return s;
}
public String readJagString() {
this.readByte();
String s;
int b;
for(s = ""; (b = this.readByte()) != 0; s = s + (char)b) {
;
}
return s;
}
public int readBigSmart() {
if(~this.buffer[this.offset] <= -1) {
int value = this.readUnsignedShort();
return value == 32767?-1:value;
} else {
return this.readInt() & Integer.MAX_VALUE;
}
}
public int readUnsignedSmart() {
int i = 255 & this.buffer[this.offset];
return i >= 128?-32768 + this.readUnsignedShort():this.readUnsignedByte();
}
}
@@ -0,0 +1,331 @@
package com.alex.io;
import com.alex.io.Stream;
import java.math.BigInteger;
public final class OutputStream extends Stream {
private static final int[] BIT_MASK = new int[32];
private int opcodeStart = 0;
static {
for(int i = 0; i < 32; ++i) {
BIT_MASK[i] = (1 << i) - 1;
}
}
public OutputStream(int capacity) {
this.setBuffer(new byte[capacity]);
}
public OutputStream() {
this.setBuffer(new byte[16]);
}
public OutputStream(byte[] buffer) {
this.setBuffer(buffer);
this.offset = buffer.length;
this.length = buffer.length;
}
public OutputStream(int[] buffer) {
this.setBuffer(new byte[buffer.length]);
int[] arr$ = buffer;
int len$ = buffer.length;
for(int i$ = 0; i$ < len$; ++i$) {
int value = arr$[i$];
this.writeByte(value);
}
}
public void checkCapacityPosition(int position) {
if(position >= this.getBuffer().length) {
byte[] newBuffer = new byte[position + 16];
System.arraycopy(this.getBuffer(), 0, newBuffer, 0, this.getBuffer().length);
this.setBuffer(newBuffer);
}
}
public void skip(int length) {
this.setOffset(this.getOffset() + length);
}
public void setOffset(int offset) {
this.offset = offset;
}
public void writeBytes(byte[] b, int offset, int length) {
this.checkCapacityPosition(this.getOffset() + length - offset);
System.arraycopy(b, offset, this.getBuffer(), this.getOffset(), length);
this.setOffset(this.getOffset() + (length - offset));
}
public void writeBytes(byte[] b) {
byte offset = 0;
int length = b.length;
this.checkCapacityPosition(this.getOffset() + length - offset);
System.arraycopy(b, offset, this.getBuffer(), this.getOffset(), length);
this.setOffset(this.getOffset() + (length - offset));
}
public void addBytes128(byte[] data, int offset, int len) {
for(int k = offset; k < len; ++k) {
this.writeByte((byte)(data[k] + 128));
}
}
public void addBytesS(byte[] data, int offset, int len) {
for(int k = offset; k < len; ++k) {
this.writeByte((byte)(-128 + data[k]));
}
}
public void addBytes_Reverse(byte[] data, int offset, int len) {
for(int i = len - 1; i >= 0; --i) {
this.writeByte(data[i]);
}
}
public void addBytes_Reverse128(byte[] data, int offset, int len) {
for(int i = len - 1; i >= 0; --i) {
this.writeByte((byte)(data[i] + 128));
}
}
public void writeByte(int i) {
this.writeByte(i, this.offset++);
}
public void writeNegativeByte(int i) {
this.writeByte(-i, this.offset++);
}
public void writeByte(int i, int position) {
this.checkCapacityPosition(position);
this.getBuffer()[position] = (byte)i;
}
public void writeByte128(int i) {
this.writeByte(i + 128);
}
public void writeByteC(int i) {
this.writeByte(-i);
}
public void write3Byte(int i) {
this.writeByte(i >> 16);
this.writeByte(i >> 8);
this.writeByte(i);
}
public void write128Byte(int i) {
this.writeByte(128 - i);
}
public void writeShortLE128(int i) {
this.writeByte(i + 128);
this.writeByte(i >> 8);
}
public void writeShort128(int i) {
this.writeByte(i >> 8);
this.writeByte(i + 128);
}
public void writeBigSmart(int i) {
//if(i >= 32767 && i >= 0) {
if(i >= 52767 && i >= 0) {
this.writeInt(i - Integer.MAX_VALUE - 1);
} else {
this.writeShort(i >= 0?i:52767);
//this.writeShort(i >= 0?i:32767);
}
}
public void writeSmart(int i) {
if(i >= 128) {
this.writeShort(i);
} else {
this.writeByte(i);
}
}
public void writeShort(int i) {
this.writeByte(i >> 8);
this.writeByte(i);
}
public void writeShortLE(int i) {
this.writeByte(i);
this.writeByte(i >> 8);
}
public void write24BitInt(int i) {
this.writeByte(i >> 16);
this.writeByte(i >> 8);
this.writeByte(i);
}
public void writeInt(int i) {
this.writeByte(i >> 24);
this.writeByte(i >> 16);
this.writeByte(i >> 8);
this.writeByte(i);
}
public void writeIntV1(int i) {
this.writeByte(i >> 8);
this.writeByte(i);
this.writeByte(i >> 24);
this.writeByte(i >> 16);
}
public void writeIntV2(int i) {
this.writeByte(i >> 16);
this.writeByte(i >> 24);
this.writeByte(i);
this.writeByte(i >> 8);
}
public void writeIntLE(int i) {
this.writeByte(i);
this.writeByte(i >> 8);
this.writeByte(i >> 16);
this.writeByte(i >> 24);
}
public void writeLong(long l) {
this.writeByte((int)(l >> 56));
this.writeByte((int)(l >> 48));
this.writeByte((int)(l >> 40));
this.writeByte((int)(l >> 32));
this.writeByte((int)(l >> 24));
this.writeByte((int)(l >> 16));
this.writeByte((int)(l >> 8));
this.writeByte((int)l);
}
public void writePSmarts(int i) {
if(i < 128) {
this.writeByte(i);
} else if (i < 32768) {
this.writeShort(32768 + i);
}else {
System.out.println("Error psmarts out of range:");
}
}
public void writeString(String s) {
this.checkCapacityPosition(this.getOffset() + s.length() + 1);
System.arraycopy(s.getBytes(), 0, this.getBuffer(), this.getOffset(), s.length());
this.setOffset(this.getOffset() + s.length());
this.writeByte(0);
}
public void writeGJString(String s) {
this.writeByte(0);
this.writeString(s);
}
public void putGJString3(String s) {
this.writeByte(0);
this.writeString(s);
this.writeByte(0);
}
public void writePacket(int id) {
this.writeByte(id);
}
public void writePacketVarByte(int id) {
this.writePacket(id);
this.writeByte(0);
this.opcodeStart = this.getOffset() - 1;
}
public void writePacketVarShort(int id) {
this.writePacket(id);
this.writeShort(0);
this.opcodeStart = this.getOffset() - 2;
}
public void endPacketVarByte() {
this.writeByte(this.getOffset() - (this.opcodeStart + 2) + 1, this.opcodeStart);
}
public void endPacketVarShort() {
int size = this.getOffset() - (this.opcodeStart + 2);
this.writeByte(size >> 8, this.opcodeStart++);
this.writeByte(size, this.opcodeStart);
}
public void initBitAccess() {
this.bitPosition = this.getOffset() * 8;
}
public void finishBitAccess() {
this.setOffset((this.bitPosition + 7) / 8);
}
public int getBitPos(int i) {
return 8 * i - this.bitPosition;
}
public void writeBits(int numBits, int value) {
int bytePos = this.bitPosition >> 3;
int bitOffset = 8 - (this.bitPosition & 7);
byte[] var10000;
for(this.bitPosition += numBits; numBits > bitOffset; bitOffset = 8) {
this.checkCapacityPosition(bytePos);
var10000 = this.getBuffer();
var10000[bytePos] = (byte)(var10000[bytePos] & ~BIT_MASK[bitOffset]);
var10000 = this.getBuffer();
int var10001 = bytePos++;
var10000[var10001] = (byte)(var10000[var10001] | value >> numBits - bitOffset & BIT_MASK[bitOffset]);
numBits -= bitOffset;
}
this.checkCapacityPosition(bytePos);
if(numBits == bitOffset) {
var10000 = this.getBuffer();
var10000[bytePos] = (byte)(var10000[bytePos] & ~BIT_MASK[bitOffset]);
var10000 = this.getBuffer();
var10000[bytePos] = (byte)(var10000[bytePos] | value & BIT_MASK[bitOffset]);
} else {
var10000 = this.getBuffer();
var10000[bytePos] = (byte)(var10000[bytePos] & ~(BIT_MASK[numBits] << bitOffset - numBits));
var10000 = this.getBuffer();
var10000[bytePos] = (byte)(var10000[bytePos] | (value & BIT_MASK[numBits]) << bitOffset - numBits);
}
}
public void setBuffer(byte[] buffer) {
this.buffer = buffer;
}
public final void rsaEncode(BigInteger key, BigInteger modulus) {
int length = this.offset;
this.offset = 0;
byte[] data = new byte[length];
this.getBytes(data, 0, length);
BigInteger biginteger2 = new BigInteger(data);
BigInteger biginteger3 = biginteger2.modPow(key, modulus);
byte[] out = biginteger3.toByteArray();
this.offset = 0;
this.writeBytes(out, 0, out.length);
}
}
@@ -0,0 +1,91 @@
package com.alex.io;
public abstract class Stream {
protected int offset;
protected int length;
protected byte[] buffer;
protected int bitPosition;
public int getLength() {
return this.length;
}
public byte[] getBuffer() {
return this.buffer;
}
public int getOffset() {
return this.offset;
}
public void decodeXTEA(int[] keys) {
this.decodeXTEA(keys, 5, this.length);
}
public void decodeXTEA(int[] keys, int start, int end) {
int l = this.offset;
this.offset = start;
int i1 = (end - start) / 8;
for(int j1 = 0; j1 < i1; ++j1) {
int k1 = this.readInt();
int l1 = this.readInt();
int sum = -957401312;
int delta = -1640531527;
for(int k2 = 32; k2-- > 0; k1 -= (l1 >>> 5 ^ l1 << 4) + l1 ^ keys[sum & 3] + sum) {
l1 -= keys[(sum & 7300) >>> 11] + sum ^ (k1 >>> 5 ^ k1 << 4) + k1;
sum -= delta;
}
this.offset -= 8;
this.writeInt(k1);
this.writeInt(l1);
}
this.offset = l;
}
public final void encodeXTEA(int[] keys, int start, int end) {
int o = this.offset;
int j = (end - start) / 8;
this.offset = start;
for(int k = 0; k < j; ++k) {
int l = this.readInt();
int i1 = this.readInt();
int sum = 0;
int delta = -1640531527;
for(int l1 = 32; l1-- > 0; i1 += l + (l >>> 5 ^ l << 4) ^ keys[(7916 & sum) >>> 11] + sum) {
l += sum + keys[3 & sum] ^ i1 + (i1 >>> 5 ^ i1 << 4);
sum += delta;
}
this.offset -= 8;
this.writeInt(l);
this.writeInt(i1);
}
this.offset = o;
}
private final int readInt() {
this.offset += 4;
return ((255 & this.buffer[-3 + this.offset]) << 16) + ((255 & this.buffer[-4 + this.offset]) << 24) + ((this.buffer[-2 + this.offset] & 255) << 8) + (this.buffer[-1 + this.offset] & 255);
}
public void writeInt(int value) {
this.buffer[this.offset++] = (byte)(value >> 24);
this.buffer[this.offset++] = (byte)(value >> 16);
this.buffer[this.offset++] = (byte)(value >> 8);
this.buffer[this.offset++] = (byte)value;
}
public final void getBytes(byte[] data, int off, int len) {
for(int k = off; k < len + off; ++k) {
data[k] = this.buffer[this.offset++];
}
}
}
@@ -0,0 +1,281 @@
package com.alex.loaders.animations;
import com.alex.io.InputStream;
import com.alex.store.Store;
import java.io.IOException;
import java.io.PrintStream;
import java.util.concurrent.ConcurrentHashMap;
public class AnimationDefinitions {
public static Store cache;
public static int id;
public int loopCycles = 99;
public int anInt2137;
public static int[] frames;
public int anInt2140 = -1;
public boolean aBoolean2141 = false;
public int priority = 5;
public int leftHandEquip = -1;
public int rightHandEquip = -1;
public int anInt2145;
public int[][] handledSounds;
public boolean[] aBooleanArray2149;
public int[] anIntArray2151;
public boolean aBoolean2152 = false;
public static int[] delays;
public int anInt2155 = 2;
public boolean aBoolean2158 = false;
public boolean aBoolean2159 = false;
public int anInt2162 = -1;
public int loopDelay = -1;
public int[] soundMinDelay;
public int[] soundMaxDelay;
public int[] anIntArray1362;
public boolean effect2Sound;
private static final ConcurrentHashMap animDefs = new ConcurrentHashMap();
public static void main(String[] args) throws IOException {
cache = new Store("C:/Users/yvonne christer/Dropbox/Source/data/562cache/");
label55:
for(int i = 0; i < 1; ++i) {
System.out.println("Emote ID: " + i);
int k = 0;
while(true) {
getAnimationDefinitions(i);
PrintStream var10000;
StringBuilder var10001;
if(k >= delays.length) {
k = 0;
while(true) {
getAnimationDefinitions(i);
if(k >= frames.length) {
System.out.println("loopDelay = " + getAnimationDefinitions(i).loopDelay);
System.out.println("leftHandEquip = " + getAnimationDefinitions(i).leftHandEquip);
System.out.println("priority = " + getAnimationDefinitions(i).priority);
System.out.println("rightHandEquip = " + getAnimationDefinitions(i).rightHandEquip);
System.out.println("loopCycles = " + getAnimationDefinitions(i).loopCycles);
System.out.println("anInt2140 = " + getAnimationDefinitions(i).anInt2140);
System.out.println("anInt2162 = " + getAnimationDefinitions(i).anInt2162);
System.out.println("anInt2155 = " + getAnimationDefinitions(i).anInt2155);
System.out.println("anInt2145 = " + getAnimationDefinitions(i).anInt2145);
for(k = 0; k < getAnimationDefinitions(i).anIntArray2151.length; ++k) {
System.out.println("anIntArray2151[" + k + "] = " + getAnimationDefinitions(i).anIntArray2151[k]);
}
for(k = 0; k < getAnimationDefinitions(i).aBooleanArray2149.length; ++k) {
System.out.println("aBooleanArray2149[" + k + "] = " + getAnimationDefinitions(i).aBooleanArray2149[k]);
}
System.out.println("aBoolean2152 = " + getAnimationDefinitions(i).aBoolean2152);
for(k = 0; k < getAnimationDefinitions(i).anIntArray1362.length; ++k) {
System.out.println("anIntArray1362[" + k + "] = " + getAnimationDefinitions(i).anIntArray1362[k]);
}
continue label55;
}
var10000 = System.out;
var10001 = (new StringBuilder()).append("frames[").append(k).append("] = ");
getAnimationDefinitions(i);
var10000.println(var10001.append(frames[k]).toString());
++k;
}
}
var10000 = System.out;
var10001 = (new StringBuilder()).append("delays[").append(k).append("] = ");
getAnimationDefinitions(i);
var10000.println(var10001.append(delays[k]).toString());
++k;
}
}
}
public static final AnimationDefinitions getAnimationDefinitions(int emoteId) {
try {
AnimationDefinitions var3 = (AnimationDefinitions)animDefs.get(Integer.valueOf(emoteId));
if(var3 != null) {
return var3;
} else {
byte[] data = cache.getIndexes()[20].getFile(emoteId >>> 7, emoteId & 127);
var3 = new AnimationDefinitions();
if(data != null) {
var3.readValueLoop(new InputStream(data));
}
var3.method2394();
animDefs.put(Integer.valueOf(emoteId), var3);
id = emoteId;
return var3;
}
} catch (Throwable var31) {
return null;
}
}
private void readValueLoop(InputStream stream) {
while(true) {
int opcode = stream.readUnsignedByte();
if(opcode == 0) {
return;
}
this.readValues(stream, opcode);
}
}
public int getEmoteTime() {
if(delays == null) {
return 0;
} else {
int ms = 0;
int[] arr$ = delays;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
int i = arr$[i$];
ms += i;
}
return ms * 30;
}
}
public int getEmoteGameTickets() {
return this.getEmoteTime() / 1000;
}
private void readValues(InputStream stream, int opcode) {
int index;
int i_21_;
if(opcode == 1) {
index = stream.readUnsignedShort();
delays = new int[index];
for(i_21_ = 0; ~index < ~i_21_; ++i_21_) {
delays[i_21_] = stream.readUnsignedShort();
}
frames = new int[index];
for(i_21_ = 0; ~i_21_ > ~index; ++i_21_) {
frames[i_21_] = stream.readUnsignedShort();
}
for(i_21_ = 0; i_21_ < index; ++i_21_) {
frames[i_21_] += stream.readUnsignedShort() << 16;
}
} else if(opcode == 2) {
this.loopDelay = stream.readUnsignedShort();
} else if(opcode == 3) {
this.aBooleanArray2149 = new boolean[256];
index = stream.readUnsignedByte();
for(i_21_ = 0; i_21_ < index; ++i_21_) {
this.aBooleanArray2149[stream.readUnsignedByte()] = true;
}
} else if(opcode == 4) {
this.aBoolean2152 = true;
} else if(opcode == 5) {
this.priority = stream.readUnsignedByte();
} else if(opcode == 6) {
this.rightHandEquip = stream.readUnsignedShort();
} else if(opcode == 7) {
this.leftHandEquip = stream.readUnsignedShort();
} else if(opcode == 8) {
this.loopCycles = stream.readUnsignedByte();
} else if(opcode == 9) {
this.anInt2140 = stream.readUnsignedByte();
} else if(opcode == 10) {
this.anInt2162 = stream.readUnsignedByte();
} else if(opcode == 11) {
this.anInt2155 = stream.readUnsignedByte();
} else if(opcode == 12) {
index = stream.readUnsignedByte();
this.anIntArray2151 = new int[index];
for(i_21_ = 0; ~i_21_ > ~index; ++i_21_) {
this.anIntArray2151[i_21_] = stream.readUnsignedShort();
}
for(i_21_ = 0; index > i_21_; ++i_21_) {
this.anIntArray2151[i_21_] += stream.readUnsignedShort() << 16;
}
} else if(opcode == 13) {
index = stream.readUnsignedShort();
this.handledSounds = new int[index][];
for(i_21_ = 0; i_21_ < index; ++i_21_) {
int i_22_ = stream.readUnsignedByte();
if(~i_22_ < -1) {
this.handledSounds[i_21_] = new int[i_22_];
this.handledSounds[i_21_][0] = stream.read24BitInt();
for(int i_23_ = 1; ~i_22_ < ~i_23_; ++i_23_) {
this.handledSounds[i_21_][i_23_] = stream.readUnsignedShort();
}
}
}
} else if(opcode == 14) {
this.aBoolean2141 = true;
} else if(opcode == 15) {
this.aBoolean2159 = true;
} else if(opcode == 16) {
this.aBoolean2158 = true;
} else if(opcode == 17) {
this.anInt2145 = stream.readUnsignedByte();
} else if(opcode == 18) {
this.effect2Sound = true;
} else if(opcode == 19) {
if(this.anIntArray1362 == null) {
this.anIntArray1362 = new int[this.handledSounds.length];
for(index = 0; index < this.handledSounds.length; ++index) {
this.anIntArray1362[index] = 255;
}
}
this.anIntArray1362[stream.readUnsignedByte()] = stream.readUnsignedByte();
} else if(opcode == 20) {
if(this.soundMaxDelay == null || this.soundMinDelay == null) {
this.soundMaxDelay = new int[this.handledSounds.length];
this.soundMinDelay = new int[this.handledSounds.length];
for(index = 0; index < this.handledSounds.length; ++index) {
this.soundMaxDelay[index] = 256;
this.soundMinDelay[index] = 256;
}
}
index = stream.readUnsignedByte();
this.soundMaxDelay[index] = stream.readUnsignedShort();
this.soundMinDelay[index] = stream.readUnsignedShort();
}
}
public void method2394() {
if(this.anInt2140 == -1) {
if(this.aBooleanArray2149 == null) {
this.anInt2140 = 0;
} else {
this.anInt2140 = 2;
}
}
if(this.anInt2162 == -1) {
if(this.aBooleanArray2149 == null) {
this.anInt2162 = 0;
} else {
this.anInt2162 = 2;
}
}
}
}
@@ -0,0 +1,4 @@
package com.alex.loaders.clientscripts;
public class ClientScript {
}
@@ -0,0 +1,341 @@
package com.alex.loaders.images;
import com.alex.io.InputStream;
import com.alex.io.OutputStream;
import com.alex.store.Store;
import java.awt.image.BufferedImage;
import java.util.Arrays;
public final class IndexedColorImageFile {
private BufferedImage[] images;
private int[] pallete;
private int[][] pixelsIndexes;
private byte[][] alpha;
private boolean[] usesAlpha;
private int biggestWidth;
private int biggestHeight;
public IndexedColorImageFile(BufferedImage... images) {
this.images = images;
}
public IndexedColorImageFile(Store cache, int archiveId, int fileId) {
this(cache, 8, archiveId, fileId);
}
public IndexedColorImageFile(Store cache, int idx, int archiveId, int fileId) {
this.decodeArchive(cache, idx, archiveId, fileId);
}
public void decodeArchive(Store cache, int idx, int archiveId, int fileId) {
byte[] data = cache.getIndexes()[idx].getFile(archiveId, fileId);
if(data != null) {
InputStream stream = new InputStream(data);
stream.setOffset(data.length - 2);
int count = stream.readUnsignedShort();
this.images = new BufferedImage[count];
this.pixelsIndexes = new int[this.images.length][];
this.alpha = new byte[this.images.length][];
this.usesAlpha = new boolean[this.images.length];
int[] imagesMinX = new int[this.images.length];
int[] imagesMinY = new int[this.images.length];
int[] imagesWidth = new int[this.images.length];
int[] imagesHeight = new int[this.images.length];
stream.setOffset(data.length - 7 - this.images.length * 8);
this.setBiggestWidth(stream.readShort());
this.setBiggestHeight(stream.readShort());
int palleteLength = (stream.readUnsignedByte() & 255) + 1;
int i_20_;
for(i_20_ = 0; i_20_ < this.images.length; ++i_20_) {
imagesMinX[i_20_] = stream.readUnsignedShort();
}
for(i_20_ = 0; i_20_ < this.images.length; ++i_20_) {
imagesMinY[i_20_] = stream.readUnsignedShort();
}
for(i_20_ = 0; i_20_ < this.images.length; ++i_20_) {
imagesWidth[i_20_] = stream.readUnsignedShort();
}
for(i_20_ = 0; i_20_ < this.images.length; ++i_20_) {
imagesHeight[i_20_] = stream.readUnsignedShort();
}
stream.setOffset(data.length - 7 - this.images.length * 8 - (palleteLength - 1) * 3);
this.pallete = new int[palleteLength];
for(i_20_ = 1; i_20_ < palleteLength; ++i_20_) {
this.pallete[i_20_] = stream.read24BitInt();
if(this.pallete[i_20_] == 0) {
this.pallete[i_20_] = 1;
}
}
stream.setOffset(0);
for(i_20_ = 0; i_20_ < this.images.length; ++i_20_) {
int pixelsIndexesLength = imagesWidth[i_20_] * imagesHeight[i_20_];
this.pixelsIndexes[i_20_] = new int[pixelsIndexesLength];
this.alpha[i_20_] = new byte[pixelsIndexesLength];
int maskData = stream.readUnsignedByte();
int i_31_;
if((maskData & 2) == 0) {
int var201;
if((maskData & 1) == 0) {
for(var201 = 0; var201 < pixelsIndexesLength; ++var201) {
this.pixelsIndexes[i_20_][var201] = (byte)stream.readByte();
}
} else {
for(var201 = 0; var201 < imagesWidth[i_20_]; ++var201) {
for(i_31_ = 0; i_31_ < imagesHeight[i_20_]; ++i_31_) {
this.pixelsIndexes[i_20_][var201 + i_31_ * imagesWidth[i_20_]] = (byte)stream.readByte();
}
}
}
} else {
this.usesAlpha[i_20_] = true;
boolean var20 = false;
if((maskData & 1) == 0) {
for(i_31_ = 0; i_31_ < pixelsIndexesLength; ++i_31_) {
this.pixelsIndexes[i_20_][i_31_] = (byte)stream.readByte();
}
for(i_31_ = 0; i_31_ < pixelsIndexesLength; ++i_31_) {
byte var21 = this.alpha[i_20_][i_31_] = (byte)stream.readByte();
var20 |= var21 != -1;
}
} else {
int var211;
for(i_31_ = 0; i_31_ < imagesWidth[i_20_]; ++i_31_) {
for(var211 = 0; var211 < imagesHeight[i_20_]; ++var211) {
this.pixelsIndexes[i_20_][i_31_ + var211 * imagesWidth[i_20_]] = stream.readByte();
}
}
for(i_31_ = 0; i_31_ < imagesWidth[i_20_]; ++i_31_) {
for(var211 = 0; var211 < imagesHeight[i_20_]; ++var211) {
byte i_33_ = this.alpha[i_20_][i_31_ + var211 * imagesWidth[i_20_]] = (byte)stream.readByte();
var20 |= i_33_ != -1;
}
}
}
if(!var20) {
this.alpha[i_20_] = null;
}
}
this.images[i_20_] = this.getBufferedImage(imagesWidth[i_20_], imagesHeight[i_20_], this.pixelsIndexes[i_20_], this.alpha[i_20_], this.usesAlpha[i_20_]);
}
}
}
public BufferedImage getBufferedImage(int width, int height, int[] pixelsIndexes, byte[] extraPixels, boolean useExtraPixels) {
if(width > 0 && height > 0) {
BufferedImage image = new BufferedImage(width, height, 6);
int[] rgbArray = new int[width * height];
int i = 0;
int i_43_ = 0;
int i_46_;
int i_47_;
if(useExtraPixels && extraPixels != null) {
for(i_46_ = 0; i_46_ < height; ++i_46_) {
for(i_47_ = 0; i_47_ < width; ++i_47_) {
rgbArray[i_43_++] = extraPixels[i] << 24 | this.pallete[pixelsIndexes[i] & 255];
++i;
}
}
} else {
for(i_46_ = 0; i_46_ < height; ++i_46_) {
for(i_47_ = 0; i_47_ < width; ++i_47_) {
int i_48_ = this.pallete[pixelsIndexes[i++] & 255];
rgbArray[i_43_++] = i_48_ != 0?-16777216 | i_48_:0;
}
}
}
image.setRGB(0, 0, width, height, rgbArray, 0, width);
image.flush();
return image;
} else {
return null;
}
}
public byte[] encodeFile() {
if(this.pallete == null) {
this.generatePallete();
}
OutputStream stream = new OutputStream();
int container;
int len$;
int i$;
for(container = 0; container < this.images.length; ++container) {
len$ = 0;
if(this.usesAlpha[container]) {
len$ |= 2;
}
stream.writeByte(len$);
for(i$ = 0; i$ < this.pixelsIndexes[container].length; ++i$) {
stream.writeByte(this.pixelsIndexes[container][i$]);
}
if(this.usesAlpha[container]) {
for(i$ = 0; i$ < this.alpha[container].length; ++i$) {
stream.writeByte(this.alpha[container][i$]);
}
}
}
for(container = 0; container < this.pallete.length; ++container) {
stream.write24BitInt(this.pallete[container]);
}
if(this.biggestWidth == 0 && this.biggestHeight == 0) {
BufferedImage[] var7 = this.images;
len$ = var7.length;
for(i$ = 0; i$ < len$; ++i$) {
BufferedImage image = var7[i$];
if(image.getWidth() > this.biggestWidth) {
this.biggestWidth = image.getWidth();
}
if(image.getHeight() > this.biggestHeight) {
this.biggestHeight = image.getHeight();
}
}
}
stream.writeShort(this.biggestWidth);
stream.writeShort(this.biggestHeight);
stream.writeByte(this.pallete.length - 1);
for(container = 0; container < this.images.length; ++container) {
stream.writeShort(this.images[container].getMinX());
}
for(container = 0; container < this.images.length; ++container) {
stream.writeShort(this.images[container].getMinY());
}
for(container = 0; container < this.images.length; ++container) {
stream.writeShort(this.images[container].getWidth());
}
for(container = 0; container < this.images.length; ++container) {
stream.writeShort(this.images[container].getHeight());
}
stream.writeShort(this.images.length);
byte[] var71 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(var71, 0, var71.length);
return var71;
}
public int getPalleteIndex(int rgb) {
if(this.pallete == null) {
this.pallete = new int[1];
}
for(int var3 = 0; var3 < this.pallete.length; ++var3) {
if(this.pallete[var3] == rgb) {
return var3;
}
}
if(this.pallete.length == 256) {
System.out.println("Pallete to big, please reduce images quality.");
return 0;
} else {
int[] var31 = new int[this.pallete.length + 1];
System.arraycopy(this.pallete, 0, var31, 0, this.pallete.length);
var31[this.pallete.length] = rgb;
this.pallete = var31;
return this.pallete.length - 1;
}
}
public int addImage(BufferedImage image) {
BufferedImage[] newImages = (BufferedImage[])Arrays.copyOf(this.images, this.images.length + 1);
newImages[this.images.length] = image;
this.images = newImages;
this.pallete = null;
this.pixelsIndexes = null;
this.alpha = null;
this.usesAlpha = null;
return this.images.length - 1;
}
public void replaceImage(BufferedImage image, int index) {
this.images[index] = image;
this.pallete = null;
this.pixelsIndexes = null;
this.alpha = null;
this.usesAlpha = null;
}
public void generatePallete() {
this.pixelsIndexes = new int[this.images.length][];
this.alpha = new byte[this.images.length][];
this.usesAlpha = new boolean[this.images.length];
for(int index = 0; index < this.images.length; ++index) {
BufferedImage image = this.images[index];
int[] rgbArray = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), rgbArray, 0, image.getWidth());
this.pixelsIndexes[index] = new int[image.getWidth() * image.getHeight()];
this.alpha[index] = new byte[image.getWidth() * image.getHeight()];
for(int pixel = 0; pixel < this.pixelsIndexes[index].length; ++pixel) {
int rgb = rgbArray[pixel];
int medintrgb = this.convertToMediumInt(rgb);
int i = this.getPalleteIndex(medintrgb);
this.pixelsIndexes[index][pixel] = i;
if(rgb >> 24 != 0) {
this.alpha[index][pixel] = (byte)(rgb >> 24);
this.usesAlpha[index] = true;
}
}
}
}
public int convertToMediumInt(int rgb) {
OutputStream out = new OutputStream(4);
out.writeInt(rgb);
InputStream stream = new InputStream(out.getBuffer());
stream.setOffset(1);
rgb = stream.read24BitInt();
return rgb;
}
public BufferedImage[] getImages() {
return this.images;
}
public int getBiggestWidth() {
return this.biggestWidth;
}
public void setBiggestWidth(int biggestWidth) {
this.biggestWidth = biggestWidth;
}
public int getBiggestHeight() {
return this.biggestHeight;
}
public void setBiggestHeight(int biggestHeight) {
this.biggestHeight = biggestHeight;
}
}
@@ -0,0 +1,35 @@
package com.alex.loaders.images;
import com.alex.store.Store;
public class LoaderImageArchive {
private byte[] data;
public LoaderImageArchive(byte[] data) {
this.data = data;
}
public LoaderImageArchive(Store cache, int archiveId) {
this(cache, 32, archiveId, 0);
}
private LoaderImageArchive(Store cache, int idx, int archiveId, int fileId) {
this.decodeArchive(cache, idx, archiveId, fileId);
}
private void decodeArchive(Store cache, int idx, int archiveId, int fileId) {
byte[] data = cache.getIndexes()[idx].getFile(archiveId, fileId);
if(data != null) {
this.data = data;
}
}
public Image getImage() {
return Toolkit.getDefaultToolkit().createImage(this.data);
}
public byte[] getImageData() {
return this.data;
}
}
@@ -0,0 +1,842 @@
package com.alex.loaders.interfaces;
import com.alex.io.InputStream;
import com.alex.loaders.interfaces.IComponentSettings;
public class IComponent {
public Object[] anObjectArray2296;
public int anInt2297 = 0;
public int anInt2298 = -1;
public int[] anIntArray2299;
public int anInt2300;
public int anInt2301 = 1;
public Object[] anObjectArray2302;
public int anInt2303 = -1;
public int anInt2305 = 0;
public boolean aBoolean2306 = false;
public int anInt2308 = 0;
public int[] anIntArray2310;
public byte aByte2311 = 0;
public int anInt2312 = 0;
public Object[] anObjectArray2313;
public int anInt2314;
public int[] anIntArray2315;
public Object[] anObjectArray2316;
public byte[] aByteArray2317;
public Object[] anObjectArray2318;
public int anInt2319 = 0;
public int anInt2321 = -1;
public int height = 0;
public int[] anIntArray2323;
public int anInt2324 = 0;
public int anInt2325 = 0;
public IComponent[] aClass173Array2326;
public int[][] anIntArrayArray2327;
public Object[] anObjectArray2328;
public String aString2329 = "Ok";
public String aString2330;
public Object[] anObjectArray2331;
public int anInt2332 = 0;
public int anInt2333 = 0;
public String aString2334 = "";
public int anInt2335 = 0;
public Object[] anObjectArray2336;
public int[] anIntArray2337;
public int anInt2338 = 0;
public int anInt2340;
public byte aByte2341 = 0;
public boolean aBoolean2342;
public int anInt2343 = 0;
public Object[] anObjectArray2344;
public IComponent aClass173_2345 = null;
public static int anInt2346;
public int anInt2347 = 0;
public Object[] anObjectArray2348;
public int anInt2349 = -1;
public int anInt2350 = -1;
public Object[] anObjectArray2351;
public Object[] anObjectArray2352;
public boolean aBoolean2353 = false;
public boolean useScripts = false;
public byte aByte2356 = 0;
public String aString2357 = "";
public int modelId;
public int[] anIntArray2360;
public int anInt2361 = -1;
public Object[] anObjectArray2362;
public String[] aStringArray2363;
public int anInt2364 = 0;
public int anInt2365 = -1;
public boolean aBoolean2366 = false;
public boolean aBoolean2367 = false;
public boolean aBoolean2368 = false;
public int anInt2369 = 0;
public Object[] anObjectArray2371;
public String aString2373 = "";
public int anInt2374 = -1;
public int anInt2375 = -1;
public int imageId = -1;
public int[] anIntArray2379;
public boolean aBoolean2380 = false;
public int anInt2381 = 0;
public int anInt2382;
public short aShort2383 = 0;
public int[] anIntArray2384;
public String[] aStringArray2385;
public int anInt2386 = -1;
public int[] anIntArray2388;
public int anInt2389 = 0;
public int anInt2390 = 0;
public String aString2391 = "";
public boolean aBoolean2393 = false;
public int anInt2394 = 1;
public Object[] anObjectArray2395;
public int anInt2396 = 0;
public int anInt2397 = 0;
public IComponentSettings settings;
public Object[] anObjectArray2399;
public int[] anIntArray2400;
public boolean aBoolean2401 = false;
public Object[] anObjectArray2402;
public int anInt2403 = 100;
public boolean hidden = false;
public Object[] anObjectArray2405;
public int[] anIntArray2407;
public Object[] anObjectArray2408;
public int anInt2409;
public Object[] anObjectArray2410;
public int anInt2411 = 0;
public int anInt2412 = 0;
public boolean aBoolean2413 = false;
public int anInt2414 = 0;
public int anInt2415 = 0;
public int modelType = 1;
public byte[] aByteArray2417;
public int[] anIntArray2418;
public boolean aBoolean2419;
public short aShort2420 = 3000;
public int anInt2421 = -1;
public boolean aBoolean2422 = false;
public int anInt2423 = 0;
public int anInt2424 = 0;
public Object[] defaultScript;
public int anInt2427 = 0;
public boolean aBoolean2429 = false;
public int[] anIntArray2431;
public int y = 0;
public int borderThickness = 0;
public boolean aBoolean2434 = false;
public int anInt2435 = 0;
public boolean aBoolean2436 = false;
public int anInt2437 = 0;
public int anInt2438 = 1;
public Object[] anObjectArray2439;
public int width = 0;
public int anInt2441 = 0;
public int anInt2442 = 0;
public int anInt2443 = -1;
public int anInt2444 = 0;
public int x = 0;
public Object[] anObjectArray2446;
public Object[] anObjectArray2447;
public int anInt2448 = -1;
public int[] anIntArray2449;
public int anInt2450 = 0;
public int anInt2451 = 0;
public int[] anIntArray2452;
public int anInt2453 = -1;
public Object[] anObjectArray2454;
public int hash = -1;
public int parentId = -1;
public int anInt2457 = -1;
public int anInt2458;
public int anInt2459 = 0;
public int anInt2461 = 0;
public Object[] anObjectArray2462;
public String aString2463 = "";
public Object[] anObjectArray2464;
public Object[] anObjectArray2465;
public int anInt2467 = 0;
public byte aByte2469 = 0;
public int type;
public int anInt2471 = 1;
public int[] anIntArray2472;
public String aString2473;
public int anInt2474 = 2;
public Object[] anObjectArray2475;
public boolean aBoolean2476 = false;
public int anInt2477 = 0;
public int[] anIntArray2478;
public int anInt2479 = 0;
public int anInt2480 = 0;
public int anInt2481 = 1;
public int anInt2482 = 0;
public Object[] anObjectArray2483;
public int anInt2484 = 0;
public boolean aBoolean4782;
public void decodeScriptsFormat(InputStream stream) {
this.useScripts = true;
int newInt = stream.readUnsignedByte();
if(newInt == 255) {
newInt = -1;
}
this.type = stream.readUnsignedByte();
if(~(this.type & 128) != -1) {
this.type &= 127;
this.aString2473 = stream.readString();
}
this.anInt2441 = stream.readUnsignedShort();
this.x = stream.readShort();
this.y = stream.readShort();
this.width = stream.readUnsignedShort();
this.height = stream.readUnsignedShort();
this.aByte2356 = (byte)stream.readByte();
this.aByte2341 = (byte)stream.readByte();
this.aByte2469 = (byte)stream.readByte();
this.aByte2311 = (byte)stream.readByte();
this.parentId = stream.readUnsignedShort();
if(~this.parentId != -65536) {
this.parentId += this.hash & -65536;
} else {
this.parentId = -1;
}
int i_17_ = stream.readUnsignedByte();
this.hidden = ~(1 & i_17_) != -1;
if(newInt >= 0) {
this.aBoolean2429 = ~(i_17_ & 2) != -1;
}
if(~this.type == -1) {
this.anInt2444 = stream.readUnsignedShort();
this.anInt2479 = stream.readUnsignedShort();
if(~newInt > -1) {
this.aBoolean2429 = stream.readUnsignedByte() == 1;
}
}
int settingsHash;
if(~this.type == -6) {
this.imageId = stream.readInt();
this.anInt2381 = stream.readUnsignedShort();
settingsHash = stream.readUnsignedByte();
this.aBoolean2422 = ~(2 & settingsHash) != -1;
this.aBoolean2434 = ~(settingsHash & 1) != -1;
this.anInt2369 = stream.readUnsignedByte();
this.borderThickness = stream.readUnsignedByte();
this.anInt2325 = stream.readInt();
this.aBoolean2419 = ~stream.readUnsignedByte() == -2;
this.aBoolean2342 = ~stream.readUnsignedByte() == -2;
this.anInt2467 = stream.readInt();
if(~newInt <= -4) {
this.aBoolean4782 = ~stream.readUnsignedByte() == -2;
}
}
if(~this.type == -7) {
this.modelType = 1;
this.modelId = stream.readBigSmart();
this.anInt2480 = stream.readShort();
this.anInt2459 = stream.readShort();
this.anInt2461 = stream.readUnsignedShort();
this.anInt2482 = stream.readUnsignedShort();
this.anInt2308 = stream.readUnsignedShort();
this.anInt2403 = stream.readUnsignedShort();
this.anInt2443 = stream.readUnsignedShort();
if(this.anInt2443 == '\uffff') {
this.anInt2443 = -1;
}
this.aBoolean2476 = stream.readUnsignedByte() == 1;
this.aShort2383 = (short)stream.readUnsignedShort();
this.aShort2420 = (short)stream.readUnsignedShort();
this.aBoolean2368 = stream.readUnsignedByte() == 1;
if(~this.aByte2356 != -1) {
this.anInt2423 = stream.readUnsignedShort();
}
if(this.aByte2341 != 0) {
this.anInt2397 = stream.readUnsignedShort();
}
}
if(this.type == 4) {
this.anInt2375 = stream.readBigSmart();
if(~this.anInt2375 == -65536) {
this.anInt2375 = -1;
}
this.aString2357 = stream.readString();
if(this.aString2357.toLowerCase().contains("ship")) {
System.out.println(this.hash >> 16);
}
this.anInt2364 = stream.readUnsignedByte();
this.anInt2312 = stream.readUnsignedByte();
this.anInt2297 = stream.readUnsignedByte();
this.aBoolean2366 = ~stream.readUnsignedByte() == -2;
this.anInt2467 = stream.readInt();
}
if(this.type == 3) {
this.anInt2467 = stream.readInt();
this.aBoolean2367 = ~stream.readUnsignedByte() == -2;
this.anInt2369 = stream.readUnsignedByte();
}
if(~this.type == -10) {
this.anInt2471 = stream.readUnsignedByte();
this.anInt2467 = stream.readInt();
this.aBoolean2306 = ~stream.readUnsignedByte() == -2;
}
settingsHash = stream.read24BitInt();
int i_28_ = stream.readUnsignedByte();
int i_30_;
if(i_28_ != 0) {
this.anIntArray2449 = new int[11];
this.aByteArray2417 = new byte[11];
for(this.aByteArray2317 = new byte[11]; ~i_28_ != -1; i_28_ = stream.readUnsignedByte()) {
i_30_ = -1 + (i_28_ >> 360744868);
i_28_ = i_28_ << -456693784 | stream.readUnsignedByte();
i_28_ &= 4095;
if(~i_28_ != -4096) {
this.anIntArray2449[i_30_] = i_28_;
} else {
this.anIntArray2449[i_30_] = -1;
}
this.aByteArray2317[i_30_] = (byte)stream.readByte();
if(~this.aByteArray2317[i_30_] != -1) {
this.aBoolean2401 = true;
}
this.aByteArray2417[i_30_] = (byte)stream.readByte();
}
}
this.aString2391 = stream.readString();
i_30_ = stream.readUnsignedByte();
int i_31_ = i_30_ & 15;
int i_33_;
if(~i_31_ < -1) {
this.aStringArray2385 = new String[i_31_];
for(i_33_ = 0; i_31_ > i_33_; ++i_33_) {
this.aStringArray2385[i_33_] = stream.readString();
}
}
i_33_ = i_30_ >> -686838332;
int defaultHash;
int i;
if(~i_33_ < -1) {
defaultHash = stream.readUnsignedByte();
this.anIntArray2315 = new int[1 + defaultHash];
for(i = 0; i < this.anIntArray2315.length; ++i) {
this.anIntArray2315[i] = -1;
}
this.anIntArray2315[defaultHash] = stream.readUnsignedShort();
}
if(~i_33_ < -2) {
defaultHash = stream.readUnsignedByte();
this.anIntArray2315[defaultHash] = stream.readUnsignedShort();
}
this.aString2330 = stream.readString();
if(this.aString2330.equals("")) {
this.aString2330 = null;
}
this.anInt2335 = stream.readUnsignedByte();
this.anInt2319 = stream.readUnsignedByte();
this.aBoolean2436 = ~stream.readUnsignedByte() == -2;
this.aString2463 = stream.readString();
defaultHash = -1;
if(~method2412(settingsHash) != -1) {
defaultHash = stream.readUnsignedShort();
if(~defaultHash == -65536) {
defaultHash = -1;
}
this.anInt2303 = stream.readUnsignedShort();
if(this.anInt2303 == '\uffff') {
this.anInt2303 = -1;
}
this.anInt2374 = stream.readUnsignedShort();
if(this.anInt2374 == '\uffff') {
this.anInt2374 = -1;
}
}
this.settings = new IComponentSettings(settingsHash, defaultHash);
this.defaultScript = this.decodeScript(stream);
this.anObjectArray2462 = this.decodeScript(stream);
this.anObjectArray2402 = this.decodeScript(stream);
this.anObjectArray2371 = this.decodeScript(stream);
this.anObjectArray2408 = this.decodeScript(stream);
this.anObjectArray2439 = this.decodeScript(stream);
this.anObjectArray2454 = this.decodeScript(stream);
this.anObjectArray2410 = this.decodeScript(stream);
this.anObjectArray2316 = this.decodeScript(stream);
this.anObjectArray2465 = this.decodeScript(stream);
this.anObjectArray2446 = this.decodeScript(stream);
this.anObjectArray2313 = this.decodeScript(stream);
this.anObjectArray2318 = this.decodeScript(stream);
this.anObjectArray2328 = this.decodeScript(stream);
this.anObjectArray2395 = this.decodeScript(stream);
this.anObjectArray2331 = this.decodeScript(stream);
this.anObjectArray2405 = this.decodeScript(stream);
this.anObjectArray2351 = this.decodeScript(stream);
this.anObjectArray2302 = this.decodeScript(stream);
this.anObjectArray2296 = this.decodeScript(stream);
this.anIntArray2452 = this.method2465(stream);
this.anIntArray2472 = this.method2465(stream);
this.anIntArray2360 = this.method2465(stream);
this.anIntArray2388 = this.method2465(stream);
this.anIntArray2299 = this.method2465(stream);
System.out.println("useScripts = " + this.useScripts);
System.out.println("x = " + this.x);
System.out.println("y = " + this.y);
System.out.println("width = " + this.width);
System.out.println("height = " + this.height);
System.out.println("parentId = " + this.parentId);
System.out.println("imageId = " + this.imageId);
System.out.println("modelId = " + this.modelId);
System.out.println("aString2357 = " + this.aString2357);
System.out.println("aString2391 = " + this.aString2391);
for(i = 0; i < this.aStringArray2385.length; ++i) {
System.out.println("aStringArray2385[" + i + "] = " + this.aStringArray2385[i]);
}
for(i = 0; i < this.anIntArray2315.length; ++i) {
System.out.println("anIntArray2315[" + i + "] = " + this.anIntArray2315[i]);
}
System.out.println("aString2330 = " + this.aString2330);
System.out.println("aBoolean2436 = " + this.aBoolean2436);
System.out.println("aString2463 = " + this.aString2463);
System.out.println("anInt2303 = " + this.anInt2303);
System.out.println("anInt2364 = " + this.anInt2364);
for(i = 0; i < this.anObjectArray2462.length; ++i) {
System.out.println("anObjectArray2462[" + i + "] = " + this.anObjectArray2462[i]);
}
for(i = 0; i < this.anObjectArray2402.length; ++i) {
System.out.println("anObjectArray2402[" + i + "] = " + this.anObjectArray2402[i]);
}
for(i = 0; i < this.anObjectArray2371.length; ++i) {
System.out.println("anObjectArray2371[" + i + "] = " + this.anObjectArray2371[i]);
}
for(i = 0; i < this.anObjectArray2408.length; ++i) {
System.out.println("anObjectArray2408[" + i + "] = " + this.anObjectArray2408[i]);
}
for(i = 0; i < this.anObjectArray2439.length; ++i) {
System.out.println("anObjectArray2439[" + i + "] = " + this.anObjectArray2439[i]);
}
for(i = 0; i < this.anObjectArray2454.length; ++i) {
System.out.println("anObjectArray2454[" + i + "] = " + this.anObjectArray2454[i]);
}
for(i = 0; i < this.anObjectArray2410.length; ++i) {
System.out.println("anObjectArray2410[" + i + "] = " + this.anObjectArray2410[i]);
}
for(i = 0; i < this.anObjectArray2316.length; ++i) {
System.out.println("anObjectArray2316[" + i + "] = " + this.anObjectArray2316[i]);
}
for(i = 0; i < this.anObjectArray2465.length; ++i) {
System.out.println("anObjectArray2465[" + i + "] = " + this.anObjectArray2465[i]);
}
for(i = 0; i < this.anObjectArray2446.length; ++i) {
System.out.println("anObjectArray2446[" + i + "] = " + this.anObjectArray2446[i]);
}
for(i = 0; i < this.anObjectArray2313.length; ++i) {
System.out.println("anObjectArray2313[" + i + "] = " + this.anObjectArray2313[i]);
}
for(i = 0; i < this.anObjectArray2318.length; ++i) {
System.out.println("anObjectArray2318[" + i + "] = " + this.anObjectArray2318[i]);
}
for(i = 0; i < this.anObjectArray2328.length; ++i) {
System.out.println("anObjectArray2328[" + i + "] = " + this.anObjectArray2328[i]);
}
for(i = 0; i < this.anObjectArray2395.length; ++i) {
System.out.println("anObjectArray2395[" + i + "] = " + this.anObjectArray2395[i]);
}
for(i = 0; i < this.anObjectArray2331.length; ++i) {
System.out.println("anObjectArray2331[" + i + "] = " + this.anObjectArray2331[i]);
}
for(i = 0; i < this.anObjectArray2405.length; ++i) {
System.out.println("anObjectArray2405[" + i + "] = " + this.anObjectArray2405[i]);
}
for(i = 0; i < this.anObjectArray2351.length; ++i) {
System.out.println("anObjectArray2351[" + i + "] = " + this.anObjectArray2351[i]);
}
for(i = 0; i < this.anObjectArray2302.length; ++i) {
System.out.println("anObjectArray2302[" + i + "] = " + this.anObjectArray2302[i]);
}
for(i = 0; i < this.anObjectArray2296.length; ++i) {
System.out.println("anObjectArray2296[" + i + "] = " + this.anObjectArray2296[i]);
}
for(i = 0; i < this.anIntArray2452.length; ++i) {
System.out.println("anIntArray2452[" + i + "] = " + this.anIntArray2452[i]);
}
for(i = 0; i < this.anIntArray2472.length; ++i) {
System.out.println("anIntArray2472[" + i + "] = " + this.anIntArray2472[i]);
}
for(i = 0; i < this.anIntArray2360.length; ++i) {
System.out.println("anIntArray2360[" + i + "] = " + this.anIntArray2360[i]);
}
for(i = 0; i < this.anIntArray2388.length; ++i) {
System.out.println("anIntArray2388[" + i + "] = " + this.anIntArray2388[i]);
}
for(i = 0; i < this.anIntArray2299.length; ++i) {
System.out.println("anIntArray2299[" + i + "] = " + this.anIntArray2299[i]);
}
}
public Object[] decodeScript(InputStream stream) {
int size = stream.readUnsignedByte();
Object[] objects = new Object[size];
for(int index = 0; ~size < ~index; ++index) {
int i_41_ = stream.readUnsignedByte();
if(~i_41_ == -1) {
objects[index] = new Integer(stream.readInt());
} else if(i_41_ == 1) {
objects[index] = stream.readString();
}
}
this.aBoolean2353 = true;
return objects;
}
public int[] method2465(InputStream stream) {
int size = stream.readUnsignedByte();
if(size == 0) {
return null;
} else {
int[] array = new int[size];
for(int index = 0; size > index; ++index) {
array[index] = stream.readInt();
}
return array;
}
}
public void decodeNoscriptsFormat(InputStream stream) {
this.useScripts = false;
this.type = stream.readUnsignedByte();
this.anInt2324 = stream.readUnsignedByte();
this.anInt2441 = stream.readUnsignedShort();
this.x = stream.readShort();
this.y = stream.readShort();
this.width = stream.readUnsignedShort();
this.height = stream.readUnsignedShort();
this.aByte2341 = 0;
this.aByte2356 = 0;
this.aByte2311 = 0;
this.aByte2469 = 0;
this.anInt2369 = stream.readUnsignedByte();
this.parentId = stream.readUnsignedShort();
if(~this.parentId == -65536) {
this.parentId = -1;
} else {
this.parentId += this.hash & -65536;
}
this.anInt2448 = stream.readUnsignedShort();
if(~this.anInt2448 == -65536) {
this.anInt2448 = -1;
}
int i = stream.readUnsignedByte();
int i_1_;
if(~i < -1) {
this.anIntArray2407 = new int[i];
this.anIntArray2384 = new int[i];
for(i_1_ = 0; i > i_1_; ++i_1_) {
this.anIntArray2384[i_1_] = stream.readUnsignedByte();
this.anIntArray2407[i_1_] = stream.readUnsignedShort();
}
}
i_1_ = stream.readUnsignedByte();
int i_5_;
int is;
int i_13_;
if(~i_1_ < -1) {
this.anIntArrayArray2327 = new int[i_1_][];
for(i_5_ = 0; ~i_1_ < ~i_5_; ++i_5_) {
is = stream.readUnsignedShort();
this.anIntArrayArray2327[i_5_] = new int[is];
for(i_13_ = 0; ~is < ~i_13_; ++i_13_) {
this.anIntArrayArray2327[i_5_][i_13_] = stream.readUnsignedShort();
if(~this.anIntArrayArray2327[i_5_][i_13_] == -65536) {
this.anIntArrayArray2327[i_5_][i_13_] = -1;
}
}
}
}
if(~this.type == -1) {
this.anInt2479 = stream.readUnsignedShort();
this.hidden = stream.readUnsignedByte() == 1;
}
if(this.type == 1) {
stream.readUnsignedShort();
stream.readUnsignedByte();
}
i_5_ = 0;
if(~this.type == -3) {
this.anIntArray2400 = new int[this.height * this.width];
this.aByte2341 = 3;
this.anIntArray2418 = new int[this.height * this.width];
this.aByte2356 = 3;
is = stream.readUnsignedByte();
if(is == 1) {
i_5_ |= 268435456;
}
i_13_ = stream.readUnsignedByte();
if(i_13_ == 1) {
i_5_ |= 1073741824;
}
int var10 = stream.readUnsignedByte();
stream.readUnsignedByte();
if(~var10 == -2) {
i_5_ |= Integer.MIN_VALUE;
}
this.anInt2332 = stream.readUnsignedByte();
this.anInt2414 = stream.readUnsignedByte();
this.anIntArray2337 = new int[20];
this.anIntArray2323 = new int[20];
this.anIntArray2431 = new int[20];
int i_11_;
for(i_11_ = 0; i_11_ < 20; ++i_11_) {
int var12 = stream.readUnsignedByte();
if(~var12 != -2) {
this.anIntArray2431[i_11_] = -1;
} else {
this.anIntArray2323[i_11_] = stream.readShort();
this.anIntArray2337[i_11_] = stream.readShort();
this.anIntArray2431[i_11_] = stream.readInt();
}
}
this.aStringArray2363 = new String[5];
for(i_11_ = 0; i_11_ < 5; ++i_11_) {
String var121 = stream.readString();
if(~var121.length() < -1) {
this.aStringArray2363[i_11_] = var121;
i_5_ |= 1 << 23 + i_11_;
}
}
}
if(~this.type == -4) {
this.aBoolean2367 = ~stream.readUnsignedByte() == -2;
}
if(~this.type == -5 || this.type == 1) {
this.anInt2312 = stream.readUnsignedByte();
this.anInt2297 = stream.readUnsignedByte();
this.anInt2364 = stream.readUnsignedByte();
this.anInt2375 = stream.readUnsignedShort();
if(~this.anInt2375 == -65536) {
this.anInt2375 = -1;
}
this.aBoolean2366 = stream.readUnsignedByte() == 1;
}
if(~this.type == -5) {
this.aString2357 = stream.readString();
this.aString2334 = stream.readString();
}
if(this.type == 1 || ~this.type == -4 || this.type == 4) {
this.anInt2467 = stream.readInt();
}
if(this.type == 3 || this.type == 4) {
this.anInt2424 = stream.readInt();
this.anInt2451 = stream.readInt();
this.anInt2477 = stream.readInt();
}
if(~this.type == -6) {
this.imageId = stream.readInt();
this.anInt2349 = stream.readInt();
}
if(~this.type == -7) {
this.modelType = 1;
this.modelId = stream.readUnsignedShort();
this.anInt2301 = 1;
if(this.modelId == '\uffff') {
this.modelId = -1;
}
this.anInt2386 = stream.readUnsignedShort();
if(~this.anInt2386 == -65536) {
this.anInt2386 = -1;
}
this.anInt2443 = stream.readUnsignedShort();
if(this.anInt2443 == '\uffff') {
this.anInt2443 = -1;
}
this.anInt2298 = stream.readUnsignedShort();
if(this.anInt2298 == '\uffff') {
this.anInt2298 = -1;
}
this.anInt2403 = stream.readUnsignedShort();
this.anInt2461 = stream.readUnsignedShort();
this.anInt2482 = stream.readUnsignedShort();
}
if(~this.type == -8) {
this.aByte2341 = 3;
this.anIntArray2418 = new int[this.width * this.height];
this.aByte2356 = 3;
this.anIntArray2400 = new int[this.width * this.height];
this.anInt2312 = stream.readUnsignedByte();
this.anInt2375 = stream.readUnsignedShort();
if(this.anInt2375 == '\uffff') {
this.anInt2375 = -1;
}
this.aBoolean2366 = stream.readUnsignedByte() == 1;
this.anInt2467 = stream.readInt();
this.anInt2332 = stream.readShort();
this.anInt2414 = stream.readShort();
is = stream.readUnsignedByte();
if(~is == -2) {
i_5_ |= 1073741824;
}
this.aStringArray2363 = new String[5];
for(i_13_ = 0; i_13_ < 5; ++i_13_) {
String var101 = stream.readString();
if(var101.length() > 0) {
this.aStringArray2363[i_13_] = var101;
i_5_ |= 1 << i_13_ + 23;
}
}
}
if(~this.type == -9) {
this.aString2357 = stream.readString();
}
if(this.anInt2324 == 2 || ~this.type == -3) {
this.aString2463 = stream.readString();
this.aString2373 = stream.readString();
is = 63 & stream.readUnsignedShort();
i_5_ |= is << -116905845;
}
if(~this.anInt2324 == -2 || ~this.anInt2324 == -5 || this.anInt2324 == 5 || this.anInt2324 == 6) {
this.aString2329 = stream.readString();
if(~this.aString2329.length() == -1) {
if(~this.anInt2324 == -2) {
this.aString2329 = "Ok";
}
if(~this.anInt2324 == -5) {
this.aString2329 = "Select";
}
if(~this.anInt2324 == -6) {
this.aString2329 = "Select";
}
if(~this.anInt2324 == -7) {
this.aString2329 = "Continue";
}
}
}
if(this.anInt2324 == 1 || this.anInt2324 == 4 || ~this.anInt2324 == -6) {
i_5_ |= 4194304;
}
if(~this.anInt2324 == -7) {
i_5_ |= 1;
}
this.settings = new IComponentSettings(i_5_, -1);
System.out.println("useScripts = " + this.useScripts);
System.out.println("type = " + this.type);
System.out.println("anInt2324 = " + this.anInt2324);
System.out.println("anInt2441 = " + this.anInt2441);
System.out.println("x = " + this.x);
System.out.println("y = " + this.y);
System.out.println("width = " + this.width);
System.out.println("height = " + this.height);
System.out.println("anInt2369 = " + this.anInt2369);
System.out.println("parentId = " + this.parentId);
System.out.println("anInt2448 = " + this.anInt2448);
byte var11;
for(var11 = 0; var11 < this.anIntArray2407.length; ++i) {
System.out.println("anIntArray2407[" + var11 + "] = " + this.anIntArray2407[var11]);
}
for(var11 = 0; var11 < this.aStringArray2363.length; ++i) {
System.out.println("aStringArray2363[" + var11 + "] = " + this.aStringArray2363[var11]);
}
}
public static int method2412(int arg0) {
return 127 & arg0 >> -809958741;
}
}
@@ -0,0 +1,11 @@
package com.alex.loaders.interfaces;
public final class IComponentSettings {
public int settingsHash;
public int defaultHash;
public IComponentSettings(int settingsHash, int defaultHash) {
this.settingsHash = settingsHash;
this.defaultHash = defaultHash;
}
}
@@ -0,0 +1,77 @@
package com.alex.loaders.interfaces;
import com.alex.io.InputStream;
import com.alex.loaders.interfaces.IComponent;
import com.alex.store.Store;
import com.alex.utils.Utils;
import java.awt.image.FilteredImageSource;
import java.awt.image.ReplicateScaleFilter;
import java.io.IOException;
public class Interface {
public int id;
public Store cache;
public IComponent[] components;
public JComponent[] jcomponents;
public static void main(String[] args) throws IOException {
Store rscache = new Store("cache/");
for(int i = 0; i < Utils.getInterfaceDefinitionsSize(rscache); ++i) {
try {
new Interface(i, rscache);
} catch (Throwable var4) {
;
}
}
}
public Interface(int id, Store cache) {
this(id, cache, true);
}
public Interface(int id, Store cache, boolean load) {
this.id = id;
this.cache = cache;
if(load) {
this.getComponents();
}
}
public void draw(JComponent parent) {
}
public Image resizeImage(Image image, int width, int height, Component c) {
ReplicateScaleFilter replicate = new ReplicateScaleFilter(width, height);
FilteredImageSource prod = new FilteredImageSource(image.getSource(), replicate);
return c.createImage(prod);
}
public void getComponents() {
if(Utils.getInterfaceDefinitionsSize(this.cache) <= this.id) {
throw new RuntimeException("Invalid interface id.");
} else {
this.components = new IComponent[Utils.getInterfaceDefinitionsComponentsSize(this.cache, this.id)];
for(int componentId = 0; componentId < this.components.length; ++componentId) {
this.components[componentId] = new IComponent();
this.components[componentId].hash = this.id << 16 | componentId;
byte[] data = this.cache.getIndexes()[3].getFile(this.id, componentId);
if(data == null) {
throw new RuntimeException("Interface " + this.id + ", component " + componentId + " data is null.");
}
System.out.println("Interface: " + this.id + " - ComponentId: " + componentId);
if(data[0] != -1) {
this.components[componentId].decodeNoscriptsFormat(new InputStream(data));
} else {
this.components[componentId].decodeScriptsFormat(new InputStream(data));
}
}
}
}
}
@@ -0,0 +1,60 @@
package com.alex.loaders.interfaces;
import com.alex.store.Store;
import com.alex.utils.Utils;
import java.io.IOException;
public class InterfaceName {
public static final char[] VALID_CHARS = new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
public static void printAllCombinations4Letters() {
}
public static void main(String[] args) throws IOException {
Store rscache = new Store("C:/Users/yvonne christer/Dropbox/Source/data/562cache/", false);
int hash = rscache.getIndexes()[3].getTable().getArchives()[884].getNameHash();
char[] arr$ = VALID_CHARS;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
char l1 = arr$[i$];
System.out.println(l1);
char[] arr$1 = VALID_CHARS;
int len$1 = arr$1.length;
for(int i$1 = 0; i$1 < len$1; ++i$1) {
char l2 = arr$1[i$1];
char[] arr$2 = VALID_CHARS;
int len$2 = arr$2.length;
for(int i$2 = 0; i$2 < len$2; ++i$2) {
char l3 = arr$2[i$2];
char[] arr$3 = VALID_CHARS;
int len$3 = arr$3.length;
for(int i$3 = 0; i$3 < len$3; ++i$3) {
char l4 = arr$3[i$3];
char[] arr$4 = VALID_CHARS;
int len$4 = arr$4.length;
for(int i$4 = 0; i$4 < len$4; ++i$4) {
char l5 = arr$4[i$4];
char[] arr$5 = VALID_CHARS;
int len$5 = arr$5.length;
for(int i$5 = 0; i$5 < len$5; ++i$5) {
char l6 = arr$5[i$5];
String name = new String(new char[]{l1, l2, l3, l4, l5, l6});
if(Utils.getNameHash(name) == hash) {
System.out.println(name);
}
}
}
}
}
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,908 @@
package com.alex.loaders.objects;
import com.alex.io.InputStream;
import com.alex.io.OutputStream;
import com.alex.store.Store;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
public class ObjectDefinitions {
private static final ConcurrentHashMap objectDefinitions = new ConcurrentHashMap();
private short[] originalColors;
int[] toObjectIds;
static int anInt3832;
int[] anIntArray3833 = null;
public int anInt3834;
int anInt3835;
static int anInt3836;
public byte aByte3837;
int anInt3838 = -1;
boolean aBoolean3839;
public int anInt3840;
public int anInt3841;
static int anInt3842;
static int anInt3843;
int anInt3844;
boolean aBoolean3845;
public byte aByte3847;
public boolean ignoreClipOnAlternativeRoute;
int[] animations = null;
private byte[] possibleTypes;
private int[] anIntArray4534;
private byte[] unknownArray4;
private byte[] unknownArray3;
private int cflag;
public byte aByte3849;
int anInt3850;
int anInt3851;
public boolean secondBool;
public boolean aBoolean3853;
int anInt3855;
public boolean notCliped;
int anInt3857;
private byte[] aByteArray3858;
int[] anIntArray3859;
int anInt3860;
public String[] options;
int configFileId;
private short[] modifiedColors;
int anInt3865;
boolean aBoolean3866;
boolean aBoolean3867;
private int[] anIntArray3869;
boolean aBoolean3870;
public int sizeY;
boolean aBoolean3872;
boolean aBoolean3873;
public int thirdInt;
public int anInt3875;
public int objectAnimation;
public int anInt3877;
public int anInt3878;
public int clipType;
public int anInt3881;
public int anInt3882;
public int anInt3883;
Object loader;
public int anInt3889;
public int sizeX;
public boolean aBoolean3891;
int anInt3892;
public int secondInt;
boolean aBoolean3894;
boolean aBoolean3895;
int anInt3896;
int configId;
private byte[] aByteArray3899;
int anInt3900;
public String name;
public int anInt3902;
int anInt3904;
int anInt3905;
boolean aBoolean3906;
int[] anIntArray3908;
public byte aByte3912;
int anInt3913;
public byte aByte3914;
public int anInt3915;
public int[][] modelIds;
public int anInt3917;
public boolean loaded;
private short[] aShortArray3919;
private short[] aShortArray3920;
int anInt3921;
private HashMap parameters;
boolean aBoolean3923;
boolean aBoolean3924;
int anInt3925;
public int id;
public boolean aBool6886;
static int anInt3846;
public boolean projectileCliped;
public ObjectDefinitions() {
this.anInt3835 = -1;
this.anInt3860 = -1;
this.configFileId = -1;
this.aBoolean3866 = false;
this.anInt3851 = -1;
this.anInt3865 = 255;
this.aBoolean3845 = false;
this.aBoolean3867 = false;
this.anInt3850 = 0;
this.anInt3844 = -1;
this.anInt3881 = 0;
this.anInt3857 = -1;
this.aBoolean3872 = true;
this.anInt3882 = -1;
this.anInt3834 = 0;
this.options = new String[5];
this.anInt3875 = 0;
this.aBoolean3839 = false;
this.anIntArray3869 = null;
this.sizeY = 1;
this.thirdInt = -1;
this.anInt3883 = 0;
this.aBoolean3895 = true;
this.anInt3840 = 0;
this.aBoolean3870 = false;
this.anInt3889 = 0;
this.aBoolean3853 = true;
this.secondBool = false;
this.clipType = 2;
this.projectileCliped = true;
this.ignoreClipOnAlternativeRoute = false;
this.anInt3855 = -1;
this.anInt3878 = 0;
this.anInt3904 = 0;
this.sizeX = 1;
this.objectAnimation = -1;
this.aBoolean3891 = false;
this.anInt3905 = 0;
this.name = "null";
this.anInt3913 = -1;
this.aBoolean3906 = false;
this.aBoolean3873 = false;
this.aByte3914 = 0;
this.anInt3915 = 0;
this.anInt3900 = 0;
this.secondInt = -1;
this.aBoolean3894 = false;
this.aByte3912 = 0;
this.anInt3921 = 0;
this.anInt3902 = 128;
this.configId = -1;
this.anInt3877 = 0;
this.anInt3925 = 0;
this.anInt3892 = 64;
this.aBoolean3923 = false;
this.aBoolean3924 = false;
this.anInt3841 = 128;
this.anInt3917 = 128;
}
public String getFirstOption() {
return this.options != null && this.options.length >= 1?this.options[0]:"";
}
public String getSecondOption() {
return this.options != null && this.options.length >= 2?this.options[1]:"";
}
public String getOption(int option) {
return this.options != null && this.options.length >= option && option != 0?this.options[option - 1]:"";
}
public String getThirdOption() {
return this.options != null && this.options.length >= 3?this.options[2]:"";
}
private static int getArchiveId(int i_0_) {
return i_0_ >>> -1135990488;
}
public int getSizeX() {
return this.sizeX;
}
public int getSizeY() {
return this.sizeY;
}
private Object getValue(Field field) throws Throwable {
field.setAccessible(true);
Class type = field.getType();
return type == int[][].class?Arrays.toString((int[][])field.get(this)):(type == int[].class?Arrays.toString((int[])field.get(this)):(type == byte[].class?Arrays.toString((byte[])field.get(this)):(type == short[].class?Arrays.toString((short[])field.get(this)):(type == double[].class?Arrays.toString((double[])field.get(this)):(type == float[].class?Arrays.toString((float[])field.get(this)):(type == Object[].class?Arrays.toString((Object[])field.get(this)):field.get(this)))))));
}
public boolean isProjectileCliped() {
return this.projectileCliped;
}
public boolean containsOption(int i, String option) {
return this.options != null && this.options[i] != null && this.options.length > i?this.options[i].equals(option):false;
}
public boolean containsOption(String o) {
if(this.options == null) {
return false;
} else {
String[] var5 = this.options;
int var4 = this.options.length;
for(int var3 = 0; var3 < var4; ++var3) {
String option = var5[var3];
if(option != null && option.equalsIgnoreCase(o)) {
return true;
}
}
return false;
}
}
final void method3287() {
if(this.secondInt == -1) {
this.secondInt = 0;
if(this.possibleTypes != null && this.possibleTypes.length == 1 && this.possibleTypes[0] == 10) {
this.secondInt = 1;
}
for(int i_13_ = 0; i_13_ < 5; ++i_13_) {
if(this.options[i_13_] != null) {
this.secondInt = 1;
break;
}
}
}
if(this.anInt3855 == -1) {
this.anInt3855 = this.clipType != 0?1:0;
}
}
public int getAccessBlockFlag() {
return this.cflag;
}
private void readValues(InputStream stream, int opcode) {
boolean aBoolean1162;
int i_73_;
int i_74_;
int i_75_;
if(opcode != 1 && opcode != 5) {
if(opcode != 2) {
if(opcode != 14) {
if(opcode != 15) {
if(opcode == 17) {
this.projectileCliped = false;
this.clipType = 0;
} else if(opcode != 18) {
if(opcode == 19) {
this.secondInt = stream.readUnsignedByte();
} else if(opcode == 21) {
this.aByte3912 = 1;
} else if(opcode != 22) {
if(opcode != 23) {
if(opcode != 24) {
if(opcode == 27) {
this.clipType = 1;
} else if(opcode == 28) {
this.anInt3892 = stream.readUnsignedByte() << 2;
} else if(opcode != 29) {
if(opcode != 39) {
if(opcode >= 30 && opcode < 35) {
this.options[-30 + opcode] = stream.readString();
} else {
int var8;
if(opcode == 40) {
var8 = stream.readUnsignedByte();
this.originalColors = new short[var8];
this.modifiedColors = new short[var8];
for(i_73_ = 0; var8 > i_73_; ++i_73_) {
this.originalColors[i_73_] = (short)stream.readUnsignedShort();
this.modifiedColors[i_73_] = (short)stream.readUnsignedShort();
}
} else {
short var9;
byte var10;
if(44 == opcode) {
var9 = (short)stream.readUnsignedShort();
i_73_ = 0;
for(i_74_ = var9; i_74_ > 0; i_74_ >>= 1) {
++i_73_;
}
this.unknownArray3 = new byte[i_73_];
var10 = 0;
for(i_75_ = 0; i_75_ < i_73_; ++i_75_) {
if((var9 & 1 << i_75_) > 0) {
this.unknownArray3[i_75_] = var10++;
} else {
this.unknownArray3[i_75_] = -1;
}
}
} else if(opcode == 45) {
var9 = (short)stream.readUnsignedShort();
i_73_ = 0;
for(i_74_ = var9; i_74_ > 0; i_74_ >>= 1) {
++i_73_;
}
this.unknownArray4 = new byte[i_73_];
var10 = 0;
for(i_75_ = 0; i_75_ < i_73_; ++i_75_) {
if((var9 & 1 << i_75_) > 0) {
this.unknownArray4[i_75_] = var10++;
} else {
this.unknownArray4[i_75_] = -1;
}
}
} else if(opcode != 41) {
if(opcode != 42) {
if(opcode != 62) {
if(opcode != 64) {
if(opcode == 65) {
this.anInt3902 = stream.readUnsignedShort();
} else if(opcode != 66) {
if(opcode != 67) {
if(opcode == 69) {
this.cflag = stream.readUnsignedByte();
} else if(opcode != 70) {
if(opcode == 71) {
this.anInt3889 = stream.readShort() << 2;
} else if(opcode != 72) {
if(opcode == 73) {
this.secondBool = true;
} else if(opcode == 74) {
this.ignoreClipOnAlternativeRoute = true;
} else if(opcode != 75) {
if(opcode != 77 && opcode != 92) {
if(opcode == 78) {
this.anInt3860 = stream.readUnsignedShort();
this.anInt3904 = stream.readUnsignedByte();
} else if(opcode != 79) {
if(opcode == 81) {
this.aByte3912 = 2;
this.anInt3882 = 256 * stream.readUnsignedByte();
} else if(opcode != 82) {
if(opcode == 88) {
this.aBoolean3853 = false;
} else if(opcode != 89) {
if(opcode == 90) {
this.aBoolean3870 = true;
} else if(opcode != 91) {
if(opcode != 93) {
if(opcode == 94) {
this.aByte3912 = 4;
} else if(opcode != 95) {
if(opcode != 96) {
if(opcode == 97) {
this.aBoolean3866 = true;
} else if(opcode == 98) {
this.aBoolean3923 = true;
} else if(opcode == 99) {
this.anInt3857 = stream.readUnsignedByte();
this.anInt3835 = stream.readUnsignedShort();
} else if(opcode == 100) {
this.anInt3844 = stream.readUnsignedByte();
this.anInt3913 = stream.readUnsignedShort();
} else if(opcode != 101) {
if(opcode == 102) {
this.anInt3838 = stream.readUnsignedShort();
} else if(opcode == 103) {
this.thirdInt = 0;
} else if(opcode != 104) {
if(opcode == 105) {
this.aBoolean3906 = true;
} else if(opcode == 106) {
var8 = stream.readUnsignedByte();
this.anIntArray3869 = new int[var8];
this.animations = new int[var8];
for(i_73_ = 0; i_73_ < var8; ++i_73_) {
this.animations[i_73_] = stream.readBigSmart();
i_74_ = stream.readUnsignedByte();
this.anIntArray3869[i_73_] = i_74_;
this.anInt3881 += i_74_;
}
} else if(opcode == 107) {
this.anInt3851 = stream.readUnsignedShort();
} else if(opcode >= 150 && opcode < 155) {
this.options[opcode + -150] = stream.readString();
} else if(opcode != 160) {
if(opcode == 162) {
this.aByte3912 = 3;
this.anInt3882 = stream.readInt();
} else if(opcode == 163) {
this.aByte3847 = (byte)stream.readByte();
this.aByte3849 = (byte)stream.readByte();
this.aByte3837 = (byte)stream.readByte();
this.aByte3914 = (byte)stream.readByte();
} else if(opcode != 164) {
if(opcode != 165) {
if(opcode != 166) {
if(opcode == 167) {
this.anInt3921 = stream.readUnsignedShort();
} else if(opcode != 168) {
if(opcode == 169) {
this.aBoolean3845 = true;
} else if(opcode == 170) {
var8 = stream.readUnsignedSmart();
} else if(opcode == 171) {
var8 = stream.readUnsignedSmart();
} else if(opcode == 173) {
var8 = stream.readUnsignedShort();
i_73_ = stream.readUnsignedShort();
} else if(opcode == 177) {
aBoolean1162 = true;
} else if(opcode == 178) {
var8 = stream.readUnsignedByte();
} else if(opcode == 189) {
aBoolean1162 = true;
} else if(opcode >= 190 && opcode < 196) {
if(this.anIntArray4534 == null) {
this.anIntArray4534 = new int[6];
Arrays.fill(this.anIntArray4534, -1);
}
this.anIntArray4534[opcode - 190] = stream.readUnsignedShort();
} else if(opcode == 249) {
var8 = stream.readUnsignedByte();
if(this.parameters == null) {
this.parameters = new HashMap(var8);
}
for(i_73_ = 0; i_73_ < var8; ++i_73_) {
boolean var11 = stream.readUnsignedByte() == 1;
i_75_ = stream.read24BitInt();
if(!var11) {
this.parameters.put(Integer.valueOf(i_75_), Integer.valueOf(stream.readInt()));
} else {
this.parameters.put(Integer.valueOf(i_75_), stream.readString());
}
}
}
} else {
this.aBoolean3894 = true;
}
} else {
this.anInt3877 = stream.readShort();
}
} else {
this.anInt3875 = stream.readShort();
}
} else {
this.anInt3834 = stream.readShort();
}
} else {
var8 = stream.readUnsignedByte();
this.anIntArray3908 = new int[var8];
for(i_73_ = 0; var8 > i_73_; ++i_73_) {
this.anIntArray3908[i_73_] = stream.readUnsignedShort();
}
}
} else {
this.anInt3865 = stream.readUnsignedByte();
}
} else {
this.anInt3850 = stream.readUnsignedByte();
}
} else {
this.aBoolean3924 = true;
}
} else {
this.aByte3912 = 5;
this.anInt3882 = stream.readShort();
}
} else {
this.aByte3912 = 3;
this.anInt3882 = stream.readUnsignedShort();
}
} else {
this.aBoolean3873 = true;
}
} else {
this.aBoolean3895 = false;
}
} else {
this.aBoolean3891 = true;
}
} else {
this.anInt3900 = stream.readUnsignedShort();
this.anInt3905 = stream.readUnsignedShort();
this.anInt3904 = stream.readUnsignedByte();
var8 = stream.readUnsignedByte();
this.anIntArray3859 = new int[var8];
for(i_73_ = 0; i_73_ < var8; ++i_73_) {
this.anIntArray3859[i_73_] = stream.readUnsignedShort();
}
}
} else {
this.configFileId = stream.readUnsignedShort();
if(this.configFileId == '\uffff') {
this.configFileId = -1;
}
this.configId = stream.readUnsignedShort();
if(this.configId == '\uffff') {
this.configId = -1;
}
var8 = -1;
if(opcode == 92) {
var8 = stream.readBigSmart();
}
i_73_ = stream.readUnsignedByte();
this.toObjectIds = new int[i_73_ - -2];
for(i_74_ = 0; i_73_ >= i_74_; ++i_74_) {
this.toObjectIds[i_74_] = stream.readBigSmart();
}
this.toObjectIds[i_73_ + 1] = var8;
}
} else {
this.anInt3855 = stream.readUnsignedByte();
}
} else {
this.anInt3915 = stream.readShort() << 2;
}
} else {
this.anInt3883 = stream.readShort() << 2;
}
} else {
this.anInt3917 = stream.readUnsignedShort();
}
} else {
this.anInt3841 = stream.readUnsignedShort();
}
} else {
this.aBoolean3872 = false;
}
} else {
this.aBoolean3839 = true;
}
} else {
var8 = stream.readUnsignedByte();
this.aByteArray3858 = new byte[var8];
for(i_73_ = 0; i_73_ < var8; ++i_73_) {
this.aByteArray3858[i_73_] = (byte)stream.readByte();
}
}
} else {
var8 = stream.readUnsignedByte();
this.aShortArray3920 = new short[var8];
this.aShortArray3919 = new short[var8];
for(i_73_ = 0; var8 > i_73_; ++i_73_) {
this.aShortArray3920[i_73_] = (short)stream.readUnsignedShort();
this.aShortArray3919[i_73_] = (short)stream.readUnsignedShort();
}
}
}
}
} else {
this.anInt3840 = stream.readByte() * 5;
}
} else {
this.anInt3878 = stream.readByte();
}
} else {
this.objectAnimation = stream.readBigSmart();
}
} else {
this.thirdInt = 1;
}
} else {
this.aBoolean3867 = true;
}
} else {
this.projectileCliped = false;
}
} else {
this.sizeY = stream.readUnsignedByte();
}
} else {
this.sizeX = stream.readUnsignedByte();
}
} else {
this.name = stream.readString();
}
} else {
aBoolean1162 = false;
if(opcode == 5 && aBoolean1162) {
this.skipReadModelIds(stream);
}
i_73_ = stream.readUnsignedByte();
this.modelIds = new int[i_73_][];
this.possibleTypes = new byte[i_73_];
for(i_74_ = 0; i_74_ < i_73_; ++i_74_) {
this.possibleTypes[i_74_] = (byte)stream.readByte();
i_75_ = stream.readUnsignedByte();
this.modelIds[i_74_] = new int[i_75_];
for(int i_76_ = 0; i_75_ > i_76_; ++i_76_) {
this.modelIds[i_74_][i_76_] = stream.readIntLE(); //fix
}
}
if(opcode == 5 && !aBoolean1162) {
this.skipReadModelIds(stream);
}
}
}
private void skipReadModelIds(InputStream stream) {
int length = stream.readUnsignedByte();
for(int index = 0; index < length; ++index) {
stream.skip(1);
int length2 = stream.readUnsignedByte();
for(int i = 0; i < length2; ++i) {
stream.readBigSmart();
}
}
}
private void readValueLoop(InputStream stream) {
while(true) {
int opcode = stream.readUnsignedByte();
if(opcode == 0) {
return;
}
this.readValues(stream, opcode);
}
}
public ObjectDefinitions(Store cache, int i) {
this.anInt3835 = -1;
this.anInt3860 = -1;
this.configFileId = -1;
this.aBoolean3866 = false;
this.anInt3851 = -1;
this.anInt3865 = 255;
this.aBoolean3845 = false;
this.aBoolean3867 = false;
this.anInt3850 = 0;
this.anInt3844 = -1;
this.anInt3881 = 0;
this.anInt3857 = -1;
this.aBoolean3872 = true;
this.anInt3882 = -1;
this.anInt3834 = 0;
this.options = new String[5];
this.anInt3875 = 0;
this.aBoolean3839 = false;
this.anIntArray3869 = null;
this.sizeY = 1;
this.thirdInt = -1;
this.anInt3883 = 0;
this.aBoolean3895 = true;
this.anInt3840 = 0;
this.aBoolean3870 = false;
this.anInt3889 = 0;
this.aBoolean3853 = true;
this.secondBool = false;
this.clipType = 2;
this.projectileCliped = true;
this.notCliped = false;
this.anInt3855 = -1;
this.anInt3878 = 0;
this.anInt3904 = 0;
this.sizeX = 1;
this.objectAnimation = -1;
this.aBoolean3891 = false;
this.anInt3905 = 0;
this.name = "null";
this.anInt3913 = -1;
this.aBoolean3906 = false;
this.aBoolean3873 = false;
this.aByte3914 = 0;
this.anInt3915 = 0;
this.anInt3900 = 0;
this.secondInt = -1;
this.aBoolean3894 = false;
this.aByte3912 = 0;
this.anInt3921 = 0;
this.anInt3902 = 128;
this.configId = -1;
this.anInt3877 = 0;
this.anInt3925 = 0;
this.anInt3892 = 64;
this.aBoolean3923 = false;
this.aBoolean3924 = false;
this.anInt3841 = 128;
this.anInt3917 = 128;
}
public int getArchiveId() {
return this.id >>> -1135990488;
}
public int getFileId() {
return 0xff & this.id;
}
public static ObjectDefinitions getObjectDefinitions(int id, Store store) {
ObjectDefinitions def = (ObjectDefinitions)objectDefinitions.get(Integer.valueOf(id));
if(def == null) {
def = new ObjectDefinitions();
def.id = id;
byte[] data = store.getIndexes()[16].getFile(getArchiveId(id), id & 0xff);
if(data != null) {
def.readValueLoop(new InputStream(data));
}
def.method3287();
objectDefinitions.put(Integer.valueOf(id), def);
}
return def;
}
private void loadObjectDefinition(Store store) {
byte[] data = store.getIndexes()[16].getFile(this.id >>> -1135990488, this.id & 0xff);
if(data == null) {
System.out.println("FAILED LOADING OBJECT " + this.id);
} else {
try {
this.readOpcodeValues(new InputStream(data));
} catch (RuntimeException var4) {
var4.printStackTrace();
}
this.loaded = true;
}
}
private void readOpcodeValues(InputStream stream) {
while(true) {
int opcode = stream.readUnsignedByte();
if(opcode == 0) {
return;
}
this.readValues(stream, opcode);
}
}
public static ObjectDefinitions getObjectDefinition(Store cache, int itemId) {
return getObjectDefinition(cache, itemId, true);
}
public static ObjectDefinitions getObjectDefinition(Store cache, int itemId, boolean load) {
return new ObjectDefinitions(cache, itemId, load);
}
public ObjectDefinitions(Store cache, int id, boolean load) {
this.id = id;
this.setDefaultVariableValues();
this.setDefaultOptions();
if(load) {
this.loadObjectDefinition(cache);
}
}
private void setDefaultOptions() {
this.options = new String[5];
}
private void setDefaultVariableValues() {
this.name = name;
this.sizeX = 1;
this.sizeY = 1;
this.projectileCliped = true;
this.clipType = 2;
this.objectAnimation = -1;
}
public int getClipType() {
return this.clipType;
}
public static void clearObjectDefinitions() {
objectDefinitions.clear();
}
public void printFields() {
Field[] arr$ = this.getClass().getDeclaredFields();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
Field field = arr$[i$];
if((field.getModifiers() & 8) == 0) {
try {
System.out.println(field.getName() + ": " + this.getValue(field));
} catch (Throwable var6) {
var6.printStackTrace();
}
}
}
System.out.println("-- end of " + this.getClass().getSimpleName() + " fields --");
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public byte[] encode() {
OutputStream stream = new OutputStream();
stream.writeByte(1);
int i_73_ = this.modelIds.length;
this.modelIds = new int[i_73_][];
this.aByteArray3899 = new byte[i_73_];
int data;
for(data = 0; data < i_73_; ++data) {
stream.write128Byte(this.aByteArray3899[data]);
int var6 = this.modelIds[data].length;
this.modelIds[data] = new int[var6];
for(int i_76_ = 0; var6 > i_76_; ++i_76_) {
stream.writeBigSmart(this.modelIds[data][i_76_]);
}
}
if(!this.name.equals("null")) {
stream.writeByte(2);
stream.writeString(this.name);
}
if(this.sizeX != 1) {
stream.writeByte(14);
stream.write128Byte(this.sizeX);
}
if(this.sizeY != 1) {
stream.writeByte(15);
stream.writeByte(this.sizeY);
}
if(this.objectAnimation != -1) {
stream.writeByte(24);
stream.writeBigSmart(this.objectAnimation);
}
for(data = 0; data < this.options.length; ++data) {
if(this.options[data] != null && this.options[data] != "Hidden") {
stream.writeByte(30 + data);
stream.writeString(this.options[data]);
}
}
if(this.originalColors != null && this.modifiedColors != null) {
stream.writeByte(40);
stream.writeByte(this.originalColors.length);
for(data = 0; data < this.originalColors.length; ++data) {
stream.writeShort(this.originalColors[data]);
stream.writeShort(this.modifiedColors[data]);
}
}
if(this.clipType == 0 && this.projectileCliped) {
stream.writeByte(17);
}
if(this.projectileCliped) {
stream.writeByte(18);
}
if(this.clipType == 1 || this.clipType == 2) {
stream.writeByte(27);
}
stream.writeByte(0);
byte[] var61 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(var61, 0, var61.length);
return var61;
}
}
@@ -0,0 +1,166 @@
package com.alex.store;
import com.alex.io.InputStream;
import com.alex.io.OutputStream;
import com.alex.store.MainFile;
import com.alex.util.bzip2.BZip2Compressor;
import com.alex.util.bzip2.BZip2Decompressor;
import com.alex.util.crc32.CRC32HGenerator;
import com.alex.util.gzip.GZipCompressor;
import com.alex.util.gzip.GZipDecompressor;
import com.alex.util.whirlpool.Whirlpool;
public class Archive {
private int id;
private int revision;
private int compression;
private byte[] data;
private int[] keys;
protected Archive(int id, byte[] archive, int[] keys) {
this.id = id;
this.keys = keys;
this.decompress(archive);
}
public Archive(int id, int compression, int revision, byte[] data) {
this.id = id;
this.compression = compression;
this.revision = revision;
this.data = data;
}
public byte[] compress() {
OutputStream stream = new OutputStream();
stream.writeByte(this.compression);
byte[] compressedData1;
switch(this.compression) {
case 0:
compressedData1 = this.data;
stream.writeInt(this.data.length);
break;
case 1:
Object compressed = null;
compressedData1 = BZip2Compressor.compress(this.data);
stream.writeInt(compressedData1.length);
stream.writeInt(this.data.length);
default:
compressedData1 = GZipCompressor.compress(this.data);
stream.writeInt(compressedData1.length);
stream.writeInt(this.data.length);
}
stream.writeBytes(compressedData1);
if(this.keys != null && this.keys.length == 4) {
stream.encodeXTEA(this.keys, 5, stream.getOffset());
}
if(this.revision != -1) {
stream.writeShort(this.revision);
}
byte[] compressed1 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(compressed1, 0, compressed1.length);
return compressed1;
}
private void decompress(byte[] archive) {
InputStream stream = new InputStream(archive);
if(this.keys != null && this.keys.length == 4) {
stream.decodeXTEA(this.keys);
}
this.compression = stream.readUnsignedByte();
int compressedLength = stream.readInt();
if(compressedLength >= 0 && compressedLength <= 1000000) {
int length;
switch(this.compression) {
case 0:
this.data = new byte[compressedLength];
this.checkRevision(compressedLength, archive, stream.getOffset());
stream.readBytes(this.data, 0, compressedLength);
break;
case 1:
length = stream.readInt();
if(length <= 0) {
this.data = null;
} else {
this.data = new byte[length];
this.checkRevision(compressedLength, archive, stream.getOffset());
BZip2Decompressor.decompress(this.data, archive, compressedLength, 9);
}
break;
default:
length = stream.readInt();
if(length > 0 && length <= 1000000000) {
this.data = new byte[length];
this.checkRevision(compressedLength, archive, stream.getOffset());
if(!GZipDecompressor.decompress(stream, this.data)) {
this.data = null;
}
} else {
this.data = null;
}
}
} else {
throw new RuntimeException("INVALID ARCHIVE HEADER");
}
}
private void checkRevision(int compressedLength, byte[] archive, int o) {
InputStream stream = new InputStream(archive);
int offset = stream.getOffset();
if(stream.getLength() - (compressedLength + o) >= 2) {
stream.setOffset(stream.getLength() - 2);
this.revision = stream.readUnsignedShort();
stream.setOffset(offset);
} else {
this.revision = -1;
}
}
public Object[] editNoRevision(byte[] data, MainFile mainFile) {
this.data = data;
if(this.compression == 1) {
this.compression = 2;
}
byte[] compressed = this.compress();
return !mainFile.putArchiveData(this.id, compressed)?null:new Object[]{Integer.valueOf(CRC32HGenerator.getHash(compressed)), Whirlpool.getHash(compressed, 0, compressed.length)};
}
public int getId() {
return this.id;
}
public byte[] getData() {
return this.data;
}
public int getDecompressedLength() {
return this.data.length;
}
public int getRevision() {
return this.revision;
}
public void setRevision(int revision) {
this.revision = revision;
}
public int getCompression() {
return this.compression;
}
public int[] getKeys() {
return this.keys;
}
public void setKeys(int[] keys) {
this.keys = keys;
}
}
@@ -0,0 +1,138 @@
package com.alex.store;
import com.alex.store.FileReference;
import java.util.Arrays;
public class ArchiveReference {
private int nameHash;
private byte[] whirpool;
private int crc;
private int revision;
private FileReference[] files;
private int[] validFileIds;
private boolean needsFilesSort;
private boolean updatedRevision;
public void updateRevision() {
if(!this.updatedRevision) {
++this.revision;
this.updatedRevision = true;
}
}
public int getNameHash() {
return this.nameHash;
}
public void setNameHash(int nameHash) {
this.nameHash = nameHash;
}
public byte[] getWhirpool() {
return this.whirpool;
}
public void setWhirpool(byte[] whirpool) {
this.whirpool = whirpool;
}
public int getCRC() {
return this.crc;
}
public void setCrc(int crc) {
this.crc = crc;
}
public int getRevision() {
return this.revision;
}
public FileReference[] getFiles() {
return this.files;
}
public void setFiles(FileReference[] files) {
this.files = files;
}
public void setRevision(int revision) {
this.revision = revision;
}
public int[] getValidFileIds() {
return this.validFileIds;
}
public void setValidFileIds(int[] validFileIds) {
this.validFileIds = validFileIds;
}
public boolean isNeedsFilesSort() {
return this.needsFilesSort;
}
public void setNeedsFilesSort(boolean needsFilesSort) {
this.needsFilesSort = needsFilesSort;
}
public void removeFileReference(int fileId) {
int[] newValidFileIds = new int[this.validFileIds.length - 1];
int count = 0;
int[] arr$ = this.validFileIds;
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
int id = arr$[i$];
if(id != fileId) {
newValidFileIds[count++] = id;
}
}
this.validFileIds = newValidFileIds;
this.files[fileId] = null;
}
public void addEmptyFileReference(int fileId) {
this.needsFilesSort = true;
int[] newValidFileIds = Arrays.copyOf(this.validFileIds, this.validFileIds.length + 1);
newValidFileIds[newValidFileIds.length - 1] = fileId;
this.validFileIds = newValidFileIds;
if(this.files.length <= fileId) {
FileReference[] newFiles = (FileReference[])Arrays.copyOf(this.files, fileId + 1);
newFiles[fileId] = new FileReference();
this.files = newFiles;
} else {
this.files[fileId] = new FileReference();
}
}
public void sortFiles() {
Arrays.sort(this.validFileIds);
this.needsFilesSort = false;
}
public void reset() {
this.whirpool = null;
this.updatedRevision = true;
this.revision = 0;
this.nameHash = 0;
this.crc = 0;
this.files = new FileReference[0];
this.validFileIds = new int[0];
this.needsFilesSort = false;
}
public void copyHeader(ArchiveReference fromReference) {
this.setCrc(fromReference.getCRC());
this.setNameHash(fromReference.getNameHash());
this.setWhirpool(fromReference.getWhirpool());
int[] validFiles = fromReference.getValidFileIds();
this.setValidFileIds(Arrays.copyOf(validFiles, validFiles.length));
FileReference[] files = fromReference.getFiles();
this.setFiles((FileReference[])Arrays.copyOf(files, files.length));
}
}
@@ -0,0 +1,13 @@
package com.alex.store;
public class FileReference {
private int nameHash;
public int getNameHash() {
return this.nameHash;
}
public void setNameHash(int nameHash) {
this.nameHash = nameHash;
}
}
@@ -0,0 +1,504 @@
package com.alex.store;
import com.alex.io.InputStream;
import com.alex.io.OutputStream;
import com.alex.store.*;
import com.alex.util.crc32.CRC32HGenerator;
import com.alex.util.whirlpool.Whirlpool;
import com.alex.utils.Utils;
public final class Index {
private MainFile mainFile;
private MainFile index255;
private ReferenceTable table;
private byte[][][] cachedFiles;
private int crc;
private byte[] whirlpool;
protected Index(MainFile index255, MainFile mainFile, int[] keys) {
this.mainFile = mainFile;
this.index255 = index255;
byte[] archiveData = index255.getArchiveData(this.getId());
if(archiveData != null) {
this.crc = CRC32HGenerator.getHash(archiveData);
this.whirlpool = Whirlpool.getHash(archiveData, 0, archiveData.length);
Archive archive = new Archive(this.getId(), archiveData, keys);
this.table = new ReferenceTable(archive);
this.resetCachedFiles();
}
}
public void resetCachedFiles() {
this.cachedFiles = new byte[this.getLastArchiveId() + 1][][];
}
public int getLastFileId(int archiveId) {
return !this.archiveExists(archiveId)?-1:this.table.getArchives()[archiveId].getFiles().length - 1;
}
public int getLastArchiveId() {
return this.table.getArchives().length - 1;
}
public int getValidArchivesCount() {
return this.table.getValidArchiveIds().length;
}
public int getValidFilesCount(int archiveId) {
return !this.archiveExists(archiveId)?-1:this.table.getArchives()[archiveId].getValidFileIds().length;
}
public boolean archiveExists(int archiveId) {
if(archiveId < 0) {
return false;
} else {
ArchiveReference[] archives = this.table.getArchives();
return archives.length > archiveId && archives[archiveId] != null;
}
}
public boolean fileExists(int archiveId, int fileId) {
if(!this.archiveExists(archiveId)) {
return false;
} else {
FileReference[] files = this.table.getArchives()[archiveId].getFiles();
return files.length > fileId && files[fileId] != null;
}
}
public int getArchiveId(String name) {
int nameHash = Utils.getNameHash(name);
ArchiveReference[] archives = this.table.getArchives();
int[] validArchiveIds = this.table.getValidArchiveIds();
int[] arr$ = validArchiveIds;
int len$ = validArchiveIds.length;
for(int i$ = 0; i$ < len$; ++i$) {
int archiveId = arr$[i$];
if(archives[archiveId].getNameHash() == nameHash) {
return archiveId;
}
}
return -1;
}
public int getFileId(int archiveId, String name) {
if(!this.archiveExists(archiveId)) {
return -1;
} else {
int nameHash = Utils.getNameHash(name);
FileReference[] files = this.table.getArchives()[archiveId].getFiles();
int[] validFileIds = this.table.getArchives()[archiveId].getValidFileIds();
for(int index = 0; index < validFileIds.length; ++index) {
int fileId = validFileIds[index];
if(files[fileId].getNameHash() == nameHash) {
return fileId;
}
}
return -1;
}
}
public byte[] getFile(int archiveId) {
return !this.archiveExists(archiveId)?null:this.getFile(archiveId, this.table.getArchives()[archiveId].getValidFileIds()[0]);
}
public byte[] getFile(int archiveId, int fileId) {
return this.getFile(archiveId, fileId, (int[])null);
}
public byte[] getFile(int archiveId, int fileId, int[] keys) {
try {
if(!this.fileExists(archiveId, fileId)) {
return null;
} else {
if(this.cachedFiles[archiveId] == null || this.cachedFiles[archiveId][fileId] == null) {
this.cacheArchiveFiles(archiveId, keys);
}
byte[] var5 = this.cachedFiles[archiveId][fileId];
this.cachedFiles[archiveId][fileId] = null;
return var5;
}
} catch (Throwable var51) {
var51.printStackTrace();
return null;
}
}
public boolean packIndex(Store originalStore) {
return this.packIndex(originalStore, false);
}
public boolean packIndex(Store originalStore, boolean checkCRC) {
try {
return this.packIndex(this.getId(), originalStore, checkCRC);
} catch (Exception var4) {
return this.packIndex(this.getId(), originalStore, checkCRC);
}
}
public boolean packIndex(int id, Store originalStore, boolean checkCRC) {
try {
Index var9 = originalStore.getIndexes()[id];
int[] arr$ = var9.table.getValidArchiveIds();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
int archiveId = arr$[i$];
if((!checkCRC || !this.archiveExists(archiveId) || var9.table.getArchives()[archiveId].getCRC() != this.table.getArchives()[archiveId].getCRC()) && !this.putArchive(id, archiveId, originalStore, false, false)) {
return false;
}
}
if(!this.rewriteTable()) {
return false;
} else {
this.resetCachedFiles();
return true;
}
} catch (Exception var91) {
return true;
}
}
public boolean putArchive(int archiveId, Store originalStore) {
return this.putArchive(this.getId(), archiveId, originalStore, true, true);
}
public boolean putArchive(int archiveId, Store originalStore, boolean rewriteTable, boolean resetCache) {
return this.putArchive(this.getId(), archiveId, originalStore, rewriteTable, resetCache);
}
public boolean putArchive(int id, int archiveId, Store originalStore, boolean rewriteTable, boolean resetCache) {
try {
Index var11 = originalStore.getIndexes()[id];
byte[] data = var11.getMainFile().getArchiveData(archiveId);
if(data == null) {
return false;
} else {
if(!this.archiveExists(archiveId)) {
this.table.addEmptyArchiveReference(archiveId);
}
ArchiveReference reference = this.table.getArchives()[archiveId];
reference.updateRevision();
ArchiveReference originalReference = var11.table.getArchives()[archiveId];
reference.copyHeader(originalReference);
int revision = reference.getRevision();
data[data.length - 2] = (byte)(revision >> 8);
data[data.length - 1] = (byte)revision;
if(!this.mainFile.putArchiveData(archiveId, data)) {
return false;
} else if(rewriteTable && !this.rewriteTable()) {
return false;
} else {
if(resetCache) {
this.resetCachedFiles();
}
return true;
}
}
} catch (Exception var111) {
return true;
}
}
public boolean putFile(int archiveId, int fileId, byte[] data) {
return this.putFile(archiveId, fileId, 2, data, (int[])null, true, true, -1, -1);
}
public boolean removeFile(int archiveId, int fileId) {
return this.removeFile(archiveId, fileId, 2, (int[])null);
}
public boolean removeFile(int archiveId, int fileId, int compression, int[] keys) {
if(!this.fileExists(archiveId, fileId)) {
return false;
} else {
this.cacheArchiveFiles(archiveId, keys);
ArchiveReference reference = this.table.getArchives()[archiveId];
reference.removeFileReference(fileId);
int filesCount = this.getValidFilesCount(archiveId);
byte[] archiveData;
if(filesCount == 1) {
archiveData = this.getFile(archiveId, reference.getValidFileIds()[0], keys);
} else {
int[] var13 = new int[filesCount];
OutputStream var14 = new OutputStream();
int index;
int offset;
for(index = 0; index < filesCount; ++index) {
offset = reference.getValidFileIds()[index];
byte[] fileData = this.getFile(archiveId, offset, keys);
var13[index] = fileData.length;
var14.writeBytes(fileData);
}
for(index = 0; index < var13.length; ++index) {
offset = var13[index];
if(index != 0) {
offset -= var13[index - 1];
}
var14.writeInt(offset);
}
var14.writeByte(1);
archiveData = new byte[var14.getOffset()];
var14.setOffset(0);
var14.getBytes(archiveData, 0, archiveData.length);
}
reference.updateRevision();
Archive var131 = new Archive(archiveId, compression, reference.getRevision(), archiveData);
byte[] var141 = var131.compress();
reference.setCrc(CRC32HGenerator.getHash(var141, 0, var141.length - 2));
reference.setWhirpool(Whirlpool.getHash(var141, 0, var141.length - 2));
if(!this.mainFile.putArchiveData(archiveId, var141)) {
return false;
} else if(!this.rewriteTable()) {
return false;
} else {
this.resetCachedFiles();
return true;
}
}
}
public boolean putFile(int archiveId, int fileId, int compression, byte[] data, int[] keys, boolean rewriteTable, boolean resetCache, int archiveName, int fileName) {
if(!this.archiveExists(archiveId)) {
this.table.addEmptyArchiveReference(archiveId);
this.resetCachedFiles();
this.cachedFiles[archiveId] = new byte[1][];
} else {
this.cacheArchiveFiles(archiveId, keys);
}
ArchiveReference reference = this.table.getArchives()[archiveId];
if(!this.fileExists(archiveId, fileId)) {
reference.addEmptyFileReference(fileId);
}
reference.sortFiles();
int filesCount = this.getValidFilesCount(archiveId);
byte[] archiveData;
if(filesCount == 1) {
archiveData = data;
} else {
int[] var18 = new int[filesCount];
OutputStream var19 = new OutputStream();
int index;
int offset;
for(index = 0; index < filesCount; ++index) {
offset = reference.getValidFileIds()[index];
byte[] fileData;
if(offset == fileId) {
fileData = data;
} else {
fileData = this.getFile(archiveId, offset, keys);
}
var18[index] = fileData.length;
var19.writeBytes(fileData);
}
for(index = 0; index < filesCount; ++index) {
offset = var18[index];
if(index != 0) {
offset -= var18[index - 1];
}
var19.writeInt(offset);
}
var19.writeByte(1);
archiveData = new byte[var19.getOffset()];
var19.setOffset(0);
var19.getBytes(archiveData, 0, archiveData.length);
}
reference.updateRevision();
Archive var181 = new Archive(archiveId, compression, reference.getRevision(), archiveData);
byte[] var191 = var181.compress();
reference.setCrc(CRC32HGenerator.getHash(var191, 0, var191.length - 2));
reference.setWhirpool(Whirlpool.getHash(var191, 0, var191.length - 2));
if(archiveName != -1) {
reference.setNameHash(archiveName);
}
if(fileName != -1) {
reference.getFiles()[fileId].setNameHash(fileName);
}
if(!this.mainFile.putArchiveData(archiveId, var191)) {
return false;
} else if(rewriteTable && !this.rewriteTable()) {
return false;
} else {
if(resetCache) {
this.resetCachedFiles();
}
return true;
}
}
public boolean encryptArchive(int archiveId, int[] keys) {
return this.encryptArchive(archiveId, (int[])null, keys, true, true);
}
public boolean encryptArchive(int archiveId, int[] oldKeys, int[] keys, boolean rewriteTable, boolean resetCache) {
if(!this.archiveExists(archiveId)) {
return false;
} else {
Archive archive = this.mainFile.getArchive(archiveId, oldKeys);
if(archive == null) {
return false;
} else {
ArchiveReference reference = this.table.getArchives()[archiveId];
if(reference.getRevision() != archive.getRevision()) {
throw new RuntimeException("ERROR REVISION");
} else {
reference.updateRevision();
archive.setRevision(reference.getRevision());
archive.setKeys(keys);
byte[] closedArchive = archive.compress();
reference.setCrc(CRC32HGenerator.getHash(closedArchive, 0, closedArchive.length - 2));
reference.setWhirpool(Whirlpool.getHash(closedArchive, 0, closedArchive.length - 2));
if(!this.mainFile.putArchiveData(archiveId, closedArchive)) {
return false;
} else if(rewriteTable && !this.rewriteTable()) {
return false;
} else {
if(resetCache) {
this.resetCachedFiles();
}
return true;
}
}
}
}
}
public boolean rewriteTable() {
this.table.updateRevision();
this.table.sortTable();
Object[] hashes = this.table.encodeHeader(this.index255);
if(hashes == null) {
return false;
} else {
this.whirlpool = (byte[])hashes[1];
return true;
}
}
public void setKeys(int[] keys) {
this.table.setKeys(keys);
}
public int[] getKeys() {
return this.table.getKeys();
}
private void cacheArchiveFiles(int archiveId, int[] keys) {
Archive archive = this.getArchive(archiveId, keys);
int lastFileId = this.getLastFileId(archiveId);
this.cachedFiles[archiveId] = new byte[lastFileId + 1][];
if(archive != null) {
byte[] data = archive.getData();
if(data != null) {
int filesCount = this.getValidFilesCount(archiveId);
if(filesCount == 1) {
this.cachedFiles[archiveId][lastFileId] = data;
} else {
int readPosition = data.length;
--readPosition;
int amtOfLoops = data[readPosition] & 255;
readPosition -= amtOfLoops * filesCount * 4;
InputStream stream = new InputStream(data);
stream.setOffset(readPosition);
int[] filesSize = new int[filesCount];
int sourceOffset;
int count;
for(int var18 = 0; var18 < amtOfLoops; ++var18) {
sourceOffset = 0;
for(count = 0; count < filesCount; ++count) {
filesSize[count] += sourceOffset += stream.readInt();
}
}
byte[][] var181 = new byte[filesCount][];
for(sourceOffset = 0; sourceOffset < filesCount; ++sourceOffset) {
var181[sourceOffset] = new byte[filesSize[sourceOffset]];
filesSize[sourceOffset] = 0;
}
stream.setOffset(readPosition);
sourceOffset = 0;
int len$;
for(count = 0; count < amtOfLoops; ++count) {
int var19 = 0;
for(len$ = 0; len$ < filesCount; ++len$) {
var19 += stream.readInt();
System.arraycopy(data, sourceOffset, var181[len$], filesSize[len$], var19);
sourceOffset += var19;
filesSize[len$] += var19;
}
}
count = 0;
int[] var191 = this.table.getArchives()[archiveId].getValidFileIds();
len$ = var191.length;
for(int i$ = 0; i$ < len$; ++i$) {
int fileId = var191[i$];
this.cachedFiles[archiveId][fileId] = var181[count++];
}
}
}
}
}
public int getId() {
return this.mainFile.getId();
}
public ReferenceTable getTable() {
return this.table;
}
public MainFile getMainFile() {
return this.mainFile;
}
public Archive getArchive(int id) {
return this.mainFile.getArchive(id, (int[])null);
}
public Archive getArchive(int id, int[] keys) {
return this.mainFile.getArchive(id, keys);
}
public int getCRC() {
return this.crc;
}
public byte[] getWhirlpool() {
return this.whirlpool;
}
}
@@ -0,0 +1,277 @@
package com.alex.store;
import com.alex.store.Archive;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public final class MainFile {
public static final int IDX_BLOCK_LEN = 6;
public static final int HEADER_LEN = 8;
public static final int EXPANDED_HEADER_LEN = 10;
public static final int BLOCK_LEN = 512;
public static final int EXPANDED_BLOCK_LEN = 510;
public static final int TOTAL_BLOCK_LEN = 520;
private static final ByteBuffer tempBuffer = ByteBuffer.allocateDirect(520);
private int id;
private FileChannel index;
private FileChannel data;
private boolean newProtocol;
protected MainFile(int id, RandomAccessFile data, RandomAccessFile index, boolean newProtocol) throws IOException {
this.id = id;
this.data = data.getChannel();
this.index = index.getChannel();
this.newProtocol = newProtocol;
}
public Archive getArchive(int id) {
return this.getArchive(id, (int[])null);
}
public Archive getArchive(int id, int[] keys) {
byte[] data = this.getArchiveData(id);
return data == null?null:new Archive(id, data, keys);
}
public byte[] getArchiveData(int archiveId) {
FileChannel var2 = this.data;
FileChannel var3 = this.data;
synchronized(this.data) {
try {
tempBuffer.position(0).limit(6);
this.index.read(tempBuffer, (long)(archiveId * 6));
tempBuffer.flip();
int var16 = getMediumInt(tempBuffer);
int block = getMediumInt(tempBuffer);
Object var10000;
byte[] var100001;
if(var16 < 0) {
var10000 = null;
var100001 = (byte[])var10000;
return var100001;
} else if(block <= 0 || (long)block > this.data.size() / 520L) {
var10000 = null;
var100001 = (byte[])var10000;
return var100001;
} else {
ByteBuffer fileBuffer = ByteBuffer.allocate(var16);
int remaining = var16;
int chunk = 0;
int blockLen = this.newProtocol && archiveId > '\uffff'?510:512;
int headerLen = this.newProtocol && archiveId > '\uffff'?10:8;
while(remaining > 0) {
if(block == 0) {
System.out.println(archiveId + ", " + this.newProtocol);
var10000 = null;
var100001 = (byte[])var10000;
return var100001;
}
int blockSize = remaining > blockLen?blockLen:remaining;
tempBuffer.position(0).limit(blockSize + headerLen);
this.data.read(tempBuffer, (long)(block * 520));
tempBuffer.flip();
int currentFile;
int currentChunk;
int nextBlock;
int currentIndex;
if(this.newProtocol && archiveId > '\uffff') {
currentFile = tempBuffer.getInt();
currentChunk = tempBuffer.getShort() & '\uffff';
nextBlock = getMediumInt(tempBuffer);
currentIndex = tempBuffer.get() & 255;
} else {
currentFile = tempBuffer.getShort() & '\uffff';
currentChunk = tempBuffer.getShort() & '\uffff';
nextBlock = getMediumInt(tempBuffer);
currentIndex = tempBuffer.get() & 255;
}
if((archiveId == currentFile || archiveId > '\uffff') && chunk == currentChunk && this.id == currentIndex) {
if(nextBlock >= 0 && (long)nextBlock <= this.data.size() / 520L) {
fileBuffer.put(tempBuffer);
remaining -= blockSize;
block = nextBlock;
++chunk;
continue;
}
var10000 = null;
var100001 = (byte[])var10000;
return var100001;
}
var10000 = null;
var100001 = (byte[])var10000;
return var100001;
}
byte[] var18 = (byte[])fileBuffer.flip().array();
return var18;
}
} catch (Exception var181) {
return null;
}
}
}
private static int getMediumInt(ByteBuffer buffer) {
return (buffer.get() & 255) << 16 | (buffer.get() & 255) << 8 | buffer.get() & 255;
}
private static void putMediumInt(ByteBuffer buffer, int val) {
buffer.put((byte)(val >> 16));
buffer.put((byte)(val >> 8));
buffer.put((byte)val);
}
public boolean putArchive(Archive archive) {
return this.putArchiveData(archive.getId(), archive.getData());
}
public boolean putArchiveData(int id, byte[] archive) {
ByteBuffer buffer = ByteBuffer.wrap(archive);
boolean done = this.putArchiveData(id, buffer, archive.length, true);
if(!done) {
done = this.putArchiveData(id, buffer, archive.length, false);
}
return done;
}
public boolean putArchiveData(int archiveId, ByteBuffer archive, int size, boolean exists) {
FileChannel var5 = this.data;
FileChannel var6 = this.data;
synchronized(this.data) {
try {
boolean var10000;
int var16;
boolean var100001;
if(exists) {
if((long)(archiveId * 6 + 6) > this.index.size()) {
var10000 = false;
var100001 = var10000;
return var100001;
}
tempBuffer.position(0).limit(6);
this.index.read(tempBuffer, (long)(archiveId * 6));
tempBuffer.flip().position(3);
var16 = getMediumInt(tempBuffer);
if(var16 <= 0 || (long)var16 > this.data.size() / 520L) {
var10000 = false;
var100001 = var10000;
return var100001;
}
} else {
var16 = (int)(this.data.size() + 520L - 1L) / 520;
if(var16 == 0) {
var16 = 1;
}
}
tempBuffer.position(0);
putMediumInt(tempBuffer, size);
putMediumInt(tempBuffer, var16);
tempBuffer.flip();
this.index.write(tempBuffer, (long)(archiveId * 6));
int remaining = size;
int chunk = 0;
int blockLen = this.newProtocol && archiveId > '\uffff'?510:512;
for(int headerLen = this.newProtocol && archiveId > '\uffff'?10:8; remaining > 0; ++chunk) {
int nextBlock = 0;
int blockSize;
if(exists) {
tempBuffer.position(0).limit(headerLen);
this.data.read(tempBuffer, (long)(var16 * 520));
tempBuffer.flip();
int currentChunk;
int currentIndex;
if(this.newProtocol && archiveId > '\uffff') {
blockSize = tempBuffer.getInt();
currentChunk = tempBuffer.getShort() & '\uffff';
nextBlock = getMediumInt(tempBuffer);
currentIndex = tempBuffer.get() & 255;
} else {
blockSize = tempBuffer.getShort() & '\uffff';
currentChunk = tempBuffer.getShort() & '\uffff';
nextBlock = getMediumInt(tempBuffer);
currentIndex = tempBuffer.get() & 255;
}
if(archiveId != blockSize && archiveId <= '\uffff' || chunk != currentChunk || this.id != currentIndex) {
var10000 = false;
var100001 = var10000;
return var100001;
}
if(nextBlock < 0 || (long)nextBlock > this.data.size() / 520L) {
var10000 = false;
var100001 = var10000;
return var100001;
}
}
if(nextBlock == 0) {
exists = false;
nextBlock = (int)((this.data.size() + 520L - 1L) / 520L);
if(nextBlock == 0) {
nextBlock = 1;
}
if(nextBlock == var16) {
++nextBlock;
}
}
if(remaining <= blockLen) {
nextBlock = 0;
}
tempBuffer.position(0).limit(520);
if(this.newProtocol && archiveId > '\uffff') {
tempBuffer.putInt(archiveId);
tempBuffer.putShort((short)chunk);
putMediumInt(tempBuffer, nextBlock);
tempBuffer.put((byte)this.id);
} else {
tempBuffer.putShort((short)archiveId);
tempBuffer.putShort((short)chunk);
putMediumInt(tempBuffer, nextBlock);
tempBuffer.put((byte)this.id);
}
blockSize = remaining > blockLen?blockLen:remaining;
archive.limit(archive.position() + blockSize);
tempBuffer.put(archive);
tempBuffer.flip();
this.data.write(tempBuffer, (long)(var16 * 520));
remaining -= blockSize;
var16 = nextBlock;
}
var10000 = true;
return var10000;
} catch (Exception var17) {
return false;
}
}
}
public int getId() {
return this.id;
}
public int getArchivesCount() throws IOException {
FileChannel var1 = this.index;
FileChannel var2 = this.index;
synchronized(this.index) {
return (int)(this.index.size() / 6L);
}
}
}
@@ -0,0 +1,317 @@
package com.alex.store;
import com.alex.io.InputStream;
import com.alex.io.OutputStream;
import com.alex.store.Archive;
import com.alex.store.ArchiveReference;
import com.alex.store.FileReference;
import com.alex.store.MainFile;
import java.util.Arrays;
public final class ReferenceTable {
private Archive archive;
private int revision;
private boolean named;
private boolean usesWhirpool;
private ArchiveReference[] archives;
private int[] validArchiveIds;
private boolean updatedRevision;
private boolean needsArchivesSort;
protected ReferenceTable(Archive archive) {
this.archive = archive;
this.decodeHeader();
}
public void setKeys(int[] keys) {
this.archive.setKeys(keys);
}
public int[] getKeys() {
return this.archive.getKeys();
}
public void sortArchives() {
Arrays.sort(this.validArchiveIds);
this.needsArchivesSort = false;
}
public void addEmptyArchiveReference(int archiveId) {
this.needsArchivesSort = true;
int[] newValidArchiveIds = Arrays.copyOf(this.validArchiveIds, this.validArchiveIds.length + 1);
newValidArchiveIds[newValidArchiveIds.length - 1] = archiveId;
this.validArchiveIds = newValidArchiveIds;
ArchiveReference reference;
if(this.archives.length <= archiveId) {
ArchiveReference[] newArchives = (ArchiveReference[])Arrays.copyOf(this.archives, archiveId + 1);
reference = newArchives[archiveId] = new ArchiveReference();
this.archives = newArchives;
} else {
reference = this.archives[archiveId] = new ArchiveReference();
}
reference.reset();
}
public void sortTable() {
if(this.needsArchivesSort) {
this.sortArchives();
}
for(int index = 0; index < this.validArchiveIds.length; ++index) {
ArchiveReference archive = this.archives[this.validArchiveIds[index]];
if(archive.isNeedsFilesSort()) {
archive.sortFiles();
}
}
}
public Object[] encodeHeader(MainFile mainFile) {
OutputStream stream = new OutputStream();
int protocol = this.getProtocol();
stream.writeByte(protocol);
if(protocol >= 6) {
stream.writeInt(this.revision);
}
stream.writeByte((this.named?1:0) | (this.usesWhirpool?2:0));
if(protocol >= 7) {
stream.writeBigSmart(this.validArchiveIds.length);
} else {
stream.writeShort(this.validArchiveIds.length);
}
int data;
int archive;
for(data = 0; data < this.validArchiveIds.length; ++data) {
archive = this.validArchiveIds[data];
if(data != 0) {
archive -= this.validArchiveIds[data - 1];
}
if(protocol >= 7) {
stream.writeBigSmart(archive);
} else {
stream.writeShort(archive);
}
}
if(this.named) {
for(data = 0; data < this.validArchiveIds.length; ++data) {
stream.writeInt(this.archives[this.validArchiveIds[data]].getNameHash());
}
}
if(this.usesWhirpool) {
for(data = 0; data < this.validArchiveIds.length; ++data) {
stream.writeBytes(this.archives[this.validArchiveIds[data]].getWhirpool());
}
}
for(data = 0; data < this.validArchiveIds.length; ++data) {
stream.writeInt(this.archives[this.validArchiveIds[data]].getCRC());
}
for(data = 0; data < this.validArchiveIds.length; ++data) {
stream.writeInt(this.archives[this.validArchiveIds[data]].getRevision());
}
for(data = 0; data < this.validArchiveIds.length; ++data) {
archive = this.archives[this.validArchiveIds[data]].getValidFileIds().length;
if(protocol >= 7) {
stream.writeBigSmart(archive);
} else {
stream.writeShort(archive);
}
}
int index2;
ArchiveReference var8;
for(data = 0; data < this.validArchiveIds.length; ++data) {
var8 = this.archives[this.validArchiveIds[data]];
for(index2 = 0; index2 < var8.getValidFileIds().length; ++index2) {
int var9 = var8.getValidFileIds()[index2];
if(index2 != 0) {
var9 -= var8.getValidFileIds()[index2 - 1];
}
if(protocol >= 7) {
stream.writeBigSmart(var9);
} else {
stream.writeShort(var9);
}
}
}
if(this.named) {
for(data = 0; data < this.validArchiveIds.length; ++data) {
var8 = this.archives[this.validArchiveIds[data]];
for(index2 = 0; index2 < var8.getValidFileIds().length; ++index2) {
stream.writeInt(var8.getFiles()[var8.getValidFileIds()[index2]].getNameHash());
}
}
}
byte[] var91 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(var91, 0, var91.length);
return this.archive.editNoRevision(var91, mainFile);
}
public int getProtocol() {
if(this.archives.length > '\uffff') {
return 7;
} else {
for(int index = 0; index < this.validArchiveIds.length; ++index) {
if(index > 0 && this.validArchiveIds[index] - this.validArchiveIds[index - 1] > '\uffff') {
return 7;
}
if(this.archives[this.validArchiveIds[index]].getValidFileIds().length > '\uffff') {
return 7;
}
}
return this.revision == 0?5:6;
}
}
public void setRevision(int revision) {
this.updatedRevision = true;
this.revision = revision;
}
public void updateRevision() {
if(!this.updatedRevision) {
++this.revision;
this.updatedRevision = true;
}
}
private void decodeHeader() {
InputStream stream = new InputStream(this.archive.getData());
int protocol = stream.readUnsignedByte();
if(protocol >= 5 && protocol <= 7) {
if(protocol >= 6) {
this.revision = stream.readInt();
}
int hash = stream.readUnsignedByte();
this.named = (1 & hash) != 0;
this.usesWhirpool = (2 & hash) != 0;
int validArchivesCount = protocol >= 7?stream.readBigSmart():stream.readUnsignedShort();
this.validArchiveIds = new int[validArchivesCount];
int lastArchiveId = 0;
int biggestArchiveId = 0;
int index;
int archive;
for(index = 0; index < validArchivesCount; ++index) {
archive = lastArchiveId += protocol >= 7?stream.readBigSmart():stream.readUnsignedShort();
if(archive > biggestArchiveId) {
biggestArchiveId = archive;
}
this.validArchiveIds[index] = archive;
}
this.archives = new ArchiveReference[biggestArchiveId + 1];
for(index = 0; index < validArchivesCount; ++index) {
this.archives[this.validArchiveIds[index]] = new ArchiveReference();
}
if(this.named) {
for(index = 0; index < validArchivesCount; ++index) {
this.archives[this.validArchiveIds[index]].setNameHash(stream.readInt());
}
}
if(this.usesWhirpool) {
for(index = 0; index < validArchivesCount; ++index) {
byte[] index2 = new byte[64];
stream.getBytes(index2, 0, 64);
this.archives[this.validArchiveIds[index]].setWhirpool(index2);
}
}
for(index = 0; index < validArchivesCount; ++index) {
this.archives[this.validArchiveIds[index]].setCrc(stream.readInt());
}
for(index = 0; index < validArchivesCount; ++index) {
this.archives[this.validArchiveIds[index]].setRevision(stream.readInt());
}
for(index = 0; index < validArchivesCount; ++index) {
this.archives[this.validArchiveIds[index]].setValidFileIds(new int[protocol >= 7?stream.readBigSmart():stream.readUnsignedShort()]);
}
ArchiveReference var14;
int var13;
for(index = 0; index < validArchivesCount; ++index) {
archive = 0;
var13 = 0;
var14 = this.archives[this.validArchiveIds[index]];
int index21;
for(index21 = 0; index21 < var14.getValidFileIds().length; ++index21) {
int fileId = archive += protocol >= 7?stream.readBigSmart():stream.readUnsignedShort();
if(fileId > var13) {
var13 = fileId;
}
var14.getValidFileIds()[index21] = fileId;
}
var14.setFiles(new FileReference[var13 + 1]);
for(index21 = 0; index21 < var14.getValidFileIds().length; ++index21) {
var14.getFiles()[var14.getValidFileIds()[index21]] = new FileReference();
}
}
if(this.named) {
for(index = 0; index < validArchivesCount; ++index) {
var14 = this.archives[this.validArchiveIds[index]];
for(var13 = 0; var13 < var14.getValidFileIds().length; ++var13) {
var14.getFiles()[var14.getValidFileIds()[var13]].setNameHash(stream.readInt());
}
}
}
} else {
throw new RuntimeException("INVALID PROTOCOL");
}
}
public int getRevision() {
return this.revision;
}
public ArchiveReference[] getArchives() {
return this.archives;
}
public int[] getValidArchiveIds() {
return this.validArchiveIds;
}
public boolean isNamed() {
return this.named;
}
public boolean usesWhirpool() {
return this.usesWhirpool;
}
public int getCompression() {
return this.archive.getCompression();
}
}
@@ -0,0 +1,152 @@
package com.alex.store;
import com.alex.io.OutputStream;
import com.alex.store.Archive;
import com.alex.store.Index;
import com.alex.store.MainFile;
import com.alex.util.whirlpool.Whirlpool;
import com.alex.utils.Utils;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.math.BigInteger;
import java.util.Arrays;
public final class Store {
private Index[] indexes;
private MainFile index255;
private String path;
private RandomAccessFile data;
private boolean newProtocol;
public Store(String path) throws IOException {
this(path, true);
}
public Store(String path, boolean newProtocol) throws IOException {
this(path, newProtocol, (int[][])null);
}
public Store(String path, boolean newProtocol, int[][] keys) throws IOException {
this.path = path;
this.newProtocol = newProtocol;
this.data = new RandomAccessFile(path + "main_file_cache.dat2", "rw");
this.index255 = new MainFile(255, this.data, new RandomAccessFile(path + "main_file_cache.idx255", "rw"), newProtocol);
int idxsCount = this.index255.getArchivesCount();
this.indexes = new Index[idxsCount];
for(int id = 0; id < idxsCount; ++id) {
Index index = new Index(this.index255, new MainFile(id, this.data, new RandomAccessFile(path + "main_file_cache.idx" + id, "rw"), newProtocol), keys == null?null:keys[id]);
if(index.getTable() != null) {
this.indexes[id] = index;
}
}
}
public final byte[] generateIndex255Archive255Current(BigInteger grab_server_private_exponent, BigInteger grab_server_modulus) {
OutputStream stream = new OutputStream();
stream.writeByte(this.getIndexes().length);
for(int var9 = 0; var9 < this.getIndexes().length; ++var9) {
if(this.getIndexes()[var9] == null) {
stream.writeInt(0);
stream.writeInt(0);
stream.writeBytes(new byte[64]);
} else {
stream.writeInt(this.getIndexes()[var9].getCRC());
stream.writeInt(this.getIndexes()[var9].getTable().getRevision());
stream.writeBytes(this.getIndexes()[var9].getWhirlpool());
if(this.getIndexes()[var9].getKeys() != null) {
int[] var10 = this.getIndexes()[var9].getKeys();
int var12 = var10.length;
for(int i$ = 0; i$ < var12; ++i$) {
int key = var10[i$];
stream.writeInt(key);
}
} else {
for(int var11 = 0; var11 < 4; ++var11) {
stream.writeInt(0);
}
}
}
}
byte[] var91 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(var91, 0, var91.length);
OutputStream var111 = new OutputStream(65);
var111.writeByte(0);
var111.writeBytes(Whirlpool.getHash(var91, 0, var91.length));
byte[] var121 = new byte[var111.getOffset()];
var111.setOffset(0);
var111.getBytes(var121, 0, var121.length);
if(grab_server_private_exponent != null && grab_server_modulus != null) {
var121 = Utils.cryptRSA(var121, grab_server_private_exponent, grab_server_modulus);
}
stream.writeBytes(var121);
var91 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(var91, 0, var91.length);
return var91;
}
public byte[] generateIndex255Archive255() {
return this.generateIndex255Archive255Current((BigInteger)null, (BigInteger)null);
}
public byte[] generateIndex255Archive255Outdated() {
OutputStream stream = new OutputStream(this.indexes.length * 8);
for(int var3 = 0; var3 < this.indexes.length; ++var3) {
if(this.indexes[var3] == null) {
stream.writeInt(0);
stream.writeInt(0);
} else {
stream.writeInt(this.indexes[var3].getCRC());
stream.writeInt(this.indexes[var3].getTable().getRevision());
}
}
byte[] var31 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(var31, 0, var31.length);
return var31;
}
public Index[] getIndexes() {
return this.indexes;
}
public MainFile getIndex255() {
return this.index255;
}
public int addIndex(boolean named, boolean usesWhirpool, int tableCompression) throws IOException {
int id = this.indexes.length;
Index[] newIndexes = (Index[])Arrays.copyOf(this.indexes, this.indexes.length + 1);
this.resetIndex(id, newIndexes, named, usesWhirpool, tableCompression);
this.indexes = newIndexes;
return id;
}
public void resetIndex(int id, boolean named, boolean usesWhirpool, int tableCompression) throws FileNotFoundException, IOException {
this.resetIndex(id, this.indexes, named, usesWhirpool, tableCompression);
}
public void resetIndex(int id, Index[] indexes, boolean named, boolean usesWhirpool, int tableCompression) throws FileNotFoundException, IOException {
OutputStream stream = new OutputStream(4);
stream.writeByte(5);
stream.writeByte((named?1:0) | (usesWhirpool?2:0));
stream.writeShort(0);
byte[] archiveData = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(archiveData, 0, archiveData.length);
Archive archive = new Archive(id, tableCompression, -1, archiveData);
this.index255.putArchiveData(id, archive.compress());
indexes[id] = new Index(this.index255, new MainFile(id, this.data, new RandomAccessFile(this.path + "main_file_cache.idx" + id, "rw"), this.newProtocol), (int[])null);
}
}
@@ -0,0 +1,48 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.store.Archive;
import com.alex.store.ArchiveReference;
import com.alex.store.Index;
import com.alex.store.Store;
import java.io.IOException;
import java.util.Random;
public class ArchiveValidation {
public static void main(String[] args) throws IOException {
Store rscache = new Store("718/cache/");
for(int i = 0; i < rscache.getIndexes().length; ++i) {
if(i != 5) {
Index index = rscache.getIndexes()[i];
System.out.println("checking index: " + i);
int[] arr$ = index.getTable().getValidArchiveIds();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
int archiveId = arr$[i$];
Archive archive = index.getArchive(archiveId);
if(archive == null) {
System.out.println("Missing:: " + i + ", " + archiveId);
} else {
ArchiveReference reference = index.getTable().getArchives()[archiveId];
if(archive.getRevision() != reference.getRevision()) {
System.out.println("corrupted: " + i + ", " + archiveId);
}
}
}
}
}
}
public static int[] generateKeys() {
int[] keys = new int[4];
for(int index = 0; index < keys.length; ++index) {
keys[index] = (new Random()).nextInt();
}
return keys;
}
}
@@ -0,0 +1,192 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.store.Index;
import com.alex.store.Store;
import com.alex.tools.clientCacheUpdater.RSXteas;
import com.alex.utils.Utils;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageOutputStream;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class CacheEditor {
public static byte[] getBytesFromFile(File file) throws IOException {
FileInputStream is = new FileInputStream(file);
long length = file.length();
if(length > 2147483647L) {
;
}
byte[] bytes = new byte[(int)length];
int offset = 0;
int numRead1;
for(boolean numRead = false; offset < bytes.length && (numRead1 = is.read(bytes, offset, bytes.length - offset)) >= 0; offset += numRead1) {
;
}
if(offset < bytes.length) {
throw new IOException("Could not completely read file " + file.getName());
} else {
is.close();
return bytes;
}
}
public static int packCustomModel(Store cache, byte[] data) {
int archiveId = cache.getIndexes()[7].getLastArchiveId() + 1;
if(cache.getIndexes()[7].putFile(archiveId, 0, data)) {
return archiveId;
} else {
System.out.println("Failing packing model " + archiveId);
return -1;
}
}
public static void packCustomItem(Store cache, int id, ItemDefinitions def) {
cache.getIndexes()[19].putFile(id >>> 8, 255 & id, def.encode());
}
public static void divideBackgrounds() throws IOException {
BufferedImage background = ImageIO.read(new File("718/sprites/bg.jpg"));
int id = 4139;
int sx = background.getWidth() / 4;
int sy = background.getHeight() / 2;
int y;
for(int var8 = 0; var8 < 2; ++var8) {
for(y = 0; y < 4; ++y) {
BufferedImage var9 = background.getSubimage(y * sx, var8 * sy, sx, sy);
ImageIO.write(var9, "gif", new File("718/sprites/bg/" + id++ + ".gif"));
}
}
BufferedImage var81 = ImageIO.read(new File("718/sprites/load.png"));
id = 3769;
sx = var81.getWidth() / 2;
sy = var81.getHeight() / 2;
for(y = 0; y < 2; ++y) {
for(int var91 = 0; var91 < 2; ++var91) {
BufferedImage part = var81.getSubimage(var91 * sx, y * sy, sx, sy);
ImageIO.write(part, "png", new File("718/sprites/load/" + id + ".png"));
ImageIO.write(part, "gif", new File("718/sprites/load/" + id++ + ".gif"));
}
}
}
public static byte[] getImage(File file) throws IOException {
ImageOutputStream stream = ImageIO.createImageOutputStream(file);
byte[] data = new byte[(int)stream.length()];
stream.read(data);
return data;
}
public static void main(String[] args) throws IOException {
boolean beta = false;
boolean addNewItemDefinitions = false;
boolean divideBackgrounds = false;
if(divideBackgrounds) {
divideBackgrounds();
}
Store rscache = new Store(beta?"718/rsCacheBeta/":"718/rscache/");
Store cache = new Store(beta?"718/cacheBeta/":"718/cache/");
cache.resetIndex(7, false, false, 2);
boolean result;
int regionId;
for(regionId = 0; regionId < cache.getIndexes().length; ++regionId) {
if(regionId != 3 && regionId != 5 && regionId != 12) {
result = cache.getIndexes()[regionId].packIndex(rscache, true);
System.out.println("Packed index archives: " + regionId + ", " + result);
}
}
int regionY;
if(addNewItemDefinitions) {
System.out.println("Packing old item definitions...");
Store var14 = new Store("cache667/", false);
short var15 = 30000;
regionY = Utils.getItemDefinitionsSize(var14);
for(int data = var15; data < var15 + regionY; ++data) {
int var16 = data - var15;
cache.getIndexes()[19].putFile(data >>> 8, 255 & data, 2, var14.getIndexes()[19].getFile(var16 >>> 8, 255 & var16), (int[])null, false, false, -1, -1);
}
result = cache.getIndexes()[19].rewriteTable();
System.out.println("Packed old item definitions: " + result);
}
System.out.println("Adding new interfaces...");
for(regionId = cache.getIndexes()[3].getLastArchiveId() + 1; regionId <= rscache.getIndexes()[3].getLastArchiveId(); ++regionId) {
if(regionId != 548 && regionId != 746 && rscache.getIndexes()[3].archiveExists(regionId)) {
cache.getIndexes()[3].putArchive(regionId, rscache, false, false);
}
}
result = cache.getIndexes()[3].rewriteTable();
System.out.println("Packed new interfaces: " + result);
RSXteas.loadUnpackedXteas("old");
System.out.println("Updating Maps.");
for(regionId = 0; regionId < 30000; ++regionId) {
int var13 = (regionId >> 8) * 64;
regionY = (regionId & 255) * 64;
String var141 = "m" + (var13 >> 3) / 8 + "_" + (regionY >> 3) / 8;
byte[] var151 = rscache.getIndexes()[5].getFile(rscache.getIndexes()[5].getArchiveId(var141));
if(var151 != null) {
result = addMapFile(cache.getIndexes()[5], var141, var151);
System.out.println(var141 + ", " + result);
}
var141 = "um" + (var13 >> 3) / 8 + "_" + (regionY >> 3) / 8;
var151 = rscache.getIndexes()[5].getFile(rscache.getIndexes()[5].getArchiveId(var141));
if(var151 != null) {
result = addMapFile(cache.getIndexes()[5], var141, var151);
System.out.println(var141 + ", " + result);
}
int[] var161 = RSXteas.getXteas(regionId);
var141 = "l" + (var13 >> 3) / 8 + "_" + (regionY >> 3) / 8;
var151 = rscache.getIndexes()[5].getFile(rscache.getIndexes()[5].getArchiveId(var141), 0, var161);
if(var151 != null) {
result = addMapFile(cache.getIndexes()[5], var141, var151);
System.out.println(var141 + ", " + result);
}
var141 = "ul" + (var13 >> 3) / 8 + "_" + (regionY >> 3) / 8;
var151 = rscache.getIndexes()[5].getFile(rscache.getIndexes()[5].getArchiveId(var141), 0, var161);
if(var151 != null) {
result = addMapFile(cache.getIndexes()[5], var141, var151);
System.out.println(var141 + ", " + result);
}
var141 = "n" + (var13 >> 3) / 8 + "_" + (regionY >> 3) / 8;
var151 = rscache.getIndexes()[5].getFile(rscache.getIndexes()[5].getArchiveId(var141), 0);
if(var151 != null) {
result = addMapFile(cache.getIndexes()[5], var141, var151);
System.out.println(var141 + ", " + result);
}
}
result = cache.getIndexes()[5].rewriteTable();
System.out.println("Updated maps: " + result);
}
public static boolean addMapFile(Index index, String name, byte[] data) {
int archiveId = index.getArchiveId(name);
if(archiveId == -1) {
archiveId = index.getTable().getValidArchiveIds().length;
}
return index.putFile(archiveId, 0, 2, data, (int[])null, false, false, Utils.getNameHash(name), -1);
}
}
@@ -0,0 +1,135 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.store.Store;
import com.alex.utils.Utils;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageOutputStream;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class CacheEditormodels {
public static byte[] getBytesFromFile(File file) throws IOException {
FileInputStream is = new FileInputStream(file);
long length = file.length();
if(length > 2147483647L) {
;
}
byte[] bytes = new byte[(int)length];
int offset = 0;
int numRead1;
for(boolean numRead = false; offset < bytes.length && (numRead1 = is.read(bytes, offset, bytes.length - offset)) >= 0; offset += numRead1) {
;
}
if(offset < bytes.length) {
throw new IOException("Could not completely read file " + file.getName());
} else {
is.close();
return bytes;
}
}
public static int packCustomModel(Store cache, byte[] data) {
int archiveId = cache.getIndexes()[7].getLastArchiveId() + 1;
if(cache.getIndexes()[7].putFile(archiveId, 0, data)) {
return archiveId;
} else {
System.out.println("Failing packing model " + archiveId);
return -1;
}
}
public static void packCustomItems(Store cache) throws IOException {
int modelID = packCustomModel(cache, getBytesFromFile(new File("pkcapefinalb.dat")));
ItemDefinitions pkCape = ItemDefinitions.getItemDefinition(cache, 9747);
pkCape.setName("PK Cape");
pkCape.femaleEquip1 = modelID;
pkCape.maleEquip1 = modelID;
pkCape.modelId = modelID;
pkCape.resetModelColors();
packCustomItem(cache, 30000, pkCape);
}
public static void packCustomItem(Store cache, int id, ItemDefinitions def) {
cache.getIndexes()[19].putFile(id >>> 8, 255 & id, def.encode());
}
public static void divideBackgrounds() throws IOException {
BufferedImage background = ImageIO.read(new File("718/sprites/bg.jpg"));
int id = 4139;
int sx = background.getWidth() / 4;
int sy = background.getHeight() / 2;
int y;
for(int var8 = 0; var8 < 2; ++var8) {
for(y = 0; y < 4; ++y) {
BufferedImage var9 = background.getSubimage(y * sx, var8 * sy, sx, sy);
ImageIO.write(var9, "gif", new File("718/sprites/bg/" + id++ + ".gif"));
}
}
BufferedImage var81 = ImageIO.read(new File("718/sprites/load.png"));
id = 3769;
sx = var81.getWidth() / 2;
sy = var81.getHeight() / 2;
for(y = 0; y < 2; ++y) {
for(int var91 = 0; var91 < 2; ++var91) {
BufferedImage part = var81.getSubimage(var91 * sx, y * sy, sx, sy);
ImageIO.write(part, "png", new File("718/sprites/load/" + id + ".png"));
ImageIO.write(part, "gif", new File("718/sprites/load/" + id++ + ".gif"));
}
}
}
public static byte[] getImage(File file) throws IOException {
ImageOutputStream stream = ImageIO.createImageOutputStream(file);
byte[] data = new byte[(int)stream.length()];
stream.read(data);
return data;
}
public static void main(String[] args) throws IOException {
boolean beta = false;
boolean addNewItemDefinitions = false;
boolean divideBackgrounds = false;
if(divideBackgrounds) {
divideBackgrounds();
}
Store rscache = new Store(beta?"718/rsCacheBeta/":"718/rscache/");
Store cache = new Store(beta?"718/cacheBeta/":"718/cache/");
cache.resetIndex(7, false, false, 2);
boolean result;
for(int var13 = 0; var13 < cache.getIndexes().length; ++var13) {
if(var13 != 3 && var13 != 5 && var13 != 12) {
result = cache.getIndexes()[var13].packIndex(rscache, true);
System.out.println("Packed index archives: " + var13 + ", " + result);
}
}
if(addNewItemDefinitions) {
System.out.println("Packing old item definitions...");
Store var12 = new Store("cache667/", false);
short currentSize = 30000;
int oldSize = Utils.getItemDefinitionsSize(var12);
for(int i = currentSize; i < currentSize + oldSize; ++i) {
int oldItemId = i - currentSize;
cache.getIndexes()[19].putFile(i >>> 8, 255 & i, 2, var12.getIndexes()[19].getFile(oldItemId >>> 8, 255 & oldItemId), (int[])null, false, false, -1, -1);
}
result = cache.getIndexes()[19].rewriteTable();
System.out.println("Packed old item definitions: " + result);
}
}
}
@@ -0,0 +1,96 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.store.Store;
import com.alex.utils.Utils;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
public class CheckMap {
public static void main(String[] args) throws IOException {
Store cache = new Store("C:/Users/yvonne christer/Dropbox/Source/data/562cache/", false, (int[][])null);
double land = 0.0D;
double map = 0.0D;
for(int var11 = 0; var11 < 30000; ++var11) {
int regionX = (var11 >> 8) * 64;
int regionY = (var11 & 255) * 64;
String name1 = "l" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
String name2 = "m" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
if(cache.getIndexes()[5].getArchiveId(name1) != -1) {
++land;
}
if(cache.getIndexes()[5].getArchiveId(name2) != -1) {
++map;
}
}
System.out.println("land: " + land + ", newMaps: " + map);
double var111 = land * 100.0D / map;
System.out.println(var111 + "% complete!");
}
public static boolean passArchive(int regionId, Store store1, Store store2, String nameHash, int i, int[] keys1, int[] keys2) {
if(keys2 != null) {
System.out.println(keys2);
}
int archiveId = store1.getIndexes()[i].getArchiveId(nameHash);
if(archiveId == -1) {
return false;
} else {
int oldArchiveId = store2.getIndexes()[i].getArchiveId(nameHash);
if(oldArchiveId == -1) {
oldArchiveId = store2.getIndexes()[i].getLastArchiveId() + 1;
}
byte[] data = store1.getIndexes()[i].getFile(archiveId, 0, keys1);
if(data == null) {
return false;
} else {
try {
boolean var13 = store2.getIndexes()[i].putFile(oldArchiveId, 0, 2, data, keys2, false, false, Utils.getNameHash(nameHash), -1);
if(!var13) {
return false;
} else {
int[] keys = writeKeys(regionId);
return store2.getIndexes()[i].encryptArchive(oldArchiveId, keys2, keys, false, false);
}
} catch (Error var12) {
return false;
} catch (Exception var131) {
var131.printStackTrace();
return false;
}
}
}
}
public static int[] generateKeys() {
int[] keys = new int[4];
for(int index = 0; index < keys.length; ++index) {
keys[index] = (new Random()).nextInt();
}
return keys;
}
public static int[] writeKeys(int regionId) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter("C:/Users/yvonne christer/Desktop/LS/Xteas/xteas/742/" + regionId + ".txt"));
int[] keys = generateKeys();
for(int index = 0; index < keys.length; ++index) {
writer.write("" + keys[index]);
writer.newLine();
writer.flush();
}
System.out.println("Region: " + regionId + ", " + Arrays.toString(keys));
return keys;
}
}
@@ -0,0 +1,22 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.store.Index;
import com.alex.store.Store;
import java.io.IOException;
public class CopyCache {
public static void main(String[] args) throws IOException {
Store cache = new Store("718/cache/");
Store newCache = new Store("718/cacheCleaned/");
for(int i = 0; i < cache.getIndexes().length; ++i) {
Index index = cache.getIndexes()[i];
newCache.addIndex(index.getTable().isNamed(), index.getTable().usesWhirpool(), 2);
newCache.getIndexes()[i].packIndex(cache);
newCache.getIndexes()[i].getTable().setRevision(cache.getIndexes()[i].getTable().getRevision());
newCache.getIndexes()[i].rewriteTable();
}
}
}
@@ -0,0 +1,57 @@
package com.alex.tools.clientCacheUpdater;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
public final class OriginalXteas {
public static final HashMap mapContainersXteas = new HashMap();
public static final int[] getXteas(int regionId) {
return (int[])mapContainersXteas.get(Integer.valueOf(regionId));
}
public static void init() {
loadUnpackedXteas();
}
public static final void delete() {
}
public static final void loadUnpackedXteas() {
try {
File var11 = new File("cache667_protected/keys");
File[] xteasFiles = var11.listFiles();
File[] arr$ = xteasFiles;
int len$ = xteasFiles.length;
for(int i$ = 0; i$ < len$; ++i$) {
File region = arr$[i$];
String name = region.getName();
if(!name.contains(".txt")) {
region.delete();
} else {
short regionId = Short.parseShort(name.replace(".txt", ""));
if(regionId <= 0) {
region.delete();
} else {
BufferedReader in = new BufferedReader(new FileReader(region));
int[] xteas = new int[4];
for(int index = 0; index < 4; ++index) {
xteas[index] = Integer.parseInt(in.readLine());
}
mapContainersXteas.put(Integer.valueOf(regionId), xteas);
in.close();
}
}
}
} catch (IOException var111) {
var111.printStackTrace();
}
}
}
@@ -0,0 +1,99 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.store.Index;
import com.alex.store.Store;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
public class ProtectCache {
public static void main(String[] args) throws IOException {
boolean encryptMaps = true;
boolean encryptTables = false;
Store cache = new Store("718/cacheEncrypted/");
if(encryptMaps) {
Store var13 = new Store("718/rscache/");
Index var14 = cache.getIndexes()[5];
Index rsIndex = var13.getIndexes()[5];
for(int regionId = 0; regionId < 25000; ++regionId) {
int regionX = (regionId >> 8) * 64;
int regionY = (regionId & 255) * 64;
int[] keys1 = null;
String name = "l" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
int archiveId;
if(rsIndex.getFile(rsIndex.getArchiveId(name), 0) == null) {
archiveId = var14.getArchiveId(name);
if(archiveId != -1) {
keys1 = writeKeys(regionId);
if(!var14.encryptArchive(archiveId, (int[])null, keys1, false, false)) {
throw new RuntimeException("FAIL");
}
}
}
name = "ul" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
if(rsIndex.getFile(rsIndex.getArchiveId(name), 0) == null) {
archiveId = var14.getArchiveId(name);
if(archiveId != -1) {
if(keys1 == null) {
keys1 = writeKeys(regionId);
}
if(!var14.encryptArchive(archiveId, (int[])null, keys1, false, false)) {
throw new RuntimeException("FAIL");
}
}
}
}
var14.rewriteTable();
}
if(encryptTables) {
int[][] var131 = new int[cache.getIndexes().length][];
int var141;
for(var141 = 0; var141 < var131.length; ++var141) {
var131[var141] = generateKeys();
if(cache.getIndexes()[var141] != null) {
System.out.println("encrypting idx table: " + var141);
cache.getIndexes()[var141].setKeys(var131[var141]);
cache.getIndexes()[var141].rewriteTable();
}
}
for(var141 = 0; var141 < var131.length; ++var141) {
System.out.println(Arrays.toString(var131[var141]));
}
}
}
public static int[] generateKeys() {
int[] keys = new int[4];
for(int index = 0; index < keys.length; ++index) {
keys[index] = (new Random()).nextInt();
}
return keys;
}
public static int[] writeKeys(int regionId) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter("718/maps/unpacked/" + regionId + ".txt"));
int[] keys = generateKeys();
for(int index = 0; index < keys.length; ++index) {
writer.write("" + keys[index]);
writer.newLine();
writer.flush();
}
System.out.println("Region: " + regionId + ", " + Arrays.toString(keys));
return keys;
}
}
@@ -0,0 +1,49 @@
package com.alex.tools.clientCacheUpdater;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.HashMap;
public final class RSXteas {
public static final HashMap mapContainersXteas = new HashMap();
public static final int[] getXteas(int regionId) {
return (int[])mapContainersXteas.get(Integer.valueOf(regionId));
}
public static final void loadUnpackedXteas(String location) {
try {
File var12 = new File(location);
File[] xteasFiles = var12.listFiles();
File[] arr$ = xteasFiles;
int len$ = xteasFiles.length;
for(int i$ = 0; i$ < len$; ++i$) {
File region = arr$[i$];
String name = region.getName();
if(!name.contains(".txt")) {
region.delete();
} else {
short regionId = Short.parseShort(name.replace(".txt", ""));
if(regionId <= 0) {
region.delete();
} else {
BufferedReader in = new BufferedReader(new FileReader(region));
int[] xteas = new int[4];
for(int index = 0; index < 4; ++index) {
xteas[index] = Integer.parseInt(in.readLine());
}
mapContainersXteas.put(Integer.valueOf(regionId), xteas);
in.close();
}
}
}
} catch (Exception var121) {
var121.printStackTrace();
}
}
}
@@ -0,0 +1,116 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.store.Index;
import com.alex.store.Store;
import com.alex.tools.clientCacheUpdater.UpdateCache;
import javax.imageio.ImageIO;
import javax.imageio.stream.ImageOutputStream;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.io.File;
import java.io.IOException;
public class SpritesDumper {
public static void main2(String[] args) throws IOException {
BufferedImage background = ImageIO.read(new File("bg/matrix.jpg"));
int id = 3769;
int sx = background.getWidth() / 2;
int sy = background.getHeight() / 2;
for(int y = 0; y < 2; ++y) {
for(int x = 0; x < 2; ++x) {
System.out.println("id " + id);
BufferedImage part = background.getSubimage(x * sx, y * sy, sx, sy);
ImageIO.write(part, "gif", new File("bg/" + id++ + ".gif"));
}
}
}
public static void main3(String[] args) throws IOException {
Store cache = new Store("cache667_2/", false);
UpdateCache.packLogo(cache);
System.out.println("Adding donator icon...");
UpdateCache.packDonatorIcon(cache);
System.out.println("Adding Matrix icon...");
UpdateCache.packMatrixIcon(cache);
}
public static byte[] getImage(File file) throws IOException {
ImageOutputStream stream = ImageIO.createImageOutputStream(file);
byte[] data = new byte[(int)stream.length()];
stream.read(data);
return data;
}
public static void main(String[] args) throws IOException {
Store cache = new Store("718/rscache/");
Index sprites = cache.getIndexes()[32];
int[] arr$ = sprites.getTable().getValidArchiveIds();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
int archiveId = arr$[i$];
int[] arr$1 = sprites.getTable().getArchives()[archiveId].getValidFileIds();
int len$1 = arr$1.length;
for(int i$1 = 0; i$1 < len$1; ++i$1) {
int fileId = arr$1[i$1];
byte[] data = sprites.getFile(archiveId, fileId);
Image image = Toolkit.getDefaultToolkit().createImage(data);
String name = "sprites32/" + archiveId + "_" + fileId;
BufferedImage bi = toBufferedImage(image);
if(bi == null) {
System.out.println("failed " + name);
} else {
ImageIO.write(bi, "png", new File(name + ".png"));
}
}
}
}
public static BufferedImage toBufferedImage(Image image) {
if(image instanceof BufferedImage) {
return (BufferedImage)image;
} else {
image = (new ImageIcon(image)).getImage();
boolean hasAlpha = true;
BufferedImage bimage = null;
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
byte g;
try {
g = 1;
if(hasAlpha) {
g = 2;
}
GraphicsDevice g1 = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = g1.getDefaultConfiguration();
if(image.getWidth((ImageObserver)null) < 0 || image.getHeight((ImageObserver)null) < 0) {
return null;
}
bimage = gc.createCompatibleImage(image.getWidth((ImageObserver)null), image.getHeight((ImageObserver)null), g);
} catch (HeadlessException var7) {
;
}
if(bimage == null) {
g = 1;
if(hasAlpha) {
g = 2;
}
bimage = new BufferedImage(image.getWidth((ImageObserver)null), image.getHeight((ImageObserver)null), g);
}
Graphics2D g11 = bimage.createGraphics();
g11.drawImage(image, 0, 0, (ImageObserver)null);
g11.dispose();
return bimage;
}
}
}
@@ -0,0 +1,357 @@
package com.alex.tools.clientCacheUpdater;
import com.alex.loaders.images.IndexedColorImageFile;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.store.Index;
import com.alex.store.Store;
import com.alex.tools.clientCacheUpdater.RSXteas;
import com.alex.tools.clientCacheUpdater.SpritesDumper;
import com.alex.utils.Utils;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class UpdateCache {
public static byte[] getBytesFromFile(File file) throws IOException {
FileInputStream is = new FileInputStream(file);
long length = file.length();
if(length > 2147483647L) {
;
}
byte[] bytes = new byte[(int)length];
int offset = 0;
int numRead1;
for(boolean numRead = false; offset < bytes.length && (numRead1 = is.read(bytes, offset, bytes.length - offset)) >= 0; offset += numRead1) {
;
}
if(offset < bytes.length) {
throw new IOException("Could not completely read file " + file.getName());
} else {
is.close();
return bytes;
}
}
public static void main6(String[] args) throws IOException {
Store cache = new Store("cache667_2/", false);
cache.getIndexes()[6].putFile(0, 0, getBytesFromFile(new File("0")));
}
public static void main5(String[] args) throws IOException {
Store rscache = new Store("cache697/");
Store cache = new Store("cache667_2/", false);
boolean result = false;
result = cache.getIndexes()[3].putArchive(320, rscache, false, false);
System.out.println("Packed skill interface: 320, " + result);
result = cache.getIndexes()[3].putArchive(679, rscache, false, false);
System.out.println("Packed skill interface: 679, " + result);
cache.getIndexes()[3].rewriteTable();
}
public static void main555(String[] args) throws IOException {
Store cache = new Store("cache667_2/", false);
Store originalCache = new Store("rscache/", false);
cache.addIndex(false, false, 2);
int[] arr$ = originalCache.getIndexes()[19].getTable().getValidArchiveIds();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
int i = arr$[i$];
System.out.println(i);
int[] arr$1 = originalCache.getIndexes()[19].getTable().getArchives()[i].getValidFileIds();
int len$1 = arr$1.length;
for(int i$1 = 0; i$1 < len$1; ++i$1) {
int i2 = arr$1[i$1];
try {
cache.getIndexes()[37].putFile(i, i2, 2, originalCache.getIndexes()[19].getFile(i, i2), (int[])null, false, false, -1, -1);
} catch (Throwable var12) {
var12.printStackTrace();
}
}
}
cache.getIndexes()[37].rewriteTable();
}
public static void main77(String[] args) throws IOException {
Store originalCache = new Store("cache667/", false);
Store cache = new Store("cache667_2/", false);
for(int i = 1610; i < 1616; ++i) {
cache.getIndexes()[17].putFile(i >>> 8, i & 255, originalCache.getIndexes()[17].getFile(i >>> 8, i & 255));
}
}
public static void packLogo(Store cache) throws IOException {
short id = 2498;
IndexedColorImageFile f = null;
try {
f = new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/logo.png"))});
} catch (IOException var81) {
var81.printStackTrace();
}
byte[] data = f.encodeFile();
cache.getIndexes()[8].putFile(id, 0, data);
int i;
for(i = 4139; i <= 4146; ++i) {
try {
cache.getIndexes()[8].putFile(i, 0, (new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/" + i + ".gif"))})).encodeFile());
} catch (IOException var7) {
var7.printStackTrace();
}
}
for(i = 0; i < 4; ++i) {
int realid = 3769 + i;
int var8 = 3769 + i;
cache.getIndexes()[8].putFile(var8, 0, (new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/" + realid + ".gif"))})).encodeFile());
var8 = 3779 + i;
cache.getIndexes()[8].putFile(var8, 0, (new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/" + realid + ".gif"))})).encodeFile());
var8 = 3783 + (i >= 2?i - 2:i + 2);
cache.getIndexes()[8].putFile(var8, 0, (new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/" + realid + ".gif"))})).encodeFile());
var8 = 3769 + i;
cache.getIndexes()[34].putFile(var8, 0, (new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/" + realid + ".gif"))})).encodeFile());
var8 = 3779 + i;
cache.getIndexes()[34].putFile(var8, 0, (new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/" + realid + ".gif"))})).encodeFile());
var8 = 3783 + (i >= 2?i - 2:i + 2);
cache.getIndexes()[34].putFile(var8, 0, (new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("bg/" + realid + ".gif"))})).encodeFile());
var8 = 3769 + i;
cache.getIndexes()[32].putFile(var8, 0, SpritesDumper.getImage(new File("bg/" + realid + ".png")));
var8 = 3779 + i;
cache.getIndexes()[32].putFile(var8, 0, SpritesDumper.getImage(new File("bg/" + realid + ".png")));
var8 = 3783 + (i >= 2?i - 2:i + 2);
cache.getIndexes()[32].putFile(var8, 0, SpritesDumper.getImage(new File("bg/" + realid + ".png")));
System.out.println("added file: " + i);
}
}
public static void packDonatorIcon(Store cache) {
short id = 1455;
IndexedColorImageFile f = null;
try {
f = new IndexedColorImageFile(cache, id, 0);
BufferedImage var7 = ImageIO.read(new File("1455.png"));
System.out.println("Added icon: " + f.addImage(var7) + ".");
BufferedImage icon2 = ImageIO.read(new File("1455f.png"));
System.out.println("Added icon2: " + f.addImage(icon2) + ".");
BufferedImage icon3 = ImageIO.read(new File("crown_green.gif"));
System.out.println("Added icon3: " + f.addImage(icon3) + ".");
BufferedImage icon4 = ImageIO.read(new File("1455_11.png"));
System.out.println("Added icon4: " + f.addImage(icon4) + ".");
} catch (IOException var71) {
var71.printStackTrace();
}
cache.getIndexes()[8].putFile(id, 0, f.encodeFile());
}
public static void packMatrixIcon(Store cache) {
short id = 2173;
IndexedColorImageFile f = null;
try {
f = new IndexedColorImageFile(new BufferedImage[]{ImageIO.read(new File("2173.png"))});
} catch (IOException var4) {
var4.printStackTrace();
}
byte[] data = f.encodeFile();
cache.getIndexes()[8].putFile(id, 0, data);
}
public static int packCustomModel(Store cache, byte[] data) {
int archiveId = cache.getIndexes()[7].getLastArchiveId() + 1;
if(cache.getIndexes()[7].putFile(archiveId, 0, data)) {
return archiveId;
} else {
System.out.println("Failing packing model " + archiveId);
return -1;
}
}
public static void packCustomItems(Store cache) throws IOException {
int modelID = packCustomModel(cache, getBytesFromFile(new File("donatorCape.dat")));
System.out.println("model id " + modelID);
ItemDefinitions donatorCape = ItemDefinitions.getItemDefinition(cache, 9747);
donatorCape.setName("Donator cape");
donatorCape.femaleEquip1 = modelID;
donatorCape.maleEquip1 = modelID;
donatorCape.modelId = modelID;
donatorCape.resetModelColors();
short newId = 29999;
System.out.println(cache.getIndexes()[19].putFile(newId >>> 8, 255 & newId, donatorCape.encode()));
}
public static void main(String[] args) throws IOException {
boolean updateJustMaps = false;
boolean addOldItems = true;
Store rscache = new Store("cache697/");
Store cache = new Store("cache667_2/", false);
Store originalCache = new Store("cache667/", false);
if(addOldItems) {
cache.resetIndex(19, false, false, 2);
}
cache.resetIndex(7, false, false, 2);
cache.getIndexes()[7].packIndex(originalCache);
int regionId;
int regionX;
int regionY;
boolean var20;
int[] xteas;
if(!updateJustMaps) {
int var19;
for(var19 = 0; var19 < cache.getIndexes().length; ++var19) {
if(var19 != 3 && var19 != 5 && var19 != 12 && var19 != 33 && var19 != 30) {
boolean var21 = cache.getIndexes()[var19].packIndex(rscache, true);
System.out.println("Packed index archives: " + var19 + ", " + var21);
}
}
System.out.println("Adding logo...");
packLogo(cache);
System.out.println("Adding donator icon...");
packDonatorIcon(cache);
System.out.println("Adding Matrix icon...");
packMatrixIcon(cache);
System.out.println("Adding Custom items...");
packCustomItems(cache);
int var22;
int var17;
if(addOldItems) {
System.out.println("Adding back old item definitions...");
short var24 = 30000;
System.out.println(var24);
var22 = Utils.getItemDefinitionsSize(originalCache);
for(var17 = var24; var17 < var24 + var22; ++var17) {
regionId = var17 - var24;
cache.getIndexes()[19].putFile(var17 >>> 8, 255 & var17, 2, originalCache.getIndexes()[19].getFile(regionId >>> 8, 255 & regionId), (int[])null, false, false, -1, -1);
}
cache.getIndexes()[19].rewriteTable();
}
System.out.println("Recovering Client Script Maps...");
int[] var211 = originalCache.getIndexes()[17].getTable().getValidArchiveIds();
var22 = var211.length;
for(var17 = 0; var17 < var22; ++var17) {
int data = var211[var17];
xteas = originalCache.getIndexes()[17].getTable().getArchives()[data].getValidFileIds();
regionX = xteas.length;
for(regionY = 0; regionY < regionX; ++regionY) {
int name = xteas[regionY];
if(!cache.getIndexes()[17].fileExists(data, name) || cache.getIndexes()[17].getFile(data, name).length == 1) {
cache.getIndexes()[17].putFile(data, name, originalCache.getIndexes()[17].getFile(data, name));
}
}
}
System.out.println("Recovering Bank Client Script Maps...");
for(var19 = 1610; var19 < 1616; ++var19) {
cache.getIndexes()[17].putFile(var19 >>> 8, var19 & 255, originalCache.getIndexes()[17].getFile(var19 >>> 8, var19 & 255));
}
System.out.println("Adding new interfaces...");
for(var19 = cache.getIndexes()[3].getLastArchiveId() + 1; var19 <= rscache.getIndexes()[3].getLastArchiveId(); ++var19) {
if(rscache.getIndexes()[3].archiveExists(var19)) {
cache.getIndexes()[3].putArchive(var19, rscache, false, false);
}
}
cache.getIndexes()[3].putArchive(320, rscache, false, false);
cache.getIndexes()[3].putArchive(751, rscache, false, false);
cache.getIndexes()[3].putArchive(1092, rscache, false, false);
var20 = cache.getIndexes()[3].rewriteTable();
cache.getIndexes()[8].rewriteTable();
System.out.println("Packed new interfaces: " + var20);
}
Index var18 = cache.getIndexes()[5];
Index var191 = rscache.getIndexes()[5];
Index var201 = originalCache.getIndexes()[5];
RSXteas.loadUnpackedXteas("old");
System.out.println("Updating Maps.");
for(regionId = 0; regionId < 30000; ++regionId) {
regionX = (regionId >> 8) * 64;
regionY = (regionId & 255) * 64;
String var221 = "m" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
byte[] var23 = var191.getFile(var191.getArchiveId(var221));
if(var23 == null) {
var23 = var201.getFile(var201.getArchiveId(var221));
}
if(var23 != null) {
var20 = addMapFile(var18, var221, var23);
System.out.println(var221 + ", " + var20);
}
var221 = "um" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
var23 = var191.getFile(var191.getArchiveId(var221));
if(var23 == null) {
var23 = var201.getFile(var201.getArchiveId(var221));
}
if(var23 != null) {
var20 = addMapFile(var18, var221, var23);
System.out.println(var221 + ", " + var20);
}
xteas = RSXteas.getXteas(regionId);
var221 = "l" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
var23 = var191.getFile(var191.getArchiveId(var221), 0, xteas);
if(var23 != null) {
var20 = addMapFile(var18, var221, var23);
System.out.println(var221 + ", " + var20);
}
var221 = "ul" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
var23 = var191.getFile(var191.getArchiveId(var221), 0, xteas);
if(var23 != null) {
var20 = addMapFile(var18, var221, var23);
System.out.println(var221 + ", " + var20);
}
var221 = "n" + (regionX >> 3) / 8 + "_" + (regionY >> 3) / 8;
var23 = var191.getFile(var191.getArchiveId(var221), 0);
if(var23 == null) {
var23 = var201.getFile(var201.getArchiveId(var221), 0);
}
if(var23 != null) {
var20 = addMapFile(var18, var221, var23);
System.out.println(var221 + ", " + var20);
}
}
var18.rewriteTable();
}
public static boolean addMapFile(Index index, String name, byte[] data) {
int archiveId = index.getArchiveId(name);
if(archiveId == -1) {
archiveId = index.getTable().getValidArchiveIds().length;
}
return index.putFile(archiveId, 0, 2, data, (int[])null, false, false, Utils.getNameHash(name), -1);
}
}
@@ -0,0 +1,197 @@
package com.alex.tools.itemsDefsEditor;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.store.Store;
import com.alex.tools.itemsDefsEditor.GeneratedUkeys;
import com.alex.tools.itemsDefsEditor.ItemDefsEditor;
import com.alex.utils.Utils;
import javax.swing.UIManager.LookAndFeelInfo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
public class Application {
public static Store STORE;
private JFrame frmCacheEditorV;
private JList itemsList;
private DefaultListModel itemsListmodel;
public static void main(String[] args) throws IOException {
STORE = new Store("cache/", false);
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Application var2 = new Application();
var2.frmCacheEditorV.setVisible(true);
} catch (Exception var21) {
var21.printStackTrace();
}
}
});
}
public Application() {
this.initialize();
}
private void setLook() {
boolean found = false;
LookAndFeelInfo[] e = UIManager.getInstalledLookAndFeels();
int len$ = e.length;
for(int var7 = 0; var7 < len$; ++var7) {
LookAndFeelInfo info = e[var7];
if(info.getName().equals("Nimbus")) {
try {
UIManager.setLookAndFeel(info.getClassName());
found = true;
} catch (Exception var8) {
var8.printStackTrace();
}
}
}
if(!found) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception var71) {
var71.printStackTrace();
}
}
}
private void initialize() {
this.setLook();
this.frmCacheEditorV = new JFrame();
this.frmCacheEditorV.setTitle("Cache Editor V0.1");
this.frmCacheEditorV.setBounds(100, 100, 352, 435);
this.frmCacheEditorV.setDefaultCloseOperation(3);
JTabbedPane tabbedPane = new JTabbedPane(1);
this.frmCacheEditorV.getContentPane().add(tabbedPane, "Center");
JPanel panel = new JPanel();
tabbedPane.addTab("Main", (Icon)null, panel, (String)null);
panel.setLayout((LayoutManager)null);
JButton btnGenerateUkeys = new JButton("Generate Ukeys (614- Client Builts)");
btnGenerateUkeys.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
byte[] ukeys = Utils.getArchivePacketData(255, 255, Application.STORE.generateIndex255Archive255Outdated());
new GeneratedUkeys(Application.this.getFrame(), ukeys);
}
});
btnGenerateUkeys.setBounds(33, 64, 257, 28);
panel.add(btnGenerateUkeys);
JLabel lblCreatedByAlexalso = new JLabel("Created By Alex(Also named Dragonkk)");
lblCreatedByAlexalso.setFont(new Font("Tekton Pro Ext", 0, 15));
lblCreatedByAlexalso.setBounds(6, 290, 322, 46);
panel.add(lblCreatedByAlexalso);
JPanel panel_1 = new JPanel();
tabbedPane.addTab("Items", (Icon)null, panel_1, (String)null);
panel_1.setLayout((LayoutManager)null);
this.itemsListmodel = new DefaultListModel();
this.itemsList = new JList(this.itemsListmodel);
this.itemsList.setSelectionMode(1);
this.itemsList.setLayoutOrientation(0);
this.itemsList.setVisibleRowCount(-1);
JScrollPane itemListscrollPane = new JScrollPane(this.itemsList);
itemListscrollPane.setBounds(34, 49, 155, 254);
panel_1.add(itemListscrollPane);
JButton btnEdit = new JButton("Edit");
btnEdit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefinitions defs = (ItemDefinitions)Application.this.itemsList.getSelectedValue();
if(defs != null) {
new ItemDefsEditor(Application.this, defs);
}
}
});
btnEdit.setBounds(201, 48, 90, 28);
panel_1.add(btnEdit);
JButton btnAdd = new JButton("Add");
btnAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ItemDefsEditor(Application.this, new ItemDefinitions(Application.STORE, Utils.getItemDefinitionsSize(Application.STORE), false));
}
});
btnAdd.setBounds(201, 88, 90, 28);
panel_1.add(btnAdd);
JButton btnRemove = new JButton("Remove");
btnRemove.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefinitions defs = (ItemDefinitions)Application.this.itemsList.getSelectedValue();
if(defs != null) {
Application.STORE.getIndexes()[19].removeFile(defs.getArchiveId(), defs.getFileId());
Application.this.removeItemDefs(defs);
}
}
});
btnRemove.setBounds(201, 128, 90, 28);
panel_1.add(btnRemove);
JLabel label = new JLabel("Cached Items:");
label.setFont(new Font("Comic Sans MS", 0, 18));
label.setBounds(34, 18, 155, 21);
panel_1.add(label);
JButton btnDuplicate = new JButton("Clone");
btnDuplicate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefinitions defs = (ItemDefinitions)Application.this.itemsList.getSelectedValue();
if(defs != null) {
defs = (ItemDefinitions)defs.clone();
if(defs != null) {
defs.id = Utils.getItemDefinitionsSize(Application.STORE);
new ItemDefsEditor(Application.this, defs);
}
}
}
});
btnDuplicate.setBounds(201, 168, 90, 28);
panel_1.add(btnDuplicate);
this.addAllItems();
}
public void addAllItems() {
for(int id = 0; id < Utils.getItemDefinitionsSize(STORE) - 22314; ++id) {
this.addItemDefs(ItemDefinitions.getItemDefinition(STORE, id));
}
}
public void addItemDefs(final ItemDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
Application.this.itemsListmodel.addElement(defs);
}
});
}
public void updateItemDefs(final ItemDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
int index = Application.this.itemsListmodel.indexOf(defs);
if(index == -1) {
Application.this.itemsListmodel.addElement(defs);
} else {
Application.this.itemsListmodel.setElementAt(defs, index);
}
}
});
}
public void removeItemDefs(final ItemDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
Application.this.itemsListmodel.removeElement(defs);
}
});
}
public JFrame getFrame() {
return this.frmCacheEditorV;
}
}
@@ -0,0 +1,39 @@
package com.alex.tools.itemsDefsEditor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
public class GeneratedUkeys extends JDialog {
private static final long serialVersionUID = -4163755150981048484L;
public GeneratedUkeys(JFrame frame, byte[] ukeys) {
super(frame, "Ukeys", true);
this.setBounds(100, 100, 450, 300);
this.getContentPane().setLayout((LayoutManager)null);
final JEditorPane editorPane = new JEditorPane();
editorPane.setText(Arrays.toString(ukeys));
editorPane.setBounds(6, 6, 420, 213);
this.getContentPane().add(editorPane);
JButton btnClose = new JButton("Close");
btnClose.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GeneratedUkeys.this.dispose();
}
});
btnClose.setBounds(101, 221, 90, 28);
this.getContentPane().add(btnClose);
JButton btnCopy = new JButton("Copy");
btnCopy.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ActionEvent nev = new ActionEvent(editorPane, 1001, "copy");
editorPane.selectAll();
editorPane.getActionMap().get(nev.getActionCommand()).actionPerformed(nev);
}
});
btnCopy.setBounds(6, 221, 90, 28);
this.getContentPane().add(btnCopy);
this.setDefaultCloseOperation(2);
this.setVisible(true);
}
}
@@ -0,0 +1,351 @@
package com.alex.tools.itemsDefsEditor;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.tools.itemsDefsEditor.Application;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ItemDefsEditor extends JDialog {
private static final long serialVersionUID = 779623426244652906L;
private final JPanel contentPanel = new JPanel();
private ItemDefinitions defs;
private Application application;
private JTextField modelIDField;
private JTextField nameField;
private JTextField modelZoomField;
private JTextField groundOptionsField;
private JTextField inventoryOptionsField;
private JTextField femaleModelId2Field;
private JTextField maleModelId1Field;
private JTextField maleModelId2Field;
private JTextField maleModelId3Field;
private JTextField femaleModelId1Field;
private JTextField femaleModelId3Field;
private JTextField teamIdField;
private JTextField notedItemIdField;
private JTextField switchNotedItemField;
private JTextField lendedItemIdField;
private JTextField switchLendedItemField;
private JTextField changedModelColorsField;
private JTextField changedTextureColorsField;
private JCheckBox membersOnlyCheck;
private JTextField price;
public void save() {
this.defs.setInvModelId(Integer.valueOf(this.modelIDField.getText()).intValue());
this.defs.setName(this.nameField.getText());
this.defs.setInvModelZoom(Integer.valueOf(this.modelZoomField.getText()).intValue());
String[] groundOptions = this.groundOptionsField.getText().split(";");
for(int var9 = 0; var9 < this.defs.getGroundOptions().length; ++var9) {
this.defs.getGroundOptions()[var9] = groundOptions[var9].equals("null")?null:groundOptions[var9];
}
String[] var91 = this.inventoryOptionsField.getText().split(";");
for(int t = 0; t < this.defs.getInventoryOptions().length; ++t) {
this.defs.getInventoryOptions()[t] = var91[t].equals("null")?null:var91[t];
}
this.defs.maleEquip1 = Integer.valueOf(this.maleModelId1Field.getText()).intValue();
this.defs.maleEquip2 = Integer.valueOf(this.maleModelId2Field.getText()).intValue();
this.defs.maleEquipModelId3 = Integer.valueOf(this.maleModelId3Field.getText()).intValue();
this.defs.femaleEquip1 = Integer.valueOf(this.femaleModelId1Field.getText()).intValue();
this.defs.femaleEquip2 = Integer.valueOf(this.femaleModelId2Field.getText()).intValue();
this.defs.femaleEquipModelId3 = Integer.valueOf(this.femaleModelId3Field.getText()).intValue();
this.defs.teamId = Integer.valueOf(this.teamIdField.getText()).intValue();
this.defs.notedItemId = Integer.valueOf(this.notedItemIdField.getText()).intValue();
this.defs.switchNoteItemId = Integer.valueOf(this.switchNotedItemField.getText()).intValue();
this.defs.lendedItemId = Integer.valueOf(this.lendedItemIdField.getText()).intValue();
this.defs.switchLendItemId = Integer.valueOf(this.switchLendedItemField.getText()).intValue();
this.defs.resetModelColors();
int var5;
int var6;
String[] var7;
String[] editedColor;
String[] var10;
String var101;
if(!this.changedModelColorsField.getText().equals("")) {
var10 = this.changedModelColorsField.getText().split(";");
var7 = var10;
var6 = var10.length;
for(var5 = 0; var5 < var6; ++var5) {
var101 = var7[var5];
editedColor = var101.split("=");
this.defs.changeModelColor(Integer.valueOf(editedColor[0]).intValue(), Integer.valueOf(editedColor[1]).intValue());
}
}
this.defs.resetTextureColors();
if(!this.changedTextureColorsField.getText().equals("")) {
var10 = this.changedTextureColorsField.getText().split(";");
var7 = var10;
var6 = var10.length;
for(var5 = 0; var5 < var6; ++var5) {
var101 = var7[var5];
editedColor = var101.split("=");
this.defs.changeTextureColor(Short.valueOf(editedColor[0]).shortValue(), Short.valueOf(editedColor[1]).shortValue());
}
}
this.defs.membersOnly = this.membersOnlyCheck.isSelected();
this.defs.value = Integer.valueOf(this.price.getText()).intValue();
this.defs.equipType = Integer.valueOf(this.modelIDField.getText()).intValue();
this.defs.equipSlot = Integer.valueOf(this.modelIDField.getText()).intValue();
this.defs.write(Application.STORE);
this.application.updateItemDefs(this.defs);
}
public ItemDefsEditor(Application application, ItemDefinitions defs) {
super(application.getFrame(), "Item Definitions Editor", true);
this.defs = defs;
this.application = application;
this.setBounds(100, 100, 912, 354);
this.getContentPane().setLayout(new BorderLayout());
this.contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
this.getContentPane().add(this.contentPanel, "Center");
this.contentPanel.setLayout((LayoutManager)null);
JLabel lblNewLabel = new JLabel("Model ID:");
lblNewLabel.setFont(new Font("Comic Sans MS", 0, 14));
lblNewLabel.setBounds(6, 43, 81, 21);
this.contentPanel.add(lblNewLabel);
this.modelIDField = new JTextField();
this.modelIDField.setBounds(139, 40, 122, 28);
this.contentPanel.add(this.modelIDField);
this.modelIDField.setColumns(10);
this.modelIDField.setText("" + defs.getInvModelId());
JLabel label = new JLabel("Name:");
label.setFont(new Font("Comic Sans MS", 0, 14));
label.setBounds(6, 76, 81, 21);
this.contentPanel.add(label);
this.nameField = new JTextField();
this.nameField.setBounds(139, 73, 122, 28);
this.contentPanel.add(this.nameField);
this.nameField.setColumns(10);
this.nameField.setText(defs.getName());
label = new JLabel("Model Zoom:");
label.setFont(new Font("Comic Sans MS", 0, 14));
label.setBounds(6, 109, 95, 21);
this.contentPanel.add(label);
this.modelZoomField = new JTextField();
this.modelZoomField.setBounds(139, 106, 122, 28);
this.contentPanel.add(this.modelZoomField);
this.modelZoomField.setColumns(10);
this.modelZoomField.setText("" + defs.getInvModelZoom());
label = new JLabel("Ground Options:");
label.setFont(new Font("Comic Sans MS", 0, 14));
label.setBounds(6, 142, 108, 21);
this.contentPanel.add(label);
this.groundOptionsField = new JTextField();
this.groundOptionsField.setBounds(139, 139, 122, 28);
this.contentPanel.add(this.groundOptionsField);
this.groundOptionsField.setColumns(10);
String var14 = "";
String[] label_1 = defs.getGroundOptions();
int label_2 = label_1.length;
int label_3;
String label_4;
for(label_3 = 0; label_3 < label_2; ++label_3) {
label_4 = label_1[label_3];
var14 = var14 + (label_4 == null?"null":label_4) + ";";
}
this.groundOptionsField.setText(var14);
label = new JLabel("Inventory Options:");
label.setFont(new Font("Comic Sans MS", 0, 14));
label.setBounds(6, 175, 139, 21);
this.contentPanel.add(label);
this.inventoryOptionsField = new JTextField();
this.inventoryOptionsField.setBounds(139, 172, 122, 28);
this.contentPanel.add(this.inventoryOptionsField);
this.inventoryOptionsField.setColumns(10);
var14 = "";
label_1 = defs.getInventoryOptions();
label_2 = label_1.length;
for(label_3 = 0; label_3 < label_2; ++label_3) {
label_4 = label_1[label_3];
var14 = var14 + (label_4 == null?"null":label_4) + ";";
}
this.inventoryOptionsField.setText(var14);
JButton var16 = new JButton("Save");
var16.setBounds(6, 265, 55, 28);
this.contentPanel.add(var16);
var16.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefsEditor.this.save();
ItemDefsEditor.this.dispose();
}
});
this.getRootPane().setDefaultButton(var16);
var16 = new JButton("Cancel");
var16.setBounds(73, 265, 67, 28);
this.contentPanel.add(var16);
var16.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefsEditor.this.dispose();
}
});
var16.setActionCommand("Cancel");
label = new JLabel("Interface / Droped");
label.setFont(new Font("Comic Sans MS", 0, 18));
label.setBounds(6, 6, 205, 21);
this.contentPanel.add(label);
JLabel var15 = new JLabel("Wearing");
var15.setFont(new Font("Comic Sans MS", 0, 18));
var15.setBounds(273, 6, 205, 21);
this.contentPanel.add(var15);
JLabel var17 = new JLabel("Male Model ID 1:");
var17.setFont(new Font("Comic Sans MS", 0, 14));
var17.setBounds(273, 43, 131, 21);
this.contentPanel.add(var17);
JLabel var18 = new JLabel("Male Model ID 2:");
var18.setFont(new Font("Comic Sans MS", 0, 14));
var18.setBounds(273, 76, 131, 21);
this.contentPanel.add(var18);
JLabel var19 = new JLabel("Male Model ID 3:");
var19.setFont(new Font("Comic Sans MS", 0, 14));
var19.setBounds(273, 112, 131, 21);
this.contentPanel.add(var19);
JLabel label_5 = new JLabel("Female Model ID 1:");
label_5.setFont(new Font("Comic Sans MS", 0, 14));
label_5.setBounds(273, 145, 131, 21);
this.contentPanel.add(label_5);
JLabel label_6 = new JLabel("Female Model ID 2:");
label_6.setFont(new Font("Comic Sans MS", 0, 14));
label_6.setBounds(273, 175, 131, 21);
this.contentPanel.add(label_6);
JLabel label_7 = new JLabel("Female Model ID 3:");
label_7.setFont(new Font("Comic Sans MS", 0, 14));
label_7.setBounds(273, 208, 131, 21);
this.contentPanel.add(label_7);
this.femaleModelId2Field = new JTextField();
this.femaleModelId2Field.setBounds(411, 172, 122, 28);
this.contentPanel.add(this.femaleModelId2Field);
this.femaleModelId2Field.setColumns(10);
this.femaleModelId2Field.setText("" + defs.femaleEquip2);
this.maleModelId1Field = new JTextField();
this.maleModelId1Field.setBounds(411, 40, 122, 28);
this.contentPanel.add(this.maleModelId1Field);
this.maleModelId1Field.setColumns(10);
this.maleModelId1Field.setText("" + defs.maleEquip1);
this.maleModelId2Field = new JTextField();
this.maleModelId2Field.setBounds(411, 73, 122, 28);
this.contentPanel.add(this.maleModelId2Field);
this.maleModelId2Field.setColumns(10);
this.maleModelId2Field.setText("" + defs.maleEquip2);
this.maleModelId3Field = new JTextField();
this.maleModelId3Field.setBounds(411, 106, 122, 28);
this.contentPanel.add(this.maleModelId3Field);
this.maleModelId3Field.setColumns(10);
this.maleModelId3Field.setText("" + defs.maleEquipModelId3);
this.femaleModelId1Field = new JTextField();
this.femaleModelId1Field.setBounds(411, 139, 122, 28);
this.contentPanel.add(this.femaleModelId1Field);
this.femaleModelId1Field.setColumns(10);
this.femaleModelId1Field.setText("" + defs.femaleEquip1);
this.femaleModelId3Field = new JTextField();
this.femaleModelId3Field.setBounds(411, 205, 122, 28);
this.contentPanel.add(this.femaleModelId3Field);
this.femaleModelId3Field.setColumns(10);
this.femaleModelId3Field.setText("" + defs.femaleEquipModelId3);
JLabel buttonPane = new JLabel("Team ID:");
buttonPane.setFont(new Font("Comic Sans MS", 0, 14));
buttonPane.setBounds(273, 241, 131, 21);
this.contentPanel.add(buttonPane);
this.teamIdField = new JTextField();
this.teamIdField.setBounds(411, 238, 122, 28);
this.contentPanel.add(this.teamIdField);
this.teamIdField.setColumns(10);
this.teamIdField.setText("" + defs.teamId);
buttonPane = new JLabel("Others");
buttonPane.setFont(new Font("Comic Sans MS", 0, 18));
buttonPane.setBounds(539, 6, 205, 21);
this.contentPanel.add(buttonPane);
buttonPane = new JLabel("Noted Item ID:");
buttonPane.setFont(new Font("Comic Sans MS", 0, 14));
buttonPane.setBounds(545, 43, 131, 21);
this.contentPanel.add(buttonPane);
buttonPane = new JLabel("Switch Noted Item Id:");
buttonPane.setFont(new Font("Comic Sans MS", 0, 14));
buttonPane.setBounds(545, 76, 160, 21);
this.contentPanel.add(buttonPane);
buttonPane = new JLabel("Lended Item ID:");
buttonPane.setFont(new Font("Comic Sans MS", 0, 14));
buttonPane.setBounds(545, 109, 160, 21);
this.contentPanel.add(buttonPane);
buttonPane = new JLabel("Switch Lended Item Id:");
buttonPane.setFont(new Font("Comic Sans MS", 0, 14));
buttonPane.setBounds(545, 145, 160, 21);
this.contentPanel.add(buttonPane);
this.notedItemIdField = new JTextField();
this.notedItemIdField.setBounds(707, 39, 122, 28);
this.contentPanel.add(this.notedItemIdField);
this.notedItemIdField.setColumns(10);
this.notedItemIdField.setText("" + defs.notedItemId);
this.switchNotedItemField = new JTextField();
this.switchNotedItemField.setBounds(707, 73, 122, 28);
this.contentPanel.add(this.switchNotedItemField);
this.switchNotedItemField.setColumns(10);
this.switchNotedItemField.setText("" + defs.switchNoteItemId);
this.lendedItemIdField = new JTextField();
this.lendedItemIdField.setBounds(707, 106, 122, 28);
this.contentPanel.add(this.lendedItemIdField);
this.lendedItemIdField.setColumns(10);
this.lendedItemIdField.setText("" + defs.lendedItemId);
this.switchLendedItemField = new JTextField();
this.switchLendedItemField.setBounds(707, 139, 122, 28);
this.contentPanel.add(this.switchLendedItemField);
this.switchLendedItemField.setColumns(10);
this.switchLendedItemField.setText("" + defs.switchLendItemId);
buttonPane = new JLabel("Changed Model Colors:");
buttonPane.setFont(new Font("Comic Sans MS", 0, 14));
buttonPane.setBounds(545, 175, 160, 21);
this.contentPanel.add(buttonPane);
this.changedModelColorsField = new JTextField();
this.changedModelColorsField.setBounds(707, 172, 122, 28);
this.contentPanel.add(this.changedModelColorsField);
this.changedModelColorsField.setColumns(10);
String var20 = "";
int i;
if(defs.originalModelColors != null) {
for(i = 0; i < defs.originalModelColors.length; ++i) {
var20 = var20 + defs.originalModelColors[i] + "=" + defs.modifiedModelColors[i] + ";";
}
}
this.changedModelColorsField.setText(var20);
buttonPane = new JLabel("Changed Texture Colors:");
buttonPane.setFont(new Font("Comic Sans MS", 0, 14));
buttonPane.setBounds(545, 205, 160, 21);
this.contentPanel.add(buttonPane);
this.changedTextureColorsField = new JTextField();
this.changedTextureColorsField.setBounds(707, 205, 122, 28);
this.contentPanel.add(this.changedTextureColorsField);
this.changedTextureColorsField.setColumns(10);
var20 = "";
if(defs.originalTextureColors != null) {
for(i = 0; i < defs.originalTextureColors.length; ++i) {
var20 = var20 + defs.originalTextureColors[i] + "=" + defs.modifiedTextureColors[i] + ";";
}
}
this.changedTextureColorsField.setText(var20);
this.membersOnlyCheck = new JCheckBox("Members Only");
this.membersOnlyCheck.setFont(new Font("Comic Sans MS", 0, 14));
this.membersOnlyCheck.setBounds(545, 243, 131, 18);
this.membersOnlyCheck.setSelected(defs.membersOnly);
this.contentPanel.add(this.membersOnlyCheck);
JPanel var21 = new JPanel();
var21.setLayout(new FlowLayout(2));
this.getContentPane().add(var21, "South");
this.setDefaultCloseOperation(2);
this.setVisible(true);
}
}
@@ -0,0 +1,36 @@
package com.alex.util.bzip2;
public class BZip2BlockEntry {
boolean[] aBooleanArray2205 = new boolean[16];
boolean[] aBooleanArray2213 = new boolean[256];
byte aByte2201;
byte[] aByteArray2204 = new byte[4096];
byte[] aByteArray2211 = new byte[256];
byte[] aByteArray2212;
byte[] aByteArray2214 = new byte[18002];
byte[] aByteArray2219 = new byte[18002];
byte[] aByteArray2224;
byte[][] aByteArrayArray2229 = new byte[6][258];
int anInt2202;
int anInt2203 = 0;
int anInt2206;
int anInt2207;
int anInt2208;
int anInt2209 = 0;
int anInt2215;
int anInt2216;
int anInt2217;
int anInt2221;
int anInt2222;
int anInt2223;
int anInt2225;
int anInt2227;
int anInt2232;
int[] anIntArray2200 = new int[6];
int[] anIntArray2220 = new int[257];
int[] anIntArray2226 = new int[16];
int[] anIntArray2228 = new int[256];
int[][] anIntArrayArray2210 = new int[6][258];
int[][] anIntArrayArray2218 = new int[6][258];
int[][] anIntArrayArray2230 = new int[6][258];
}
@@ -0,0 +1,22 @@
package com.alex.util.bzip2;
import org.apache.tools.bzip2.CBZip2OutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class BZip2Compressor {
public static final byte[] compress(byte[] data) {
ByteArrayOutputStream compressedBytes = new ByteArrayOutputStream();
try {
CBZip2OutputStream var3 = new CBZip2OutputStream(compressedBytes);
var3.write(data);
var3.close();
return compressedBytes.toByteArray();
} catch (IOException var31) {
var31.printStackTrace();
return null;
}
}
}
@@ -0,0 +1,584 @@
package com.alex.util.bzip2;
import com.alex.util.bzip2.BZip2BlockEntry;
public class BZip2Decompressor {
private static int[] anIntArray257;
private static BZip2BlockEntry entryInstance = new BZip2BlockEntry();
public static final void decompress(byte[] decompressedData, byte[] packedData, int containerSize, int blockSize) {
BZip2BlockEntry var4 = entryInstance;
BZip2BlockEntry var5 = entryInstance;
synchronized(entryInstance) {
entryInstance.aByteArray2224 = packedData;
entryInstance.anInt2209 = blockSize;
entryInstance.aByteArray2212 = decompressedData;
entryInstance.anInt2203 = 0;
entryInstance.anInt2206 = decompressedData.length;
entryInstance.anInt2232 = 0;
entryInstance.anInt2207 = 0;
entryInstance.anInt2217 = 0;
entryInstance.anInt2216 = 0;
method1793(entryInstance);
entryInstance.aByteArray2224 = null;
entryInstance.aByteArray2212 = null;
}
}
private static final void method1785(BZip2BlockEntry entry) {
entry.anInt2215 = 0;
for(int i = 0; i < 256; ++i) {
if(entry.aBooleanArray2213[i]) {
entry.aByteArray2211[entry.anInt2215] = (byte)i;
++entry.anInt2215;
}
}
}
private static final void method1786(int[] ai, int[] ai1, int[] ai2, byte[] abyte0, int i, int j, int k) {
int l = 0;
int i3;
int k2;
for(i3 = i; i3 <= j; ++i3) {
for(k2 = 0; k2 < k; ++k2) {
if(abyte0[k2] == i3) {
ai2[l] = k2;
++l;
}
}
}
for(i3 = 0; i3 < 23; ++i3) {
ai1[i3] = 0;
}
for(i3 = 0; i3 < k; ++i3) {
++ai1[abyte0[i3] + 1];
}
for(i3 = 1; i3 < 23; ++i3) {
ai1[i3] += ai1[i3 - 1];
}
for(i3 = 0; i3 < 23; ++i3) {
ai[i3] = 0;
}
i3 = 0;
for(k2 = i; k2 <= j; ++k2) {
i3 += ai1[k2 + 1] - ai1[k2];
ai[k2] = i3 - 1;
i3 <<= 1;
}
for(k2 = i + 1; k2 <= j; ++k2) {
ai1[k2] = (ai[k2 - 1] + 1 << 1) - ai1[k2];
}
}
private static final void method1787(BZip2BlockEntry entry) {
byte byte4 = entry.aByte2201;
int i = entry.anInt2222;
int j = entry.anInt2227;
int k = entry.anInt2221;
int[] ai = anIntArray257;
int l = entry.anInt2208;
byte[] abyte0 = entry.aByteArray2212;
int i1 = entry.anInt2203;
int j1 = entry.anInt2206;
int l1 = entry.anInt2225 + 1;
label63:
while(true) {
if(i > 0) {
while(true) {
if(j1 == 0) {
break label63;
}
if(i == 1) {
if(j1 == 0) {
i = 1;
break label63;
}
abyte0[i1] = byte4;
++i1;
--j1;
break;
}
abyte0[i1] = byte4;
--i;
++i1;
--j1;
}
}
boolean flag = true;
byte byte1;
while(flag) {
flag = false;
if(j == l1) {
i = 0;
break label63;
}
byte4 = (byte)k;
l = ai[l];
byte1 = (byte)(l & 255);
l >>= 8;
++j;
if(byte1 != k) {
k = byte1;
if(j1 == 0) {
i = 1;
break label63;
}
abyte0[i1] = byte4;
++i1;
--j1;
flag = true;
} else if(j == l1) {
if(j1 == 0) {
i = 1;
break label63;
}
abyte0[i1] = byte4;
++i1;
--j1;
flag = true;
}
}
i = 2;
l = ai[l];
byte1 = (byte)(l & 255);
l >>= 8;
++j;
if(j != l1) {
if(byte1 != k) {
k = byte1;
} else {
i = 3;
l = ai[l];
byte byte2 = (byte)(l & 255);
l >>= 8;
++j;
if(j != l1) {
if(byte2 != k) {
k = byte2;
} else {
l = ai[l];
byte byte3 = (byte)(l & 255);
l >>= 8;
++j;
i = (byte3 & 255) + 4;
l = ai[l];
k = (byte)(l & 255);
l >>= 8;
++j;
}
}
}
}
}
entry.anInt2216 += j1 - j1;
entry.aByte2201 = byte4;
entry.anInt2222 = i;
entry.anInt2227 = j;
entry.anInt2221 = k;
anIntArray257 = ai;
entry.anInt2208 = l;
entry.aByteArray2212 = abyte0;
entry.anInt2203 = i1;
entry.anInt2206 = j1;
}
private static final byte method1788(BZip2BlockEntry entry) {
return (byte)method1790(1, entry);
}
private static final byte method1789(BZip2BlockEntry entry) {
return (byte)method1790(8, entry);
}
private static final int method1790(int i, BZip2BlockEntry entry) {
while(entry.anInt2232 < i) {
entry.anInt2207 = entry.anInt2207 << 8 | entry.aByteArray2224[entry.anInt2209] & 255;
entry.anInt2232 += 8;
++entry.anInt2209;
++entry.anInt2217;
}
int k = entry.anInt2207 >> entry.anInt2232 - i & (1 << i) - 1;
entry.anInt2232 -= i;
return k;
}
public static void clearBlockEntryInstance() {
entryInstance = null;
}
private static final void method1793(BZip2BlockEntry entry) {
int j8 = 0;
int[] ai = null;
int[] ai1 = null;
int[] ai2 = null;
entry.anInt2202 = 1;
if(anIntArray257 == null) {
anIntArray257 = new int[entry.anInt2202 * 100000];
}
boolean flag18 = true;
while(true) {
while(flag18) {
byte byte0 = method1789(entry);
if(byte0 == 23) {
return;
}
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1789(entry);
byte0 = method1788(entry);
entry.anInt2223 = 0;
byte0 = method1789(entry);
entry.anInt2223 = entry.anInt2223 << 8 | byte0 & 255;
byte0 = method1789(entry);
entry.anInt2223 = entry.anInt2223 << 8 | byte0 & 255;
byte0 = method1789(entry);
entry.anInt2223 = entry.anInt2223 << 8 | byte0 & 255;
int i4;
for(i4 = 0; i4 < 16; ++i4) {
byte var28 = method1788(entry);
if(var28 == 1) {
entry.aBooleanArray2205[i4] = true;
} else {
entry.aBooleanArray2205[i4] = false;
}
}
for(i4 = 0; i4 < 256; ++i4) {
entry.aBooleanArray2213[i4] = false;
}
int var341;
for(i4 = 0; i4 < 16; ++i4) {
if(entry.aBooleanArray2205[i4]) {
for(var341 = 0; var341 < 16; ++var341) {
byte var29 = method1788(entry);
if(var29 == 1) {
entry.aBooleanArray2213[i4 * 16 + var341] = true;
}
}
}
}
method1785(entry);
i4 = entry.anInt2215 + 2;
var341 = method1790(3, entry);
int var351 = method1790(15, entry);
int l4;
byte i5;
for(int abyte0 = 0; abyte0 < var351; ++abyte0) {
l4 = 0;
while(true) {
i5 = method1788(entry);
if(i5 == 0) {
entry.aByteArray2214[abyte0] = (byte)l4;
break;
}
++l4;
}
}
byte[] var30 = new byte[6];
byte j5;
for(j5 = 0; j5 < var341; var30[j5] = j5++) {
;
}
for(l4 = 0; l4 < var351; ++l4) {
i5 = entry.aByteArray2214[l4];
for(j5 = var30[i5]; i5 > 0; --i5) {
var30[i5] = var30[i5 - 1];
}
var30[0] = j5;
entry.aByteArray2219[l4] = j5;
}
int var32;
int var33;
for(l4 = 0; l4 < var341; ++l4) {
var32 = method1790(5, entry);
for(var33 = 0; var33 < i4; ++var33) {
while(true) {
byte var35 = method1788(entry);
if(var35 == 0) {
entry.aByteArrayArray2229[l4][var33] = (byte)var32;
break;
}
var35 = method1788(entry);
if(var35 == 0) {
++var32;
} else {
--var32;
}
}
}
}
int var36;
for(l4 = 0; l4 < var341; ++l4) {
i5 = 32;
j5 = 0;
for(var36 = 0; var36 < i4; ++var36) {
if(entry.aByteArrayArray2229[l4][var36] > j5) {
j5 = entry.aByteArrayArray2229[l4][var36];
}
if(entry.aByteArrayArray2229[l4][var36] < i5) {
i5 = entry.aByteArrayArray2229[l4][var36];
}
}
method1786(entry.anIntArrayArray2230[l4], entry.anIntArrayArray2218[l4], entry.anIntArrayArray2210[l4], entry.aByteArrayArray2229[l4], i5, j5, i4);
entry.anIntArray2200[l4] = i5;
}
l4 = entry.anInt2215 + 1;
var32 = -1;
byte var34 = 0;
for(var36 = 0; var36 <= 255; ++var36) {
entry.anIntArray2228[var36] = 0;
}
var36 = 4095;
int l5;
int l6;
for(l5 = 15; l5 >= 0; --l5) {
for(l6 = 15; l6 >= 0; --l6) {
entry.aByteArray2204[var36] = (byte)(l5 * 16 + l6);
--var36;
}
entry.anIntArray2226[l5] = var36 + 1;
}
l5 = 0;
if(var34 == 0) {
++var32;
var34 = 50;
byte k7 = entry.aByteArray2219[var32];
j8 = entry.anIntArray2200[k7];
ai = entry.anIntArrayArray2230[k7];
ai2 = entry.anIntArrayArray2210[k7];
ai1 = entry.anIntArrayArray2218[k7];
}
var33 = var34 - 1;
l6 = j8;
byte byte9;
int var37;
for(var37 = method1790(j8, entry); var37 > ai[l6]; var37 = var37 << 1 | byte9) {
++l6;
byte9 = method1788(entry);
}
int l2 = ai2[var37 - ai1[l6]];
while(true) {
while(l2 != l4) {
int var39;
byte j7;
int i8;
byte byte11;
int var38;
if(l2 != 0 && l2 != 1) {
var39 = l2 - 1;
byte var391;
if(var39 < 16) {
var38 = entry.anIntArray2226[0];
for(var391 = entry.aByteArray2204[var38 + var39]; var39 > 3; var39 -= 4) {
i8 = var38 + var39;
entry.aByteArray2204[i8] = entry.aByteArray2204[i8 - 1];
entry.aByteArray2204[i8 - 1] = entry.aByteArray2204[i8 - 2];
entry.aByteArray2204[i8 - 2] = entry.aByteArray2204[i8 - 3];
entry.aByteArray2204[i8 - 3] = entry.aByteArray2204[i8 - 4];
}
while(var39 > 0) {
entry.aByteArray2204[var38 + var39] = entry.aByteArray2204[var38 + var39 - 1];
--var39;
}
entry.aByteArray2204[var38] = var391;
} else {
var38 = var39 / 16;
i8 = var39 % 16;
int var40 = entry.anIntArray2226[var38] + i8;
for(var391 = entry.aByteArray2204[var40]; var40 > entry.anIntArray2226[var38]; --var40) {
entry.aByteArray2204[var40] = entry.aByteArray2204[var40 - 1];
}
++entry.anIntArray2226[var38];
while(var38 > 0) {
--entry.anIntArray2226[var38];
entry.aByteArray2204[entry.anIntArray2226[var38]] = entry.aByteArray2204[entry.anIntArray2226[var38 - 1] + 16 - 1];
--var38;
}
--entry.anIntArray2226[0];
entry.aByteArray2204[entry.anIntArray2226[0]] = var391;
if(entry.anIntArray2226[0] == 0) {
int l9 = 4095;
for(int j9 = 15; j9 >= 0; --j9) {
for(int k9 = 15; k9 >= 0; --k9) {
entry.aByteArray2204[l9] = entry.aByteArray2204[entry.anIntArray2226[j9] + k9];
--l9;
}
entry.anIntArray2226[j9] = l9 + 1;
}
}
}
++entry.anIntArray2228[entry.aByteArray2211[var391 & 255] & 255];
anIntArray257[l5] = entry.aByteArray2211[var391 & 255] & 255;
++l5;
if(var33 == 0) {
++var32;
var33 = 50;
j7 = entry.aByteArray2219[var32];
j8 = entry.anIntArray2200[j7];
ai = entry.anIntArrayArray2230[j7];
ai2 = entry.anIntArrayArray2210[j7];
ai1 = entry.anIntArrayArray2218[j7];
}
--var33;
var38 = j8;
for(i8 = method1790(j8, entry); i8 > ai[var38]; i8 = i8 << 1 | byte11) {
++var38;
byte11 = method1788(entry);
}
l2 = ai2[i8 - ai1[var38]];
} else {
var39 = -1;
int byte6 = 1;
do {
if(l2 == 0) {
var39 += byte6;
} else if(l2 == 1) {
var39 += 2 * byte6;
}
byte6 *= 2;
if(var33 == 0) {
++var32;
var33 = 50;
j7 = entry.aByteArray2219[var32];
j8 = entry.anIntArray2200[j7];
ai = entry.anIntArrayArray2230[j7];
ai2 = entry.anIntArrayArray2210[j7];
ai1 = entry.anIntArrayArray2218[j7];
}
--var33;
var38 = j8;
for(i8 = method1790(j8, entry); i8 > ai[var38]; i8 = i8 << 1 | byte11) {
++var38;
byte11 = method1788(entry);
}
l2 = ai2[i8 - ai1[var38]];
} while(l2 == 0 || l2 == 1);
++var39;
j7 = entry.aByteArray2211[entry.aByteArray2204[entry.anIntArray2226[0]] & 255];
for(entry.anIntArray2228[j7 & 255] += var39; var39 > 0; --var39) {
anIntArray257[l5] = j7 & 255;
++l5;
}
}
}
entry.anInt2222 = 0;
entry.aByte2201 = 0;
entry.anIntArray2220[0] = 0;
for(l2 = 1; l2 <= 256; ++l2) {
entry.anIntArray2220[l2] = entry.anIntArray2228[l2 - 1];
}
for(l2 = 1; l2 <= 256; ++l2) {
entry.anIntArray2220[l2] += entry.anIntArray2220[l2 - 1];
}
for(l2 = 0; l2 < l5; ++l2) {
byte var381 = (byte)(anIntArray257[l2] & 255);
anIntArray257[entry.anIntArray2220[var381 & 255]] |= l2 << 8;
++entry.anIntArray2220[var381 & 255];
}
entry.anInt2208 = anIntArray257[entry.anInt2223] >> 8;
entry.anInt2227 = 0;
entry.anInt2208 = anIntArray257[entry.anInt2208];
entry.anInt2221 = (byte)(entry.anInt2208 & 255);
entry.anInt2208 >>= 8;
++entry.anInt2227;
entry.anInt2225 = l5;
method1787(entry);
if(entry.anInt2227 == entry.anInt2225 + 1 && entry.anInt2222 == 0) {
flag18 = true;
break;
}
flag18 = false;
break;
}
}
return;
}
}
}
@@ -0,0 +1,22 @@
package com.alex.util.crc32;
import java.util.zip.CRC32;
public final class CRC32HGenerator {
public static final CRC32 CRC32Instance = new CRC32();
public static int getHash(byte[] data) {
return getHash(data, 0, data.length);
}
public static int getHash(byte[] data, int offset, int length) {
CRC32 var3 = CRC32Instance;
CRC32 var4 = CRC32Instance;
synchronized(CRC32Instance) {
CRC32Instance.update(data, offset, length);
int hash = (int)CRC32Instance.getValue();
CRC32Instance.reset();
return hash;
}
}
}
@@ -0,0 +1,22 @@
package com.alex.util.gzip;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;
public class GZipCompressor {
public static final byte[] compress(byte[] data) {
ByteArrayOutputStream compressedBytes = new ByteArrayOutputStream();
try {
GZIPOutputStream var3 = new GZIPOutputStream(compressedBytes);
var3.write(data);
var3.finish();
var3.close();
return compressedBytes.toByteArray();
} catch (IOException var31) {
var31.printStackTrace();
return null;
}
}
}
@@ -0,0 +1,30 @@
package com.alex.util.gzip;
import com.alex.io.Stream;
import java.util.zip.Inflater;
public class GZipDecompressor {
private static final Inflater inflaterInstance = new Inflater(true);
public static final boolean decompress(Stream stream, byte[] data) {
Inflater var2 = inflaterInstance;
Inflater var3 = inflaterInstance;
synchronized(inflaterInstance) {
if(stream.getBuffer()[stream.getOffset()] == 31 && stream.getBuffer()[stream.getOffset() + 1] == -117) {
try {
inflaterInstance.setInput(stream.getBuffer(), stream.getOffset() + 10, -stream.getOffset() - 18 + stream.getBuffer().length);
inflaterInstance.inflate(data);
} catch (Exception var5) {
inflaterInstance.reset();
return false;
}
inflaterInstance.reset();
return true;
} else {
return false;
}
}
}
}
@@ -0,0 +1,250 @@
package com.alex.util.whirlpool;
import java.util.Arrays;
public class Whirlpool {
public static final int DIGESTBITS = 512;
public static final int DIGESTBYTES = 64;
protected static final int R = 10;
private static final String sbox = "ᠣ웨螸Å㚦틵祯酒悼鮎ꌌ笵ᷠퟂ\u2e4b﹗ᕷ㟥\u9ff0䫚壉⤊놠殅ëµáƒ´ì¬¾Õ§\ue427䆋ê½é—˜ï¯®ç±¦\udd17äžžì¨\u00ad뼇굚茳挂ꩱ젙䧙\uf2e3守騦㊰\ue90fí–€ë»ã‘ˆï½ºéŸ\u2068\u1aae둔錢擱猒䀈ì¬\udba1贽需켫皂혛떯æ©ä—³ãƒ¯ã½•ꋪ斺⿀\ude1c\ufd4d鉵ڊ닦ฟ拔ꢖ暈╙葲㥌幸㢌톥\ue261댡鰞ä‡ï°„写æ´\ufadf縤㮫츑轎럫ã²é“·ë¤“ⳓ\ue76eìƒå™„義⪻셓\udc0b鵬ㅴ\uf646겉ᓡᘺ椉炶íƒ\u00ad챂颤⡜\uf886";
private static long[][] C = new long[8][256];
private static long[] rc = new long[11];
protected byte[] bitLength = new byte[32];
protected byte[] buffer = new byte[64];
protected int bufferBits = 0;
protected int bufferPos = 0;
protected long[] hash = new long[8];
protected long[] K = new long[8];
protected long[] L = new long[8];
protected long[] block = new long[8];
protected long[] state = new long[8];
static {
int r;
for(r = 0; r < 256; ++r) {
char var15 = "ᠣ웨螸Å㚦틵祯酒悼鮎ꌌ笵ᷠퟂ\u2e4b﹗ᕷ㟥\u9ff0䫚壉⤊놠殅ëµáƒ´ì¬¾Õ§\ue427䆋ê½é—˜ï¯®ç±¦\udd17äžžì¨\u00ad뼇굚茳挂ꩱ젙䧙\uf2e3守騦㊰\ue90fí–€ë»ã‘ˆï½ºéŸ\u2068\u1aae둔錢擱猒䀈ì¬\udba1贽需켫皂혛떯æ©ä—³ãƒ¯ã½•ꋪ斺⿀\ude1c\ufd4d鉵ڊ닦ฟ拔ꢖ暈╙葲㥌幸㢌톥\ue261댡鰞ä‡ï°„写æ´\ufadf縤㮫츑轎럫ã²é“·ë¤“ⳓ\ue76eìƒå™„義⪻셓\udc0b鵬ㅴ\uf646겉ᓡᘺ椉炶íƒ\u00ad챂颤⡜\uf886".charAt(r / 2);
long v1 = (r & 1) == 0?(long)(var15 >>> 8):(long)(var15 & 255);
long v2 = v1 << 1;
if(v2 >= 256L) {
v2 ^= 285L;
}
long v4 = v2 << 1;
if(v4 >= 256L) {
v4 ^= 285L;
}
long v5 = v4 ^ v1;
long v8 = v4 << 1;
if(v8 >= 256L) {
v8 ^= 285L;
}
long v9 = v8 ^ v1;
C[0][r] = v1 << 56 | v1 << 48 | v4 << 40 | v1 << 32 | v8 << 24 | v5 << 16 | v2 << 8 | v9;
for(int t = 1; t < 8; ++t) {
C[t][r] = C[t - 1][r] >>> 8 | C[t - 1][r] << 56;
}
}
rc[0] = 0L;
for(r = 1; r <= 10; ++r) {
int var151 = 8 * (r - 1);
rc[r] = C[0][var151] & -72057594037927936L ^ C[1][var151 + 1] & 71776119061217280L ^ C[2][var151 + 2] & 280375465082880L ^ C[3][var151 + 3] & 1095216660480L ^ C[4][var151 + 4] & 4278190080L ^ C[5][var151 + 5] & 16711680L ^ C[6][var151 + 6] & 65280L ^ C[7][var151 + 7] & 255L;
}
}
public static byte[] getHash(byte[] data, int off, int len) {
byte[] source;
if(off <= 0) {
source = data;
} else {
source = new byte[len];
for(int var6 = 0; var6 < len; ++var6) {
source[var6] = data[off + var6];
}
}
Whirlpool var61 = new Whirlpool();
var61.NESSIEinit();
var61.NESSIEadd(source, (long)(len * 8));
byte[] digest = new byte[64];
var61.NESSIEfinalize(digest);
return digest;
}
protected void processBuffer() {
int i = 0;
int i1;
for(i1 = 0; i < 8; i1 += 8) {
this.block[i] = (long)this.buffer[i1] << 56 ^ ((long)this.buffer[i1 + 1] & 255L) << 48 ^ ((long)this.buffer[i1 + 2] & 255L) << 40 ^ ((long)this.buffer[i1 + 3] & 255L) << 32 ^ ((long)this.buffer[i1 + 4] & 255L) << 24 ^ ((long)this.buffer[i1 + 5] & 255L) << 16 ^ ((long)this.buffer[i1 + 6] & 255L) << 8 ^ (long)this.buffer[i1 + 7] & 255L;
++i;
}
for(i = 0; i < 8; ++i) {
this.state[i] = this.block[i] ^ (this.K[i] = this.hash[i]);
}
for(i = 1; i <= 10; ++i) {
int t;
int s;
for(i1 = 0; i1 < 8; ++i1) {
this.L[i1] = 0L;
t = 0;
for(s = 56; t < 8; s -= 8) {
this.L[i1] ^= C[t][(int)(this.K[i1 - t & 7] >>> s) & 255];
++t;
}
}
for(i1 = 0; i1 < 8; ++i1) {
this.K[i1] = this.L[i1];
}
this.K[0] ^= rc[i];
for(i1 = 0; i1 < 8; ++i1) {
this.L[i1] = this.K[i1];
t = 0;
for(s = 56; t < 8; s -= 8) {
this.L[i1] ^= C[t][(int)(this.state[i1 - t & 7] >>> s) & 255];
++t;
}
}
for(i1 = 0; i1 < 8; ++i1) {
this.state[i1] = this.L[i1];
}
}
for(i = 0; i < 8; ++i) {
this.hash[i] ^= this.state[i] ^ this.block[i];
}
}
public void NESSIEinit() {
Arrays.fill(this.bitLength, (byte)0);
this.bufferBits = this.bufferPos = 0;
this.buffer[0] = 0;
Arrays.fill(this.hash, 0L);
}
public void NESSIEadd(byte[] source, long sourceBits) {
int sourcePos = 0;
int sourceGap = 8 - ((int)sourceBits & 7) & 7;
int bufferRem = this.bufferBits & 7;
long value = sourceBits;
int i = 31;
int b;
for(b = 0; i >= 0; --i) {
b += (this.bitLength[i] & 255) + ((int)value & 255);
this.bitLength[i] = (byte)b;
b >>>= 8;
value >>>= 8;
}
while(sourceBits > 8L) {
b = source[sourcePos] << sourceGap & 255 | (source[sourcePos + 1] & 255) >>> 8 - sourceGap;
if(b < 0 || b >= 256) {
throw new RuntimeException("LOGIC ERROR");
}
byte[] var10000 = this.buffer;
int var10001 = this.bufferPos++;
var10000[var10001] = (byte)(var10000[var10001] | b >>> bufferRem);
this.bufferBits += 8 - bufferRem;
if(this.bufferBits == 512) {
this.processBuffer();
this.bufferBits = this.bufferPos = 0;
}
this.buffer[this.bufferPos] = (byte)(b << 8 - bufferRem & 255);
this.bufferBits += bufferRem;
sourceBits -= 8L;
++sourcePos;
}
if(sourceBits > 0L) {
b = source[sourcePos] << sourceGap & 255;
this.buffer[this.bufferPos] = (byte)(this.buffer[this.bufferPos] | b >>> bufferRem);
} else {
b = 0;
}
if((long)bufferRem + sourceBits < 8L) {
this.bufferBits = (int)((long)this.bufferBits + sourceBits);
} else {
++this.bufferPos;
this.bufferBits += 8 - bufferRem;
sourceBits -= (long)(8 - bufferRem);
if(this.bufferBits == 512) {
this.processBuffer();
this.bufferBits = this.bufferPos = 0;
}
this.buffer[this.bufferPos] = (byte)(b << 8 - bufferRem & 255);
this.bufferBits += (int)sourceBits;
}
}
public void NESSIEfinalize(byte[] digest) {
this.buffer[this.bufferPos] = (byte)(this.buffer[this.bufferPos] | 128 >>> (this.bufferBits & 7));
++this.bufferPos;
if(this.bufferPos > 32) {
while(true) {
if(this.bufferPos >= 64) {
this.processBuffer();
this.bufferPos = 0;
break;
}
this.buffer[this.bufferPos++] = 0;
}
}
while(this.bufferPos < 32) {
this.buffer[this.bufferPos++] = 0;
}
System.arraycopy(this.bitLength, 0, this.buffer, 32, 32);
this.processBuffer();
int i = 0;
for(int j = 0; i < 8; j += 8) {
long h = this.hash[i];
digest[j] = (byte)((int)(h >>> 56));
digest[j + 1] = (byte)((int)(h >>> 48));
digest[j + 2] = (byte)((int)(h >>> 40));
digest[j + 3] = (byte)((int)(h >>> 32));
digest[j + 4] = (byte)((int)(h >>> 24));
digest[j + 5] = (byte)((int)(h >>> 16));
digest[j + 6] = (byte)((int)(h >>> 8));
digest[j + 7] = (byte)((int)h);
++i;
}
}
public void NESSIEadd(String source) {
if(source.length() > 0) {
byte[] data = new byte[source.length()];
for(int i = 0; i < source.length(); ++i) {
data[i] = (byte)source.charAt(i);
}
this.NESSIEadd(data, (long)(8 * data.length));
}
}
}
@@ -0,0 +1,20 @@
package com.alex.utils;
public final class Constants {
public static final int NO_COMPRESSION = 0;
public static final int BZIP2_COMPRESSION = 1;
public static final int GZIP_COMPRESSION = 2;
public static final int MAX_VALID_ARCHIVE_LENGTH = 1000000;
public static final int INTERFACE_DEFINITIONS_INDEX = 3;
public static final int MAPS_INDEX = 5;
public static final int MODELS_INDEX = 7;
public static final int SPRITES_INDEX = 8;
public static final int INDEXED_IMAGES_INDEX = 8;
public static final int OBJECTS_DEFINITIONS_INDEX = 18;
public static final int ITEM_DEFINITIONS_INDEX = 19;
public static final int LOADER_IMAGES_INDEX = 32;
public static final int LOADER_INDEXED_IMAGES_INDEX = 34;
public static final int CLIENT_BUILD = 562;
public static final boolean ENCRYPTED_CACHE = true;
public static final int NPC_DEFINITIONS_INDEX = 18;
}
@@ -0,0 +1,73 @@
package com.alex.utils;
import com.alex.io.OutputStream;
import com.alex.store.Store;
import java.math.BigInteger;
public final class Utils {
public static byte[] cryptRSA(byte[] data, BigInteger exponent, BigInteger modulus) {
return (new BigInteger(data)).modPow(exponent, modulus).toByteArray();
}
public static byte[] getArchivePacketData(int indexId, int archiveId, byte[] archive) {
OutputStream stream = new OutputStream(archive.length + 4);
stream.writeByte(indexId);
stream.writeShort(archiveId);
stream.writeByte(0);
stream.writeInt(archive.length);
int offset = 8;
for(int var6 = 0; var6 < archive.length; ++var6) {
if(offset == 512) {
stream.writeByte(-1);
offset = 1;
}
stream.writeByte(archive[var6]);
++offset;
}
byte[] var61 = new byte[stream.getOffset()];
stream.setOffset(0);
stream.getBytes(var61, 0, var61.length);
return var61;
}
public static int getNameHash(String name) {
return name.toLowerCase().hashCode();
}
public static final int getInterfaceDefinitionsSize(Store store) {
return store.getIndexes()[3].getLastArchiveId() + 1;
}
public static final int getInterfaceDefinitionsComponentsSize(Store store, int interfaceId) {
return store.getIndexes()[3].getLastFileId(interfaceId) + 1;
}
public static final int getAnimationDefinitionsSize(Store store) {
int lastArchiveId = store.getIndexes()[20].getLastArchiveId();
return lastArchiveId * 128 + store.getIndexes()[20].getValidFilesCount(lastArchiveId);
}
public static final int getItemDefinitionsSize(Store store) {
int lastArchiveId = store.getIndexes()[19].getLastArchiveId();
return lastArchiveId * 256 + store.getIndexes()[19].getValidFilesCount(lastArchiveId);
}
public static int getNPCDefinitionsSize(Store store) {
int lastArchiveId = store.getIndexes()[18].getLastArchiveId();
return lastArchiveId * 128 + store.getIndexes()[18].getValidFilesCount(lastArchiveId);
}
public static final int getObjectDefinitionsSize(Store store) {
int lastArchiveId = store.getIndexes()[16].getLastArchiveId();
return lastArchiveId * 256 + store.getIndexes()[16].getValidFilesCount(lastArchiveId);
}
public static final int getGraphicDefinitionsSize(Store store) {
int lastArchiveId = store.getIndexes()[21].getLastArchiveId();
return lastArchiveId * 256 + store.getIndexes()[21].getValidFilesCount(lastArchiveId);
}
}
@@ -0,0 +1,108 @@
package com.editor;
import com.editor.Main;
import javax.swing.GroupLayout.Alignment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class Console extends JFrame {
private static final long serialVersionUID = -4693540915136770583L;
private JMenu jMenu1;
private JMenuBar jMenuBar1;
private JMenuItem jMenuItem1;
private JMenuItem jMenuItem2;
private JScrollPane jScrollPane1;
public static JTextArea output;
public Console() {
this.setTitle("Console");
this.setResizable(false);
this.setDefaultCloseOperation(0);
this.setLocationRelativeTo((Component)null);
this.initComponents();
Main.log("Console", "Console Started.");
}
private void initComponents() {
this.jScrollPane1 = new JScrollPane();
output = new JTextArea();
this.jMenuBar1 = new JMenuBar();
this.jMenu1 = new JMenu();
this.jMenuItem1 = new JMenuItem();
this.jMenuItem2 = new JMenuItem();
this.setDefaultCloseOperation(3);
output.setEditable(false);
output.setColumns(20);
output.setLineWrap(true);
output.setRows(5);
this.jScrollPane1.setViewportView(output);
this.jMenu1.setText("File");
this.jMenuItem1.setText("Close Console");
this.jMenuItem1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Console.this.jMenuItem1ActionPerformed(evt);
}
});
this.jMenu1.add(this.jMenuItem1);
this.jMenuItem2.setText("Exit Program");
this.jMenuItem2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Console.this.jMenuItem2ActionPerformed(evt);
}
});
this.jMenu1.add(this.jMenuItem2);
this.jMenuBar1.add(this.jMenu1);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.jScrollPane1, -1, 618, 32767));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.jScrollPane1, -1, 240, 32767));
this.pack();
}
private void jMenuItem2ActionPerformed(ActionEvent evt) {
System.exit(0);
}
private void jMenuItem1ActionPerformed(ActionEvent evt) {
this.dispose();
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
(new Console()).setVisible(true);
}
});
}
private static void updateTextArea(final String text) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Console.output.append(text);
}
});
}
public static void redirectSystemStreams() {
OutputStream out = new OutputStream() {
public void write(int b) throws IOException {
Console.updateTextArea(String.valueOf((char)b));
}
public void write(byte[] b, int off, int len) throws IOException {
Console.updateTextArea(new String(b, off, len));
}
public void write(byte[] b) throws IOException {
this.write(b, 0, b.length);
}
};
System.setOut(new PrintStream(out, true));
System.setErr(new PrintStream(out, true));
}
}
@@ -0,0 +1,52 @@
package com.editor;
import com.editor.Console;
import com.editor.ToolSelection;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
public class Main {
public static void main(String[] args) {
Console.redirectSystemStreams();
(new Console()).setVisible(true);
(new ToolSelection()).setVisible(true);
log("Main", "Frosty's Cache Editor");
log("Main", "Edited to support the #562 revision by Jens.");
}
public static void log(String className, String message) {
System.out.println("[" + className + "]: " + message);
printDebug(className, message);
}
private static void printDebug(String className, String message) {
File f = new File(System.getProperty("user.home") + "/FCE/logs/");
File f1 = new File(System.getProperty("user.home") + "/FCE/logs/" + 2 + 5 + 1 + 11 + ".txt");
f.mkdirs();
try {
f1.createNewFile();
} catch (IOException var10) {
log("Main", "Could not create log file.");
}
String strFilePath = System.getProperty("user.home") + "/FCE/logs/" + 2 + 5 + 1 + 11 + ".txt";
try {
FileOutputStream var9 = new FileOutputStream(strFilePath, true);
String strContent = new Date() + ": [" + className + "]: " + message;
String lineSep = System.getProperty("line.separator");
var9.write(strContent.getBytes());
var9.write(lineSep.getBytes());
} catch (FileNotFoundException var8) {
log("Main", "FileNotFoundException : " + var8);
} catch (IOException var91) {
log("Main", "IOException : " + var91);
}
}
}
@@ -0,0 +1,167 @@
package com.editor;
import com.editor.Main;
import com.editor.item.ItemDefDump;
import com.editor.item.ItemSelection;
import com.editor.model.MultiModelPacker;
import com.editor.model.UniModelDumper;
import com.editor.npc.NPCDefDump;
import com.editor.npc.NPCSelection;
import com.editor.object.ObjectSelection;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
public class ToolSelection extends JFrame {
private static final long serialVersionUID = 2024943190858205332L;
private String cache;
private JLabel jLabel1;
private JMenu jMenu1;
private JMenuBar jMenuBar1;
private JMenuItem loadCacheButton;
private JMenuItem exitButton;
private JComboBox selectionBox;
private JButton submitButton;
public ToolSelection() {
this.setTitle("Tool Selection");
this.setResizable(false);
this.setDefaultCloseOperation(3);
this.setLocationRelativeTo((Component)null);
this.initComponents();
Main.log("Main", "ToolSelection Started");
}
private void initComponents() {
this.jLabel1 = new JLabel();
this.selectionBox = new JComboBox();
this.submitButton = new JButton();
this.jMenuBar1 = new JMenuBar();
this.jMenu1 = new JMenu();
this.loadCacheButton = new JMenuItem();
this.exitButton = new JMenuItem();
this.setDefaultCloseOperation(3);
this.jLabel1.setText("Select Your Editor:");
this.selectionBox.setModel(new DefaultComboBoxModel(new String[]{"Items", "NPCs", "Objects", "ItemDefDump", "NPCDefDump", "MultiModelPacker", "MultiItemPacker", "MultiNPCPacker", "UniModelDumper"}));
this.submitButton.setText("Submit");
this.submitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ToolSelection.this.submitButtonActionPerformed(evt);
}
});
this.jMenu1.setText("File");
this.loadCacheButton.setText("Load Cache");
this.loadCacheButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ToolSelection.this.jMenuItem1ActionPerformed(evt);
}
});
this.jMenu1.add(this.loadCacheButton);
this.exitButton.setText("Exit Program");
this.exitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ToolSelection.this.exitButtonActionPerformed(evt);
}
});
this.jMenu1.add(this.exitButton);
this.jMenuBar1.add(this.jMenu1);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(77, 77, 77).addGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.submitButton).addComponent(this.selectionBox, -2, -1, -2)).addContainerGap(-1, 32767)).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(62, 32767).addComponent(this.jLabel1).addGap(58, 58, 58)));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap(50, 32767).addComponent(this.jLabel1).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.selectionBox, -2, -1, -2).addGap(44, 44, 44).addComponent(this.submitButton).addGap(38, 38, 38)));
this.pack();
}
private void submitButtonActionPerformed(ActionEvent evt) {
if(this.selectionBox.getSelectedIndex() == 0) {
try {
(new ItemSelection(this.cache)).setVisible(true);
Main.log("ToolSelection", "ItemSelection Started");
} catch (IOException var4) {
Main.log("ToolSelection", "No Cache Set!");
}
} else if(this.selectionBox.getSelectedIndex() == 1) {
try {
(new NPCSelection(this.cache)).setVisible(true);
Main.log("ToolSelection", "NPCSelection Started");
} catch (IOException var3) {
Main.log("ToolSelection", "No Cache Set!");
}
} else if(this.selectionBox.getSelectedIndex() == 2) {
try {
(new ObjectSelection(this.cache)).setVisible(true);
Main.log("ToolSelection", "ObjectSelection Started");
} catch (IOException var2) {
Main.log("ToolSelection", "No Cache Set!");
}
} else if(this.selectionBox.getSelectedIndex() == 3) {
Main.log("ToolSelection", "Item Def Dumping Started");
EventQueue.invokeLater(new Runnable() {
public void run() {
ItemDefDump.editorDump(ToolSelection.this.cache);
}
});
} else if(this.selectionBox.getSelectedIndex() == 4) {
Main.log("ToolSelection", "NPC Def Dumping Started");
EventQueue.invokeLater(new Runnable() {
public void run() {
NPCDefDump.editorDump(ToolSelection.this.cache);
}
});
} else if(this.selectionBox.getSelectedIndex() == 5) {
Main.log("ToolSelection", "MultiModelPacker Started");
EventQueue.invokeLater(new Runnable() {
public void run() {
new MultiModelPacker(ToolSelection.this.cache);
}
});
} else if(this.selectionBox.getSelectedIndex() == 6) {
Main.log("ToolSelection", "MultiNPCPacker is not working at the moment.");
} else if(this.selectionBox.getSelectedIndex() == 8) {
Main.log("ToolSelection", "UniModelDumper Started");
EventQueue.invokeLater(new Runnable() {
public void run() {
new UniModelDumper(ToolSelection.this.cache);
}
});
} else {
Main.log("ToolSelection", "No Tool Selected!");
}
}
private void jMenuItem1ActionPerformed(ActionEvent evt) {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(1);
if(evt.getSource() == this.loadCacheButton) {
int returnVal = fc.showOpenDialog(this);
if(returnVal == 0) {
File file = fc.getSelectedFile();
this.cache = file.getPath() + "/";
}
}
}
private void exitButtonActionPerformed(ActionEvent evt) {
JDialog.setDefaultLookAndFeelDecorated(true);
int response = JOptionPane.showConfirmDialog((Component)null, "Do you want to continue?", "Confirm", 0, 3);
if(response == 0) {
System.exit(0);
}
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
(new ToolSelection()).setVisible(true);
}
});
}
}
@@ -0,0 +1,51 @@
package com.editor;
import com.alex.store.Store;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class Utils {
public static byte[] getBytesFromFile(File file) throws IOException {
FileInputStream is = new FileInputStream(file);
long length = file.length();
if(length > 2147483647L) {
;
}
byte[] bytes = new byte[(int)length];
int offset = 0;
int numRead1;
for(boolean numRead = false; offset < bytes.length && (numRead1 = is.read(bytes, offset, bytes.length - offset)) >= 0; offset += numRead1) {
;
}
if(offset < bytes.length) {
throw new IOException("Could not completely read file " + file.getName());
} else {
is.close();
return bytes;
}
}
public static int packCustomModel(Store cache, byte[] data) {
int archiveId = cache.getIndexes()[7].getLastArchiveId() + 1;
if(cache.getIndexes()[7].putFile(archiveId, 0, data)) {
return archiveId;
} else {
System.out.println("Failed packing model " + archiveId);
return -1;
}
}
public static int packCustomModel(Store cache, byte[] data, int modelId) {
if(cache.getIndexes()[7].putFile(modelId, 0, data)) {
return modelId;
} else {
System.out.println("Failed packing model " + modelId);
return -1;
}
}
}
@@ -0,0 +1,418 @@
package com.editor.item;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.store.Store;
import com.alex.utils.Utils;
import com.editor.Main;
import java.util.Iterator;
public class ItemDefDump {
private static ItemDefinitions defs;
private static Store STORE;
public static void main(String[] args) {
try {
STORE = new Store("C:/Users/yvonne å christer/Dropbox/FCE/ItemDefDump/");
} catch (IOException var2) {
System.out.println("Cannot find cache location");
}
int id;
if(Utils.getItemDefinitionsSize(STORE) > 30000) {
for(id = 0; id < Utils.getItemDefinitionsSize(STORE) - 22314; ++id) {
defs = ItemDefinitions.getItemDefinition(STORE, id);
dump();
Main.log("ItemDefDump", "Dumping Item " + defs.id);
}
} else {
for(id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
defs = ItemDefinitions.getItemDefinition(STORE, id);
dump();
Main.log("ItemDefDump", "Dumping Item " + defs.id);
}
}
}
public static void editorDump(String cache) {
try {
STORE = new Store(cache);
} catch (IOException var2) {
Main.log("ItemDefDump", "Cannot find cache location");
}
int id;
if(Utils.getItemDefinitionsSize(STORE) > 30000) {
for(id = 0; id < Utils.getItemDefinitionsSize(STORE) - 22314; ++id) {
defs = ItemDefinitions.getItemDefinition(STORE, id);
dump();
Main.log("ItemDefDump", "Dumping Item " + defs.id);
}
} else {
for(id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
defs = ItemDefinitions.getItemDefinition(STORE, id);
dump();
Main.log("ItemDefDump", "Dumping Item " + defs.id);
}
}
}
public static void dump() {
File f = new File(System.getProperty("user.home") + "/FCE/items/");
f.mkdirs();
String lineSep = System.getProperty("line.separator");
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(System.getProperty("user.home") + "/FCE/items/" + defs.id + ".txt"), "utf-8"));
writer.write("name = " + defs.getName());
writer.write(lineSep);
writer.write("value = " + defs.getValue());
writer.write(lineSep);
writer.write("team id = " + defs.getTeamId());
writer.write(lineSep);
writer.write("members only = " + String.valueOf(defs.isMembersOnly()));
writer.write(lineSep);
writer.write("equip slot = " + defs.getEquipSlot());
writer.write(lineSep);
writer.write("equip type = " + defs.getEquipType());
writer.write(lineSep);
writer.write("stack ids = " + getStackIDs());
writer.write(lineSep);
writer.write("stack amounts = " + getStackAmts());
writer.write(lineSep);
writer.write("stackable = " + defs.getStackable());
writer.write(lineSep);
writer.write("inv model zoom = " + defs.getInvModelZoom());
writer.write(lineSep);
writer.write("model rotation 1 = " + defs.getModelRotation1());
writer.write(lineSep);
writer.write("model rotation 2 = " + defs.getModelRotation2());
writer.write(lineSep);
writer.write("model offset 1 = " + defs.getModelOffset1());
writer.write(lineSep);
writer.write("model offset 2 = " + defs.getModelOffset2());
writer.write(lineSep);
writer.write("inv model id = " + defs.getInvModelId());
writer.write(lineSep);
writer.write("male equip model id 1 = " + defs.getMaleEquipModelId1());
writer.write(lineSep);
writer.write("female equip model id 1 = " + defs.getFemaleEquipModelId1());
writer.write(lineSep);
writer.write("male equip model id 2 = " + defs.getMaleEquipModelId2());
writer.write(lineSep);
writer.write("female equip model id 2 = " + defs.getFemaleEquipModelId2());
writer.write(lineSep);
writer.write("male equip model id 3 = " + defs.getMaleEquipModelId3());
writer.write(lineSep);
writer.write("female equip model id 3 = " + defs.getFemaleEquipModelId3());
writer.write(lineSep);
writer.write("inventory options = " + getInventoryOpts());
writer.write(lineSep);
writer.write("ground options = " + getGroundOpts());
writer.write(lineSep);
writer.write("changed model colors = " + getChangedModelColors());
writer.write(lineSep);
writer.write("changed texture colors = " + getChangedTextureColors());
writer.write(lineSep);
writer.write("switch note item id = " + defs.switchNoteItemId);
writer.write(lineSep);
writer.write("noted item id = " + defs.notedItemId);
writer.write(lineSep);
writer.write("unnoted = " + String.valueOf(defs.isUnnoted()));
writer.write(lineSep);
writer.write("switch lend item id = " + defs.getSwitchLendItemId());
writer.write(lineSep);
writer.write("lended item id = " + defs.getLendedItemId());
writer.write(lineSep);
writer.write("unknownArray1 = " + getUnknownArray1());
writer.write(lineSep);
writer.write("unknownArray2 = " + getUnknownArray2());
writer.write(lineSep);
writer.write("unknownArray3 = " + getUnknownArray3());
writer.write(lineSep);
writer.write("unknownArray4 = " + getUnknownArray4());
writer.write(lineSep);
writer.write("unknownArray5 = " + getUnknownArray5());
writer.write(lineSep);
writer.write("unknownArray6 = " + getUnknownArray6());
writer.write(lineSep);
writer.write("unknownInt1 = " + defs.unknownInt1);
writer.write(lineSep);
writer.write("unknownInt2 = " + defs.unknownInt2);
writer.write(lineSep);
writer.write("unknownInt3 = " + defs.unknownInt3);
writer.write(lineSep);
writer.write("unknownInt4 = " + defs.unknownInt4);
writer.write(lineSep);
writer.write("unknownInt5 = " + defs.unknownInt5);
writer.write(lineSep);
writer.write("unknownInt6 = " + defs.unknownInt6);
writer.write(lineSep);
writer.write("unknownInt7 = " + defs.unknownInt7);
writer.write(lineSep);
writer.write("unknownInt8 = " + defs.unknownInt8);
writer.write(lineSep);
writer.write("unknownInt9 = " + defs.unknownInt9);
writer.write(lineSep);
writer.write("unknownInt10 = " + defs.unknownInt10);
writer.write(lineSep);
writer.write("unknownInt11 = " + defs.unknownInt11);
writer.write(lineSep);
writer.write("unknownInt12 = " + defs.unknownInt12);
writer.write(lineSep);
writer.write("unknownInt13 = " + defs.unknownInt13);
writer.write(lineSep);
writer.write("unknownInt14 = " + defs.unknownInt14);
writer.write(lineSep);
writer.write("unknownInt15 = " + defs.unknownInt15);
writer.write(lineSep);
writer.write("unknownInt16 = " + defs.unknownInt16);
writer.write(lineSep);
writer.write("unknownInt17 = " + defs.unknownInt17);
writer.write(lineSep);
writer.write("unknownInt18 = " + defs.unknownInt18);
writer.write(lineSep);
writer.write("unknownInt19 = " + defs.unknownInt19);
writer.write(lineSep);
writer.write("unknownInt20 = " + defs.unknownInt20);
writer.write(lineSep);
writer.write("unknownInt21 = " + defs.unknownInt21);
writer.write(lineSep);
writer.write("unknownInt22 = " + defs.unknownInt22);
writer.write(lineSep);
writer.write("unknownInt23 = " + defs.unknownInt23);
writer.write(lineSep);
writer.write("Clientscripts");
writer.write(lineSep);
if(defs.clientScriptData != null) {
Iterator var14 = defs.clientScriptData.keySet().iterator();
while(var14.hasNext()) {
int key = ((Integer)var14.next()).intValue();
Object value = defs.clientScriptData.get(Integer.valueOf(key));
writer.write("KEY: " + key + ", VALUE: " + value);
writer.write(lineSep);
}
}
} catch (IOException var141) {
Main.log("ItemEditor", "Failed to export Item Defs to .txt");
} finally {
try {
writer.close();
} catch (Exception var13) {
;
}
}
}
public static String getInventoryOpts() {
String text = "";
String[] arr$ = defs.getInventoryOptions();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
String option = arr$[i$];
text = text + (option == null?"null":option) + ";";
}
return text;
}
public static String getGroundOpts() {
String text = "";
String[] arr$ = defs.getGroundOptions();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
String option = arr$[i$];
text = text + (option == null?"null":option) + ";";
}
return text;
}
public static String getChangedModelColors() {
String text = "";
if(defs.originalModelColors != null) {
for(int i = 0; i < defs.originalModelColors.length; ++i) {
text = text + defs.originalModelColors[i] + "=" + defs.modifiedModelColors[i] + ";";
}
}
return text;
}
public static String getChangedTextureColors() {
String text = "";
if(defs.originalTextureColors != null) {
for(int i = 0; i < defs.originalTextureColors.length; ++i) {
text = text + defs.originalTextureColors[i] + "=" + defs.modifiedTextureColors[i] + ";";
}
}
return text;
}
public static String getStackIDs() {
String text = "";
try {
int[] e = defs.getStackIds();
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getClientScripts() {
String text = "";
String lineSep = System.getProperty("line.separator");
if(defs.clientScriptData != null) {
for(Iterator i$ = defs.clientScriptData.keySet().iterator(); i$.hasNext(); text = text + lineSep) {
int key = ((Integer)i$.next()).intValue();
Object value = defs.clientScriptData.get(Integer.valueOf(key));
text = text + "KEY: " + key + ", VALUE: " + value;
}
}
return text;
}
public static String getStackAmts() {
String text = "";
try {
int[] e = defs.getStackAmounts();
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray1() {
String text = "";
try {
byte[] e = defs.unknownArray1;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
byte index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray2() {
String text = "";
try {
int[] e = defs.unknownArray2;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray3() {
String text = "";
try {
byte[] e = defs.unknownArray3;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
byte index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray4() {
String text = "";
try {
int[] e = defs.unknownArray4;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray5() {
String text = "";
try {
int[] e = defs.unknownArray5;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray6() {
String text = "";
try {
byte[] e = defs.unknownArray6;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
byte index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,57 @@
package com.editor.item;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.store.Store;
import com.alex.utils.Utils;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class ItemListDumper {
private static Store STORE;
public static void main(String[] args) {
try {
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
new ItemListDumper();
} catch (IOException var2) {
var2.printStackTrace();
}
}
public ItemListDumper() throws IOException {
File file = new File("C:/Users/Travis/Documents/781 ItemList.txt");
if(file.exists()) {
file.delete();
} else {
file.createNewFile();
}
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.append("//Version = 781\n");
writer.flush();
for(int id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
ItemDefinitions def = ItemDefinitions.getItemDefinition(STORE, id);
if(!def.getName().equals("null")) {
writer.append(id + " - " + def.getName());
writer.newLine();
writer.flush();
}
}
writer.close();
}
public static int convertInt(String str) {
try {
int var2 = Integer.parseInt(str);
return var2;
} catch (NumberFormatException var21) {
return 0;
}
}
}
@@ -0,0 +1,198 @@
package com.editor.item;
import com.alex.loaders.items.ItemDefinitions;
import com.alex.store.Store;
import com.alex.utils.Utils;
import com.editor.Main;
import com.editor.item.ItemEditor;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
public class ItemSelection extends JFrame {
private static final long serialVersionUID = -3059309913196024742L;
public static Store STORE;
private JButton addButton;
private JButton duplicateButton;
private JButton editButton;
private DefaultListModel itemsListmodel;
private JList itemsList;
private JMenu jMenu1;
private JMenuBar jMenuBar1;
private JMenuItem exitButton;
private JButton deleteButton;
public ItemSelection(String cache) throws IOException {
STORE = new Store(cache);
this.setTitle("Item Selection");
this.setResizable(false);
this.setDefaultCloseOperation(1);
this.setLocationRelativeTo((Component)null);
this.initComponents();
}
public ItemSelection() {
this.initComponents();
}
private void initComponents() {
this.editButton = new JButton();
this.addButton = new JButton();
this.duplicateButton = new JButton();
this.deleteButton = new JButton();
this.jMenuBar1 = new JMenuBar();
this.jMenu1 = new JMenu();
this.exitButton = new JMenuItem();
this.setDefaultCloseOperation(1);
this.itemsListmodel = new DefaultListModel();
this.itemsList = new JList(this.itemsListmodel);
this.itemsList.setSelectionMode(1);
this.itemsList.setLayoutOrientation(0);
this.itemsList.setVisibleRowCount(-1);
JScrollPane jScrollPane1 = new JScrollPane(this.itemsList);
this.editButton.setText("Edit");
this.editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefinitions defs = (ItemDefinitions)ItemSelection.this.itemsList.getSelectedValue();
if(defs != null) {
new ItemEditor(ItemSelection.this, defs);
}
}
});
this.addButton.setText("Add New");
this.addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefinitions defs = new ItemDefinitions(ItemSelection.STORE, ItemSelection.this.getNewItemID(), false);
if(defs != null && defs.id != -1) {
new ItemEditor(ItemSelection.this, defs);
}
}
});
this.duplicateButton.setText("Duplicate");
this.duplicateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefinitions defs = (ItemDefinitions)ItemSelection.this.itemsList.getSelectedValue();
if(defs != null) {
defs = (ItemDefinitions)defs.clone();
if(defs != null) {
defs.id = ItemSelection.this.getNewItemID();
if(defs.id != -1) {
new ItemEditor(ItemSelection.this, defs);
}
}
}
}
});
this.deleteButton.setText("Delete");
this.deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ItemDefinitions defs = (ItemDefinitions)ItemSelection.this.itemsList.getSelectedValue();
JFrame frame = new JFrame();
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete item " + defs.id);
if(result == 0) {
if(defs == null) {
return;
}
ItemSelection.STORE.getIndexes()[19].removeFile(defs.getArchiveId(), defs.getFileId());
ItemSelection.this.removeItemDefs(defs);
Main.log("ItemSelection", "Item " + defs.id + " removed.");
}
}
});
this.jMenu1.setText("File");
this.exitButton.setText("Close");
this.exitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ItemSelection.this.exitButtonActionPerformed(evt);
}
});
this.jMenu1.add(this.exitButton);
this.jMenuBar1.add(this.jMenu1);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(jScrollPane1, -2, 200, -2).addGroup(layout.createSequentialGroup().addComponent(this.editButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.addButton))).addGap(0, 0, 32767)).addGroup(layout.createSequentialGroup().addComponent(this.duplicateButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.deleteButton))).addContainerGap(-1, 32767)));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, -2, 279, -2).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.editButton).addComponent(this.addButton)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.duplicateButton).addComponent(this.deleteButton)).addContainerGap(-1, 32767)));
this.pack();
this.addAllItems();
}
public static void main(String[] args) throws IOException {
STORE = new Store("cache/", false);
EventQueue.invokeLater(new Runnable() {
public void run() {
(new ItemSelection()).setVisible(true);
}
});
}
private void exitButtonActionPerformed(ActionEvent evt) {
this.dispose();
}
public int getNewItemID() {
try {
JFrame var3 = new JFrame();
String parent1 = JOptionPane.showInputDialog(var3, "Enter new Item ID:");
return Integer.parseInt(parent1.toString());
} catch (Exception var31) {
JFrame parent = new JFrame();
JOptionPane.showMessageDialog(parent, "Please enter a valid integer!");
Main.log("ItemSelection", "Non-valid character entered for new Item ID");
return -1;
}
}
public void addAllItems() {
int id;
if(Utils.getItemDefinitionsSize(STORE) > 30000) {
for(id = 0; id < Utils.getItemDefinitionsSize(STORE) - 22314; ++id) {
this.addItemDefs(ItemDefinitions.getItemDefinition(STORE, id));
}
} else {
for(id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
this.addItemDefs(ItemDefinitions.getItemDefinition(STORE, id));
}
}
Main.log("ItemSelection", "All Items Loaded");
}
public void addItemDefs(final ItemDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
ItemSelection.this.itemsListmodel.addElement(defs);
}
});
}
public void updateItemDefs(final ItemDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
int index = ItemSelection.this.itemsListmodel.indexOf(defs);
if(index == -1) {
ItemSelection.this.itemsListmodel.addElement(defs);
} else {
ItemSelection.this.itemsListmodel.setElementAt(defs, index);
}
}
});
}
public void removeItemDefs(final ItemDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
ItemSelection.this.itemsListmodel.removeElement(defs);
}
});
}
}
@@ -0,0 +1,36 @@
package com.editor.model;
import com.alex.store.Index;
import com.alex.store.Store;
import java.io.FileOutputStream;
import java.io.IOException;
public class ModelDumper {
private static Store STORE;
public static void main(String[] args) throws IOException {
try {
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
} catch (Exception var4) {
;
}
Index index = STORE.getIndexes()[7];
System.out.println(index.getLastArchiveId());
for(int i = 0; i < index.getLastArchiveId(); ++i) {
byte[] data = index.getFile(i);
if(data != null) {
writeFile(data, "C:/Users/Travis/Documents/781 Models/" + i + ".dat");
}
}
}
public static void writeFile(byte[] data, String fileName) throws IOException {
FileOutputStream out = new FileOutputStream(fileName);
out.write(data);
out.close();
}
}
@@ -0,0 +1,182 @@
package com.editor.model;
import com.alex.store.Store;
import com.editor.Main;
import com.editor.Utils;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.UIManager.LookAndFeelInfo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class MultiModelPacker extends JFrame {
private static final long serialVersionUID = -1984870962939167633L;
private static Store STORE;
private JMenuItem exit;
private JLabel jLabel1;
private JLabel jLabel2;
private JMenu jMenu1;
private JMenuBar jMenuBar1;
private JMenuItem modelDir;
private JTextField modelDirField;
private JCheckBox sameId;
private JButton submit;
public MultiModelPacker() {
this.initComponents();
}
public MultiModelPacker(String cache) {
try {
STORE = new Store(cache);
} catch (Exception var3) {
Main.log("MultiModelPacker", "Cannot find cache directory");
}
this.initComponents();
this.setResizable(false);
this.setTitle("MultiModelPacker");
this.setDefaultCloseOperation(1);
this.setLocationRelativeTo((Component)null);
this.setVisible(true);
}
private void initComponents() {
this.jLabel1 = new JLabel();
this.jLabel2 = new JLabel();
this.modelDirField = new JTextField();
this.sameId = new JCheckBox();
this.submit = new JButton();
this.jMenuBar1 = new JMenuBar();
this.jMenu1 = new JMenu();
this.modelDir = new JMenuItem();
this.exit = new JMenuItem();
this.setDefaultCloseOperation(3);
this.jLabel1.setText("Multiple Model Packer");
this.jLabel2.setText("Models Directory");
this.sameId.setText("Keep Same ID");
this.sameId.setToolTipText("Keeps same ID as named");
this.submit.setText("Submit");
this.submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
MultiModelPacker.this.submitActionPerformed(evt);
}
});
this.jMenu1.setText("File");
this.modelDir.setText("Choose Model Dir");
this.modelDir.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
MultiModelPacker.this.modelDirActionPerformed(evt);
}
});
this.jMenu1.add(this.modelDir);
this.exit.setText("Exit");
this.exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
MultiModelPacker.this.exitActionPerformed(evt);
}
});
this.jMenu1.add(this.exit);
this.jMenuBar1.add(this.jMenu1);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.modelDirField).addContainerGap()).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED, 4, -2).addComponent(this.jLabel2)).addComponent(this.sameId))).addGroup(layout.createSequentialGroup().addGap(77, 77, 77).addComponent(this.jLabel1)).addGroup(layout.createSequentialGroup().addGap(101, 101, 101).addComponent(this.submit))).addGap(0, 76, 32767)));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.jLabel1).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.jLabel2).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.modelDirField, -2, -1, -2).addGap(18, 18, 18).addComponent(this.sameId).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.submit).addContainerGap(20, 32767)));
this.pack();
}
private void submitActionPerformed(ActionEvent evt) {
String directory = this.modelDirField.getText();
boolean keepID = this.sameId.isSelected();
String fileName;
if(keepID) {
fileName = "";
String var12 = "";
File var13 = new File(directory);
File[] var14 = var13.listFiles();
for(int var10 = 0; var10 < var14.length; ++var10) {
if(var14[var10].isFile()) {
System.out.println(var14[var10]);
fileName = var14[var10].getName();
var12 = var14[var10].getName().replace(".dat", "");
try {
Main.log("MultiModelPacker", "The model ID of " + fileName + " is: " + Utils.packCustomModel(STORE, Utils.getBytesFromFile(var14[var10]), Integer.parseInt(var12)));
} catch (IOException var11) {
Main.log("MultiModelPacker", "There was an error packing the model.");
}
}
}
} else {
fileName = "";
File var121 = new File(directory);
File[] var131 = var121.listFiles();
for(int var141 = 0; var141 < var131.length; ++var141) {
if(var131[var141].isFile()) {
fileName = var131[var141].getName();
try {
Main.log("MultiModelPacker", "The model ID of " + fileName + " is: " + Utils.packCustomModel(STORE, Utils.getBytesFromFile(var131[var141])));
} catch (IOException var101) {
Main.log("MultiModelPacker", "There was an error packing the model.");
}
}
}
}
}
private void modelDirActionPerformed(ActionEvent evt) {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(1);
if(evt.getSource() == this.modelDir) {
int returnVal = fc.showOpenDialog(this);
if(returnVal == 0) {
File file = fc.getSelectedFile();
this.modelDirField.setText(file.getPath() + "/");
}
}
}
private void exitActionPerformed(ActionEvent evt) {
this.dispose();
}
public static void main(String[] args) {
try {
LookAndFeelInfo[] var8 = UIManager.getInstalledLookAndFeels();
int len$ = var8.length;
for(int i$ = 0; i$ < len$; ++i$) {
LookAndFeelInfo info = var8[i$];
if("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException var5) {
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var5);
} catch (InstantiationException var6) {
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var6);
} catch (IllegalAccessException var7) {
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var7);
} catch (UnsupportedLookAndFeelException var81) {
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var81);
}
EventQueue.invokeLater(new Runnable() {
public void run() {
(new MultiModelPacker()).setVisible(true);
}
});
}
}
@@ -0,0 +1,133 @@
package com.editor.model;
import com.alex.store.Index;
import com.alex.store.Store;
import com.editor.Main;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.UIManager.LookAndFeelInfo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class UniModelDumper extends JFrame {
private static final long serialVersionUID = 433437706015594462L;
private static Store STORE;
private JMenu exit;
private JLabel jLabel1;
private JMenuBar jMenuBar1;
private JMenuItem jMenuItem1;
private JTextField modelID;
private JButton submit;
public UniModelDumper() {
this.initComponents();
}
public UniModelDumper(String cache) {
try {
STORE = new Store(cache);
} catch (Exception var3) {
Main.log("UniModelDumper", "Cannot find cache directory");
}
this.initComponents();
this.setResizable(false);
this.setTitle("UniModelDumper");
this.setDefaultCloseOperation(1);
this.setLocationRelativeTo((Component)null);
this.setVisible(true);
}
private void initComponents() {
this.jLabel1 = new JLabel();
this.modelID = new JTextField();
this.submit = new JButton();
this.jMenuBar1 = new JMenuBar();
this.exit = new JMenu();
this.jMenuItem1 = new JMenuItem();
this.setDefaultCloseOperation(3);
this.jLabel1.setText("Model ID To Dump:");
this.submit.setText("Submit");
this.submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
UniModelDumper.this.submitActionPerformed(evt);
}
});
this.exit.setText("File");
this.exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
UniModelDumper.this.exitActionPerformed(evt);
}
});
this.jMenuItem1.setText("Exit");
this.exit.add(this.jMenuItem1);
this.jMenuBar1.add(this.exit);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(10, 10, 10).addComponent(this.modelID, -2, 100, -2)).addComponent(this.jLabel1))).addGroup(layout.createSequentialGroup().addGap(32, 32, 32).addComponent(this.submit))).addContainerGap(22, 32767)));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.jLabel1).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.modelID, -2, -1, -2).addGap(33, 33, 33).addComponent(this.submit).addContainerGap(20, 32767)));
this.pack();
}
private void exitActionPerformed(ActionEvent evt) {
this.dispose();
}
private void submitActionPerformed(ActionEvent evt) {
File f = new File(System.getProperty("user.home") + "/FCE/models/");
f.mkdirs();
Index index = STORE.getIndexes()[7];
int modelId = Integer.parseInt(this.modelID.getText());
try {
byte[] var6 = index.getFile(modelId);
writeFile(var6, System.getProperty("user.home") + "/FCE/models/" + modelId + ".dat");
Main.log("UniModelDumper", "Dumped Model ID: " + modelId + " to: " + System.getProperty("user.home") + "/FCE/models/" + modelId + ".dat");
} catch (IOException var61) {
Main.log("UniModelDumper", "Cannot Dump Model");
}
}
public static void writeFile(byte[] data, String fileName) throws IOException {
FileOutputStream out = new FileOutputStream(fileName);
out.write(data);
out.close();
}
public static void main(String[] args) {
try {
LookAndFeelInfo[] var8 = UIManager.getInstalledLookAndFeels();
int len$ = var8.length;
for(int i$ = 0; i$ < len$; ++i$) {
LookAndFeelInfo info = var8[i$];
if("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException var5) {
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var5);
} catch (InstantiationException var6) {
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var6);
} catch (IllegalAccessException var7) {
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var7);
} catch (UnsupportedLookAndFeelException var81) {
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var81);
}
EventQueue.invokeLater(new Runnable() {
public void run() {
(new UniModelDumper()).setVisible(true);
}
});
}
}
@@ -0,0 +1,361 @@
package com.editor.npc;
import com.alex.loaders.npcs.NPCDefinitions;
import com.alex.store.Store;
import com.alex.utils.Utils;
import com.editor.Main;
import java.util.Iterator;
public class NPCDefDump {
private static NPCDefinitions defs;
private static Store STORE;
public static void main(String[] args) {
try {
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
} catch (IOException var2) {
System.out.println("Cannot find cache location");
}
int id;
if(Utils.getNPCDefinitionsSize(STORE) > 30000) {
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE) - 18433; ++id) {
defs = NPCDefinitions.getNPCDefinition(STORE, id);
dump();
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
}
} else {
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE); ++id) {
defs = NPCDefinitions.getNPCDefinition(STORE, id);
dump();
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
}
}
}
public static void editorDump(String cache) {
try {
STORE = new Store(cache);
} catch (IOException var2) {
Main.log("NPCDefDump", "Cannot find cache location");
}
int id;
if(Utils.getNPCDefinitionsSize(STORE) > 30000) {
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE) - 15615; ++id) {
defs = NPCDefinitions.getNPCDefinition(STORE, id);
dump();
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
}
} else {
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE); ++id) {
defs = NPCDefinitions.getNPCDefinition(STORE, id);
dump();
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
}
}
}
private static void dump() {
File f = new File(System.getProperty("user.home") + "/FCE/npcs/");
f.mkdirs();
String lineSep = System.getProperty("line.separator");
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(System.getProperty("user.home") + "/FCE/npcs/" + defs.id + ".txt"), "utf-8"));
writer.write("name = " + defs.getName());
writer.write(lineSep);
writer.write("combat level = " + defs.getCombatLevel());
writer.write(lineSep);
writer.write("isVisibleOnMap = " + defs.isVisibleOnMap);
writer.write(lineSep);
writer.write("height = " + defs.npcHeight);
writer.write(lineSep);
writer.write("width = " + defs.npcWidth);
writer.write(lineSep);
writer.write("walk mask = " + defs.walkMask);
writer.write(lineSep);
writer.write("respawn direction = " + defs.respawnDirection);
writer.write(lineSep);
writer.write("render emote = " + defs.renderEmote);
writer.write(lineSep);
writer.write("model ids = " + getModelIds());
writer.write(lineSep);
writer.write("chat head model ids = " + getChatHeads());
writer.write(lineSep);
writer.write("options = " + getOpts());
writer.write(lineSep);
writer.write("model colors = " + getChangedModelColors());
writer.write(lineSep);
writer.write("texture colors = " + getChangedTextureColors());
writer.write(lineSep);
writer.write("unknown array1 = " + getUnknownArray1());
writer.write(lineSep);
writer.write("unknown array2 = " + getUnknownArray2());
writer.write(lineSep);
writer.write("unknown array3 = " + getUnknownArray3());
writer.write(lineSep);
writer.write("unknown array4 = " + getUnknownArray4());
writer.write(lineSep);
writer.write("unknown array5 = " + getUnknownArray5());
writer.write(lineSep);
writer.write("unknownBoolean1 = " + defs.unknownBoolean1);
writer.write(lineSep);
writer.write("unknwonBoolean2 = " + defs.unknownBoolean2);
writer.write(lineSep);
writer.write("unknownBoolean3 = " + defs.unknownBoolean3);
writer.write(lineSep);
writer.write("unknownBoolean4 = " + defs.unknownBoolean5);
writer.write(lineSep);
writer.write("unknownBoolean5 = " + defs.unknownBoolean4);
writer.write(lineSep);
writer.write("unknownBoolean6 = " + defs.unknownBoolean6);
writer.write(lineSep);
writer.write("unknownBoolean7 = " + defs.unknownBoolean7);
writer.write(lineSep);
writer.write("unknown int1 = " + defs.unknownInt1);
writer.write(lineSep);
writer.write("unknown int2 = " + defs.unknownInt2);
writer.write(lineSep);
writer.write("unknown int3 = " + defs.unknownInt3);
writer.write(lineSep);
writer.write("unknown int4 = " + defs.unknownInt4);
writer.write(lineSep);
writer.write("unknown int5 = " + defs.unknownInt5);
writer.write(lineSep);
writer.write("unknown int6 = " + defs.unknownInt6);
writer.write(lineSep);
writer.write("unknown int7 = " + defs.unknownInt7);
writer.write(lineSep);
writer.write("unknown int8 = " + defs.unknownInt8);
writer.write(lineSep);
writer.write("unknown int9 = " + defs.unknownInt9);
writer.write(lineSep);
writer.write("unknown int10 = " + defs.unknownInt10);
writer.write(lineSep);
writer.write("unknown int11 = " + defs.unknownInt11);
writer.write(lineSep);
writer.write("unknown int12 = " + defs.unknownInt12);
writer.write(lineSep);
writer.write("unknown int13 = " + defs.unknownInt13);
writer.write(lineSep);
writer.write("unknown int14 = " + defs.unknownInt14);
writer.write(lineSep);
writer.write("unknown int15 = " + defs.unknownInt15);
writer.write(lineSep);
writer.write("unknown int16 = " + defs.unknownInt16);
writer.write(lineSep);
writer.write("unknown int17 = " + defs.unknownInt17);
writer.write(lineSep);
writer.write("unknown int18 = " + defs.unknownInt18);
writer.write(lineSep);
writer.write("unknown int19 = " + defs.unknownInt19);
writer.write(lineSep);
writer.write("unknown int20 = " + defs.unknownInt20);
writer.write(lineSep);
writer.write("unknown int21 = " + defs.unknownInt21);
writer.write(lineSep);
writer.write("Clientscripts");
writer.write(lineSep);
if(defs.clientScriptData != null) {
Iterator var14 = defs.clientScriptData.keySet().iterator();
while(var14.hasNext()) {
int key = ((Integer)var14.next()).intValue();
Object value = defs.clientScriptData.get(Integer.valueOf(key));
writer.write("KEY: " + key + ", VALUE: " + value);
writer.write(lineSep);
}
}
} catch (IOException var141) {
Main.log("NPCDefDump", "Failed to export NPC Defs to .txt");
} finally {
try {
writer.close();
} catch (Exception var13) {
;
}
}
}
public static String getClientScripts() {
String text = "";
String lineSep = System.getProperty("line.separator");
if(defs.clientScriptData != null) {
for(Iterator i$ = defs.clientScriptData.keySet().iterator(); i$.hasNext(); text = text + lineSep) {
int key = ((Integer)i$.next()).intValue();
Object value = defs.clientScriptData.get(Integer.valueOf(key));
text = text + "KEY: " + key + ", VALUE: " + value;
}
}
return text;
}
public static String getModelIds() {
String text = "";
try {
int[] e = defs.modelIds;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getOpts() {
String text = "";
String[] arr$ = defs.getOptions();
int len$ = arr$.length;
for(int i$ = 0; i$ < len$; ++i$) {
String option = arr$[i$];
text = text + (option == null?"null":option) + ";";
}
return text;
}
public static String getChangedModelColors() {
String text = "";
if(defs.originalModelColors != null) {
for(int i = 0; i < defs.originalModelColors.length; ++i) {
text = text + defs.originalModelColors[i] + "=" + defs.modifiedModelColors[i] + ";";
}
}
return text;
}
public static String getChangedTextureColors() {
String text = "";
if(defs.originalTextureColors != null) {
for(int i = 0; i < defs.originalTextureColors.length; ++i) {
text = text + defs.originalTextureColors[i] + "=" + defs.modifiedTextureColors[i] + ";";
}
}
return text;
}
public static String getChatHeads() {
String text = "";
try {
int[] e = defs.npcChatHeads;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int id = e[i$];
text = text + id + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray1() {
String text = "";
try {
byte[] e = defs.unknownArray1;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
byte index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray2() {
String text = "";
try {
int[] e = defs.unknownArray2;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray3() {
String text = "";
try {
int[] e = defs.unknownArray3[0];
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray4() {
String text = "";
try {
int[] e = defs.unknownArray4;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
public static String getUnknownArray5() {
String text = "";
try {
int[] e = defs.unknownArray5;
int len$ = e.length;
for(int i$ = 0; i$ < len$; ++i$) {
int index = e[i$];
text = text + index + ";";
}
} catch (Exception var5) {
;
}
return text;
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,38 @@
package com.editor.npc;
import com.alex.loaders.npcs.NPCDefinitions;
import com.alex.store.Store;
import com.alex.utils.Utils;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class NPCListDumper {
private static Store STORE;
public static void main(String[] args) throws IOException {
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
File file = new File("C:/Users/Travis/Documents/781 NPCList.txt");
if(file.exists()) {
file.delete();
} else {
file.createNewFile();
}
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.append("//Version = 781\n");
writer.flush();
for(int id = 0; id < Utils.getNPCDefinitionsSize(STORE) - 18433; ++id) {
NPCDefinitions def = NPCDefinitions.getNPCDefinition(STORE, id);
writer.append(id + " - " + def.name);
writer.newLine();
System.out.println(id + " - " + def.name);
writer.flush();
}
writer.close();
}
}
@@ -0,0 +1,191 @@
package com.editor.npc;
import com.alex.loaders.npcs.NPCDefinitions;
import com.alex.store.Store;
import com.alex.utils.Utils;
import com.editor.Main;
import com.editor.npc.NPCEditor;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
public class NPCSelection extends JFrame {
private static final long serialVersionUID = -3068337441331467664L;
public static Store STORE;
private JButton addButton;
private JButton duplicateButton;
private JButton editButton;
private DefaultListModel npcsListmodel;
private JList npcsList;
private JMenu jMenu1;
private JMenuBar jMenuBar1;
private JMenuItem exitButton;
private JButton deleteButton;
public NPCSelection(String cache) throws IOException {
STORE = new Store(cache);
this.setTitle("NPC Selection");
this.setResizable(false);
this.setDefaultCloseOperation(1);
this.setLocationRelativeTo((Component)null);
this.initComponents();
}
public NPCSelection() {
this.initComponents();
}
private void initComponents() {
this.editButton = new JButton();
this.addButton = new JButton();
this.duplicateButton = new JButton();
this.deleteButton = new JButton();
this.jMenuBar1 = new JMenuBar();
this.jMenu1 = new JMenu();
this.exitButton = new JMenuItem();
this.setDefaultCloseOperation(1);
this.npcsListmodel = new DefaultListModel();
this.npcsList = new JList(this.npcsListmodel);
this.npcsList.setSelectionMode(1);
this.npcsList.setLayoutOrientation(0);
this.npcsList.setVisibleRowCount(-1);
JScrollPane jScrollPane1 = new JScrollPane(this.npcsList);
this.editButton.setText("Edit");
this.editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
NPCDefinitions defs = (NPCDefinitions)NPCSelection.this.npcsList.getSelectedValue();
if(defs != null) {
new NPCEditor(NPCSelection.this, defs);
}
}
});
this.addButton.setText("Add New");
this.addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
NPCDefinitions defs = new NPCDefinitions(NPCSelection.STORE, NPCSelection.this.getNewNPCID(), false);
if(defs != null && defs.id != -1) {
new NPCEditor(NPCSelection.this, defs);
}
}
});
this.duplicateButton.setText("Duplicate");
this.duplicateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
NPCDefinitions defs = (NPCDefinitions)NPCSelection.this.npcsList.getSelectedValue();
if(defs != null) {
defs = (NPCDefinitions)defs.clone();
if(defs != null) {
defs.id = NPCSelection.this.getNewNPCID();
if(defs.id != -1) {
new NPCEditor(NPCSelection.this, defs);
}
}
}
}
});
this.deleteButton.setText("Delete");
this.deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
NPCDefinitions defs = (NPCDefinitions)NPCSelection.this.npcsList.getSelectedValue();
JFrame frame = new JFrame();
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete item " + defs.id);
if(result == 0) {
if(defs == null) {
return;
}
NPCSelection.STORE.getIndexes()[19].removeFile(defs.getArchiveId(), defs.getFileId());
NPCSelection.this.removeNPCDefs(defs);
Main.log("ItemSelection", "Item " + defs.id + " removed.");
}
}
});
this.jMenu1.setText("File");
this.exitButton.setText("Close");
this.exitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
NPCSelection.this.exitButtonActionPerformed(evt);
}
});
this.jMenu1.add(this.exitButton);
this.jMenuBar1.add(this.jMenu1);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(jScrollPane1, -2, 200, -2).addGroup(layout.createSequentialGroup().addComponent(this.editButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.addButton))).addGap(0, 0, 32767)).addGroup(layout.createSequentialGroup().addComponent(this.duplicateButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.deleteButton))).addContainerGap(-1, 32767)));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, -2, 279, -2).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.editButton).addComponent(this.addButton)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.duplicateButton).addComponent(this.deleteButton)).addContainerGap(-1, 32767)));
this.pack();
this.addAllNPCs();
}
public static void main(String[] args) throws IOException {
STORE = new Store("cache/", false);
EventQueue.invokeLater(new Runnable() {
public void run() {
(new NPCSelection()).setVisible(true);
}
});
}
private void exitButtonActionPerformed(ActionEvent evt) {
this.dispose();
}
public int getNewNPCID() {
try {
JFrame var3 = new JFrame();
String parent1 = JOptionPane.showInputDialog(var3, "Enter new NPC ID:");
return Integer.parseInt(parent1.toString());
} catch (Exception var31) {
JFrame parent = new JFrame();
JOptionPane.showMessageDialog(parent, "Please enter a valid integer!");
Main.log("NPCSelection", "Non-valid character entered for new NPC ID");
return -1;
}
}
public void addAllNPCs() {
for(int id = 0; id < Utils.getNPCDefinitionsSize(STORE)/* - 15615*/; ++id) {
this.addNPCDefs(NPCDefinitions.getNPCDefinition(STORE, id));
}
Main.log("NPCSelection", "All NPCs Loaded");
}
public void addNPCDefs(final NPCDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
NPCSelection.this.npcsListmodel.addElement(defs);
}
});
}
public void updateNPCDefs(final NPCDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
int index = NPCSelection.this.npcsListmodel.indexOf(defs);
if(index == -1) {
NPCSelection.this.npcsListmodel.addElement(defs);
} else {
NPCSelection.this.npcsListmodel.setElementAt(defs, index);
}
}
});
}
public void removeNPCDefs(final NPCDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
NPCSelection.this.npcsListmodel.removeElement(defs);
}
});
}
}
@@ -0,0 +1,457 @@
package com.editor.object;
import com.alex.loaders.objects.ObjectDefinitions;
import com.editor.Main;
import com.editor.object.ObjectSelection;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ObjectEditor extends JFrame {
private ObjectDefinitions defs;
private ObjectSelection os;
private JTextField ModelOffset1;
private JTextField ModelRot2;
private JMenuItem addModelMenuBtn;
private JTextField array1;
private JTextField array2;
private JTextField array3;
private JTextField array4;
private JTextField array5;
private JTextField array6;
private JTextField csk1;
private JTextField csk2;
private JTextField csk3;
private JTextField csk4;
private JTextField csk5;
private JTextField csk6;
private JTextField csk7;
private JTextField csv1;
private JTextField csv2;
private JTextField csv3;
private JTextField csv4;
private JTextField csv5;
private JTextField csv6;
private JTextField csv7;
private JLabel currentViewLabel;
private JTextField equipSlot;
private JTextField equipType;
private JMenuItem exitMenuBtn;
private JMenuItem exportMenuBtn;
private JTextField femaleEquip1;
private JTextField femaleEquip2;
private JTextField femaleEquip3;
private JTextField groundOptions;
private JTextField int1;
private JTextField int10;
private JTextField int11;
private JTextField int12;
private JTextField int13;
private JTextField int14;
private JTextField int15;
private JTextField int16;
private JTextField int17;
private JTextField int18;
private JTextField int19;
private JTextField int2;
private JTextField int20;
private JTextField int21;
private JTextField int22;
private JTextField int23;
private JTextField int3;
private JTextField int4;
private JTextField int5;
private JTextField int6;
private JTextField int7;
private JTextField int8;
private JTextField int9;
private JTextField invModel;
private JTextField invModelZoom;
private JTextField invOptions;
private JTextField objectName;
private JLabel jLabel1;
private JLabel jLabel10;
private JLabel jLabel11;
private JLabel jLabel12;
private JLabel jLabel13;
private JLabel jLabel14;
private JLabel jLabel15;
private JLabel jLabel16;
private JLabel jLabel17;
private JLabel jLabel18;
private JLabel jLabel19;
private JLabel jLabel2;
private JLabel jLabel20;
private JLabel jLabel21;
private JLabel jLabel22;
private JLabel jLabel23;
private JLabel jLabel24;
private JLabel jLabel25;
private JLabel jLabel26;
private JLabel jLabel27;
private JLabel jLabel28;
private JLabel jLabel29;
private JLabel jLabel3;
private JLabel jLabel30;
private JLabel jLabel31;
private JLabel jLabel32;
private JLabel jLabel33;
private JLabel jLabel34;
private JLabel jLabel35;
private JLabel jLabel36;
private JLabel jLabel37;
private JLabel jLabel38;
private JLabel jLabel39;
private JLabel jLabel4;
private JLabel jLabel40;
private JLabel jLabel41;
private JLabel jLabel42;
private JLabel jLabel43;
private JLabel jLabel44;
private JLabel jLabel45;
private JLabel jLabel46;
private JLabel jLabel47;
private JLabel jLabel48;
private JLabel jLabel49;
private JLabel jLabel5;
private JLabel jLabel50;
private JLabel jLabel51;
private JLabel jLabel52;
private JLabel jLabel53;
private JLabel jLabel54;
private JLabel jLabel55;
private JLabel jLabel56;
private JLabel jLabel57;
private JLabel jLabel58;
private JLabel jLabel59;
private JLabel jLabel6;
private JLabel jLabel60;
private JLabel jLabel61;
private JLabel jLabel7;
private JLabel jLabel8;
private JLabel jLabel9;
private JMenu jMenu1;
private JMenuBar jMenuBar1;
private JPanel jPanel1;
private JPanel jPanel2;
private JPanel jPanel3;
private JPanel jPanel5;
private JPanel jPanel6;
private JPanel jPanel7;
private JScrollPane jScrollPane1;
private JTabbedPane jTabbedPane1;
private JTextField lend;
private JTextField maleEquip1;
private JTextField maleEquip2;
private JTextField maleEquip3;
private JCheckBox membersOnly;
private JTextField modelColors;
private JTextField modelOffset2;
private JTextField modelRot1;
private JTextField note;
private JMenuItem reloadMenuBtn;
private JMenuItem saveMenuBtn;
private JTextField stackAmts;
private JTextField stackIDs;
private JTextField stackable;
public JTextField switchLend;
public JTextField switchNote;
public JTextField sizeY;
public JTextField textureColors;
public JCheckBox unnoted;
public JTextField sizeX;
public ObjectEditor(ObjectSelection os, ObjectDefinitions defs) {
this.defs = defs;
this.os = os;
this.initComponents();
this.setResizable(false);
this.setTitle("Object Editor");
this.setDefaultCloseOperation(1);
this.setLocationRelativeTo((Component)null);
this.setVisible(true);
}
private void initComponents() {
this.jTabbedPane1 = new JTabbedPane();
this.jPanel1 = new JPanel();
this.jLabel1 = new JLabel();
this.objectName = new JTextField();
this.jLabel2 = new JLabel();
this.sizeX = new JTextField();
this.sizeY = new JTextField();
this.jLabel3 = new JLabel();
this.membersOnly = new JCheckBox();
this.jLabel20 = new JLabel();
this.equipSlot = new JTextField();
this.jLabel21 = new JLabel();
this.equipType = new JTextField();
this.jLabel22 = new JLabel();
this.stackIDs = new JTextField();
this.jLabel23 = new JLabel();
this.stackAmts = new JTextField();
this.jLabel24 = new JLabel();
this.stackable = new JTextField();
this.jLabel58 = new JLabel();
this.switchNote = new JTextField();
this.jLabel59 = new JLabel();
this.note = new JTextField();
this.unnoted = new JCheckBox();
this.jLabel60 = new JLabel();
this.jLabel61 = new JLabel();
this.switchLend = new JTextField();
this.lend = new JTextField();
this.jPanel2 = new JPanel();
this.jLabel4 = new JLabel();
this.invModelZoom = new JTextField();
this.jLabel5 = new JLabel();
this.modelRot1 = new JTextField();
this.jLabel6 = new JLabel();
this.ModelRot2 = new JTextField();
this.jLabel7 = new JLabel();
this.ModelOffset1 = new JTextField();
this.jLabel8 = new JLabel();
this.modelOffset2 = new JTextField();
this.jLabel9 = new JLabel();
this.invModel = new JTextField();
this.jLabel10 = new JLabel();
this.maleEquip1 = new JTextField();
this.jLabel11 = new JLabel();
this.femaleEquip1 = new JTextField();
this.jLabel12 = new JLabel();
this.maleEquip2 = new JTextField();
this.jLabel13 = new JLabel();
this.femaleEquip2 = new JTextField();
this.jLabel14 = new JLabel();
this.maleEquip3 = new JTextField();
this.jLabel15 = new JLabel();
this.femaleEquip3 = new JTextField();
this.jPanel3 = new JPanel();
this.jLabel16 = new JLabel();
this.invOptions = new JTextField();
this.jLabel17 = new JLabel();
this.groundOptions = new JTextField();
this.jLabel18 = new JLabel();
this.modelColors = new JTextField();
this.jLabel19 = new JLabel();
this.textureColors = new JTextField();
this.jPanel5 = new JPanel();
this.jLabel25 = new JLabel();
this.array1 = new JTextField();
this.jLabel27 = new JLabel();
this.jLabel28 = new JLabel();
this.jLabel29 = new JLabel();
this.jLabel30 = new JLabel();
this.jLabel31 = new JLabel();
this.array2 = new JTextField();
this.array3 = new JTextField();
this.array4 = new JTextField();
this.array5 = new JTextField();
this.array6 = new JTextField();
this.jLabel32 = new JLabel();
this.int1 = new JTextField();
this.int2 = new JTextField();
this.jLabel33 = new JLabel();
this.jLabel34 = new JLabel();
this.int3 = new JTextField();
this.jLabel35 = new JLabel();
this.int4 = new JTextField();
this.jLabel36 = new JLabel();
this.int5 = new JTextField();
this.jLabel37 = new JLabel();
this.int6 = new JTextField();
this.jLabel38 = new JLabel();
this.int7 = new JTextField();
this.jLabel39 = new JLabel();
this.int8 = new JTextField();
this.jLabel40 = new JLabel();
this.int9 = new JTextField();
this.jLabel41 = new JLabel();
this.int10 = new JTextField();
this.jLabel42 = new JLabel();
this.int11 = new JTextField();
this.jLabel43 = new JLabel();
this.int12 = new JTextField();
this.jLabel44 = new JLabel();
this.int13 = new JTextField();
this.jLabel45 = new JLabel();
this.int14 = new JTextField();
this.jPanel6 = new JPanel();
this.jLabel46 = new JLabel();
this.int15 = new JTextField();
this.jLabel47 = new JLabel();
this.int16 = new JTextField();
this.jLabel48 = new JLabel();
this.int17 = new JTextField();
this.jLabel49 = new JLabel();
this.int18 = new JTextField();
this.jLabel50 = new JLabel();
this.int19 = new JTextField();
this.jLabel51 = new JLabel();
this.int20 = new JTextField();
this.jLabel52 = new JLabel();
this.int21 = new JTextField();
this.jLabel53 = new JLabel();
this.int22 = new JTextField();
this.jLabel54 = new JLabel();
this.int23 = new JTextField();
this.jPanel7 = new JPanel();
this.jScrollPane1 = new JScrollPane();
this.jLabel26 = new JLabel();
this.jLabel55 = new JLabel();
this.jLabel56 = new JLabel();
this.jLabel57 = new JLabel();
this.csk1 = new JTextField();
this.csk2 = new JTextField();
this.csk3 = new JTextField();
this.csk4 = new JTextField();
this.csk5 = new JTextField();
this.csk6 = new JTextField();
this.csk7 = new JTextField();
this.csv1 = new JTextField();
this.csv2 = new JTextField();
this.csv3 = new JTextField();
this.csv4 = new JTextField();
this.csv5 = new JTextField();
this.csv6 = new JTextField();
this.csv7 = new JTextField();
this.currentViewLabel = new JLabel();
this.jMenuBar1 = new JMenuBar();
this.jMenu1 = new JMenu();
this.reloadMenuBtn = new JMenuItem();
this.saveMenuBtn = new JMenuItem();
this.addModelMenuBtn = new JMenuItem();
this.exportMenuBtn = new JMenuItem();
this.exitMenuBtn = new JMenuItem();
this.setDefaultCloseOperation(3);
this.jLabel1.setText("Name");
this.objectName.setText("" + this.defs.name);
this.jLabel2.setText("Size X");
this.sizeX.setText("" + this.defs.sizeX);
this.sizeY.setText("" + this.defs.sizeY);
this.jLabel3.setText("Size Y");
this.membersOnly.setSelected(true);
this.membersOnly.setText("Projectile Clipped");
this.jLabel20.setText("Animation");
this.equipSlot.setText("");
this.jLabel21.setText("Equip Type");
this.equipType.setText("");
this.jLabel22.setText("ConfigFileID");
this.stackIDs.setText("");
this.jLabel23.setText("ConfigID");
this.stackAmts.setText("");
this.jLabel24.setText("Clip Type");
this.stackable.setText("");
this.jLabel58.setText("Switch Note Item ID");
this.switchNote.setText("");
this.jLabel59.setText("Noted Item ID");
this.note.setText("");
this.unnoted.setSelected(true);
this.unnoted.setText("Unnoted");
this.jLabel60.setText("Switch Lend Item ID");
this.jLabel61.setText("Lent Item ID");
this.switchLend.setText("");
this.lend.setText("");
GroupLayout jPanel1Layout = new GroupLayout(this.jPanel1);
this.jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.unnoted).addComponent(this.membersOnly).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel20).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.equipSlot, -2, 100, -2)).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel1).addGap(18, 18, 18).addComponent(this.objectName, -2, 100, -2)).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel2).addComponent(this.jLabel3)).addGap(18, 18, 18).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.sizeY, -2, 100, -2).addComponent(this.sizeX, -2, 100, -2))).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel24).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.stackable, -2, 100, -2))).addGap(126, 126, 126).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.stackAmts, -2, 300, -2).addComponent(this.stackIDs, -2, 300, -2).addComponent(this.jLabel22).addComponent(this.jLabel23))).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel21).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.equipType, -2, 100, -2)).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel58).addComponent(this.jLabel59)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING, false).addComponent(this.switchNote, -1, 100, 32767).addComponent(this.note)).addGap(18, 18, 18).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel60).addComponent(this.jLabel61)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING, false).addComponent(this.switchLend, -1, 100, 32767).addComponent(this.lend)))).addContainerGap(36, 32767)));
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel1).addComponent(this.objectName, -2, -1, -2).addComponent(this.jLabel22)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.sizeX, -2, -1, -2).addComponent(this.jLabel2)).addComponent(this.stackIDs, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.sizeY, -2, -1, -2).addComponent(this.jLabel3).addComponent(this.jLabel23)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.stackAmts, -2, -1, -2).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel24).addComponent(this.stackable, -2, -1, -2))).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.membersOnly).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel20).addComponent(this.equipSlot, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel21).addComponent(this.equipType, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel58).addComponent(this.switchNote, -2, -1, -2).addComponent(this.jLabel60).addComponent(this.switchLend, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel59).addComponent(this.note, -2, -1, -2).addComponent(this.jLabel61).addComponent(this.lend, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.unnoted).addContainerGap(13, 32767)));
this.jTabbedPane1.addTab("General", this.jPanel1);
this.jLabel4.setText("Inventory Model Zoom");
this.invModelZoom.setText("");
this.jLabel5.setText("Model Rotation 1");
this.modelRot1.setText("");
this.jLabel6.setText("Model Rotation 2");
this.ModelRot2.setText("");
this.jLabel7.setText("Model Offset 1");
this.ModelOffset1.setText("");
this.jLabel8.setText("Model Offset 2");
this.modelOffset2.setText("");
this.jLabel9.setText("Inventory Model");
this.invModel.setText("");
this.jLabel10.setText("Male Equip 1");
this.maleEquip1.setText("");
this.jLabel11.setText("Female Equip 1");
this.femaleEquip1.setText("");
this.jLabel12.setText("Male Equip 2");
this.maleEquip2.setText("");
this.jLabel13.setText("Female Equip 2");
this.femaleEquip2.setText("");
this.jLabel14.setText("Male Equip 3");
this.maleEquip3.setText("");
this.jLabel15.setText("Female Equip 3");
this.femaleEquip3.setText("");
GroupLayout jPanel2Layout = new GroupLayout(this.jPanel2);
this.jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING, false).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel7).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.ModelOffset1, -2, 100, -2)).addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel4).addComponent(this.jLabel5).addComponent(this.jLabel6)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.ModelRot2, -2, 100, -2).addComponent(this.modelRot1, -2, 100, -2).addComponent(this.invModelZoom, -2, 100, -2))).addGroup(Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addComponent(this.jLabel8).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.modelOffset2, -2, 100, -2))).addGap(114, 114, 114).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel15).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.femaleEquip3, -2, 100, -2)).addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel9).addComponent(this.jLabel10)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.maleEquip1, -2, 100, -2).addComponent(this.invModel, -2, 100, -2))).addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel11).addComponent(this.jLabel12)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.maleEquip2, -2, 100, -2).addComponent(this.femaleEquip1, -2, 100, -2))).addGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING, false).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel14).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.maleEquip3, -2, 100, -2)).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel13).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.femaleEquip2, -2, 100, -2)))).addContainerGap(103, 32767)));
jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel4).addComponent(this.invModelZoom, -2, -1, -2).addComponent(this.jLabel9).addComponent(this.invModel, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel5).addComponent(this.modelRot1, -2, -1, -2).addComponent(this.jLabel10).addComponent(this.maleEquip1, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel6).addComponent(this.ModelRot2, -2, -1, -2).addComponent(this.jLabel11).addComponent(this.femaleEquip1, -2, -1, -2)).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addGap(9, 9, 9).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel7).addComponent(this.ModelOffset1, -2, -1, -2).addComponent(this.jLabel12)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING).addComponent(this.jLabel8).addComponent(this.modelOffset2, -2, -1, -2).addGroup(Alignment.LEADING, jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel13).addComponent(this.femaleEquip2, -2, -1, -2)))).addGroup(jPanel2Layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED).addComponent(this.maleEquip2, -2, -1, -2))).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel14).addComponent(this.maleEquip3, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel15).addComponent(this.femaleEquip3, -2, -1, -2)).addContainerGap(82, 32767)));
this.jTabbedPane1.addTab("Model", this.jPanel2);
this.jLabel16.setText("Inventory Options");
this.invOptions.setText("riggg");
this.jLabel17.setText("Ground Options");
this.groundOptions.setText("44");
this.jLabel18.setText("Model Colors");
this.modelColors.setText("1");
this.jLabel19.setText("Texture Colors");
this.textureColors.setText("2");
GroupLayout jPanel3Layout = new GroupLayout(this.jPanel3);
this.jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel16).addComponent(this.invOptions, -2, 300, -2).addComponent(this.jLabel17).addComponent(this.groundOptions, -2, 300, -2).addComponent(this.jLabel18).addComponent(this.modelColors, -2, 300, -2).addComponent(this.jLabel19).addComponent(this.textureColors, -2, 300, -2)).addContainerGap(312, 32767)));
jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addComponent(this.jLabel16).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.invOptions, -2, -1, -2).addGap(18, 18, 18).addComponent(this.jLabel17).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.groundOptions, -2, -1, -2).addGap(18, 18, 18).addComponent(this.jLabel18).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.modelColors, -2, -1, -2).addGap(18, 18, 18).addComponent(this.jLabel19).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.textureColors, -2, -1, -2).addContainerGap(47, 32767)));
this.jTabbedPane1.addTab("Options", this.jPanel3);
this.currentViewLabel.setText("Currently Viewing Definitions of Object: " + this.defs.id + " - " + defs.name);
this.jMenu1.setText("File");
this.reloadMenuBtn.setText("Reload");
this.reloadMenuBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ObjectEditor.this.reloadMenuBtnActionPerformed(evt);
}
});
this.jMenu1.add(this.reloadMenuBtn);
this.saveMenuBtn.setText("Save");
this.saveMenuBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ObjectEditor.this.saveMenuBtnActionPerformed(evt);
}
});
this.jMenu1.add(this.saveMenuBtn);
this.exitMenuBtn.setText("Exit");
this.exitMenuBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ObjectEditor.this.exitMenuBtnActionPerformed(evt);
}
});
this.jMenu1.add(this.exitMenuBtn);
this.jMenuBar1.add(this.jMenu1);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.jTabbedPane1).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.currentViewLabel).addContainerGap(-1, 32767)));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addGap(0, 11, 32767).addComponent(this.currentViewLabel).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.jTabbedPane1, -2, 300, -2)));
this.pack();
}
private void save() {
try {
this.defs.setName(this.objectName.getText().toString());
} catch (Exception var201) {
Main.log("ObjectEditor", "Cannot save. Please check for mistypes.");
}
}
private void saveMenuBtnActionPerformed(ActionEvent evt) {
this.save();
}
private void reloadMenuBtnActionPerformed(ActionEvent evt) {
this.objectName.setText(this.defs.getName());
this.sizeX.setText("" + this.defs.sizeX);
}
private void exitMenuBtnActionPerformed(ActionEvent evt) {
this.dispose();
}
}
@@ -0,0 +1,205 @@
package com.editor.object;
import com.alex.loaders.objects.ObjectDefinitions;
import com.alex.store.Store;
import com.editor.Main;
import com.editor.object.ObjectEditor;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
public class ObjectSelection extends JFrame {
private static final long serialVersionUID = -3068337441331467664L;
public static Store STORE;
private JButton addButton;
private JButton duplicateButton;
private JButton editButton;
private DefaultListModel objectsListmodel;
private JList objectsList;
private JMenu jMenu1;
private JMenuBar jMenuBar1;
private JMenuItem exitButton;
private JButton deleteButton;
public ObjectSelection(String cache) throws IOException {
STORE = new Store(cache);
this.setTitle("Object Selection");
this.setResizable(false);
this.setDefaultCloseOperation(1);
this.setLocationRelativeTo((Component)null);
this.initComponents();
}
public ObjectSelection() {
this.initComponents();
}
private void initComponents() {
this.editButton = new JButton();
this.addButton = new JButton();
this.duplicateButton = new JButton();
this.deleteButton = new JButton();
this.jMenuBar1 = new JMenuBar();
this.jMenu1 = new JMenu();
this.exitButton = new JMenuItem();
this.setDefaultCloseOperation(1);
this.objectsListmodel = new DefaultListModel();
this.objectsList = new JList(this.objectsListmodel);
this.objectsList.setSelectionMode(1);
this.objectsList.setLayoutOrientation(0);
this.objectsList.setVisibleRowCount(-1);
JScrollPane jScrollPane1 = new JScrollPane(this.objectsList);
this.editButton.setText("Edit");
this.editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ObjectDefinitions defs = (ObjectDefinitions)ObjectSelection.this.objectsList.getSelectedValue();
if(defs != null) {
new ObjectEditor(ObjectSelection.this, defs);
}
}
});
this.addButton.setText("Add New");
this.addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ObjectDefinitions defs = new ObjectDefinitions(ObjectSelection.STORE, ObjectSelection.this.getNewObjectID(), false);
if(defs != null && defs.id != -1) {
new ObjectEditor(ObjectSelection.this, defs);
}
}
});
this.duplicateButton.setText("Duplicate");
this.duplicateButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ObjectDefinitions defs = (ObjectDefinitions)ObjectSelection.this.objectsList.getSelectedValue();
if(defs != null) {
// defs = (ObjectDefinitions)defs.clone();
if(defs != null) {
defs.id = ObjectSelection.this.getNewObjectID();
if(defs.id != -1) {
new ObjectEditor(ObjectSelection.this, defs);
}
}
}
}
});
this.deleteButton.setText("Delete");
this.deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ObjectDefinitions defs = (ObjectDefinitions)ObjectSelection.this.objectsList.getSelectedValue();
JFrame frame = new JFrame();
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete Object " + defs.id);
if(result == 0) {
if(defs == null) {
return;
}
ObjectSelection.STORE.getIndexes()[19].removeFile(defs.getArchiveId(), defs.getFileId());
ObjectSelection.this.removeObjectDefs(defs);
Main.log("ObjectSelection", "Object " + defs.id + " removed.");
}
}
});
this.jMenu1.setText("File");
this.exitButton.setText("Close");
this.exitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ObjectSelection.this.exitButtonActionPerformed(evt);
}
});
this.jMenu1.add(this.exitButton);
this.jMenuBar1.add(this.jMenu1);
this.setJMenuBar(this.jMenuBar1);
GroupLayout layout = new GroupLayout(this.getContentPane());
this.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(jScrollPane1, -2, 200, -2).addGroup(layout.createSequentialGroup().addComponent(this.editButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.addButton))).addGap(0, 0, 32767)).addGroup(layout.createSequentialGroup().addComponent(this.duplicateButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.deleteButton))).addContainerGap(-1, 32767)));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, -2, 279, -2).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.editButton).addComponent(this.addButton)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.duplicateButton).addComponent(this.deleteButton)).addContainerGap(-1, 32767)));
this.pack();
this.addAllObjects();
}
public static void main(String[] args) throws IOException {
STORE = new Store("cache/", false);
EventQueue.invokeLater(new Runnable() {
public void run() {
(new ObjectSelection()).setVisible(true);
}
});
}
private void exitButtonActionPerformed(ActionEvent evt) {
this.dispose();
}
public int getNewObjectID() {
try {
JFrame var3 = new JFrame();
String parent1 = JOptionPane.showInputDialog(var3, "Enter new Object ID:");
return Integer.parseInt(parent1.toString());
} catch (Exception var31) {
JFrame parent = new JFrame();
JOptionPane.showMessageDialog(parent, "Please enter a valid integer!");
Main.log("ObjectSelection", "Non-valid character entered for new Object ID");
return -1;
}
}
public void addAllObjects() {
for(int id = 36770; id < /*Utils.getObjectDefinitionsSize(STORE)*/36773; ++id) {
addObjectDefs(ObjectDefinitions.getObjectDefinition(STORE, id));
}
Main.log("ObjectSelection", "All Objects Loaded");
}
/*public void addAllObjects() {
int id;
if(Utils.getObjectDefinitionsSize(STORE) > 30000) {
for(id = 0; id < Utils.getObjectDefinitionsSize(STORE) - 22314; ++id) {
this.addObjectDefs(ObjectDefinitions.getObjectDefinition(STORE, id));
}
} else {
for(id = 0; id < Utils.getObjectDefinitionsSize(STORE); ++id) {
this.addObjectDefs(ObjectDefinitions.getObjectDefinition(STORE, id));
}
}
Main.log("ObjectSelection", "All Objects Loaded");
}*/
public void addObjectDefs(final ObjectDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
ObjectSelection.this.objectsListmodel.addElement(defs);
}
});
}
public void updateObjectDefs(final ObjectDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
int index = ObjectSelection.this.objectsListmodel.indexOf(defs);
if(index == -1) {
ObjectSelection.this.objectsListmodel.addElement(defs);
} else {
ObjectSelection.this.objectsListmodel.setElementAt(defs, index);
}
}
});
}
public void removeObjectDefs(final ObjectDefinitions defs) {
EventQueue.invokeLater(new Runnable() {
public void run() {
ObjectSelection.this.objectsListmodel.removeElement(defs);
}
});
}
}
@@ -0,0 +1,15 @@
package org.apache.tools.bzip2;
public interface BZip2Constants {
int baseBlockSize = 100000;
int MAX_ALPHA_SIZE = 258;
int MAX_CODE_LEN = 23;
int RUNA = 0;
int RUNB = 1;
int N_GROUPS = 6;
int G_SIZE = 50;
int N_ITERS = 4;
int MAX_SELECTORS = 18002;
int NUM_OVERSHOOT_BYTES = 20;
int[] rNums = new int[]{619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 936, 638};
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,35 @@
package org.apache.tools.bzip2;
class CRC {
public static int[] crc32Table = new int[]{0, 79764919, 159529838, 222504665, 319059676, 398814059, 445009330, 507990021, 638119352, 583659535, 797628118, 726387553, 890018660, 835552979, 1015980042, 944750013, 1276238704, 1221641927, 1167319070, 1095957929, 1595256236, 1540665371, 1452775106, 1381403509, 1780037320, 1859660671, 1671105958, 1733955601, 2031960084, 2111593891, 1889500026, 1952343757, -1742489888, -1662866601, -1851683442, -1788833735, -1960329156, -1880695413, -2103051438, -2040207643, -1104454824, -1159051537, -1213636554, -1284997759, -1389417084, -1444007885, -1532160278, -1603531939, -734892656, -789352409, -575645954, -646886583, -952755380, -1007220997, -827056094, -898286187, -231047128, -151282273, -71779514, -8804623, -515967244, -436212925, -390279782, -327299027, 881225847, 809987520, 1023691545, 969234094, 662832811, 591600412, 771767749, 717299826, 311336399, 374308984, 453813921, 533576470, 25881363, 88864420, 134795389, 214552010, 2023205639, 2086057648, 1897238633, 1976864222, 1804852699, 1867694188, 1645340341, 1724971778, 1587496639, 1516133128, 1461550545, 1406951526, 1302016099, 1230646740, 1142491917, 1087903418, -1398421865, -1469785312, -1524105735, -1578704818, -1079922613, -1151291908, -1239184603, -1293773166, -1968362705, -1905510760, -2094067647, -2014441994, -1716953613, -1654112188, -1876203875, -1796572374, -525066777, -462094256, -382327159, -302564546, -206542021, -143559028, -97365931, -17609246, -960696225, -1031934488, -817968335, -872425850, -709327229, -780559564, -600130067, -654598054, 1762451694, 1842216281, 1619975040, 1682949687, 2047383090, 2127137669, 1938468188, 2001449195, 1325665622, 1271206113, 1183200824, 1111960463, 1543535498, 1489069629, 1434599652, 1363369299, 622672798, 568075817, 748617968, 677256519, 907627842, 853037301, 1067152940, 995781531, 51762726, 131386257, 177728840, 240578815, 269590778, 349224269, 429104020, 491947555, -248556018, -168932423, -122852000, -60002089, -500490030, -420856475, -341238852, -278395381, -685261898, -739858943, -559578920, -630940305, -1004286614, -1058877219, -845023740, -916395085, -1119974018, -1174433591, -1262701040, -1333941337, -1371866206, -1426332139, -1481064244, -1552294533, -1690935098, -1611170447, -1833673816, -1770699233, -2009983462, -1930228819, -2119160460, -2056179517, 1569362073, 1498123566, 1409854455, 1355396672, 1317987909, 1246755826, 1192025387, 1137557660, 2072149281, 2135122070, 1912620623, 1992383480, 1753615357, 1816598090, 1627664531, 1707420964, 295390185, 358241886, 404320391, 483945776, 43990325, 106832002, 186451547, 266083308, 932423249, 861060070, 1041341759, 986742920, 613929101, 542559546, 756411363, 701822548, -978770311, -1050133554, -869589737, -924188512, -693284699, -764654318, -550540341, -605129092, -475935807, -413084042, -366743377, -287118056, -257573603, -194731862, -114850189, -35218492, -1984365303, -1921392450, -2143631769, -2063868976, -1698919467, -1635936670, -1824608069, -1744851700, -1347415887, -1418654458, -1506661409, -1561119128, -1129027987, -1200260134, -1254728445, -1309196108};
int globalCrc;
public CRC() {
this.initialiseCRC();
}
void initialiseCRC() {
this.globalCrc = -1;
}
int getFinalCRC() {
return ~this.globalCrc;
}
int getGlobalCRC() {
return this.globalCrc;
}
void setGlobalCRC(int newCrc) {
this.globalCrc = newCrc;
}
void updateCRC(int inCh) {
int temp = this.globalCrc >> 24 ^ inCh;
if(temp < 0) {
temp += 256;
}
this.globalCrc = this.globalCrc << 8 ^ crc32Table[temp];
}
}