mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
faf4600f51
tags : #story[1142]
36 lines
915 B
Java
36 lines
915 B
Java
package seng302.gameServer.messages;
|
|
|
|
// TODO: 14/08/17 ajm412: this may eventually need adjusting due to conforming to the agreed spec.
|
|
public class CustomizeRequestMessage extends Message {
|
|
|
|
|
|
private static int MESSAGE_LENGTH = 6;
|
|
|
|
//Message fields
|
|
private CustomizeRequestType customizeType;
|
|
private Integer payloadLength;
|
|
|
|
public CustomizeRequestMessage(CustomizeRequestType customizeType, double sourceID,
|
|
byte[] payload) {
|
|
payloadLength = payload.length;
|
|
setHeader(new Header(MessageType.CUSTOMIZATION_REQUEST, 1, (short) getSize()));
|
|
allocateBuffer();
|
|
writeHeaderToBuffer();
|
|
|
|
|
|
putInt((int) sourceID, 4);
|
|
putInt((int) customizeType.getType(), 2);
|
|
putBytes(payload);
|
|
|
|
writeCRC();
|
|
rewind();
|
|
}
|
|
|
|
@Override
|
|
public int getSize() {
|
|
return MESSAGE_LENGTH + payloadLength; // placeholder
|
|
}
|
|
|
|
|
|
}
|