Search in sources :

Example 26 with GamePacketReader

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

the class FirstPlayerActionMessageDecoder method decode.

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

Example 27 with GamePacketReader

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

the class FourthPlayerActionMessageDecoder method decode.

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

Example 28 with GamePacketReader

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

the class ItemOnNpcMessageDecoder method decode.

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

Example 29 with GamePacketReader

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

the class MagicOnPlayerMessageDecoder method decode.

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

Example 30 with GamePacketReader

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

the class SwitchItemMessageDecoder method decode.

@Override
public SwitchItemMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int interfaceId = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    boolean inserting = reader.getUnsigned(DataType.BYTE, DataTransformation.NEGATE) == 1;
    int oldSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE, DataTransformation.ADD);
    int newSlot = (int) reader.getUnsigned(DataType.SHORT, DataOrder.LITTLE);
    return new SwitchItemMessage(interfaceId, inserting, oldSlot, newSlot);
}
Also used : GamePacketReader(org.apollo.net.codec.game.GamePacketReader) SwitchItemMessage(org.apollo.game.message.impl.SwitchItemMessage)

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