use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class PositionHintIconMessageEncoder method encode.
@Override
public GamePacket encode(PositionHintIconMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(199);
HintIconMessage.Type type = message.getType();
if (type == Type.PLAYER || type == Type.NPC) {
throw new IllegalStateException("Unsupported hint icon type " + type + ".");
}
builder.put(DataType.BYTE, type.getValue());
Position position = message.getPosition();
builder.put(DataType.SHORT, position.getX());
builder.put(DataType.SHORT, position.getY());
builder.put(DataType.BYTE, message.getHeight());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class ForwardPrivateChatMessageEncoder method encode.
@Override
public GamePacket encode(ForwardPrivateChatMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(135, PacketType.VARIABLE_BYTE);
builder.put(DataType.LONG, NameUtil.encodeBase37(message.getSenderUsername()));
builder.put(DataType.INT, messageCounter.incrementAndGet());
builder.put(DataType.BYTE, message.getSenderPrivilege().toInteger());
builder.putBytes(message.getCompressedMessage());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class FriendServerStatusMessageEncoder method encode.
@Override
public GamePacket encode(FriendServerStatusMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(251);
builder.put(DataType.BYTE, message.getStatusCode());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SetWidgetModelMessageEncoder method encode.
@Override
public GamePacket encode(SetWidgetModelMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(216);
builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getModel());
builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getInterfaceId());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SetWidgetPlayerModelMessageEncoder method encode.
@Override
public GamePacket encode(SetWidgetPlayerModelMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(255);
builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getInterfaceId());
return builder.toGamePacket();
}
Aggregations