Started on Request/Response packets for the Boat customization to begin the boat customization process.

tags: #story[1142]
This commit is contained in:
Alistair McIntyre
2017-08-14 13:26:51 +12:00
parent e4cc5a0950
commit bedd742c93
4 changed files with 85 additions and 3 deletions
@@ -1,8 +1,6 @@
package seng302.gameServer.server.messages;
/**
* Created by kre39 on 20/07/17.
*/
public class ChatterMessage extends Message {
private final long MESSAGE_VERSION_NUMBER = 1;
@@ -0,0 +1,19 @@
package seng302.gameServer.server.messages;
public class CustomizeRequestMessage extends Message {
CustomizeRequestType customizeType;
private static int MESSAGE_LENGTH = 2;
private Double sourceID;
public CustomizeRequestMessage(CustomizeRequestType customizeType, Double sourceID,)
@Override
public int getSize() {
return 1; // placeholder
}
}
@@ -0,0 +1,31 @@
package seng302.gameServer.server.messages;
// TODO: 14/08/17 ajm412: this may eventually need adjusting due to conforming to the agreed spec.
public enum CustomizeRequestType {
NAME(0x00),
COLOR(0x01),
SHAPE(0x02);
private int type;
CustomizeRequestType(int type) {
this.type = type;
}
int getType() {
return this.type;
}
public static CustomizeRequestType getRequestType(int typeCode) {
switch (typeCode) {
case 0x00:
return NAME;
case 0x01:
return COLOR;
case 0x02:
return SHAPE;
default:
return null;
}
}
}
@@ -0,0 +1,34 @@
package seng302.gameServer.server.messages;
// TODO: 14/08/17 ajm412: this may eventually need adjusting due to conforming to the agreed spec.
public enum CustomizeResponseType {
SUCCESS(0x00),
FAILURE(0x01),
FAILURE_MALFORMED_DATA(0x02),
FAILURE_INCOMPATIBLE(0x03);
private int type;
CustomizeResponseType(int type) {
this.type = type;
}
int getType() {
return this.type;
}
public static CustomizeResponseType getResponseType(int typeCode) {
switch (typeCode) {
case 0x00:
return SUCCESS;
case 0x01:
return FAILURE;
case 0x02:
return FAILURE_MALFORMED_DATA;
case 0x03:
return FAILURE_INCOMPATIBLE;
default:
return null;
}
}
}