From fbe671e577e66943fcfb00dabc08be447bef3fcb Mon Sep 17 00:00:00 2001 From: FateJH Date: Sat, 22 Apr 2017 14:59:46 -0400 Subject: [PATCH] initial work on InventoryStateMessage packet --- .../psforever/packet/GamePacketOpcode.scala | 2 +- .../packet/game/InventoryStateMessage.scala | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 common/src/main/scala/net/psforever/packet/game/InventoryStateMessage.scala diff --git a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala index 69629b54..35a4cd10 100644 --- a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala +++ b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala @@ -385,7 +385,7 @@ object GamePacketOpcode extends Enumeration { case 0x36 => game.PickupItemMessage.decode case 0x37 => game.DropItemMessage.decode // 0x38 - case 0x38 => noDecoder(InventoryStateMessage) + case 0x38 => game.InventoryStateMessage.decode case 0x39 => game.ChangeFireStateMessage_Start.decode case 0x3a => game.ChangeFireStateMessage_Stop.decode case 0x3b => noDecoder(UnknownMessage59) diff --git a/common/src/main/scala/net/psforever/packet/game/InventoryStateMessage.scala b/common/src/main/scala/net/psforever/packet/game/InventoryStateMessage.scala new file mode 100644 index 00000000..60817688 --- /dev/null +++ b/common/src/main/scala/net/psforever/packet/game/InventoryStateMessage.scala @@ -0,0 +1,25 @@ +// Copyright (c) 2017 PSForever +package net.psforever.packet.game + +import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket} +import scodec.Codec +import scodec.codecs._ + +final case class InventoryStateMessage(player_guid : PlanetSideGUID, + unk1 : Int, + unk2 : Int, + unk3 : Long) + extends PlanetSideGamePacket { + type Packet = InventoryStateMessage + def opcode = GamePacketOpcode.InventoryStateMessage + def encode = InventoryStateMessage.encode(this) +} + +object InventoryStateMessage extends Marshallable[InventoryStateMessage] { + implicit val codec : Codec[InventoryStateMessage] = ( + ("player_guid" | PlanetSideGUID.codec) :: + ("unk1" | uintL(10)) :: + ("unk2" | uint16L) :: + ("unk3" | uint32L) + ).as[InventoryStateMessage] +}