Search in sources :

Example 1 with Type

use of org.apollo.game.message.impl.HintIconMessage.Type in project apollo by apollo-rsps.

the class PositionHintIconMessageEncoder method encode.

@Override
public GamePacket encode(PositionHintIconMessage message) {
    GamePacketBuilder builder = new GamePacketBuilder(254);
    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 2 with Type

use of org.apollo.game.message.impl.HintIconMessage.Type 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)

Aggregations

HintIconMessage (org.apollo.game.message.impl.HintIconMessage)2 Type (org.apollo.game.message.impl.HintIconMessage.Type)2 PositionHintIconMessage (org.apollo.game.message.impl.PositionHintIconMessage)2 Position (org.apollo.game.model.Position)2 GamePacketBuilder (org.apollo.net.codec.game.GamePacketBuilder)2