From 91a429506ff2f22ce52e19f09b23e781c6498689 Mon Sep 17 00:00:00 2001 From: FateJH Date: Fri, 20 Jan 2017 23:53:56 -0500 Subject: [PATCH 1/2] initial PlayerStasisMessage packet work --- .../psforever/packet/GamePacketOpcode.scala | 2 +- .../packet/game/PlayerStasisMessage.scala | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala diff --git a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala index 1eb8898d..a8a216e8 100644 --- a/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala +++ b/common/src/main/scala/net/psforever/packet/GamePacketOpcode.scala @@ -482,7 +482,7 @@ object GamePacketOpcode extends Enumeration { // 0x88 case 0x88 => game.WeaponDelayFireMessage.decode case 0x89 => noDecoder(BugReportMessage) - case 0x8a => noDecoder(PlayerStasisMessage) + case 0x8a => game.PlayerStasisMessage.decode case 0x8b => noDecoder(UnknownMessage139) case 0x8c => noDecoder(OutfitMembershipRequest) case 0x8d => noDecoder(OutfitMembershipResponse) diff --git a/common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala b/common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala new file mode 100644 index 00000000..91ee3faf --- /dev/null +++ b/common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala @@ -0,0 +1,26 @@ +// 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._ + +/** + * na + * @param player_guid the player + * @param stasis whether or not the player is held in stasis + */ +final case class PlayerStasisMessage(player_guid : PlanetSideGUID, + stasis : Boolean) + extends PlanetSideGamePacket { + type Packet = PlayerStasisMessage + def opcode = GamePacketOpcode.PlayerStasisMessage + def encode = PlayerStasisMessage.encode(this) +} + +object PlayerStasisMessage extends Marshallable[PlayerStasisMessage] { + implicit val codec : Codec[PlayerStasisMessage] = ( + ("player_guid" | PlanetSideGUID.codec) :: + ("stasis" | bool) + ).as[PlayerStasisMessage] +} From a3d8d891a1c5298b4467f28fcac124adfe80e902 Mon Sep 17 00:00:00 2001 From: FateJH Date: Sat, 28 Jan 2017 01:05:40 -0500 Subject: [PATCH 2/2] comments and tests --- .../packet/game/PlayerStasisMessage.scala | 21 ++++++++++++++--- common/src/test/scala/GamePacketTest.scala | 23 +++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala b/common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala index 91ee3faf..0898331b 100644 --- a/common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala +++ b/common/src/main/scala/net/psforever/packet/game/PlayerStasisMessage.scala @@ -6,12 +6,27 @@ import scodec.Codec import scodec.codecs._ /** - * na + * Causes the avatar to be prepped for drop pod use.
+ *
+ * This packet is dispatched from the server to all occupants of the HART shuttle when it has completed its take-off animation. + * When received by the client, that player's avatar is "removed from the world" and the Interstellar Map is displayed for them. + * The "Launch Drop Pod" button window is also made visible. + * Selecting individual continental maps for viewing and clicking on the landmasses has the expected behavior for drop pods implementation.
+ *
+ * Being seated on the HART shuttle at the time, a player's avatar does not physically exist when the packet is received. + * If the packet is received while the player is outside of the HART shuttle, the state of their avatar is not known to them. + * "Removed from the world" merely implies that one can not leave the Interstellar Map once it has been displayed. + * According to packet capture, their avatar is not explicitly deconstructed until the dropped-into map is loaded.
+ *
+ * When the packet is received on one's client, but is addressed to another player, nothing seems to happen to that player. + * If that player's model is outside of the HART, it will not deconstruct. + * Only the client's avatar can be affected by this packet. * @param player_guid the player - * @param stasis whether or not the player is held in stasis + * @param stasis `true` by default; + * nothing when `false` (?) */ final case class PlayerStasisMessage(player_guid : PlanetSideGUID, - stasis : Boolean) + stasis : Boolean = true) extends PlanetSideGamePacket { type Packet = PlayerStasisMessage def opcode = GamePacketOpcode.PlayerStasisMessage diff --git a/common/src/test/scala/GamePacketTest.scala b/common/src/test/scala/GamePacketTest.scala index 6faa6e6e..cc1fe9d8 100644 --- a/common/src/test/scala/GamePacketTest.scala +++ b/common/src/test/scala/GamePacketTest.scala @@ -1325,6 +1325,29 @@ class GamePacketTest extends Specification { } } + "PlayerStasisMessage" should { + val string = hex"8A 4B 00 80" + + "decode" in { + PacketCoding.DecodePacket(string).require match { + case PlayerStasisMessage(player_guid, stasis) => + player_guid mustEqual PlanetSideGUID(75) + stasis mustEqual true + case default => + ko + } + } + + "encode" in { + "encode" in { + val msg = PlayerStasisMessage(PlanetSideGUID(75)) + val pkt = PacketCoding.EncodePacket(msg).require.toByteVector + + pkt mustEqual string + } + } + } + "ContinentalLockUpdateMessage" should { val string = hex"A8 16 00 40"