Search in sources :

Example 16 with GamePacketBuilder

use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.

the class OpenDialogueInterfaceMessageEncoder method encode.

@Override
public GamePacket encode(OpenDialogueInterfaceMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(109);
    builder.put(DataType.SHORT, message.getInterfaceId());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 17 with GamePacketBuilder

use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.

the class OpenInterfaceMessageEncoder method encode.

@Override
public GamePacket encode(OpenInterfaceMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(159);
    builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getId());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 18 with GamePacketBuilder

use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.

the class OpenOverlayMessageEncoder method encode.

@Override
public GamePacket encode(OpenOverlayMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(50);
    builder.put(DataType.SHORT, message.getOverlayId());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 19 with GamePacketBuilder

use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.

the class OpenSidebarMessageEncoder method encode.

@Override
public GamePacket encode(OpenSidebarMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(246);
    builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getSidebarId());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 20 with GamePacketBuilder

use of org.apollo.net.codec.game.GamePacketBuilder in project apollo by apollo-rsps.

the class PlayerSynchronizationMessageEncoder method encode.

@Override
public GamePacket encode(PlayerSynchronizationMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(90, PacketType.VARIABLE_SHORT);
    builder.switchToBitAccess();
    GamePacketBuilder blockBuilder = new GamePacketBuilder();
    putMovementUpdate(message.getSegment(), message, builder);
    putBlocks(message.getSegment(), blockBuilder);
    builder.putBits(8, message.getLocalPlayers());
    for (SynchronizationSegment segment : message.getSegments()) {
        SegmentType type = segment.getType();
        if (type == SegmentType.REMOVE_MOB) {
            putRemovePlayerUpdate(builder);
        } else if (type == SegmentType.ADD_MOB) {
            putAddPlayerUpdate((AddPlayerSegment) segment, message, builder);
            putBlocks(segment, blockBuilder);
        } else {
            putMovementUpdate(segment, message, builder);
            putBlocks(segment, blockBuilder);
        }
    }
    if (blockBuilder.getLength() > 0) {
        builder.putBits(11, 2047);
        builder.switchToByteAccess();
        builder.putRawBuilder(blockBuilder);
    } else {
        builder.switchToByteAccess();
    }
    return builder.toGamePacket();
}
Also used : SegmentType(org.apollo.game.sync.seg.SegmentType) AddPlayerSegment(org.apollo.game.sync.seg.AddPlayerSegment) GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder) SynchronizationSegment(org.apollo.game.sync.seg.SynchronizationSegment)

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