use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SendFriendMessageEncoder method encode.
@Override
public GamePacket encode(SendFriendMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(50);
builder.put(DataType.LONG, NameUtil.encodeBase37(message.getUsername()));
builder.put(DataType.BYTE, message.getWorld());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SetUpdatedRegionMessageEncoder method encode.
@Override
public GamePacket encode(SetUpdatedRegionMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(85);
Position player = message.getPlayerPosition(), region = message.getRegionPosition();
builder.put(DataType.BYTE, DataTransformation.NEGATE, region.getLocalY(player));
builder.put(DataType.BYTE, DataTransformation.NEGATE, region.getLocalX(player));
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SetWidgetModelAnimationMessageEncoder method encode.
@Override
public GamePacket encode(SetWidgetModelAnimationMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(200);
builder.put(DataType.SHORT, message.getInterfaceId() & 0xFFFF);
builder.put(DataType.SHORT, message.getAnimation());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SetWidgetNpcModelMessageEncoder method encode.
@Override
public GamePacket encode(SetWidgetNpcModelMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(75);
builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getModelId());
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 SetWidgetVisibilityMessageEncoder method encode.
@Override
public GamePacket encode(SetWidgetVisibilityMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(171);
builder.put(DataType.BYTE, message.isVisible() ? 0 : 1);
builder.put(DataType.SHORT, message.getWidgetId());
return builder.toGamePacket();
}
Aggregations