Search in sources :

Example 86 with GamePacketBuilder

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

the class SendFriendMessageEncoder method encode.

@Override
public GamePacket encode(SendFriendMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(50);
    builder.put(DataType.LONG, NameUtil.encodeBase37(message.getUsername()));
    builder.put(DataType.BYTE, message.getWorld());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 87 with GamePacketBuilder

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

the class SetUpdatedRegionMessageEncoder method encode.

@Override
public GamePacket encode(SetUpdatedRegionMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(85);
    Position player = message.getPlayerPosition(), region = message.getRegionPosition();
    builder.put(DataType.BYTE, DataTransformation.NEGATE, region.getLocalY(player));
    builder.put(DataType.BYTE, DataTransformation.NEGATE, region.getLocalX(player));
    return builder.toGamePacket();
}
Also used : Position(org.apollo.game.model.Position) GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 88 with GamePacketBuilder

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

the class SetWidgetModelAnimationMessageEncoder method encode.

@Override
public GamePacket encode(SetWidgetModelAnimationMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(200);
    builder.put(DataType.SHORT, message.getInterfaceId() & 0xFFFF);
    builder.put(DataType.SHORT, message.getAnimation());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 89 with GamePacketBuilder

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(75);
    builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getModelId());
    builder.put(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD, message.getInterfaceId());
    return builder.toGamePacket();
}
Also used : GamePacketBuilder(org.apollo.net.codec.game.GamePacketBuilder)

Example 90 with GamePacketBuilder

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

the class SetWidgetVisibilityMessageEncoder method encode.

@Override
public GamePacket encode(SetWidgetVisibilityMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(171);
    builder.put(DataType.BYTE, message.isVisible() ? 0 : 1);
    builder.put(DataType.SHORT, message.getWidgetId());
    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