Search in sources :

Example 71 with GamePacketBuilder

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();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 72 with GamePacketBuilder

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();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 73 with GamePacketBuilder

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();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder) HintIconMessage(org.apollo.game.message.impl.HintIconMessage) MobHintIconMessage(org.apollo.game.message.impl.MobHintIconMessage)

Example 74 with GamePacketBuilder

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();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 75 with GamePacketBuilder

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();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Aggregations

GamePacketBuilder (org.apollo.net.codec.game.GamePacketBuilder)93 Position (org.apollo.game.model.Position)9 Item (org.apollo.game.model.Item)6 HintIconMessage (org.apollo.game.message.impl.HintIconMessage)4 SegmentType (org.apollo.game.sync.seg.SegmentType)4 SynchronizationSegment (org.apollo.game.sync.seg.SynchronizationSegment)4 EquipmentDefinition (org.apollo.cache.def.EquipmentDefinition)2 GroupedRegionUpdateMessage (org.apollo.game.message.impl.GroupedRegionUpdateMessage)2 Type (org.apollo.game.message.impl.HintIconMessage.Type)2 MobHintIconMessage (org.apollo.game.message.impl.MobHintIconMessage)2 PositionHintIconMessage (org.apollo.game.message.impl.PositionHintIconMessage)2 RegionUpdateMessage (org.apollo.game.message.impl.RegionUpdateMessage)2 Appearance (org.apollo.game.model.Appearance)2 Skill (org.apollo.game.model.entity.Skill)2 Inventory (org.apollo.game.model.inv.Inventory)2 SlottedItem (org.apollo.game.model.inv.SlottedItem)2 AddNpcSegment (org.apollo.game.sync.seg.AddNpcSegment)2 AddPlayerSegment (org.apollo.game.sync.seg.AddPlayerSegment)2 GamePacket (org.apollo.net.codec.game.GamePacket)2 MessageEncoder (org.apollo.net.release.MessageEncoder)2