diff --git a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala index b697b677..3d270196 100644 --- a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala +++ b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala @@ -516,7 +516,7 @@ object GamePacketOpcode extends Enumeration { case 0xa4 => noDecoder(WarpgateRequest) case 0xa5 => noDecoder(WarpgateResponse) case 0xa6 => noDecoder(DamageWithPositionMessage) - case 0xa7 => noDecoder(GenericActionMessage) + case 0xa7 => game.GenericActionMessage.decode // 0xa8 case 0xa8 => game.ContinentalLockUpdateMessage.decode case 0xa9 => game.AvatarGrenadeStateMessage.decode diff --git a/common/src/main/scala/net/psforever/packet/game/GenericActionMessage.scala b/common/src/main/scala/net/psforever/packet/game/GenericActionMessage.scala new file mode 100644 index 00000000..55660a3a --- /dev/null +++ b/common/src/main/scala/net/psforever/packet/game/GenericActionMessage.scala @@ -0,0 +1,54 @@ +// Copyright (c) 2016 PSForever.net to present +package net.psforever.packet.game + +import net.psforever.packet.{GamePacketOpcode, Marshallable, PlanetSideGamePacket} +import scodec.Codec +import scodec.codecs._ + +/** + * Reports that something has happened, or makes something happen.
+ *
+ * When sent from the server to a client, there are twenty-seven individual actions caused by this packet. + * They are only vaguely organized by behavior and some numbers may not be associated with an action. + * When sent by the client to the server, an unknown number of actions are available. + * The highest known action is a server-sent 45.
+ *
+ * Actions (when sent from server):
+ * 03 - symbol: show Mosquito radar
+ * 04 - symbol: hide Mosquito radar
+ * 07 - warning: missile lock
+ * 08 - warning: Wasp missile lock
+ * 09 - warning: T-REK lock
+ * 12 - sound: base captured fanfare
+ * 14 - prompt: new character basic training
+ * 22 - message: awarded a cavern capture (updates cavern capture status)
+ * 23 - award a cavern kill
+ * 24 - message: you have been imprinted (updates imprinted status; does it?)
+ * 25 - message: you are no longer imprinted (updates imprinted status; does it?)
+ * 27 - event: purchase timers reset (does it?)
+ * 31 - switch to first person view, attempt to deconstruct but fail; + * event: fail to deconstruct due to having a "parent vehicle"
+ * 32 - switch to first person view
+ * 33 - event: fail to deconstruct
+ * 43 - prompt: friendly fire in virtual reality zone
+ * 45 - ?
+ *
+ * Actions (when sent from client):
+ * 29 - AFK
+ * 30 - back in game
+ * 36 - turn on "Looking for Squad"
+ * 37 - turn off "Looking for Squad" + * @param action what this packet does + */ +final case class GenericActionMessage(action : Int) + extends PlanetSideGamePacket { + type Packet = GenericActionMessage + def opcode = GamePacketOpcode.GenericActionMessage + def encode = GenericActionMessage.encode(this) +} + +object GenericActionMessage extends Marshallable[GenericActionMessage] { + implicit val codec : Codec[GenericActionMessage] = ( + "action" | uint(6) + ).as[GenericActionMessage] +} diff --git a/common/src/test/scala/GamePacketTest.scala b/common/src/test/scala/GamePacketTest.scala index 9bcf21bb..e6794c23 100644 --- a/common/src/test/scala/GamePacketTest.scala +++ b/common/src/test/scala/GamePacketTest.scala @@ -1426,6 +1426,26 @@ class GamePacketTest extends Specification { } } + "GenericActionMessage" should { + val string = hex"A7 94" + + "decode" in { + PacketCoding.DecodePacket(string).require match { + case GenericActionMessage(action) => + action mustEqual 37 + case default => + ko + } + } + + "encode" in { + val msg = GenericActionMessage(37) + val pkt = PacketCoding.EncodePacket(msg).require.toByteVector + + pkt mustEqual string + } + } + "ContinentalLockUpdateMessage" should { val string = hex"A8 16 00 40"