Restructure repository

* Move /common/src to /src
* Move services to net.psforever package
* Move /pslogin to /server
This commit is contained in:
Jakob Gillich 2020-08-23 03:26:06 +02:00
parent 89a30ae6f6
commit f4fd78fc5d
958 changed files with 527 additions and 725 deletions

View file

@ -0,0 +1,62 @@
// Copyright (c) 2017 PSForever
package game
import org.specs2.mutable._
import net.psforever.packet._
import net.psforever.packet.game._
import net.psforever.types.{PlanetSideGUID, Vector3}
import scodec.bits._
class ObjectDetachMessageTest extends Specification {
val string = hex"27 640B C609 92F76 01D65 F611 00 00 40"
"decode" in {
PacketCoding.DecodePacket(string).require match {
case ObjectDetachMessage(parent_guid, child_guid, pos, roll, pitch, yaw) =>
parent_guid mustEqual PlanetSideGUID(2916)
child_guid mustEqual PlanetSideGUID(2502)
pos.x mustEqual 3567.1406f
pos.y mustEqual 2988.0078f
pos.z mustEqual 71.84375f
roll mustEqual 0f
pitch mustEqual 0f
yaw mustEqual 270f
case _ =>
ko
}
}
"encode (1)" in {
val msg = ObjectDetachMessage(
PlanetSideGUID(2916),
PlanetSideGUID(2502),
Vector3(3567.1406f, 2988.0078f, 71.84375f),
0f,
0f,
270f
)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
"encode (2)" in {
val msg = ObjectDetachMessage(
PlanetSideGUID(2916),
PlanetSideGUID(2502),
Vector3(3567.1406f, 2988.0078f, 71.84375f),
Vector3(0f, 0f, 270f)
)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
"encode (3)" in {
val msg =
ObjectDetachMessage(PlanetSideGUID(2916), PlanetSideGUID(2502), Vector3(3567.1406f, 2988.0078f, 71.84375f), 270f)
val pkt = PacketCoding.EncodePacket(msg).require.toByteVector
pkt mustEqual string
}
}