modified DeployObjectMessage to reflect new data found by SouNourS; changed DOM tests; added match case in WSA

This commit is contained in:
FateJH 2017-05-03 22:30:12 -04:00
parent 939e0ed688
commit 8434d17910
3 changed files with 35 additions and 30 deletions

View file

@ -7,23 +7,26 @@ import scodec.Codec
import scodec.codecs._
/**
* For completion's sake.
* We've never actually sent or received this packet during session captures on Gemini Live.
* @param guid na
* Dispatched from the client to request that an object be deployed.<br>
* <br>
* Information in the packet mainly reports about the surface on which the object will be coplanar when/if placed.
* The server responds with a `ObjectDeployedMessage` packet with the results.
* If successful, that is followed by an `ObjectCreateMessage` packet and a `DeployableObjectsInfoMessage` packet.
* @param object_guid the object
* @param unk1 na
* @param pos na
* @param pos the location where the object is to be deployed
* @param roll the amount of roll that affects orientation
* @param pitch the amount of pitch that affects orientation
* @param yaw the amount of yaw that affects orientation
* @param unk2 na
* @param unk3 na
* @param unk4 na
* @param unk5 na
*/
final case class DeployObjectMessage(guid : PlanetSideGUID,
final case class DeployObjectMessage(object_guid : PlanetSideGUID,
unk1 : Long,
pos : Vector3,
unk2 : Int,
unk3 : Int,
unk4 : Int,
unk5 : Long)
roll : Int,
pitch : Int,
yaw : Int,
unk2 : Long)
extends PlanetSideGamePacket {
type Packet = DeployObjectMessage
def opcode = GamePacketOpcode.DeployObjectMessage
@ -32,12 +35,12 @@ final case class DeployObjectMessage(guid : PlanetSideGUID,
object DeployObjectMessage extends Marshallable[DeployObjectMessage] {
implicit val codec : Codec[DeployObjectMessage] = (
("guid1" | PlanetSideGUID.codec) ::
("object_guid" | PlanetSideGUID.codec) ::
("unk1" | uint32L) ::
("pos" | Vector3.codec_pos) ::
("unk2" | uint8L) ::
("unk3" | uint8L) ::
("unk4" | uint8L) ::
("unk5" | uint32L)
("roll" | uint8L) ::
("pitch" | uint8L) ::
("yaw" | uint8L) ::
("unk2" | uint32L)
).as[DeployObjectMessage]
}

View file

@ -8,28 +8,27 @@ import net.psforever.types.Vector3
import scodec.bits._
class DeployObjectMessageTest extends Specification {
//fake data; see comments in packet; this test exists to maintain code coverage
val string = hex"5D 0000 00000000 00000 00000 0000 00 00 00 00000000"
val string = hex"5d 740b e8030000 a644b 6e3c6 7e18 00 00 3f 01000000"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case DeployObjectMessage(guid, unk1, pos, unk2, unk3, unk4, unk5) =>
guid mustEqual PlanetSideGUID(0)
unk1 mustEqual 0L
pos.x mustEqual 0f
pos.y mustEqual 0f
pos.z mustEqual 0f
unk2 mustEqual 0
unk3 mustEqual 0
unk4 mustEqual 0
unk5 mustEqual 0L
case DeployObjectMessage(guid, unk1, pos, roll, pitch, yaw, unk2) =>
guid mustEqual PlanetSideGUID(2932)
unk1 mustEqual 1000L
pos.x mustEqual 5769.297f
pos.y mustEqual 3192.8594f
pos.z mustEqual 97.96875f
roll mustEqual 0
pitch mustEqual 0
yaw mustEqual 63
unk2 mustEqual 1L
case _ =>
ko
}
}
"encode" in {
val msg = DeployObjectMessage(PlanetSideGUID(0), 0L, Vector3(0f, 0f, 0f), 0, 0, 0, 0L)
val msg = DeployObjectMessage(PlanetSideGUID(2932), 1000L, Vector3(5769.297f, 3192.8594f, 97.96875f), 0, 0, 63, 1L)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string

View file

@ -364,6 +364,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
sendResponse(PacketCoding.CreateGamePacket(0, GenericObjectStateMsg(object_guid, 16)))
}
case msg @ DeployObjectMessage(guid, unk1, pos, roll, pitch, yaw, unk2) =>
log.info("DeployObject: " + msg)
case msg @ GenericObjectStateMsg(object_guid, unk1) =>
log.info("GenericObjectState: " + msg)