mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-15 08:24:39 +00:00
modified DeployObjectMessage to reflect new data found by SouNourS; changed DOM tests; added match case in WSA
This commit is contained in:
parent
939e0ed688
commit
8434d17910
3 changed files with 35 additions and 30 deletions
|
|
@ -7,23 +7,26 @@ import scodec.Codec
|
||||||
import scodec.codecs._
|
import scodec.codecs._
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For completion's sake.
|
* Dispatched from the client to request that an object be deployed.<br>
|
||||||
* We've never actually sent or received this packet during session captures on Gemini Live.
|
* <br>
|
||||||
* @param guid na
|
* 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 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 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,
|
unk1 : Long,
|
||||||
pos : Vector3,
|
pos : Vector3,
|
||||||
unk2 : Int,
|
roll : Int,
|
||||||
unk3 : Int,
|
pitch : Int,
|
||||||
unk4 : Int,
|
yaw : Int,
|
||||||
unk5 : Long)
|
unk2 : Long)
|
||||||
extends PlanetSideGamePacket {
|
extends PlanetSideGamePacket {
|
||||||
type Packet = DeployObjectMessage
|
type Packet = DeployObjectMessage
|
||||||
def opcode = GamePacketOpcode.DeployObjectMessage
|
def opcode = GamePacketOpcode.DeployObjectMessage
|
||||||
|
|
@ -32,12 +35,12 @@ final case class DeployObjectMessage(guid : PlanetSideGUID,
|
||||||
|
|
||||||
object DeployObjectMessage extends Marshallable[DeployObjectMessage] {
|
object DeployObjectMessage extends Marshallable[DeployObjectMessage] {
|
||||||
implicit val codec : Codec[DeployObjectMessage] = (
|
implicit val codec : Codec[DeployObjectMessage] = (
|
||||||
("guid1" | PlanetSideGUID.codec) ::
|
("object_guid" | PlanetSideGUID.codec) ::
|
||||||
("unk1" | uint32L) ::
|
("unk1" | uint32L) ::
|
||||||
("pos" | Vector3.codec_pos) ::
|
("pos" | Vector3.codec_pos) ::
|
||||||
("unk2" | uint8L) ::
|
("roll" | uint8L) ::
|
||||||
("unk3" | uint8L) ::
|
("pitch" | uint8L) ::
|
||||||
("unk4" | uint8L) ::
|
("yaw" | uint8L) ::
|
||||||
("unk5" | uint32L)
|
("unk2" | uint32L)
|
||||||
).as[DeployObjectMessage]
|
).as[DeployObjectMessage]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,28 +8,27 @@ import net.psforever.types.Vector3
|
||||||
import scodec.bits._
|
import scodec.bits._
|
||||||
|
|
||||||
class DeployObjectMessageTest extends Specification {
|
class DeployObjectMessageTest extends Specification {
|
||||||
//fake data; see comments in packet; this test exists to maintain code coverage
|
val string = hex"5d 740b e8030000 a644b 6e3c6 7e18 00 00 3f 01000000"
|
||||||
val string = hex"5D 0000 00000000 00000 00000 0000 00 00 00 00000000"
|
|
||||||
|
|
||||||
"decode" in {
|
"decode" in {
|
||||||
PacketCoding.DecodePacket(string).require match {
|
PacketCoding.DecodePacket(string).require match {
|
||||||
case DeployObjectMessage(guid, unk1, pos, unk2, unk3, unk4, unk5) =>
|
case DeployObjectMessage(guid, unk1, pos, roll, pitch, yaw, unk2) =>
|
||||||
guid mustEqual PlanetSideGUID(0)
|
guid mustEqual PlanetSideGUID(2932)
|
||||||
unk1 mustEqual 0L
|
unk1 mustEqual 1000L
|
||||||
pos.x mustEqual 0f
|
pos.x mustEqual 5769.297f
|
||||||
pos.y mustEqual 0f
|
pos.y mustEqual 3192.8594f
|
||||||
pos.z mustEqual 0f
|
pos.z mustEqual 97.96875f
|
||||||
unk2 mustEqual 0
|
roll mustEqual 0
|
||||||
unk3 mustEqual 0
|
pitch mustEqual 0
|
||||||
unk4 mustEqual 0
|
yaw mustEqual 63
|
||||||
unk5 mustEqual 0L
|
unk2 mustEqual 1L
|
||||||
case _ =>
|
case _ =>
|
||||||
ko
|
ko
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"encode" in {
|
"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
|
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
|
||||||
|
|
||||||
pkt mustEqual string
|
pkt mustEqual string
|
||||||
|
|
|
||||||
|
|
@ -364,6 +364,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
sendResponse(PacketCoding.CreateGamePacket(0, GenericObjectStateMsg(object_guid, 16)))
|
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) =>
|
case msg @ GenericObjectStateMsg(object_guid, unk1) =>
|
||||||
log.info("GenericObjectState: " + msg)
|
log.info("GenericObjectState: " + msg)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue