Fixed animation & buff window shows for recipient

This commit is contained in:
Waverunner
2013-11-11 18:46:59 -05:00
parent cc24adeea6
commit 330c06c93c
7 changed files with 212 additions and 87 deletions
@@ -1,66 +1,99 @@
package protocol.swg.objectControllerObjects;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.objects.BuffItem;
public class BuffBuilderChange extends ObjControllerObject {
private long bufferId;
private long recipientId;
private int buffCost;
private int accepted;
private int startTime;
private long unk1;
private long unk2;
private long unk3;
private int unkI1;
private int unkI2;
private long objectId;
private long bufferId;
private long recipientId;
private byte unkByte;
private Vector<BuffItem> buffs;
public BuffBuilderChange() {
}
public BuffBuilderChange(long bufferId, long recipientId, int accepted, int cost) {
public BuffBuilderChange(long objectId, long bufferId, long recipientId, int accepted, int cost) {
this.objectId = objectId;
this.bufferId = bufferId;
this.recipientId = recipientId;
this.accepted = accepted;
this.buffCost = cost;
//this.unkByte = (byte) 0;
}
@Override
public void deserialize(IoBuffer data) {
unk1 = data.getLong();
unkI1 = data.getInt();
unk2 = data.getLong();
unk3 = data.getLong();
unkI2 = data.getInt();
objectId = data.getLong(); // acting players id
data.getInt(); // tick count
bufferId = data.getLong(); // objId
recipientId = data.getLong();
startTime = data.getInt();
buffCost = data.getInt();
accepted = data.getInt();
unkByte = data.get();
int size = data.getInt(); // list size
for(int i = 0; i < size; i++) {
BuffItem buff = new BuffItem();
int stringSize;
try {
stringSize = data.getShort();
String buffName = new String(ByteBuffer.allocate(stringSize).put(data.array(), data.position(), size).array(), "US-ASCII");
buff.setSkillName(buffName);
data.position(data.position() + size);
buff.setUnknown(data.getInt());
buff.setAmount(data.getInt());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE);
result.putLong(unk1);
result.putLong(objectId);
result.putInt(unkI1); // tickCount
result.putLong(unk2);
result.putLong(unk3);
result.putInt(unkI2); // starting time
result.putInt(0); // tickCount
result.putLong(bufferId);
result.putLong(recipientId);
result.putInt(startTime); // starting time
result.putInt(buffCost);
result.putInt(accepted);
result.put(unkByte); // unk
result.put((byte) 0); // default 0
//return result.flip();
if (buffs == null || buffs.isEmpty()){
result.putInt(0);
} else {
result.putInt(buffs.size());
for (BuffItem buff : buffs) {
result.put(getAsciiString(buff.getSkillName()));
result.putInt(buff.getUnknown());
result.putInt(buff.getAmount());
}
}
return result.flip();
}
@@ -72,14 +105,6 @@ public class BuffBuilderChange extends ObjControllerObject {
this.bufferId = bufferId;
}
public long getRecipientId() {
return recipientId;
}
public void setRecipientId(long recipientId) {
this.recipientId = recipientId;
}
public int getBuffCost() {
return buffCost;
}
@@ -96,46 +121,14 @@ public class BuffBuilderChange extends ObjControllerObject {
this.accepted = accepted;
}
public long getUnk1() {
return unk1;
public long getObjectId() {
return objectId;
}
public void setUnk1(long unk1) {
this.unk1 = unk1;
public void setObjectId(long objId) {
this.objectId = objId;
}
public long getUnk2() {
return unk2;
}
public void setUnk2(long unk2) {
this.unk2 = unk2;
}
public long getUnk3() {
return unk3;
}
public void setUnk3(long unk3) {
this.unk3 = unk3;
}
public int getUnkI1() {
return unkI1;
}
public void setUnkI1(int unkI1) {
this.unkI1 = unkI1;
}
public int getUnkI2() {
return unkI2;
}
public void setUnkI2(int unkI2) {
this.unkI2 = unkI2;
}
public byte getUnkByte() {
return this.unkByte;
}
@@ -144,4 +137,27 @@ public class BuffBuilderChange extends ObjControllerObject {
this.unkByte = unkByte;
}
public int getStartTime() {
return startTime;
}
public void setStartTime(int startTime) {
this.startTime = startTime;
}
public long getRecipientId() {
return recipientId;
}
public void setRecipientId(long recipientId) {
this.recipientId = recipientId;
}
public void setBuffs(Vector<BuffItem> buffVector) {
this.buffs = buffVector;
}
public Vector<BuffItem> getBuffVector() {
return this.buffs;
}
}
@@ -10,9 +10,11 @@ public class BuffBuilderStartMessage extends ObjControllerObject {
private long objectId;
private long recieverId;
private long bufferId;
public BuffBuilderStartMessage(long objectId, long recieverId) {
public BuffBuilderStartMessage(long objectId, long bufferId, long recieverId) {
this.objectId = objectId;
this.bufferId = bufferId;
this.recieverId = recieverId;
}
@@ -30,7 +32,7 @@ public class BuffBuilderStartMessage extends ObjControllerObject {
result.putLong(objectId);
result.putInt(0); // tick count
result.putLong(objectId);
result.putLong(bufferId);
result.putLong(recieverId);