Refactored Player and NPC packets
This commit is contained in:
1 parent
22587cdb5a
commit
65b84fdeaa
11 files changed
+2196
-2044
No files matched your search
@@ -301,6 +301,10 @@ public class Buffer extends DoublyLinkedList.Node {
|
||||
position += len;
|
||||
}
|
||||
|
||||
public void read(byte[] dst) {
|
||||
read(dst,0,dst.length);
|
||||
}
|
||||
|
||||
public void readReversed(byte[] dst, int off, int len) {
|
||||
for (int i = (off + len) - 1; i >= off; i--) {
|
||||
dst[i] = data[position++];
|
||||
|
||||
+100
-101
@@ -1,123 +1,122 @@
|
||||
public class ChatCompression {
|
||||
public final class ChatCompression {
|
||||
|
||||
private static final char[] cbuf = new char[100];
|
||||
private static final Buffer buf = new Buffer(new byte[100]);
|
||||
private static final char[] charBuffer = new char[100];
|
||||
private static final Buffer buffer = new Buffer(new byte[100]);
|
||||
|
||||
private static final char[] TABLE = { //
|
||||
// only this first row is actually combined with anything else
|
||||
' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l', 'u', //
|
||||
// the rest are just 'accepted' values.
|
||||
'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z', //
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', //
|
||||
' ', '!', '?', '.', ',', ':', ';', '(', ')', '-', '&', '*', '\\', '\'', '@', '#', '+', '=', '\u00A3', '$', '%', '"', '[', ']' //
|
||||
};
|
||||
private static final char[] TABLE = {
|
||||
// only this first row is actually combined with anything else
|
||||
' ', 'e', 't', 'a', 'o', 'i', 'h', 'n', 's', 'r', 'd', 'l', 'u',
|
||||
// the rest are just 'accepted' values.
|
||||
'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b', 'v', 'k', 'x', 'j', 'q', 'z',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
' ', '!', '?', '.', ',', ':', ';', '(', ')', '-', '&', '*', '\\', '\'', '@', '#', '+', '=', '£', '$', '%', '"', '[', ']'
|
||||
};
|
||||
|
||||
private static final int RANGE = ' ' + '\u00A3'; // least significant char + most significant char (in terms of value)
|
||||
private static final int RANGE = ' ' + '£'; // least significant char + most significant char (in terms of value)
|
||||
|
||||
public static String unpack(int expectedLength, Buffer buffer) {
|
||||
int length = 0;
|
||||
int carry = -1;
|
||||
public static String unpack(int length, Buffer in) {
|
||||
int pos = 0;
|
||||
int carry = -1;
|
||||
|
||||
for (int i = 0; i < expectedLength; i++) {
|
||||
int value = buffer.read8U();
|
||||
int nibble = (value >> 4) & 0xf;
|
||||
for (int i = 0; i < length; i++) {
|
||||
int value = in.read8U();
|
||||
int nibble = (value >> 4) & 0b1111;
|
||||
|
||||
if (carry == -1) {
|
||||
if (nibble < 13) {
|
||||
cbuf[length++] = TABLE[nibble];
|
||||
} else {
|
||||
carry = nibble;
|
||||
}
|
||||
} else {
|
||||
cbuf[length++] = TABLE[((carry << 4) + nibble) - RANGE];
|
||||
carry = -1;
|
||||
}
|
||||
if (carry == -1) {
|
||||
if (nibble < 13) {
|
||||
charBuffer[pos++] = TABLE[nibble];
|
||||
} else {
|
||||
carry = nibble;
|
||||
}
|
||||
} else {
|
||||
charBuffer[pos++] = TABLE[((carry << 4) + nibble) - RANGE];
|
||||
carry = -1;
|
||||
}
|
||||
|
||||
nibble = value & 0xf;
|
||||
nibble = value & 0xf;
|
||||
|
||||
if (carry == -1) {
|
||||
if (nibble < 13) {
|
||||
cbuf[length++] = TABLE[nibble];
|
||||
} else {
|
||||
carry = nibble;
|
||||
}
|
||||
} else {
|
||||
cbuf[length++] = TABLE[((carry << 4) + nibble) - RANGE];
|
||||
carry = -1;
|
||||
}
|
||||
}
|
||||
if (carry == -1) {
|
||||
if (nibble < 13) {
|
||||
charBuffer[pos++] = TABLE[nibble];
|
||||
} else {
|
||||
carry = nibble;
|
||||
}
|
||||
} else {
|
||||
charBuffer[pos++] = TABLE[((carry << 4) + nibble) - RANGE];
|
||||
carry = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// basic sentence casing
|
||||
// "hi. i'm a line." -> "Hi. I'm a line."
|
||||
boolean uppercase = true;
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = cbuf[i];
|
||||
if (uppercase && (c >= 'a') && (c <= 'z')) {
|
||||
cbuf[i] -= 'a' - 'A';
|
||||
uppercase = false;
|
||||
}
|
||||
// basic sentence casing
|
||||
// "hi. i'm a line." -> "Hi. I'm a line."
|
||||
boolean uppercase = true;
|
||||
for (int i = 0; i < pos; i++) {
|
||||
char c = charBuffer[i];
|
||||
if (uppercase && (c >= 'a') && (c <= 'z')) {
|
||||
charBuffer[i] -= 'a' - 'A';
|
||||
uppercase = false;
|
||||
}
|
||||
|
||||
if ((c == '.') || (c == '!') || (c == '?')) {
|
||||
uppercase = true;
|
||||
}
|
||||
}
|
||||
if ((c == '.') || (c == '!') || (c == '?')) {
|
||||
uppercase = true;
|
||||
}
|
||||
}
|
||||
|
||||
return new String(cbuf, 0, length);
|
||||
}
|
||||
return new String(charBuffer, 0, pos);
|
||||
}
|
||||
|
||||
public static void pack(String s, Buffer dst) {
|
||||
if (s.length() > 80) {
|
||||
s = s.substring(0, 80);
|
||||
}
|
||||
s = s.toLowerCase();
|
||||
public static void pack(String in, Buffer out) {
|
||||
if (in.length() > 80) {
|
||||
in = in.substring(0, 80);
|
||||
}
|
||||
in = in.toLowerCase();
|
||||
|
||||
int carry = -1;
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
int carry = -1;
|
||||
for (int i = 0; i < in.length(); i++) {
|
||||
char ch = in.charAt(i);
|
||||
|
||||
int index = 0;
|
||||
for (int j = 0; j < TABLE.length; j++) {
|
||||
if (ch != TABLE[j]) {
|
||||
continue;
|
||||
}
|
||||
index = j;
|
||||
break;
|
||||
}
|
||||
int index = 0;
|
||||
for (int j = 0; j < TABLE.length; j++) {
|
||||
if (ch == TABLE[j]) {
|
||||
index = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index > 12) {
|
||||
index += RANGE;
|
||||
}
|
||||
if (index > 12) {
|
||||
index += RANGE;
|
||||
}
|
||||
|
||||
if (carry == -1) {
|
||||
if (index < 13) {
|
||||
carry = index;
|
||||
} else {
|
||||
dst.write8(index);
|
||||
}
|
||||
} else if (index < 13) {
|
||||
dst.write8((carry << 4) + index);
|
||||
carry = -1;
|
||||
} else {
|
||||
dst.write8((carry << 4) + (index >> 4));
|
||||
carry = index & 0xf;
|
||||
}
|
||||
}
|
||||
if (carry == -1) {
|
||||
if (index < 13) {
|
||||
carry = index;
|
||||
} else {
|
||||
out.write8(index);
|
||||
}
|
||||
} else if (index < 13) {
|
||||
out.write8((carry << 4) + index);
|
||||
carry = -1;
|
||||
} else {
|
||||
out.write8((carry << 4) + (index >> 4));
|
||||
carry = index & 0xf;
|
||||
}
|
||||
}
|
||||
|
||||
if (carry != -1) {
|
||||
dst.write8(carry << 4);
|
||||
}
|
||||
}
|
||||
if (carry != -1) {
|
||||
out.write8(carry << 4);
|
||||
}
|
||||
}
|
||||
|
||||
public static String format(String string) {
|
||||
buf.position = 0;
|
||||
pack(string, buf);
|
||||
int length = buf.position;
|
||||
buf.position = 0;
|
||||
return unpack(length, buf);
|
||||
}
|
||||
public static String format(String string) {
|
||||
buffer.position = 0;
|
||||
pack(string, buffer);
|
||||
int length = buffer.position;
|
||||
buffer.position = 0;
|
||||
return unpack(length, buffer);
|
||||
}
|
||||
|
||||
private ChatCompression() {
|
||||
private ChatCompression() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,406 +0,0 @@
|
||||
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
import org.apache.commons.collections4.map.LRUMap;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Component {
|
||||
|
||||
public static final LRUMap<Long, Model> modelCache = new LRUMap<>(30);
|
||||
public static LRUMap<Long, Image24> imageCache;
|
||||
public static Component[] instances;
|
||||
|
||||
public static void unpack(FileArchive config, BitmapFont[] fonts, FileArchive media) throws IOException {
|
||||
imageCache = new LRUMap<>(500);
|
||||
Buffer in = new Buffer(config.read("data"));
|
||||
|
||||
int parentID = -1;
|
||||
int count = in.read16U();
|
||||
|
||||
instances = new Component[count];
|
||||
|
||||
while (in.position < in.data.length) {
|
||||
int id = in.read16U();
|
||||
|
||||
if (id == 65535) {
|
||||
parentID = in.read16U();
|
||||
id = in.read16U();
|
||||
}
|
||||
|
||||
Component c = instances[id] = new Component();
|
||||
c.id = id;
|
||||
c.parentID = parentID;
|
||||
c.type = in.read8U();
|
||||
c.optionType = in.read8U();
|
||||
c.contentType = in.read16U();
|
||||
c.width = in.read16U();
|
||||
c.height = in.read16U();
|
||||
c.transparency = (byte) in.read8U();
|
||||
c.delegateHover = in.read8U();
|
||||
|
||||
if (c.delegateHover != 0) {
|
||||
c.delegateHover = ((c.delegateHover - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
c.delegateHover = -1;
|
||||
}
|
||||
|
||||
int comparatorCount = in.read8U();
|
||||
if (comparatorCount > 0) {
|
||||
c.scriptComparator = new int[comparatorCount];
|
||||
c.scriptOperand = new int[comparatorCount];
|
||||
for (int i = 0; i < comparatorCount; i++) {
|
||||
c.scriptComparator[i] = in.read8U();
|
||||
c.scriptOperand[i] = in.read16U();
|
||||
}
|
||||
}
|
||||
|
||||
int scriptCount = in.read8U();
|
||||
if (scriptCount > 0) {
|
||||
c.scripts = new int[scriptCount][];
|
||||
for (int scriptID = 0; scriptID < scriptCount; scriptID++) {
|
||||
int length = in.read16U();
|
||||
c.scripts[scriptID] = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
c.scripts[scriptID][i] = in.read16U();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c.type == 0) {
|
||||
c.scrollableHeight = in.read16U();
|
||||
c.hide = in.read8U() == 1;
|
||||
int childCount = in.read16U();
|
||||
c.children = new int[childCount];
|
||||
c.childX = new int[childCount];
|
||||
c.childY = new int[childCount];
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
c.children[i] = in.read16U();
|
||||
c.childX[i] = in.read16();
|
||||
c.childY[i] = in.read16();
|
||||
}
|
||||
}
|
||||
|
||||
if (c.type == 1) {
|
||||
c.unusedInt = in.read16U();
|
||||
c.unusedBool = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if (c.type == 2) {
|
||||
c.invSlotObjID = new int[c.width * c.height];
|
||||
c.invSlotAmount = new int[c.width * c.height];
|
||||
c.invDraggable = in.read8U() == 1;
|
||||
c.aBoolean249 = in.read8U() == 1;
|
||||
c.invUsable = in.read8U() == 1;
|
||||
c.invMoveReplaces = in.read8U() == 1;
|
||||
c.invMarginX = in.read8U();
|
||||
c.invMarginY = in.read8U();
|
||||
c.invSlotX = new int[20];
|
||||
c.invSlotY = new int[20];
|
||||
c.invSlotImage = new Image24[20];
|
||||
for (int j2 = 0; j2 < 20; j2++) {
|
||||
int k3 = in.read8U();
|
||||
if (k3 == 1) {
|
||||
c.invSlotX[j2] = in.read16();
|
||||
c.invSlotY[j2] = in.read16();
|
||||
String s1 = in.readString();
|
||||
if ((media != null) && (s1.length() > 0)) {
|
||||
int i5 = s1.lastIndexOf(",");
|
||||
c.invSlotImage[j2] = getImage(Integer.parseInt(s1.substring(i5 + 1)), media, s1.substring(0, i5));
|
||||
}
|
||||
}
|
||||
}
|
||||
c.invOptions = new String[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
c.invOptions[i] = in.readString();
|
||||
if (c.invOptions[i].length() == 0) {
|
||||
c.invOptions[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c.type == 3) {
|
||||
c.fill = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if ((c.type == 4) || (c.type == 1)) {
|
||||
c.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
c.font = fonts[fontID];
|
||||
}
|
||||
c.shadow = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if (c.type == 4) {
|
||||
c.text = in.readString();
|
||||
c.activeText = in.readString();
|
||||
}
|
||||
|
||||
if ((c.type == 1) || (c.type == 3) || (c.type == 4)) {
|
||||
c.color = in.read32();
|
||||
}
|
||||
|
||||
if ((c.type == 3) || (c.type == 4)) {
|
||||
c.activeColor = in.read32();
|
||||
c.hoverColor = in.read32();
|
||||
c.activeHoverColor = in.read32();
|
||||
}
|
||||
|
||||
if (c.type == 5) {
|
||||
String s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
c.image = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
c.activeImage = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
}
|
||||
|
||||
if (c.type == 6) {
|
||||
int tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
c.modelCategory = 1;
|
||||
c.modelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
c.activeModelCategory = 1;
|
||||
c.activeModelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
c.seqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
c.seqID = -1;
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
c.activeSeqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
c.activeSeqID = -1;
|
||||
}
|
||||
|
||||
c.modelZoom = in.read16U();
|
||||
c.modelPitch = in.read16U();
|
||||
c.modelYaw = in.read16U();
|
||||
}
|
||||
|
||||
if (c.type == 7) {
|
||||
c.invSlotObjID = new int[c.width * c.height];
|
||||
c.invSlotAmount = new int[c.width * c.height];
|
||||
c.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
c.font = fonts[fontID];
|
||||
}
|
||||
c.shadow = in.read8U() == 1;
|
||||
c.color = in.read32();
|
||||
c.invMarginX = in.read16();
|
||||
c.invMarginY = in.read16();
|
||||
c.aBoolean249 = in.read8U() == 1;
|
||||
c.invOptions = new String[5];
|
||||
for (int k4 = 0; k4 < 5; k4++) {
|
||||
c.invOptions[k4] = in.readString();
|
||||
if (c.invOptions[k4].length() == 0) {
|
||||
c.invOptions[k4] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (c.type == 8) {
|
||||
c.spellAction = in.readString();
|
||||
}
|
||||
|
||||
if ((c.optionType == 2) || (c.type == 2)) {
|
||||
c.spellAction = in.readString();
|
||||
c.spellName = in.readString();
|
||||
c.spellFlags = in.read16U();
|
||||
}
|
||||
|
||||
if ((c.optionType == 1) || (c.optionType == 4) || (c.optionType == 5) || (c.optionType == 6)) {
|
||||
c.option = in.readString();
|
||||
if (c.option.length() == 0) {
|
||||
if (c.optionType == 1) {
|
||||
c.option = "Ok";
|
||||
} else if (c.optionType == 4) {
|
||||
c.option = "Select";
|
||||
} else if (c.optionType == 5) {
|
||||
c.option = "Select";
|
||||
} else if (c.optionType == 6) {
|
||||
c.option = "Continue";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
imageCache = null;
|
||||
}
|
||||
|
||||
public static Image24 getImage(int id, FileArchive media, String name) {
|
||||
long uid = (StringUtil.hashCode(name) << 8) + (long) id;
|
||||
Image24 image = imageCache.get(uid);
|
||||
if (image != null) {
|
||||
return image;
|
||||
}
|
||||
try {
|
||||
image = new Image24(media, name, id);
|
||||
imageCache.put(uid, image);
|
||||
} catch (Exception _ex) {
|
||||
return null;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
public static void cacheModel(int id, int type, Model model) {
|
||||
modelCache.clear();
|
||||
if ((model != null) && (type != 4)) {
|
||||
modelCache.put(((long) type << 16) + id, model);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean aBoolean249;
|
||||
public int activeColor;
|
||||
public int activeHoverColor;
|
||||
public Image24 activeImage;
|
||||
public int activeModelCategory;
|
||||
public int activeModelID;
|
||||
public int activeSeqID;
|
||||
public String activeText;
|
||||
public boolean center;
|
||||
public int[] children;
|
||||
public int[] childX;
|
||||
public int[] childY;
|
||||
public int color;
|
||||
public int contentType;
|
||||
public int delegateHover;
|
||||
public boolean fill;
|
||||
public BitmapFont font;
|
||||
public int height;
|
||||
/**
|
||||
* Hides this component. Only works for parent components by default.
|
||||
* @see Game#drawParentComponent(Component, int, int, int)
|
||||
*/
|
||||
public boolean hide;
|
||||
public int hoverColor;
|
||||
public int id;
|
||||
public Image24 image;
|
||||
public boolean invDraggable;
|
||||
public int invMarginX;
|
||||
public int invMarginY;
|
||||
public boolean invMoveReplaces;
|
||||
public String[] invOptions;
|
||||
public int[] invSlotAmount;
|
||||
public Image24[] invSlotImage;
|
||||
public int[] invSlotObjID;
|
||||
public int[] invSlotX;
|
||||
public int[] invSlotY;
|
||||
public boolean invUsable;
|
||||
public int modelPitch;
|
||||
public int modelCategory;
|
||||
public int modelID;
|
||||
public int modelYaw;
|
||||
public int modelZoom;
|
||||
public String option;
|
||||
public int optionType;
|
||||
public int parentID;
|
||||
public int[] scriptComparator;
|
||||
public int[] scriptOperand;
|
||||
public int[][] scripts;
|
||||
public int scrollableHeight;
|
||||
public int scrollPos;
|
||||
public int seqCycle;
|
||||
public int seqFrame;
|
||||
public int seqID;
|
||||
public boolean shadow;
|
||||
public String spellAction;
|
||||
public int spellFlags;
|
||||
public String spellName;
|
||||
public String text;
|
||||
public byte transparency;
|
||||
public int type;
|
||||
public boolean unusedBool;
|
||||
public int unusedInt;
|
||||
public int width;
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
|
||||
public Component() {
|
||||
}
|
||||
|
||||
public void swapSlots(int src, int dst) {
|
||||
int tmp = invSlotObjID[src];
|
||||
invSlotObjID[src] = invSlotObjID[dst];
|
||||
invSlotObjID[dst] = tmp;
|
||||
|
||||
tmp = invSlotAmount[src];
|
||||
invSlotAmount[src] = invSlotAmount[dst];
|
||||
invSlotAmount[dst] = tmp;
|
||||
}
|
||||
|
||||
public Model getModel(int category, int id) {
|
||||
Model model = modelCache.get(((long) category << 16) + id);
|
||||
if (model != null) {
|
||||
return model;
|
||||
}
|
||||
if (category == 1) {
|
||||
model = Model.tryGet(id);
|
||||
}
|
||||
if (category == 2) {
|
||||
model = NPCType.get(id).getUnlitHeadModel();
|
||||
}
|
||||
if (category == 3) {
|
||||
model = Game.localPlayer.getUnlitHeadModel();
|
||||
}
|
||||
if (category == 4) {
|
||||
model = ObjType.get(id).getUnlitModel(50);
|
||||
}
|
||||
if (model != null) {
|
||||
modelCache.put((long) ((category << 16) + id), model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
public Model getModel(int secondaryTransformID, int primaryTransformID, boolean active) {
|
||||
Model model;
|
||||
|
||||
if (active) {
|
||||
model = getModel(activeModelCategory, activeModelID);
|
||||
} else {
|
||||
model = getModel(modelCategory, modelID);
|
||||
}
|
||||
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((primaryTransformID == -1) && (secondaryTransformID == -1) && (model.faceColor == null)) {
|
||||
return model;
|
||||
}
|
||||
|
||||
Model animatedModel = new Model(true, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID), false, model);
|
||||
|
||||
if ((primaryTransformID != -1) || (secondaryTransformID != -1)) {
|
||||
animatedModel.createLabelReferences();
|
||||
}
|
||||
|
||||
if (primaryTransformID != -1) {
|
||||
animatedModel.applyTransform(primaryTransformID);
|
||||
}
|
||||
|
||||
if (secondaryTransformID != -1) {
|
||||
animatedModel.applyTransform(secondaryTransformID);
|
||||
}
|
||||
|
||||
animatedModel.calculateNormals(64, 768, -50, -10, -50, true);
|
||||
return animatedModel;
|
||||
}
|
||||
|
||||
}
|
||||
+1510
-1359
File diff suppressed because it is too large.
Load diff
@@ -4,20 +4,20 @@
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class IDKType {
|
||||
public class IdkType {
|
||||
|
||||
public static int count;
|
||||
public static IDKType[] instances;
|
||||
public static IdkType[] instances;
|
||||
|
||||
public static void unpack(FileArchive archive) throws IOException {
|
||||
Buffer buffer = new Buffer(archive.read("idk.dat"));
|
||||
count = buffer.read16U();
|
||||
if (instances == null) {
|
||||
instances = new IDKType[count];
|
||||
instances = new IdkType[count];
|
||||
}
|
||||
for (int j = 0; j < count; j++) {
|
||||
if (instances[j] == null) {
|
||||
instances[j] = new IDKType();
|
||||
instances[j] = new IdkType();
|
||||
}
|
||||
instances[j].method536(buffer);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class IDKType {
|
||||
public int[] modelIDs;
|
||||
public boolean selectable = false;
|
||||
|
||||
public IDKType() {
|
||||
public IdkType() {
|
||||
}
|
||||
|
||||
public void method536(Buffer buffer) {
|
||||
@@ -0,0 +1,406 @@
|
||||
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
|
||||
// Jad home page: http://www.kpdus.com/jad.html
|
||||
// Decompiler options: packimports(3)
|
||||
|
||||
import org.apache.commons.collections4.map.LRUMap;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class IfType {
|
||||
|
||||
public static final LRUMap<Long, Model> modelCache = new LRUMap<>(30);
|
||||
public static LRUMap<Long, Image24> imageCache;
|
||||
public static IfType[] instances;
|
||||
|
||||
public static void unpack(FileArchive config, BitmapFont[] fonts, FileArchive media) throws IOException {
|
||||
imageCache = new LRUMap<>(500);
|
||||
Buffer in = new Buffer(config.read("data"));
|
||||
|
||||
int parentID = -1;
|
||||
int count = in.read16U();
|
||||
|
||||
instances = new IfType[count];
|
||||
|
||||
while (in.position < in.data.length) {
|
||||
int id = in.read16U();
|
||||
|
||||
if (id == 65535) {
|
||||
parentID = in.read16U();
|
||||
id = in.read16U();
|
||||
}
|
||||
|
||||
IfType iface = instances[id] = new IfType();
|
||||
iface.id = id;
|
||||
iface.parentID = parentID;
|
||||
iface.type = in.read8U();
|
||||
iface.optionType = in.read8U();
|
||||
iface.contentType = in.read16U();
|
||||
iface.width = in.read16U();
|
||||
iface.height = in.read16U();
|
||||
iface.transparency = (byte) in.read8U();
|
||||
iface.delegateHover = in.read8U();
|
||||
|
||||
if (iface.delegateHover != 0) {
|
||||
iface.delegateHover = ((iface.delegateHover - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.delegateHover = -1;
|
||||
}
|
||||
|
||||
int comparatorCount = in.read8U();
|
||||
if (comparatorCount > 0) {
|
||||
iface.scriptComparator = new int[comparatorCount];
|
||||
iface.scriptOperand = new int[comparatorCount];
|
||||
for (int i = 0; i < comparatorCount; i++) {
|
||||
iface.scriptComparator[i] = in.read8U();
|
||||
iface.scriptOperand[i] = in.read16U();
|
||||
}
|
||||
}
|
||||
|
||||
int scriptCount = in.read8U();
|
||||
if (scriptCount > 0) {
|
||||
iface.scripts = new int[scriptCount][];
|
||||
for (int scriptID = 0; scriptID < scriptCount; scriptID++) {
|
||||
int length = in.read16U();
|
||||
iface.scripts[scriptID] = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
iface.scripts[scriptID][i] = in.read16U();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == 0) {
|
||||
iface.scrollableHeight = in.read16U();
|
||||
iface.hide = in.read8U() == 1;
|
||||
int childCount = in.read16U();
|
||||
iface.children = new int[childCount];
|
||||
iface.childX = new int[childCount];
|
||||
iface.childY = new int[childCount];
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
iface.children[i] = in.read16U();
|
||||
iface.childX[i] = in.read16();
|
||||
iface.childY[i] = in.read16();
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == 1) {
|
||||
iface.unusedInt = in.read16U();
|
||||
iface.unusedBool = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if (iface.type == 2) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.inventoryDraggable = in.read8U() == 1;
|
||||
iface.aBoolean249 = in.read8U() == 1;
|
||||
iface.inventoryUsable = in.read8U() == 1;
|
||||
iface.inventoryMoveReplaces = in.read8U() == 1;
|
||||
iface.inventoryMarginX = in.read8U();
|
||||
iface.inventoryMarginY = in.read8U();
|
||||
iface.inventorySlotOffsetX = new int[20];
|
||||
iface.inventorySlotOffsetY = new int[20];
|
||||
iface.inventorySlotImage = new Image24[20];
|
||||
for (int j2 = 0; j2 < 20; j2++) {
|
||||
int k3 = in.read8U();
|
||||
if (k3 == 1) {
|
||||
iface.inventorySlotOffsetX[j2] = in.read16();
|
||||
iface.inventorySlotOffsetY[j2] = in.read16();
|
||||
String s1 = in.readString();
|
||||
if ((media != null) && (s1.length() > 0)) {
|
||||
int i5 = s1.lastIndexOf(",");
|
||||
iface.inventorySlotImage[j2] = getImage(Integer.parseInt(s1.substring(i5 + 1)), media, s1.substring(0, i5));
|
||||
}
|
||||
}
|
||||
}
|
||||
iface.inventoryOptions = new String[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
iface.inventoryOptions[i] = in.readString();
|
||||
if (iface.inventoryOptions[i].length() == 0) {
|
||||
iface.inventoryOptions[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == 3) {
|
||||
iface.fill = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if ((iface.type == 4) || (iface.type == 1)) {
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if (iface.type == 4) {
|
||||
iface.text = in.readString();
|
||||
iface.activeText = in.readString();
|
||||
}
|
||||
|
||||
if ((iface.type == 1) || (iface.type == 3) || (iface.type == 4)) {
|
||||
iface.color = in.read32();
|
||||
}
|
||||
|
||||
if ((iface.type == 3) || (iface.type == 4)) {
|
||||
iface.activeColor = in.read32();
|
||||
iface.hoverColor = in.read32();
|
||||
iface.activeHoverColor = in.read32();
|
||||
}
|
||||
|
||||
if (iface.type == 5) {
|
||||
String s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
iface.image = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
iface.activeImage = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == 6) {
|
||||
int tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.modelCategory = 1;
|
||||
iface.modelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.activeModelCategory = 1;
|
||||
iface.activeModelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.seqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.seqID = -1;
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.activeSeqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.activeSeqID = -1;
|
||||
}
|
||||
|
||||
iface.modelZoom = in.read16U();
|
||||
iface.modelPitch = in.read16U();
|
||||
iface.modelYaw = in.read16U();
|
||||
}
|
||||
|
||||
if (iface.type == 7) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
iface.color = in.read32();
|
||||
iface.inventoryMarginX = in.read16();
|
||||
iface.inventoryMarginY = in.read16();
|
||||
iface.aBoolean249 = in.read8U() == 1;
|
||||
iface.inventoryOptions = new String[5];
|
||||
for (int k4 = 0; k4 < 5; k4++) {
|
||||
iface.inventoryOptions[k4] = in.readString();
|
||||
if (iface.inventoryOptions[k4].length() == 0) {
|
||||
iface.inventoryOptions[k4] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == 8) {
|
||||
iface.spellAction = in.readString();
|
||||
}
|
||||
|
||||
if ((iface.optionType == 2) || (iface.type == 2)) {
|
||||
iface.spellAction = in.readString();
|
||||
iface.spellName = in.readString();
|
||||
iface.spellFlags = in.read16U();
|
||||
}
|
||||
|
||||
if ((iface.optionType == 1) || (iface.optionType == 4) || (iface.optionType == 5) || (iface.optionType == 6)) {
|
||||
iface.option = in.readString();
|
||||
if (iface.option.length() == 0) {
|
||||
if (iface.optionType == 1) {
|
||||
iface.option = "Ok";
|
||||
} else if (iface.optionType == 4) {
|
||||
iface.option = "Select";
|
||||
} else if (iface.optionType == 5) {
|
||||
iface.option = "Select";
|
||||
} else if (iface.optionType == 6) {
|
||||
iface.option = "Continue";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
imageCache = null;
|
||||
}
|
||||
|
||||
public static Image24 getImage(int id, FileArchive media, String name) {
|
||||
long uid = (StringUtil.hashCode(name) << 8) + (long) id;
|
||||
Image24 image = imageCache.get(uid);
|
||||
if (image != null) {
|
||||
return image;
|
||||
}
|
||||
try {
|
||||
image = new Image24(media, name, id);
|
||||
imageCache.put(uid, image);
|
||||
} catch (Exception _ex) {
|
||||
return null;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
public static void cacheModel(int id, int type, Model model) {
|
||||
modelCache.clear();
|
||||
if ((model != null) && (type != 4)) {
|
||||
modelCache.put(((long) type << 16) + id, model);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean aBoolean249;
|
||||
public int activeColor;
|
||||
public int activeHoverColor;
|
||||
public Image24 activeImage;
|
||||
public int activeModelCategory;
|
||||
public int activeModelID;
|
||||
public int activeSeqID;
|
||||
public String activeText;
|
||||
public boolean center;
|
||||
public int[] children;
|
||||
public int[] childX;
|
||||
public int[] childY;
|
||||
public int color;
|
||||
public int contentType;
|
||||
public int delegateHover;
|
||||
public boolean fill;
|
||||
public BitmapFont font;
|
||||
public int height;
|
||||
/**
|
||||
* Hides this component. Only works for parent components by default.
|
||||
* @see Game#drawParentComponent(IfType, int, int, int)
|
||||
*/
|
||||
public boolean hide;
|
||||
public int hoverColor;
|
||||
public int id;
|
||||
public Image24 image;
|
||||
public boolean inventoryDraggable;
|
||||
public int inventoryMarginX;
|
||||
public int inventoryMarginY;
|
||||
public boolean inventoryMoveReplaces;
|
||||
public String[] inventoryOptions;
|
||||
public int[] inventorySlotObjCount;
|
||||
public Image24[] inventorySlotImage;
|
||||
public int[] inventorySlotObjID;
|
||||
public int[] inventorySlotOffsetX;
|
||||
public int[] inventorySlotOffsetY;
|
||||
public boolean inventoryUsable;
|
||||
public int modelPitch;
|
||||
public int modelCategory;
|
||||
public int modelID;
|
||||
public int modelYaw;
|
||||
public int modelZoom;
|
||||
public String option;
|
||||
public int optionType;
|
||||
public int parentID;
|
||||
public int[] scriptComparator;
|
||||
public int[] scriptOperand;
|
||||
public int[][] scripts;
|
||||
public int scrollableHeight;
|
||||
public int scrollPos;
|
||||
public int seqCycle;
|
||||
public int seqFrame;
|
||||
public int seqID;
|
||||
public boolean shadow;
|
||||
public String spellAction;
|
||||
public int spellFlags;
|
||||
public String spellName;
|
||||
public String text;
|
||||
public byte transparency;
|
||||
public int type;
|
||||
public boolean unusedBool;
|
||||
public int unusedInt;
|
||||
public int width;
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
|
||||
public IfType() {
|
||||
}
|
||||
|
||||
public void inventorySwap(int src, int dst) {
|
||||
int tmp = inventorySlotObjID[src];
|
||||
inventorySlotObjID[src] = inventorySlotObjID[dst];
|
||||
inventorySlotObjID[dst] = tmp;
|
||||
|
||||
tmp = inventorySlotObjCount[src];
|
||||
inventorySlotObjCount[src] = inventorySlotObjCount[dst];
|
||||
inventorySlotObjCount[dst] = tmp;
|
||||
}
|
||||
|
||||
public Model getModel(int category, int id) {
|
||||
Model model = modelCache.get(((long) category << 16) + id);
|
||||
if (model != null) {
|
||||
return model;
|
||||
}
|
||||
if (category == 1) {
|
||||
model = Model.tryGet(id);
|
||||
}
|
||||
if (category == 2) {
|
||||
model = NPCType.get(id).getUnlitHeadModel();
|
||||
}
|
||||
if (category == 3) {
|
||||
model = Game.localPlayer.getUnlitHeadModel();
|
||||
}
|
||||
if (category == 4) {
|
||||
model = ObjType.get(id).getUnlitModel(50);
|
||||
}
|
||||
if (model != null) {
|
||||
modelCache.put((long) ((category << 16) + id), model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
public Model getModel(int secondaryTransformID, int primaryTransformID, boolean active) {
|
||||
Model model;
|
||||
|
||||
if (active) {
|
||||
model = getModel(activeModelCategory, activeModelID);
|
||||
} else {
|
||||
model = getModel(modelCategory, modelID);
|
||||
}
|
||||
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((primaryTransformID == -1) && (secondaryTransformID == -1) && (model.faceColor == null)) {
|
||||
return model;
|
||||
}
|
||||
|
||||
Model animatedModel = new Model(true, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID), false, model);
|
||||
|
||||
if ((primaryTransformID != -1) || (secondaryTransformID != -1)) {
|
||||
animatedModel.createLabelReferences();
|
||||
}
|
||||
|
||||
if (primaryTransformID != -1) {
|
||||
animatedModel.applyTransform(primaryTransformID);
|
||||
}
|
||||
|
||||
if (secondaryTransformID != -1) {
|
||||
animatedModel.applyTransform(secondaryTransformID);
|
||||
}
|
||||
|
||||
animatedModel.calculateNormals(64, 768, -50, -10, -50, true);
|
||||
return animatedModel;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,8 +42,8 @@ public class NPCEntity extends PathingEntity {
|
||||
|
||||
super.height = model.minY;
|
||||
|
||||
if ((super.spotanim != -1) && (super.spotanimFrame != -1)) {
|
||||
SpotAnimType spotanim = SpotAnimType.instances[super.spotanim];
|
||||
if ((super.spotanimID != -1) && (super.spotanimFrame != -1)) {
|
||||
SpotAnimType spotanim = SpotAnimType.instances[super.spotanimID];
|
||||
Model model0 = spotanim.getModel();
|
||||
|
||||
if (model0 != null) {
|
||||
@@ -51,7 +51,7 @@ public class NPCEntity extends PathingEntity {
|
||||
|
||||
// create a copy of the model
|
||||
Model model1 = new Model(true, SeqTransform.isNull(transformID), false, model0);
|
||||
model1.translate(0, -super.spotanimY, 0);
|
||||
model1.translate(0, -super.spotanimOffset, 0);
|
||||
model1.createLabelReferences();
|
||||
model1.applyTransform(transformID);
|
||||
model1.labelFaces = null;
|
||||
|
||||
+10
-10
@@ -7,7 +7,7 @@ public final class PacketIn {
|
||||
public static final int CAM_RESET = 107;
|
||||
public static final int CAM_SETPOS = 166;
|
||||
public static final int CAM_SHAKE = 35;
|
||||
public static final int CHAT_COMPONENT = 164;
|
||||
public static final int IF_CHAT = 164;
|
||||
public static final int CHAT_COMPONENT_STICKY = 218;
|
||||
public static final int CHAT_FILTER_SETTINGS = 206;
|
||||
public static final int CLEAR_MAP_FLAG = 78;
|
||||
@@ -50,19 +50,19 @@ public final class PacketIn {
|
||||
public static final int OBJ_COUNT = 84;
|
||||
public static final int OBJ_DEL = 156;
|
||||
public static final int OBJ_REVEAL = 215;
|
||||
public static final int PLAYER_LOC = 147;
|
||||
public static final int MAP_PROJANIM = 117;
|
||||
public static final int LOC_PLAYER = 147;
|
||||
public static final int MAP_PROJECTILE = 117;
|
||||
public static final int REBUILD_REGION = 73;
|
||||
public static final int REBUILD_REGION_INSTANCE = 241;
|
||||
public static final int RESET_ANIMS = 1;
|
||||
public static final int RESET_CLIENT_VARCACHE = 68;
|
||||
public static final int SET_PLAYER_OP = 104;
|
||||
public static final int SOUND_AREA = 105;
|
||||
public static final int MAP_SOUND = 105;
|
||||
public static final int MAP_ANIM = 4;
|
||||
public static final int SYNC_NPCS = 65;
|
||||
public static final int SYNC_PLAYERS = 81;
|
||||
public static final int SYNTH_SOUND = 174;
|
||||
public static final int TAB_COMPONENT = 71;
|
||||
public static final int IF_TAB = 71;
|
||||
public static final int TAB_HINT = 24;
|
||||
public static final int TAB_SELECTED = 106;
|
||||
public static final int UPDATE_INV_FULL = 53;
|
||||
@@ -93,7 +93,7 @@ public final class PacketIn {
|
||||
SIZE[ZONE_CLEAR] = 2;
|
||||
SIZE[SYNC_NPCS] = -2;
|
||||
SIZE[IF_SETPOSITION] = 6;
|
||||
SIZE[TAB_COMPONENT] = 3;
|
||||
SIZE[IF_TAB] = 3;
|
||||
SIZE[INV_CLEAR] = 2;
|
||||
SIZE[REBUILD_REGION] = 4;
|
||||
SIZE[MIDI_SONG] = 2;
|
||||
@@ -107,21 +107,21 @@ public final class PacketIn {
|
||||
SIZE[MINIMAP_TOGGLE] = 1;
|
||||
SIZE[LOC_DEL] = 2;
|
||||
SIZE[SET_PLAYER_OP] = -1;
|
||||
SIZE[SOUND_AREA] = 4;
|
||||
SIZE[MAP_SOUND] = 4;
|
||||
SIZE[TAB_SELECTED] = 1;
|
||||
SIZE[UPDATE_RUNENERGY] = 1;
|
||||
SIZE[UPDATE_REBOOT_TIMER] = 2;
|
||||
SIZE[MAP_PROJANIM] = 15;
|
||||
SIZE[MAP_PROJECTILE] = 15;
|
||||
SIZE[MIDI_JINGLE] = 4;
|
||||
SIZE[IF_SETCOLOR] = 4;
|
||||
SIZE[IF_SETTEXT] = -2;
|
||||
SIZE[UPDATE_STAT] = 6;
|
||||
SIZE[IF_STOPANIM] = 2;
|
||||
SIZE[PLAYER_LOC] = 14;
|
||||
SIZE[LOC_PLAYER] = 14;
|
||||
SIZE[LOC_ADD] = 4;
|
||||
SIZE[OBJ_DEL] = 3;
|
||||
SIZE[LOC_CHANGE] = 4;
|
||||
SIZE[CHAT_COMPONENT] = 2;
|
||||
SIZE[IF_CHAT] = 2;
|
||||
SIZE[CAM_SETPOS] = 6;
|
||||
SIZE[IF_SETHIDE] = 3;
|
||||
SIZE[SYNTH_SOUND] = 5;
|
||||
|
||||
+148
-150
@@ -4,164 +4,162 @@
|
||||
|
||||
public class PathingEntity extends Entity {
|
||||
|
||||
public final int[] pathTileX = new int[10];
|
||||
public final int[] pathTileZ = new int[10];
|
||||
public final int[] damage = new int[4];
|
||||
public final int[] damageType = new int[4];
|
||||
public final int[] damageCycle = new int[4];
|
||||
public final boolean[] pathRunning = new boolean[10];
|
||||
public int index = -1;
|
||||
public int seqTrigger;
|
||||
public int turnSpeed = 32;
|
||||
public int seqRunID = -1;
|
||||
public String chat;
|
||||
public int height = 200;
|
||||
public int dstYaw;
|
||||
public int seqStandID = -1;
|
||||
public int seqTurnID = -1;
|
||||
public int chatColor;
|
||||
public int secondarySeqID = -1;
|
||||
public int secondarySeqFrame;
|
||||
public int secondarySeqCycle;
|
||||
public int spotanim = -1;
|
||||
public int spotanimFrame;
|
||||
public int spotanimCycle;
|
||||
public int anInt1523;
|
||||
public int spotanimY;
|
||||
public int pathLength;
|
||||
public int primarySeqID = -1;
|
||||
public int primarySeqFrame;
|
||||
public int primarySeqCycle;
|
||||
public int primarySeqDelay;
|
||||
public int primarySeqLoop;
|
||||
public int chatStyle;
|
||||
public int combatCycle = -1000;
|
||||
public int health;
|
||||
public int totalHealth;
|
||||
public int chatTimer = 100;
|
||||
public int anInt1537;
|
||||
public int faceTileX;
|
||||
public int faceTileZ;
|
||||
public int size = 1;
|
||||
public boolean aBoolean1541 = false;
|
||||
public int seqPathLength;
|
||||
public int forceMoveStartSceneTileX;
|
||||
public int forceMoveEndSceneTileX;
|
||||
public int forceMoveStartSceneTileZ;
|
||||
public int forceMoveEndSceneTileZ;
|
||||
public int forceMoveEndCycle;
|
||||
public int forceMoveStartCycle;
|
||||
public int forceMoveFaceDirection;
|
||||
public int x;
|
||||
public int z;
|
||||
public int yaw;
|
||||
public int seqWalkID = -1;
|
||||
public int seqTurnAroundID = -1;
|
||||
public int seqTurnLeftID = -1;
|
||||
public int seqTurnRightID = -1;
|
||||
public final int[] pathTileX = new int[10];
|
||||
public final int[] pathTileZ = new int[10];
|
||||
public final int[] damage = new int[4];
|
||||
public final int[] damageType = new int[4];
|
||||
public final int[] damageCycle = new int[4];
|
||||
public final boolean[] pathRunning = new boolean[10];
|
||||
public int targetID = -1;
|
||||
public int seqTrigger;
|
||||
public int turnSpeed = 32;
|
||||
public int seqRunID = -1;
|
||||
public String chat;
|
||||
public int height = 200;
|
||||
public int dstYaw;
|
||||
public int seqStandID = -1;
|
||||
public int seqTurnID = -1;
|
||||
public int chatColor;
|
||||
public int secondarySeqID = -1;
|
||||
public int secondarySeqFrame;
|
||||
public int secondarySeqCycle;
|
||||
public int spotanimID = -1;
|
||||
public int spotanimFrame;
|
||||
public int spotanimCycle;
|
||||
public int spotanimLastCycle;
|
||||
public int spotanimOffset;
|
||||
public int pathLength;
|
||||
public int primarySeqID = -1;
|
||||
public int primarySeqFrame;
|
||||
public int primarySeqCycle;
|
||||
public int primarySeqDelay;
|
||||
public int primarySeqLoop;
|
||||
public int chatStyle;
|
||||
public int combatCycle = -1000;
|
||||
public int health;
|
||||
public int totalHealth;
|
||||
public int chatTimer = 100;
|
||||
public int cycle;
|
||||
public int targetTileX;
|
||||
public int targetTileZ;
|
||||
public int size = 1;
|
||||
public boolean aBoolean1541 = false;
|
||||
public int seqPathLength;
|
||||
public int forceMoveStartSceneTileX;
|
||||
public int forceMoveEndSceneTileX;
|
||||
public int forceMoveStartSceneTileZ;
|
||||
public int forceMoveEndSceneTileZ;
|
||||
public int forceMoveEndCycle;
|
||||
public int forceMoveStartCycle;
|
||||
public int forceMoveFaceDirection;
|
||||
public int x;
|
||||
public int z;
|
||||
public int yaw;
|
||||
public int seqWalkID = -1;
|
||||
public int seqTurnAroundID = -1;
|
||||
public int seqTurnLeftID = -1;
|
||||
public int seqTurnRightID = -1;
|
||||
|
||||
public PathingEntity() {
|
||||
}
|
||||
public PathingEntity() {
|
||||
}
|
||||
|
||||
public void move(int x, int z, boolean teleport) {
|
||||
if ((primarySeqID != -1) && (SeqType.instances[primarySeqID].idleStyle == 1)) {
|
||||
primarySeqID = -1;
|
||||
}
|
||||
if (!teleport) {
|
||||
int dx = x - pathTileX[0];
|
||||
int dz = z - pathTileZ[0];
|
||||
public void move(int x, int z, boolean teleport) {
|
||||
if ((primarySeqID != -1) && (SeqType.instances[primarySeqID].idleStyle == 1)) {
|
||||
primarySeqID = -1;
|
||||
}
|
||||
if (!teleport) {
|
||||
int dx = x - pathTileX[0];
|
||||
int dz = z - pathTileZ[0];
|
||||
|
||||
if ((dx >= -8) && (dx <= 8) && (dz >= -8) && (dz <= 8)) {
|
||||
if (pathLength < 9) {
|
||||
pathLength++;
|
||||
}
|
||||
if ((dx >= -8) && (dx <= 8) && (dz >= -8) && (dz <= 8)) {
|
||||
if (pathLength < 9) {
|
||||
pathLength++;
|
||||
}
|
||||
|
||||
for (int i = pathLength; i > 0; i--) {
|
||||
pathTileX[i] = pathTileX[i - 1];
|
||||
pathTileZ[i] = pathTileZ[i - 1];
|
||||
pathRunning[i] = pathRunning[i - 1];
|
||||
}
|
||||
for (int i = pathLength; i > 0; i--) {
|
||||
pathTileX[i] = pathTileX[i - 1];
|
||||
pathTileZ[i] = pathTileZ[i - 1];
|
||||
pathRunning[i] = pathRunning[i - 1];
|
||||
}
|
||||
|
||||
pathTileX[0] = x;
|
||||
pathTileZ[0] = z;
|
||||
pathRunning[0] = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
pathLength = 0;
|
||||
seqPathLength = 0;
|
||||
seqTrigger = 0;
|
||||
pathTileX[0] = x;
|
||||
pathTileZ[0] = z;
|
||||
this.x = (pathTileX[0] * 128) + (size * 64);
|
||||
this.z = (pathTileZ[0] * 128) + (size * 64);
|
||||
}
|
||||
pathTileX[0] = x;
|
||||
pathTileZ[0] = z;
|
||||
pathRunning[0] = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
pathLength = 0;
|
||||
seqPathLength = 0;
|
||||
seqTrigger = 0;
|
||||
pathTileX[0] = x;
|
||||
pathTileZ[0] = z;
|
||||
this.x = (pathTileX[0] * 128) + (size * 64);
|
||||
this.z = (pathTileZ[0] * 128) + (size * 64);
|
||||
}
|
||||
|
||||
public void resetPath() {
|
||||
pathLength = 0;
|
||||
seqPathLength = 0;
|
||||
}
|
||||
public void resetPath() {
|
||||
pathLength = 0;
|
||||
seqPathLength = 0;
|
||||
}
|
||||
|
||||
public void method447(int j, int k, int l) {
|
||||
for (int i1 = 0; i1 < 4; i1++) {
|
||||
if (damageCycle[i1] <= l) {
|
||||
damage[i1] = k;
|
||||
damageType[i1] = j;
|
||||
damageCycle[i1] = l + 70;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void hit(int type, int damage) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (damageCycle[i] <= Game.loopCycle) {
|
||||
this.damage[i] = damage;
|
||||
damageType[i] = type;
|
||||
damageCycle[i] = Game.loopCycle + 70;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void method448(boolean flag, int i) {
|
||||
int j = pathTileX[0];
|
||||
int k = pathTileZ[0];
|
||||
if (i == 0) {
|
||||
j--;
|
||||
k++;
|
||||
}
|
||||
if (i == 1) {
|
||||
k++;
|
||||
}
|
||||
if (i == 2) {
|
||||
j++;
|
||||
k++;
|
||||
}
|
||||
if (i == 3) {
|
||||
j--;
|
||||
}
|
||||
if (i == 4) {
|
||||
j++;
|
||||
}
|
||||
if (i == 5) {
|
||||
j--;
|
||||
k--;
|
||||
}
|
||||
if (i == 6) {
|
||||
k--;
|
||||
}
|
||||
if (i == 7) {
|
||||
j++;
|
||||
k--;
|
||||
}
|
||||
if ((primarySeqID != -1) && (SeqType.instances[primarySeqID].idleStyle == 1)) {
|
||||
primarySeqID = -1;
|
||||
}
|
||||
if (pathLength < 9) {
|
||||
pathLength++;
|
||||
}
|
||||
for (int l = pathLength; l > 0; l--) {
|
||||
pathTileX[l] = pathTileX[l - 1];
|
||||
pathTileZ[l] = pathTileZ[l - 1];
|
||||
pathRunning[l] = pathRunning[l - 1];
|
||||
}
|
||||
pathTileX[0] = j;
|
||||
pathTileZ[0] = k;
|
||||
pathRunning[0] = flag;
|
||||
}
|
||||
public void step(boolean running, int direction) {
|
||||
int nextX = pathTileX[0];
|
||||
int nextZ = pathTileZ[0];
|
||||
|
||||
public boolean isVisible() {
|
||||
return false;
|
||||
}
|
||||
if (direction == 0) {
|
||||
nextX--;
|
||||
nextZ++;
|
||||
} else if (direction == 1) {
|
||||
nextZ++;
|
||||
} else if (direction == 2) {
|
||||
nextX++;
|
||||
nextZ++;
|
||||
} else if (direction == 3) {
|
||||
nextX--;
|
||||
} else if (direction == 4) {
|
||||
nextX++;
|
||||
} else if (direction == 5) {
|
||||
nextX--;
|
||||
nextZ--;
|
||||
} else if (direction == 6) {
|
||||
nextZ--;
|
||||
} else if (direction == 7) {
|
||||
nextX++;
|
||||
nextZ--;
|
||||
}
|
||||
|
||||
if ((primarySeqID != -1) && (SeqType.instances[primarySeqID].idleStyle == 1)) {
|
||||
primarySeqID = -1;
|
||||
}
|
||||
|
||||
if (pathLength < 9) {
|
||||
pathLength++;
|
||||
}
|
||||
|
||||
for (int i = pathLength; i > 0; i--) {
|
||||
pathTileX[i] = pathTileX[i - 1];
|
||||
pathTileZ[i] = pathTileZ[i - 1];
|
||||
pathRunning[i] = pathRunning[i - 1];
|
||||
}
|
||||
|
||||
pathTileX[0] = nextX;
|
||||
pathTileZ[0] = nextZ;
|
||||
pathRunning[0] = running;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,13 +54,13 @@ public class PlayerEntity extends PathingEntity {
|
||||
return model;
|
||||
}
|
||||
|
||||
if ((super.spotanim != -1) && (super.spotanimFrame != -1)) {
|
||||
SpotAnimType spot = SpotAnimType.instances[super.spotanim];
|
||||
if ((super.spotanimID != -1) && (super.spotanimFrame != -1)) {
|
||||
SpotAnimType spot = SpotAnimType.instances[super.spotanimID];
|
||||
Model spotModel1 = spot.getModel();
|
||||
|
||||
if (spotModel1 != null) {
|
||||
Model spotModel2 = new Model(true, SeqTransform.isNull(super.spotanimFrame), false, spotModel1);
|
||||
spotModel2.translate(0, -super.spotanimY, 0);
|
||||
spotModel2.translate(0, -super.spotanimOffset, 0);
|
||||
spotModel2.createLabelReferences();
|
||||
spotModel2.applyTransform(spot.seq.transformIDs[super.spotanimFrame]);
|
||||
spotModel2.labelFaces = null;
|
||||
@@ -114,7 +114,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void method451(Buffer buffer) {
|
||||
public void read(Buffer buffer) {
|
||||
buffer.position = 0;
|
||||
gender = buffer.read8U();
|
||||
headicons = buffer.read8U();
|
||||
@@ -269,7 +269,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
value = rightHandValue;
|
||||
}
|
||||
|
||||
if ((value >= 256) && (value < 512) && !IDKType.instances[value - 256].validateModel()) {
|
||||
if ((value >= 256) && (value < 512) && !IdkType.instances[value - 256].validateModel()) {
|
||||
invalid = true;
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
}
|
||||
|
||||
if ((value >= 256) && (value < 512)) {
|
||||
Model kitModel = IDKType.instances[value - 256].getModel();
|
||||
Model kitModel = IdkType.instances[value - 256].getModel();
|
||||
if (kitModel != null) {
|
||||
models[modelCount++] = kitModel;
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
for (int part = 0; part < 12; part++) {
|
||||
int value = appearances[part];
|
||||
|
||||
if ((value >= 256) && (value < 512) && !IDKType.instances[value - 256].validateHeadModel()) {
|
||||
if ((value >= 256) && (value < 512) && !IdkType.instances[value - 256].validateHeadModel()) {
|
||||
invalid = true;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
int value = appearances[part];
|
||||
|
||||
if ((value >= 256) && (value < 512)) {
|
||||
Model model = IDKType.instances[value - 256].method540();
|
||||
Model model = IdkType.instances[value - 256].method540();
|
||||
if (model != null) {
|
||||
models[modelCount++] = model;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SeqType {
|
||||
public int[] transformIDs;
|
||||
|
||||
/**
|
||||
* Auxiliary transform indices appear to only be used by a {@link Component} of type <code>6</code> as seen in {@link Game#drawParentComponent(Component, int, int, int)}.
|
||||
* Auxiliary transform indices appear to only be used by a {@link IfType} of type <code>6</code> as seen in {@link Game#drawParentComponent(IfType, int, int, int)}.
|
||||
*/
|
||||
public int[] auxiliaryTransformIDs;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class SeqType {
|
||||
/**
|
||||
* If 0, restarts the sequence if already playing
|
||||
* If 1, does not restart if already playing
|
||||
* @see Game#method86(Buffer)
|
||||
* @see Game#readNPCUpdates()
|
||||
*/
|
||||
public int replayStyle = 1;
|
||||
|
||||
|
||||
Reference in new issue
Block a user