From dfe449354a4813d49afd891a3ae5a06d5d943225 Mon Sep 17 00:00:00 2001 From: FateJH Date: Mon, 17 Oct 2016 20:58:33 -0400 Subject: [PATCH] identified a field for PlayerStateMessageUpstream; modified file and tests; comments --- .../game/PlayerStateMessageUpstream.scala | 36 +++++++++++++------ common/src/test/scala/GamePacketTest.scala | 8 ++--- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/common/src/main/scala/net/psforever/packet/game/PlayerStateMessageUpstream.scala b/common/src/main/scala/net/psforever/packet/game/PlayerStateMessageUpstream.scala index e4a6cb52..471f3c62 100644 --- a/common/src/main/scala/net/psforever/packet/game/PlayerStateMessageUpstream.scala +++ b/common/src/main/scala/net/psforever/packet/game/PlayerStateMessageUpstream.scala @@ -6,10 +6,26 @@ import net.psforever.types.Vector3 import scodec.Codec import scodec.codecs._ -/** PlayerStateMessageUpstream is constantly sent from the client to the server to update avatar properties. - * - * Note: seq_time appears to be used in other message definitions as well. It - * seems to represent a timestamp for ordering of e.g. player and weapon events. +/** + * Constantly sent from the client to the server to update player avatar properties.
+ *
+ * Exploration:
+ * `seq_time` appears to be used in other message definitions as well. + * It seems to represent a timestamp for ordering, e.g., player and weapon events. + * @param avatar_guid the player's GUID + * @param pos where the player is in the world + * @param vel how the player is moving + * @param unk1 na + * @param aim_pitch the vertical angle of viewing + * @param unk2 na + * @param seq_time na + * @param unk3 na + * @param is_crouching whether the player is crouched + * @param unk4 na + * @param unk5 na + * @param is_cloaking whether the player is cloaked (Infiltration Suit) + * @param unk6 na + * @param unk7 na */ final case class PlayerStateMessageUpstream(avatar_guid : PlanetSideGUID, pos : Vector3, @@ -22,9 +38,9 @@ final case class PlayerStateMessageUpstream(avatar_guid : PlanetSideGUID, is_crouching : Boolean, unk4 : Boolean, unk5 : Boolean, - unk6 : Boolean, - unk7 : Int, - unk8 : Int) + is_cloaking : Boolean, + unk6 : Int, + unk7 : Int) extends PlanetSideGamePacket { type Packet = PlayerStateMessageUpstream def opcode = GamePacketOpcode.PlayerStateMessageUpstream @@ -44,8 +60,8 @@ object PlayerStateMessageUpstream extends Marshallable[PlayerStateMessageUpstrea ("is_crouching" | bool) :: ("unk4" | bool) :: ("unk5" | bool) :: - ("unk6" | bool) :: - ("unk7" | uint8L) :: - ("unk8" | uint16L) + ("is_cloaking" | bool) :: + ("unk6" | uint8L) :: + ("unk7" | uint16L) ).as[PlayerStateMessageUpstream] } diff --git a/common/src/test/scala/GamePacketTest.scala b/common/src/test/scala/GamePacketTest.scala index 2f7e8a11..19af621b 100644 --- a/common/src/test/scala/GamePacketTest.scala +++ b/common/src/test/scala/GamePacketTest.scala @@ -499,7 +499,7 @@ class GamePacketTest extends Specification { "decode" in { PacketCoding.DecodePacket(string).require match { - case PlayerStateMessageUpstream(avatar_guid, pos, vel, unk1, aim_pitch, unk2, seq_time, unk3, is_crouching, unk4, unk5, unk6, unk7, unk8) => + case PlayerStateMessageUpstream(avatar_guid, pos, vel, unk1, aim_pitch, unk2, seq_time, unk3, is_crouching, unk4, unk5, is_cloaking, unk6, unk7) => avatar_guid mustEqual PlanetSideGUID(75) pos mustEqual Vector3(3694.1094f, 2735.4531f, 90.84375f) vel mustEqual Some(Vector3(4.375f, 2.59375f, 0.0f)) @@ -511,9 +511,9 @@ class GamePacketTest extends Specification { is_crouching mustEqual false unk4 mustEqual false unk5 mustEqual false - unk6 mustEqual false - unk7 mustEqual 112 - unk8 mustEqual 0 + is_cloaking mustEqual false + unk6 mustEqual 112 + unk7 mustEqual 0 case default => ko }