Search in sources :

Example 1 with MobHintIconMessage

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

the class MobHintIconMessageEncoder method encode.

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

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

Aggregations

HintIconMessage (org.apollo.game.message.impl.HintIconMessage)2 MobHintIconMessage (org.apollo.game.message.impl.MobHintIconMessage)2 GamePacketBuilder (org.apollo.net.codec.game.GamePacketBuilder)2