identified a field for PlayerStateMessageUpstream; modified file and tests; comments

This commit is contained in:
FateJH 2016-10-17 20:58:33 -04:00
parent daa22c572e
commit dfe449354a
2 changed files with 30 additions and 14 deletions

View file

@ -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.<br>
* <br>
* Exploration:<br>
* `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]
}

View file

@ -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
}