use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class UpdateWeightMessageEncoder method encode.
@Override
public GamePacket encode(UpdateWeightMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(174);
builder.put(DataType.SHORT, message.getWeight());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class IgnoreListMessageEncoder method encode.
@Override
public GamePacket encode(IgnoreListMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(214, PacketType.VARIABLE_SHORT);
List<String> usernames = message.getUsernames();
for (String username : usernames) {
builder.put(DataType.LONG, NameUtil.encodeBase37(username));
}
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class MobHintIconMessageEncoder method encode.
@Override
public GamePacket encode(MobHintIconMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(254);
HintIconMessage.Type type = message.getType();
builder.put(DataType.BYTE, type.getValue());
switch(type) {
case NPC:
case PLAYER:
builder.put(DataType.SHORT, message.getIndex());
// Dummy bytes
builder.put(DataType.TRI_BYTE, 0);
break;
default:
throw new IllegalStateException("Unsupported hint icon type " + type + ".");
}
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class OpenInterfaceSidebarMessageEncoder method encode.
@Override
public GamePacket encode(OpenInterfaceSidebarMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(248);
builder.put(DataType.SHORT, DataTransformation.ADD, message.getInterfaceId());
builder.put(DataType.SHORT, message.getSidebarId());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class AddGlobalTileItemMessageEncoder method encode.
@Override
public GamePacket encode(SendPublicTileItemMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(106);
builder.put(DataType.BYTE, DataTransformation.ADD, message.getPositionOffset());
builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getAmount());
builder.put(DataType.SHORT, DataTransformation.ADD, message.getId());
builder.put(DataType.SHORT, DataTransformation.ADD, message.getIndex());
return builder.toGamePacket();
}
Aggregations