Flytext, System, Comms now use ProsePackages

This commit is contained in:
Treeku
2014-04-13 00:27:02 +01:00
parent 0023848113
commit eeb1ea54af
17 changed files with 338 additions and 372 deletions
@@ -36,6 +36,7 @@ public class NpcConversationMessage extends ObjControllerObject {
public NpcConversationMessage(long objectId, OutOfBand outOfBand) {
this.objectId = objectId;
this.outOfBand = outOfBand;
outOfBand.setHeaderBytes(2);
}
@Override
@@ -47,12 +48,10 @@ public class NpcConversationMessage extends ObjControllerObject {
public IoBuffer serialize() {
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer buffer = IoBuffer.allocate(16 + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.CONVERSATION_MESSAGE);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.put(outOfBandBuffer.array());
System.out.println(buffer.getInt(16));
return buffer.flip();
}
@@ -28,6 +28,7 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ConversationOption;
import resources.objects.Delta;
public class NpcConversationOptions extends ObjControllerObject {
@@ -52,16 +53,13 @@ public class NpcConversationOptions extends ObjControllerObject {
buffer.setAutoExpand(true);
buffer.putInt(ObjControllerMessage.CONVERSATION_OPTIONS);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.put((byte) conversationOptions.size());
for(ConversationOption option : conversationOptions) {
buffer.put(option.getOutOfBand().serialize());
for (ConversationOption option : conversationOptions) {
option.getOutOfBand().setHeaderBytes(2);
buffer.put(option.getOutOfBand().serialize().array());
}
int size = buffer.position();
buffer.flip();
return IoBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN).put(buffer.array(), 0, size).flip();
return Delta.resizeBuffer(buffer);
}
}
@@ -26,51 +26,28 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.OutOfBand;
import resources.common.RGB;
import resources.common.Stf;
public class ShowFlyText extends ObjControllerObject {
private long recieverId;
private long receiverId;
private long objectId;
private int unknownInt1;
private short unknownShort1;
private byte unknownByte1;
private int unknownInt2;
private String stfFile;
private String stfString;
private short xp;
private Stf stf;
private OutOfBand outOfBand;
private float scale;
private RGB color;
private int displayType;
private boolean alternativeStructure;
private String customText;
public ShowFlyText(long recieverId, long objectId, String stfFile, String stfString, float scale, RGB color, int displayType) {
this.recieverId = recieverId;
public ShowFlyText(long receiverId, long objectId, String stf, OutOfBand outOfBand, float scale, RGB color, int displayType) {
this.receiverId = receiverId;
this.objectId = objectId;
this.stfFile = stfFile;
this.stfString = stfString;
this.stf = new Stf(stf);
this.outOfBand = outOfBand;
this.scale = scale;
this.color = color;
this.displayType = displayType;
this.alternativeStructure = false;
}
public ShowFlyText(long recieverId, long objectId, int unknownInt1, int unknownShort1, int unknownByte1, int unknownInt2, String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType) {
this.recieverId = recieverId;
this.objectId = objectId;
this.unknownInt1 = unknownInt1;
this.unknownShort1 = (short) unknownShort1;
this.unknownByte1 = (byte) unknownByte1;
this.unknownInt2 = unknownInt2;
this.stfFile = stfFile;
this.stfString = stfString;
this.customText = customText;
this.xp = (short) xp;
this.scale = scale;
this.color = color;
this.alternativeStructure = true;
this.displayType = displayType;
}
@Override
@@ -81,54 +58,20 @@ public class ShowFlyText extends ObjControllerObject {
@Override
public IoBuffer serialize() {
if (!alternativeStructure) {
IoBuffer result = IoBuffer.allocate(47 + stfFile.length() + stfString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(recieverId);
result.putInt(0);
result.putLong(objectId);
result.put(getAsciiString(stfFile));
result.putInt(0);
result.put(getAsciiString(stfString));
result.putInt(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
return result.flip();
} else {
IoBuffer result = IoBuffer.allocate(124 + stfFile.length() + stfString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(recieverId);
result.putInt(0);
result.putLong(objectId);
result.putLong(0);
result.putInt(unknownInt1);
result.putShort(unknownShort1);
result.put(unknownByte1);
result.putInt(unknownInt2);
result.put(getAsciiString(stfFile));
result.putInt(0);
result.put(getAsciiString(stfString));
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.put(getUnicodeString(customText)); // %TO?
result.putShort(xp); // %DI ?
result.putLong(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
result.flip();
//StringUtilities.printBytes(result.array());
return result;
}
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer result = IoBuffer.allocate(35 + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(receiverId);
result.putInt(0);
result.putLong(objectId);
result.put(stf.getBytes());
result.put(outOfBandBuffer.array());
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
result.flip();
return result;
}
}