Search in sources :

Example 71 with GamePacketReader

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

the class ItemOnItemMessageDecoder method decode.

@Override
public ItemOnItemMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int targetId = (int) reader.getUnsigned(DataType.SHORT);
    int usedSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    int usedId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    int targetInterface = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int targetSlot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
    int usedInterface = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
    return new ItemOnItemMessage(usedInterface, usedId, usedSlot, targetInterface, targetId, targetSlot);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) ItemOnItemMessage(org.apollo.game.message.impl.ItemOnItemMessage)

Example 72 with GamePacketReader

use of org.apollo.net.codec.game.GamePacketReader 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 73 with GamePacketReader

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

the class ThirdItemOptionMessageDecoder method decode.

@Override
public ItemOptionMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int slot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    return new ItemOptionMessage(3, interfaceId, id, slot);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) ItemOptionMessage(org.apollo.game.message.impl.ItemOptionMessage)

Example 74 with GamePacketReader

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

the class SecondItemActionMessageDecoder method decode.

@Override
public ItemActionMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int slot = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
    int id = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    return new ItemActionMessage(2, interfaceId, id, slot);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) ItemActionMessage(org.apollo.game.message.impl.ItemActionMessage)

Example 75 with GamePacketReader

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

the class SecondPlayerActionMessageDecoder method decode.

@Override
public PlayerActionMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int index = (int) reader.getUnsigned(DataType.SHORT, DataTransformation.ADD);
    return new PlayerActionMessage(2, index);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) PlayerActionMessage(org.apollo.game.message.impl.PlayerActionMessage)

Aggregations

GamePacketReader (org.apollo.net.codec.game.GamePacketReader)97 ItemActionMessage (org.apollo.game.message.impl.ItemActionMessage)10 ItemOptionMessage (org.apollo.game.message.impl.ItemOptionMessage)10 NpcActionMessage (org.apollo.game.message.impl.NpcActionMessage)10 PlayerActionMessage (org.apollo.game.message.impl.PlayerActionMessage)10 Position (org.apollo.game.model.Position)10 ObjectActionMessage (org.apollo.game.message.impl.ObjectActionMessage)6 AddFriendMessage (org.apollo.game.message.impl.AddFriendMessage)2 AddIgnoreMessage (org.apollo.game.message.impl.AddIgnoreMessage)2 ArrowKeyMessage (org.apollo.game.message.impl.ArrowKeyMessage)2 ButtonMessage (org.apollo.game.message.impl.ButtonMessage)2 DialogueContinueMessage (org.apollo.game.message.impl.DialogueContinueMessage)2 EnteredAmountMessage (org.apollo.game.message.impl.EnteredAmountMessage)2 FlaggedMouseEventMessage (org.apollo.game.message.impl.FlaggedMouseEventMessage)2 FlashingTabClickedMessage (org.apollo.game.message.impl.FlashingTabClickedMessage)2 ItemOnItemMessage (org.apollo.game.message.impl.ItemOnItemMessage)2 ItemOnNpcMessage (org.apollo.game.message.impl.ItemOnNpcMessage)2 ItemOnObjectMessage (org.apollo.game.message.impl.ItemOnObjectMessage)2 MagicOnItemMessage (org.apollo.game.message.impl.MagicOnItemMessage)2 MagicOnNpcMessage (org.apollo.game.message.impl.MagicOnNpcMessage)2