use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class UpdateTileItemMessageEncoder method encode.
@Override
public GamePacket encode(UpdateTileItemMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(121);
builder.put(DataType.BYTE, message.getPositionOffset());
builder.put(DataType.SHORT, message.getId());
builder.put(DataType.SHORT, message.getPreviousAmount());
builder.put(DataType.SHORT, message.getAmount());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class RemoveTileItemMessageEncoder method encode.
@Override
public GamePacket encode(RemoveTileItemMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(208);
builder.put(DataType.SHORT, DataTransformation.ADD, message.getId());
builder.put(DataType.BYTE, DataTransformation.ADD, message.getPositionOffset());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SendObjectMessageEncoder method encode.
@Override
public GamePacket encode(SendObjectMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(152);
builder.put(DataType.BYTE, DataTransformation.NEGATE, message.getType() << 2 | message.getOrientation());
builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getId());
builder.put(DataType.BYTE, DataTransformation.ADD, message.getPositionOffset());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class ServerMessageMessageEncoder method encode.
@Override
public GamePacket encode(ServerChatMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(63, PacketType.VARIABLE_BYTE);
builder.putString(message.getMessage());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SetPlayerActionMessageEncoder method encode.
@Override
public GamePacket encode(SetPlayerActionMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(157, PacketType.VARIABLE_BYTE);
builder.put(DataType.BYTE, DataTransformation.NEGATE, message.getSlot());
builder.putString(message.getText());
builder.put(DataType.BYTE, message.isPrimaryAction() ? 0 : 1);
return builder.toGamePacket();
}
Aggregations