use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class SetWidgetItemModelMessageEncoder method encode.
@Override
public GamePacket encode(SetWidgetItemModelMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(21);
builder.put(DataType.SHORT, message.getZoom());
builder.put(DataType.SHORT, DataOrder.LITTLE, 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 SetWidgetNpcModelMessageEncoder method encode.
@Override
public GamePacket encode(SetWidgetNpcModelMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(162);
builder.put(DataType.SHORT, DataTransformation.ADD, message.getModelId());
builder.put(DataType.SHORT, DataOrder.LITTLE, message.getInterfaceId());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class UpdateSlottedItemsMessageEncoder method encode.
@Override
public GamePacket encode(UpdateSlottedItemsMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(134, PacketType.VARIABLE_SHORT);
SlottedItem[] items = message.getSlottedItems();
builder.put(DataType.SHORT, message.getInterfaceId());
for (SlottedItem slottedItem : items) {
builder.putSmart(slottedItem.getSlot());
Item item = slottedItem.getItem();
int id = item == null ? -1 : item.getId();
int amount = item == null ? 0 : item.getAmount();
builder.put(DataType.SHORT, id + 1);
if (amount > 254) {
builder.put(DataType.BYTE, 255);
builder.put(DataType.INT, amount);
} else {
builder.put(DataType.BYTE, amount);
}
}
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class PrivacyOptionMessageEncoder method encode.
@Override
public GamePacket encode(final PrivacyOptionMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(201);
builder.put(DataType.BYTE, message.getChatPrivacy().ordinal());
builder.put(DataType.BYTE, message.getFriendPrivacy().ordinal());
builder.put(DataType.BYTE, message.getTradePrivacy().ordinal());
return builder.toGamePacket();
}
use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.
the class FlashTabInterfaceMessageEncoder method encode.
@Override
public GamePacket encode(FlashTabInterfaceMessage message) {
GamePacketBuilder builder = new GamePacketBuilder(238);
builder.put(DataType.BYTE, message.getTab());
return builder.toGamePacket();
}
Aggregations