Search in sources :

Example 1 with MouseClickedMessage

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

the class MouseClickedMessageDecoder method decode.

@Override
public MouseClickedMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int value = (int) reader.getUnsigned(DataType.INT);
    long delay = (value >> 20) * 50;
    boolean right = (value >> 19 & 0x1) == 1;
    int cords = value & 0x3FFFF;
    int x = cords % 765;
    int y = cords / 765;
    return new MouseClickedMessage(delay, right, x, y);
}
Also used : MouseClickedMessage(org.apollo.game.message.impl.MouseClickedMessage) GamePacketReader(org.apollo.net.codec.game.GamePacketReader)

Example 2 with MouseClickedMessage

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

the class MouseClickedMessageDecoder method decode.

@Override
public MouseClickedMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int value = (int) reader.getUnsigned(DataType.INT);
    long delay = (value >> 20) * 50;
    boolean right = (value >> 19 & 0x1) == 1;
    int cords = value & 0x3FFFF;
    int x = cords % 765;
    int y = cords / 765;
    return new MouseClickedMessage(delay, right, x, y);
}
Also used : MouseClickedMessage(org.apollo.game.message.impl.MouseClickedMessage) GamePacketReader(org.apollo.net.codec.game.GamePacketReader)

Aggregations

MouseClickedMessage (org.apollo.game.message.impl.MouseClickedMessage)2 GamePacketReader (org.apollo.net.codec.game.GamePacketReader)2