Search in sources :

Example 61 with GamePacketBuilder

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

the class PositionHintIconMessageEncoder method encode.

@Override
public GamePacket encode(PositionHintIconMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(199);
    HintIconMessage.Type type = message.getType();
    if (type == Type.PLAYER || type == Type.NPC) {
        throw new IllegalStateException("Unsupported hint icon type " + type + ".");
    }
    builder.put(DataType.BYTE, type.getValue());
    Position position = message.getPosition();
    builder.put(DataType.SHORT, position.getX());
    builder.put(DataType.SHORT, position.getY());
    builder.put(DataType.BYTE, message.getHeight());
    return builder.toGamePacket();
}
Also used : Position(org.apollo.game.model.Position) GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder) Type(org.apollo.game.message.impl.HintIconMessage.Type) HintIconMessage(org.apollo.game.message.impl.HintIconMessage) PositionHintIconMessage(org.apollo.game.message.impl.PositionHintIconMessage)

Example 62 with GamePacketBuilder

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

the class ForwardPrivateChatMessageEncoder method encode.

@Override
public GamePacket encode(ForwardPrivateChatMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(135, PacketType.VARIABLE_BYTE);
    builder.put(DataType.LONG, NameUtil.encodeBase37(message.getSenderUsername()));
    builder.put(DataType.INT, messageCounter.incrementAndGet());
    builder.put(DataType.BYTE, message.getSenderPrivilege().toInteger());
    builder.putBytes(message.getCompressedMessage());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 63 with GamePacketBuilder

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

the class FriendServerStatusMessageEncoder method encode.

@Override
public GamePacket encode(FriendServerStatusMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(251);
    builder.put(DataType.BYTE, message.getStatusCode());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 64 with GamePacketBuilder

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

the class SetWidgetModelMessageEncoder method encode.

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

Example 65 with GamePacketBuilder

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

the class SetWidgetPlayerModelMessageEncoder method encode.

@Override
public GamePacket encode(SetWidgetPlayerModelMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(255);
    builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getInterfaceId());
    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